MentOS  0.8.0
The Mentoring Operating System
dirent.h
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include "limits.h"
9 #include "stddef.h"
10 
12 enum {
13  DT_UNKNOWN = 0,
14  DT_FIFO = 1,
15  DT_CHR = 2,
16  DT_DIR = 4,
17  DT_BLK = 6,
18  DT_REG = 8,
19  DT_LNK = 10,
20  DT_SOCK = 12,
21  DT_WHT = 14
22 };
23 
25 static const char dt_char_array[] = {
26  '?', // DT_UNKNOWN = 0,
27  'p', // DT_FIFO = 1,
28  'c', // DT_CHR = 2,
29  '*',
30  'd', // DT_DIR = 4,
31  '*',
32  'b', // DT_BLK = 6,
33  '*',
34  '-', // DT_REG = 8,
35  '*',
36  'l', // DT_LNK = 10,
37  '*',
38  's', // DT_SOCK = 12,
39  '*',
40  '?', // DT_WHT = 14
41 };
42 
44 typedef struct dirent_t {
47  unsigned short d_reclen;
48  unsigned short d_type;
49  char d_name[NAME_MAX];
static const char dt_char_array[]
Characters describing the direactory entry.
Definition: dirent.h:25
struct dirent_t dirent_t
Directory entry.
OS numeric limits.
#define NAME_MAX
Maximum number of characters in a file name.
Definition: limits.h:51
Define basic data types.
long int off_t
The type of offset.
Definition: stddef.h:46
unsigned int ino_t
Define the type of an inode.
Definition: stddef.h:34
Directory entry.
Definition: dirent.h:44
unsigned short d_reclen
Length of this linux_dirent.
Definition: dirent.h:47
ino_t d_ino
Inode number.
Definition: dirent.h:45
unsigned short d_type
type of the directory entry.
Definition: dirent.h:48
off_t d_off
Offset to next linux_dirent.
Definition: dirent.h:46
char d_name[NAME_MAX]
Filename (null-terminated)
Definition: dirent.h:49