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.
25 lines
506 B
C
25 lines
506 B
C
#ifndef _COMMON_H
|
|
#define _COMMON_H
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
int fail(int status, const char *reason) {
|
|
fprintf(stderr, "%s failed: %s\n", reason, strerror(status));
|
|
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
uintptr_t black_box_uintptr_t(uintptr_t arg) {
|
|
// Rust implements this by putting the value behind a volatile pointer and then simply loading it.
|
|
|
|
uintptr_t arg_slot = arg;
|
|
volatile uintptr_t *ptr = &arg_slot;
|
|
|
|
return *ptr;
|
|
}
|
|
|
|
#endif // _COMMON_H
|