00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef _DIRENT_H
00012 #define _DIRENT_H
00013
00014 #ifndef _TYPES_H
00015 #include <minix/types.h>
00016 #endif
00017
00018 #include <minix/dir.h>
00019
00020
00021
00022
00023
00024
00025 struct _fl_direct {
00026 ino_t d_ino;
00027 unsigned char d_extent;
00028 char d_name[3];
00029 };
00030
00031
00032 #define _EXTENT(len) (((len) + 5) >> 3)
00033
00034
00035 struct _v7_direct {
00036 ino_t d_ino;
00037 char d_name[DIRSIZ];
00038 };
00039
00040
00041
00042
00043 #define _MIN_BLOCK_SIZE 1024
00044
00045
00046
00047
00048
00049
00050 #define _MAX_BLOCK_SIZE 4096
00051
00052
00053 #define _STATIC_BLOCK_SIZE 1024
00054
00055 #define _STATIC_FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
00056 #define _FLEX_PER_V7 (_EXTENT(DIRSIZ) + 1)
00057 #define _FLEX_PER_BLOCK (_STATIC_BLOCK_SIZE/sizeof(struct _fl_direct))
00058
00059
00060 typedef struct {
00061 char _fd;
00062 unsigned _count;
00063 unsigned _pos;
00064 char _buf[_MAX_BLOCK_SIZE];
00065
00066
00067
00068
00069
00070 } DIR;
00071
00072 #define _DIRENT_NAME_LEN 61
00073
00074 struct dirent {
00075 ino_t d_ino;
00076 off_t d_off;
00077 unsigned short d_reclen;
00078 char d_name[1];
00079 };
00080
00081
00082 _PROTOTYPE( int closedir, (DIR *_dirp) );
00083 _PROTOTYPE( DIR *opendir, (const char *_dirname) );
00084 _PROTOTYPE( struct dirent *readdir, (DIR *_dirp) );
00085 _PROTOTYPE( void rewinddir, (DIR *_dirp) );
00086
00087 #ifdef _MINIX
00088 _PROTOTYPE( int seekdir, (DIR *_dirp, off_t _loc) );
00089 _PROTOTYPE( off_t telldir, (DIR *_dirp) );
00090
00091 #define dirfd(dirp) ((dirp)->_fd)
00092
00093 _PROTOTYPE( int getdents, (int _fildes, struct dirent *_buf,
00094 size_t _nbyte) );
00095
00096 #endif
00097
00098 #endif