X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=api%2Fapi_storage.c;h=a0dacad1a55ec7468573b6f5c7cae5b8abe4214b;hb=7bb62708397d93d92804749b4c4c8d796df418de;hp=2b90c18aaec93a1dcb8914e80e37d41842d88980;hpb=bea3d826203f90507ff32ed24bd0a3c53479e55c;p=oweals%2Fu-boot.git diff --git a/api/api_storage.c b/api/api_storage.c index 2b90c18aae..a0dacad1a5 100644 --- a/api/api_storage.c +++ b/api/api_storage.c @@ -8,6 +8,7 @@ #include #include #include +#include #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE) #include @@ -349,3 +350,27 @@ lbasize_t dev_read_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start return dd->block_read(dd, start, len, buf); #endif /* defined(CONFIG_BLK) */ } + + +lbasize_t dev_write_stor(void *cookie, void *buf, lbasize_t len, lbastart_t start) +{ + struct blk_desc *dd = (struct blk_desc *)cookie; + int type = dev_stor_type(dd); + + if (type == ENUM_MAX) + return 0; + + if (!dev_stor_is_valid(type, dd)) + return 0; + +#ifdef CONFIG_BLK + return blk_dwrite(dd, start, len, buf); +#else + if (dd->block_write == NULL) { + debugf("no block_write() for device 0x%08x\n", cookie); + return 0; + } + + return dd->block_write(dd, start, len, buf); +#endif /* defined(CONFIG_BLK) */ +}