b9874d0941
Add redbear-usb-storage-check in-guest binary that validates USB mass storage read and write I/O: discovers /scheme/disk/ devices, writes a test pattern to sector 2048, reads it back, verifies match, restores original content. Updates test-usb-storage-qemu.sh with write-proof verification step. Includes all accumulated Red Bear OS work: kernel patches, relibc patches, driver infrastructure, DRM/GPU, KDE recipes, firmware, validation tooling, build system hardening, and documentation.
32 lines
803 B
C
32 lines
803 B
C
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
int main(void) {
|
|
printf("sizeof(struct stat): %ld\n", sizeof(struct stat));
|
|
|
|
struct stat buf = {0};
|
|
|
|
int stat_status = stat("sys_stat/stat.c", &buf);
|
|
ERROR_IF(stat, stat_status, == -1);
|
|
UNEXP_IF(stat, stat_status, != 0);
|
|
|
|
printf("st_size: %lu\n", buf.st_size);
|
|
printf("st_blksize: %lu\n", buf.st_blksize);
|
|
printf("st_dev: %lu\n", buf.st_dev);
|
|
printf("st_ino: %lu\n", buf.st_ino);
|
|
printf("st_mode: %o\n", buf.st_mode);
|
|
printf("st_nlink: %lu\n", buf.st_nlink);
|
|
printf("st_uid: %u\n", buf.st_uid);
|
|
printf("st_gid: %u\n", buf.st_gid);
|
|
|
|
assert(buf.st_size > 600);
|
|
assert(buf.st_nlink == 1);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|