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
765 B
C
32 lines
765 B
C
#include <dirent.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include "test_helpers.h"
|
|
|
|
int filter(const struct dirent* dirent) {
|
|
return strstr(dirent->d_name, "3") == NULL;
|
|
}
|
|
|
|
int main(void) {
|
|
struct dirent** array;
|
|
|
|
int len = scandir("example_dir/", &array, filter, alphasort);
|
|
ERROR_IF(scandir, len, == -1);
|
|
UNEXP_IF(scandir, len, < 0);
|
|
|
|
for(int i = 0; i < len; i += 1) {
|
|
// TODO: Redox does not yet provide . or .. - so filter them out
|
|
// in order to make output match on all systems
|
|
if (
|
|
strcmp(array[i]->d_name, ".") != 0 &&
|
|
strcmp(array[i]->d_name, "..") != 0
|
|
) {
|
|
puts(array[i]->d_name);
|
|
}
|
|
free(array[i]);
|
|
}
|
|
free(array);
|
|
}
|