X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fos.h;h=770d76e02f7e1aa02219ec61aa71cce0ce0fc5a4;hb=92832045c54586e9dffa082ff8cd8c2ef6040757;hp=bd1096eb8b3189cc574a956dd75087d9b0681e32;hpb=4c30d18ed38c5ae84ed91da0f9d1ba4c9e83bffc;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/os.h b/include/os.h index bd1096e..770d76e 100644 --- a/include/os.h +++ b/include/os.h @@ -52,6 +52,14 @@ off_t os_lseek(int fd, off_t offset, int whence); #define OS_SEEK_END 2 /** + * os_filesize() - Calculate the size of a file + * + * @fd: File descriptor as returned by os_open() + * Return: file size or negative error code + */ +int os_filesize(int fd); + +/** * Access to the OS open() system call * * @pathname: Pathname of file to open @@ -327,9 +335,12 @@ int os_jump_to_image(const void *dest, int size); * @fname: place to put full path to U-Boot * @maxlen: maximum size of @fname * @use_img: select the 'u-boot.img' file instead of the 'u-boot' ELF file + * @cur_prefix: prefix of current executable, e.g. "spl" or "tpl" + * @next_prefix: prefix of executable to find, e.g. "spl" or "" * Return: 0 if OK, -NOSPC if the filename is too large, -ENOENT if not found */ -int os_find_u_boot(char *fname, int maxlen, bool use_img); +int os_find_u_boot(char *fname, int maxlen, bool use_img, + const char *cur_prefix, const char *next_prefix); /** * os_spl_to_uboot() - Run U-Boot proper @@ -395,6 +406,19 @@ int os_write_file(const char *name, const void *buf, int size); */ int os_read_file(const char *name, void **bufp, int *sizep); +/** + * os_map_file() - Map a file from the host filesystem into memory + * + * This can be useful when to provide a backing store for an emulated device + * + * @pathname: File pathname to map + * @os_flags: Flags, like OS_O_RDONLY, OS_O_RDWR + * @bufp: Returns buffer containing the file + * @sizep: Returns size of data + * Return: 0 if OK, -ve on error + */ +int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep); + /* * os_find_text_base() - Find the text section in this running process *