1. Store the file information in the directory (file name, extension, etc.)
#include <dirent.h>struct Dirent{long D_ino; */inode Number Index node * /off_t d_off; */* offset to this dirent offsets in the catalog file * /unsigned short d_reclen; * * length of this d_name filename long * /unsigned char d_type; * * The type of d_name file type * /Char d_name [name_max+1];/* file name (null-terminated) filename, maximum 255 characters */}2.struct __dirstream
{
void *__fd; /* ' struct HURD_FD ' pointer for descriptor. */
Char *__data; /* Directory block. */
int __entry_data; /* Entry number ' __data ' corresponds to. */
Char *__ptr; /* Current pointer into the block. */
int __entry_ptr; /* Entry number ' __ptr ' corresponds to. */
size_t __allocation; /* Space allocated for the block. */
size_t __size; /* Total valid data in the block. */
__libc_lock_define (, __lock)/* Mutex lock for this structure. */
};
typedef struct __DIRSTREAM DIR;
struct Dirent and Dir