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

31 lines
813 B
C

#include <string.h>
#include <stdio.h>
#include <wchar.h>
#include <stdlib.h>
#include "test_helpers.h"
int main(void) {
mbstate_t state;
memset(&state, 0, sizeof state);
wchar_t in[] = L"zß水🍌"; // or "z\u00df\u6c34\U0001F34C"
size_t in_sz = sizeof in / sizeof *in;
printf("Processing %zu wchar_t units: [ ", in_sz);
for(size_t n = 0; n < in_sz; ++n) printf("%#x ", (unsigned int)in[n]);
puts("]");
char out[MB_CUR_MAX * in_sz];
char *p = out;
for(size_t n = 0; n < in_sz; ++n) {
int rc = wcrtomb(p, in[n], &state);
if(rc == -1) break;
p += rc;
}
size_t out_sz = p - out;
printf("into %zu UTF-8 code units: [ ", out_sz);
for(size_t x = 0; x < out_sz; ++x) printf("%#x ", +(unsigned char)out[x]);
puts("]");
}