diff options
author | H. Peter Anvin <hpa@zytor.com> | 2010-03-06 14:51:08 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-03-06 14:51:08 -0800 |
commit | 01ac07292bb174312d82fbe8c2849f315eca60ba (patch) | |
tree | 602944eca28a08345bf933839205be505b521088 /core/include/fs.h | |
parent | 8fc99886a6f922a5d4ec105cfd72cd70f5b67d8d (diff) | |
download | syslinux-01ac07292bb174312d82fbe8c2849f315eca60ba.tar.gz |
core/fs: clean up, fix and improve the internal readdir() interfaces
- Avoid a completely unnecessary malloc/free pair by passing a pointer
to the filesystem driver;
- Make sure d_reclen is always set correctly;
- Make sure the d_type field is set correctly.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/include/fs.h')
-rw-r--r-- | core/include/fs.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/core/include/fs.h b/core/include/fs.h index 332607b7..187a55d0 100644 --- a/core/include/fs.h +++ b/core/include/fs.h @@ -68,12 +68,23 @@ struct fs_ops { int (*readlink)(struct inode *, char *); /* the _dir_ stuff */ - struct dirent * (*readdir)(struct file *); + int (*readdir)(struct file *, struct dirent *); int (*next_extent)(struct inode *, uint32_t); }; -enum inode_mode {I_FILE, I_DIR, I_SYMLINK}; +/* XXX: merge this with enum dirent_types */ +enum inode_mode { + I_UNKNOWN = 0, + I_FIFO = 1, + I_CHR = 2, + I_DIR = 4, + I_BLK = 6, + I_FILE = 8, + I_SYMLINK = 10, + I_SOCK = 12, + I_WHT = 14, +}; /* * Extent structure: contains the mapping of some chunk of a file |