Getdents implementation in library/vfs/mfs.

Changed readdir, etc. to use getdents
This commit is contained in:
Philip Homburg
2006-11-09 16:22:54 +00:00
parent 12eb228aae
commit ca448f0b0f
19 changed files with 303 additions and 59 deletions

View File

@@ -59,20 +59,23 @@ struct _v7_direct {
/* Definitions for the directory(3) routines: */
typedef struct {
char _fd; /* Filedescriptor of open directory */
char _v7; /* Directory is Version 7 */
short _count; /* This many objects in buf */
off_t _pos; /* Position in directory file */
struct _fl_direct *_ptr; /* Next slot in buf */
struct _fl_direct _buf[_FLEX_PER_BLOCK]; /* One block of a directory file */
struct _fl_direct _v7f[_FLEX_PER_V7]; /* V7 entry transformed to flex */
unsigned _count; /* This many bytes in _buf */
unsigned _pos; /* Position in _buf */
char _buf[_MAX_BLOCK_SIZE]; /* The size does not really
* matter as long as the
* buffer is big enough
* to contain at least one
* entry.
*/
} DIR;
#define _DIRENT_NAME_LEN 61
struct dirent { /* Largest entry (8 slots) */
ino_t d_ino; /* I-node number */
unsigned char d_extent; /* Extended with this many slots */
char d_name[_DIRENT_NAME_LEN]; /* Null terminated name */
off_t d_off; /* Offset in directory */
unsigned short d_reclen; /* Length of this record */
char d_name[1]; /* Null terminated name */
};
/* Function Prototypes. */
@@ -87,6 +90,9 @@ _PROTOTYPE( off_t telldir, (DIR *_dirp) );
#define dirfd(dirp) ((dirp)->_fd)
_PROTOTYPE( int getdents, (int _fildes, struct dirent *_buf,
size_t _nbyte) );
#endif
#endif /* _DIRENT_H */

View File

@@ -64,6 +64,7 @@
#define SVRCTL 77
#define SYSUNAME 78
#define GETSYSINFO 79 /* to PM or FS */
#define GETDENTS 80 /* to FS */
#define FSTATFS 82 /* to FS */
#define SELECT 85 /* to FS */
#define FCHDIR 86 /* to FS */

View File

@@ -128,7 +128,9 @@
#define REQ_BREAD 38
#define REQ_BWRITE 39
#define NREQS 40
#define REQ_GETDENTS 40
#define NREQS 41
#define FS_READY 57