Files
vasilito b9874d0941 feat: USB storage read/write proof + full Red Bear OS tree sync
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.
2026-05-03 23:03:24 +01:00

44 lines
971 B
C

#include <assert.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "test_helpers.h"
int main(void) {
printf("%lu\n", sizeof(struct dirent));
DIR* dir = opendir("example_dir/");
ERROR_IF(opendir, dir, == NULL);
struct dirent* entry;
//int tell = 0;
for (char counter = 0; (entry = readdir(dir)); counter += 1) {
puts(entry->d_name);
//if (counter == 4) {
// tell = telldir(dir);
//}
}
puts("--- Testing rewind ---");
rewinddir(dir);
entry = readdir(dir);
assert(entry != NULL);
puts(entry->d_name);
// puts("--- Testing seek ---");
// // Why this doesn't cause it to actually go to the 4th element is beyond
// // me, but glibc acts the same way.
// seekdir(dir, tell);
// entry = readdir(dir);
// puts(entry->d_name);
int c = closedir(dir);
ERROR_IF(closedir, c, == -1);
UNEXP_IF(closedir, c, != 0);
}