]>
git.ipfire.org Git - people/ms/u-boot.git/blob - fs/sandbox/sandboxfs.c
2 * Copyright (c) 2012, Google Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of
7 * the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 int sandbox_fs_set_blk_dev(block_dev_desc_t
*rbdd
, disk_partition_t
*info
)
29 long sandbox_fs_read_at(const char *filename
, unsigned long pos
,
30 void *buffer
, unsigned long maxsize
)
35 fd
= os_open(filename
, OS_O_RDONLY
);
38 ret
= os_lseek(fd
, pos
, OS_SEEK_SET
);
44 maxsize
= os_get_filesize(filename
);
45 size
= os_read(fd
, buffer
, maxsize
);
51 int sandbox_fs_ls(const char *dirname
)
53 struct os_dirent_node
*head
, *node
;
56 ret
= os_dirent_ls(dirname
, &head
);
60 for (node
= head
; node
; node
= node
->next
) {
61 printf("%s %10lu %s\n", os_dirent_get_typename(node
->type
),
62 node
->size
, node
->name
);
68 void sandbox_fs_close(void)
72 int fs_read_sandbox(const char *filename
, void *buf
, int offset
, int len
)
76 len_read
= sandbox_fs_read_at(filename
, offset
, buf
, len
);
78 printf("** Unable to read file %s **\n", filename
);