The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
dirent.h
Go to the documentation of this file.
1#pragma once
3/**
4 * the directory records getdents writes. the layout and the DT_ values are
5 * ABI: the libc's <dirent.h> reads the same ones.
6 *
7 * records follow each other in the buffer; d_reclen is the size of one
8 * record, its name and NUL included, rounded up to 4 bytes.
9 */
10
11#include "common/stdint.h"
12
13// d_type values
14#define DT_UNKNOWN 0
15#define DT_FIFO 1
16#define DT_CHR 2
17#define DT_DIR 4
18#define DT_BLK 6
19#define DT_REG 8
20#define DT_LNK 10
21#define DT_SOCK 12
22
23struct kdirent
24{
25 uint32_t d_ino; // inode number
26 uint16_t d_reclen; // bytes to the next record
27 uint8_t d_type; // DT_*
28 char d_name[]; // NUL-terminated
29} __attribute__((packed));
30
31// bytes before d_name
32#define KDIRENT_HEADER 7
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
unsigned short uint16_t
Definition stdint.h:13
ELF32 file header.
Definition elf.h:51
Definition dirent.h:24
uint32_t d_ino
Definition dirent.h:25
char d_name[]
Definition dirent.h:28
uint16_t d_reclen
Definition dirent.h:26
uint8_t d_type
Definition dirent.h:27