]> git.sur5r.net Git - u-boot/blobdiff - fs/sandbox/sandboxfs.c
x86: Document how to write PIRQ information in the device tree
[u-boot] / fs / sandbox / sandboxfs.c
index d11c087cc169c6db7b23adb784b3d3f08df8961a..5acfc03704a9b35d9f823637ffac86e06f051208 100644 (file)
 
 int sandbox_fs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info)
 {
-       return 0;
+       /*
+        * Only accept a NULL block_dev_desc_t for the sandbox, which is when
+        * hostfs interface is used
+        */
+       return rbdd != NULL;
 }
 
 int sandbox_fs_read_at(const char *filename, loff_t pos, void *buffer,
@@ -103,46 +107,35 @@ int sandbox_fs_exists(const char *filename)
        return ret == 0;
 }
 
-int sandbox_fs_size(const char *filename)
+int sandbox_fs_size(const char *filename, loff_t *size)
 {
-       loff_t size;
-       int ret;
-
-       ret = os_get_filesize(filename, &size);
-       if (ret)
-               return ret;
-       else
-               return size;
+       return os_get_filesize(filename, size);
 }
 
 void sandbox_fs_close(void)
 {
 }
 
-int fs_read_sandbox(const char *filename, void *buf, int offset, int len)
+int fs_read_sandbox(const char *filename, void *buf, loff_t offset, loff_t len,
+                   loff_t *actread)
 {
        int ret;
-       loff_t actread;
 
-       ret = sandbox_fs_read_at(filename, offset, buf, len, &actread);
-       if (ret) {
+       ret = sandbox_fs_read_at(filename, offset, buf, len, actread);
+       if (ret)
                printf("** Unable to read file %s **\n", filename);
-               return ret;
-       }
 
-       return actread;
+       return ret;
 }
 
-int fs_write_sandbox(const char *filename, void *buf, int offset, int len)
+int fs_write_sandbox(const char *filename, void *buf, loff_t offset,
+                    loff_t len, loff_t *actwrite)
 {
        int ret;
-       loff_t actwrite;
 
-       ret = sandbox_fs_write_at(filename, offset, buf, len, &actwrite);
-       if (ret) {
+       ret = sandbox_fs_write_at(filename, offset, buf, len, actwrite);
+       if (ret)
                printf("** Unable to write file %s **\n", filename);
-               return ret;
-       }
 
-       return actwrite;
+       return ret;
 }