/* USB mass-storage class driver (Bulk-Only Transport + SCSI). * * Devices are registered as `usb0..` in the block-device registry. Only the * controllers with a bulk-transfer path work: EHCI (high-speed) and xHCI * (USB2 root ports). UHCI/OHCI leave bulk_in/bulk_out NULL, so a stick on a * full/low-speed companion controller is not usable. */ #ifndef USB_MSC_H #define USB_MSC_H /* Register the device probe; call before the first USB bus scan. */ void usbmsc_register(void); /* Add the currently present MSC devices to the blkdev registry. Called at * the end of blk_scan(); the USB bus scan itself runs earlier at boot. */ void usbmsc_blk_scan(void); /* Best-effort boot mounting: the first media read gets one bounded attempt * instead of the normal retry chain, so a stuck device cannot hold * vfs_scan_busy behind the boot scan. A later `storage` rescan uses the * full recovery path again. */ void usbmsc_set_probe_only(int on); /* A full storage rescan gives every present device its long first-media-read * deadline again (the boot background probe consumes it once). */ void usbmsc_begin_full_scan(void); /* 1 when the last media read on this MSC slot failed. The raw-sector view * uses it to return immediately instead of timing out on a stuck device * again; a full scan clears it. */ int usbmsc_slot_failed(unsigned int unit); /* Block I/O for BLK_USB devices (unit = usbmsc slot index). */ int usbmsc_read(unsigned int unit, unsigned int lba, void *buf, unsigned int count); int usbmsc_write(unsigned int unit, unsigned int lba, const void *buf, unsigned int count); int usbmsc_flush(unsigned int unit); #endif