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

29 lines
767 B
C

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "test_helpers.h"
int main(void) {
char* file_name = (char*) calloc(18, sizeof(char));
strcpy(file_name, "tempXXXXXX.suffix");
int fd = mkostemps(file_name, 7, 0);
FILE* fp = fdopen(fd, "w+");
printf("Start unchanged: %d\n", strncmp(file_name, "temp", 4));
printf("End unchanged: %d\n", strcmp(file_name + 4 + 6, ".suffix"));
char* write = "Writing to file";
fputs(write, fp);
char buffer[sizeof write];
memset(buffer, 0, sizeof buffer);
fgets(buffer, strlen(buffer), fp);
if (strcmp(write, buffer)) {
printf("Read & Write Successful\n");
} else {
printf("Read & Write Failed\n");
}
fclose(fp);
remove(file_name);
}