The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
ext2.h
Go to the documentation of this file.
1#pragma once
2
3#include "common/stdint.h"
4#include "common/error.h"
6
7#define EXT2_SUPERBLOCK_OFFSET 1024u // byte offset of superblock from start of partition
8#define EXT2_SUPERBLOCK_MAGIC 0xEF53u // magic number in superblock to identify ext2 filesystem
9#define EXT2_NDIR_BLOCKS 12u // number of direct block pointers in an inode
10
11#define EXT2_INODE_ROOT 2u // inode number of the root directory
12
13#define EXT2_FT_REG_FILE 1u // file type value for regular files in directory entries
14#define EXT2_FT_DIR 2u // file type value for directories in directory entries
15#define EXT2_FT_CHRDEV 3u // file type value for character devices in directory entries
16#define EXT2_FT_BLKDEV 4u // file type value for block devices in directory entries
17#define EXT2_FT_FIFO 5u // file type value for named pipes in directory entries
18#define EXT2_FT_SYMLINK 7u // file type value for symbolic links in directory entries
19
20#define EXT2_S_IFREG 0x8000u // file type value for regular files in inode mode field
21#define EXT2_S_IFDIR 0x4000u // file type value for directories in inode mode field
22#define EXT2_S_IFLNK 0xA000u // file type value for symbolic links in inode mode field
23#define EXT2_S_IFIFO 0x1000u // file type value for named pipes in inode mode field
24#define EXT2_S_IFCHR 0x2000u // file type value for character devices in inode mode field
25#define EXT2_S_IFBLK 0x6000u // file type value for block devices in inode mode field
26#define EXT2_LINK_MAX 32000u // the most names (hard links) an inode may have
27#define EXT2_S_IFMT 0xF000u // bitmask for extracting file type from inode mode field
28
29#define EXT2_FEATURE_INCOMPAT_COMPRESSION 0x0001u // incompatible feature set flag for compression support
30#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002u // incompatible feature set flag for file type support
31#define EXT2_FEATURE_INCOMPAT_RECOVER 0x0004u // incompatible feature set flag for journal recovery support
32#define EXT2_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008u // incompatible feature set flag for journal device support
33#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010u // incompatible feature set flag for meta block group support
34#define EXT2_FEATURE_INCOMPAT_EXTENTS 0x0040u // incompatible feature set flag for extent support
35#define EXT2_FEATURE_INCOMPAT_64BIT 0x0080u // incompatible feature set flag for 64-bit support
36#define EXT2_FEATURE_INCOMPAT_MMP 0x0100u // incompatible feature set flag for multiple mount protection support
37#define EXT2_FEATURE_INCOMPAT_FLEX_BG 0x0200u // incompatible feature set flag for flexible block group support
38
39#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002u // a file has a size of 2 GiB or more
40
41#define EXT2_MAX_BLOCK_SIZE 4096u // maximum block size supported by ext2 filesystem (in bytes)
42#define EXT2_MAX_INODE_SIZE 256u // maximum inode size supported by ext2 filesystem (in bytes)
43#define EXT2_NAME_MAX 256u // maximum file/directory name length (255 chars + null terminator)
44
45typedef struct __attribute__((packed))
46{
47 uint32_t s_inodes_count; // total number of inodes in file system
48 uint32_t s_blocks_count; // total number of blocks in file system
49 uint32_t s_r_blocks_count; // number of reserved blocks for superuser
50 uint32_t s_free_blocks_count; // total number of unallocated blocks
51 uint32_t s_free_inodes_count; // total number of unallocated inodes
52 uint32_t s_first_data_block; // block number of the block containing the superblock (also the starting block number, NOT always zero.)
53 uint32_t s_log_block_size; // log_2 (block size) - 10. (In other words, the number to shift 1,024 to the left by to obtain the block size)
54 uint32_t s_log_frag_size; // log_2 (fragment size) - 10. (In other words, the number to shift 1,024 to the left by to obtain the fragment size)
55 uint32_t s_blocks_per_group; // number of blocks in each block group
56 uint32_t s_frags_per_group; // number of fragments in each block group
57 uint32_t s_inodes_per_group; // number of inodes in each block group
58 uint32_t s_mtime; // time of last mount (POSIX time)
59 uint32_t s_wtime; // time of last write (POSIX time)
60 uint16_t s_mnt_count; // number of times volume has been mounted since last consistency check (fsck)
61 uint16_t s_max_mnt_count; // maximum number of times volume can be mounted before a consistency check (fsck) is forced
62 uint16_t s_magic; // ext2 signature (0xef53), used to help confirm the presence of ext2 on a volume
63 uint16_t s_state; // file system state
64 uint16_t s_errors; // behavior when detecting errors
65 uint16_t s_minor_rev_level; // minor portion of version (combine with major portion to construct full version field)
66 uint32_t s_lastcheck; // POSIX time of last consistency check (fsck)
67 uint32_t s_checkinterval; // interval (in POSIX time) between forced consistency checks (fsck)
68 uint32_t s_creator_os; // operating system ID from which the filesystem on this volume was created
69 uint32_t s_rev_level; // major portion of version (combine with minor portion to construct full version field)
70 uint16_t s_def_resuid; // user ID that can use reserved blocks
71 uint16_t s_def_resgid; // group ID that can use reserved blocks
72 uint32_t s_first_ino; // first non-reserved inode (usually 11, but can be larger if the superblock is backed up)
73 uint16_t s_inode_size; // size of each inode structure
74 uint16_t s_block_group_nr; // block group number of this superblock
75 uint32_t s_feature_compat; // compatible feature set flags
76 uint32_t s_feature_incompat; // incompatible feature set flags
77 uint32_t s_feature_ro_compat; // read-only compatible feature set flags
79
80typedef struct __attribute__((packed))
81{
82 uint32_t bg_block_bitmap; // block number of the block bitmap for this block group
83 uint32_t bg_inode_bitmap; // block number of the inode bitmap for this block group
84 uint32_t bg_inode_table; // block number of the starting block of the inode table for this block group
85 uint16_t bg_free_blocks_count; // number of unallocated blocks in this block group
86 uint16_t bg_free_inodes_count; // number of unallocated inodes in this block group
87 uint16_t bg_used_dirs_count; // number of allocated inodes that are directories in this block group
88 uint16_t bg_pad; // padding to align to 4-byte boundary
89 uint8_t bg_reserved[12]; // reserved for future use
91
92typedef struct __attribute__((packed))
93{
94 uint16_t i_mode; // file type and access permissions
95 uint16_t i_uid; // user ID of the owner
96 uint32_t i_size; // size of the file in bytes
97 uint32_t i_atime; // time of last access (POSIX time)
98 uint32_t i_ctime; // time of last status change (POSIX time)
99 uint32_t i_mtime; // time of last modification (POSIX time)
100 uint32_t i_dtime; // time of deletion (POSIX time)
101 uint16_t i_gid; // group ID of the owner
102 uint16_t i_links_count; // number of hard links to the file
103 uint32_t i_blocks; // number of 512-byte blocks allocated to the file
104 uint32_t i_flags; // file flags
105 uint32_t i_osd1; // OS-dependent value
106 uint32_t i_block[15]; // pointers to the blocks containing the file's data (12 direct, 1 single indirect, 1 double indirect, 1 triple indirect)
107 uint32_t i_generation; // file version (used by NFS)
108 uint32_t i_file_acl; // pointer to extended attribute block
109 uint32_t i_dir_acl; // pointer to extended attribute block (for directories) or high 32 bits of file size (for regular files)
110 uint32_t i_faddr; // pointer to the fragment address (used for filesystems with fragments)
111 uint8_t i_osd2[12]; // OS-dependent value
113
114typedef struct __attribute__((packed))
115{
116 uint32_t inode; // inode number of the file or directory entry
117 uint16_t rec_len; // length of this directory entry record in bytes
118 uint8_t name_len; // length of the name field in bytes
119 uint8_t file_type; // type of the file or directory (e.g., regular file, directory, symbolic link)
121
122typedef struct
123{
124 block_device_t *disk; // pointer to the block device used by this filesystem
125 ext2_superblock_t superblock; // cached superblock for mutation helpers
126 uint32_t block_size; // size of each block in bytes (calculated as 1024 << s_log_block_size)
127 uint32_t block_shift; // log2 of block_size: a byte offset >> block_shift is its block index
128 uint32_t sectors_per_block; // number of sectors in each block (calculated as block_size / EXT2_SECTOR_SIZE)
129 uint32_t inode_size; // size of each inode structure in bytes (from s_inode_size, defaulting to 128 if zero)
130 uint32_t first_data_block; // block number of the first data block in the filesystem (from s_first_data_block)
131 uint32_t block_count; // total number of blocks in the filesystem
132 uint32_t inode_count; // total number of inodes in the filesystem
133 uint32_t first_non_reserved_inode; // first non-reserved inode number
134 uint32_t block_group_count; // total number of block groups in the filesystem (calculated from s_blocks_count and s_blocks_per_group)
135 uint32_t blocks_per_group; // number of blocks in each block group (from s_blocks_per_group)
136 uint32_t inodes_per_group; // number of inodes in each block group (from s_inodes_per_group)
137 uint32_t bgdt_start_block; // block number of the starting block of the block group descriptor table (calculated as first_data_block + 1)
138
139 // heap-allocated scratch buffers (allocated during ext2_initialize)
140 uint8_t *buf_sector; // sector-sized I/O buffer (EXT2_SECTOR_SIZE bytes)
141 uint8_t *buf_block; // general block buffer (block_size bytes)
142 uint8_t *buf_block2; // scratch for single-indirect resolution
143 uint8_t *buf_block3; // scratch for double-indirect resolution
144 uint8_t *buf_block4; // scratch for triple-indirect resolution
145 uint8_t *buf_inode; // inode read buffer (inode_size bytes)
146 uint8_t *buf_bitmap; // bitmap I/O buffer (block_size bytes)
148
149typedef struct
150{
151 uint32_t inode; // inode number of the file or directory
152 uint64_t size; // size of the file in bytes
153 uint64_t cursor; // current position in the file for reading or writing
154 uint8_t file_type; // type of the file (e.g., regular file, directory)
155 uint8_t is_open; // flag indicating whether the file is open
156 ext2_volume_t *volume; // pointer to the ext2_volume_t structure representing the filesystem volume
157 ext2_inode_t inode_cache; // cached inode structure for the file, used to avoid repeated inode reads
159
160typedef struct
161{
162 uint32_t inode; // inode number of the file or directory entry
163 uint8_t file_type; // type of the file or directory (e.g., regular file, directory)
164 uint32_t size; // size of the file in bytes (for regular files) or number of entries (for directories)
165 char name[EXT2_NAME_MAX]; // null-terminated name of the file or directory entry (maximum length of 255 characters plus null terminator)
167
168/**
169 * where the driver gets the time for inode times, in seconds since 1970.
170 * the kernel sets it at boot; while it is NULL (the bootloader) the driver
171 * uses a fixed time.
172 */
173extern uint32_t (*ext2_clock)(void);
174
175/**
176 * the time for inode times: ext2_clock, or a fixed time without one.
177 */
178uint32_t ext2_now(void);
179
180/**
181 * write an inode back to the volume.
182 * @return true on success.
183 */
184bool ext2_write_inode(ext2_volume_t *volume, uint32_t inode_number, const ext2_inode_t *inode);
185
186/**
187 * initialize an ext2 volume from a disk.
188 * @param volume volume object to initialize.
189 * @param disk initialized block device backend.
190 * @return KERR_OK on success, or an error code on failure.
191 */
193
194/**
195 * read one inode by inode number.
196 * @param volume initialized ext2 volume.
197 * @param inode_number inode to read.
198 * @param inode_out output inode.
199 * @return KERR_OK on success, or an error code on failure.
200 */
201kerr_t ext2_read_inode(ext2_volume_t *volume, uint32_t inode_number, ext2_inode_t *inode_out);
202
203/**
204 * list entries in a directory inode.
205 * @param volume initialized ext2 volume.
206 * @param inode_number directory inode number.
207 * @return KERR_OK on success, or an error code on failure.
208 */
209kerr_t ext2_list_directory(ext2_volume_t *volume, uint32_t inode_number);
210
211/**
212 * the size of an inode's file in bytes. a regular file keeps the high 32
213 * bits in i_dir_acl.
214 * @param inode the inode.
215 * @return the size.
216 */
218
219/**
220 * the largest size a regular file can have on a volume: what the direct,
221 * single, double and triple indirect blocks can map, and at most what
222 * i_blocks can count (2 TiB). on a revision 0 volume (no feature flags),
223 * 2 GiB - 1.
224 * @param volume the volume.
225 * @return the size in bytes.
226 */
228
229/**
230 * read bytes from a file inode into buffer.
231 * @param volume initialized ext2 volume.
232 * @param inode_number file inode number.
233 * @param offset byte offset in file.
234 * @param length bytes to read.
235 * @param buffer destination buffer.
236 * @return KERR_OK on success, or an error code on failure.
237 */
238kerr_t ext2_read_file(ext2_volume_t *volume, uint32_t inode_number, uint64_t offset, uint32_t length, void *buffer);
239
240/**
241 * create a regular file at an absolute path.
242 */
243kerr_t ext2_create_file(ext2_volume_t *volume, const char *path);
244
245/**
246 * create a directory at an absolute path.
247 */
248kerr_t ext2_create_dir(ext2_volume_t *volume, const char *path);
249
250/**
251 * remove a regular file at an absolute path.
252 */
253kerr_t ext2_remove_file(ext2_volume_t *volume, const char *path);
254
255/**
256 * remove a directory at an absolute path.
257 */
258kerr_t ext2_remove_dir(ext2_volume_t *volume, const char *path);
259
260/**
261 * rename a file or directory (both paths absolute and normalized).
262 * an existing new_path is replaced first, as POSIX rename does: a file by
263 * a file, an empty directory by a directory. this is not atomic: if the
264 * rename then fails, the replaced entry is gone.
265 * @return KERR_OK, KERR_INVAL (a directory into itself), KERR_ISDIR,
266 * KERR_NOTDIR, KERR_NOTEMPTY, KERR_NOTFOUND, KERR_NOSPC or KERR_IO.
267 */
268kerr_t ext2_rename(ext2_volume_t *volume, const char *old_path, const char *new_path);
269
270/**
271 * resolve an absolute path to an inode.
272 * @param volume initialized ext2 volume.
273 * @param path absolute path.
274 * @param inode_out resolved inode.
275 * @return KERR_OK on success, or an error code on failure.
276 */
277kerr_t ext2_lookup_path(ext2_volume_t *volume, const char *path, uint32_t *inode_out);
278
279/**
280 * find the first symbolic link along a path.
281 * @param follow_last also the last name of the path, when it is a link.
282 * @param target gets the link's target, with a NUL.
283 * @param end_out gets the length of the path up to and with the link's
284 * name, or 0 when there is no link (or a name is missing).
285 * @return KERR_OK, KERR_RANGE (the target is longer than size), KERR_IO.
286 */
287kerr_t ext2_find_link(ext2_volume_t *volume, const char *path, bool follow_last, char *target,
288 uint32_t size, uint32_t *end_out);
289
290/**
291 * read a symbolic link's target, with a NUL.
292 * @return KERR_OK, KERR_INVAL (not a link), KERR_RANGE (too long for size),
293 * KERR_NOTFOUND.
294 */
295kerr_t ext2_readlink(ext2_volume_t *volume, const char *path, char *target, uint32_t size);
296
297/**
298 * make a symbolic link at path that points at target.
299 * @return KERR_OK, KERR_EXIST, KERR_RANGE (the target is not shorter than
300 * a block), KERR_NOTFOUND (no parent), KERR_NOSPC.
301 */
302kerr_t ext2_symlink(ext2_volume_t *volume, const char *path, const char *target);
303
304/**
305 * give the file at old_path one more name, new_path.
306 * @return KERR_OK, KERR_ISDIR (a directory), KERR_EXIST, KERR_RANGE (too
307 * many links), KERR_NOTFOUND, KERR_NOSPC.
308 */
309kerr_t ext2_link(ext2_volume_t *volume, const char *old_path, const char *new_path);
310
311/**
312 * make a named pipe or a device node.
313 * @param mode the type (EXT2_S_IFIFO, EXT2_S_IFCHR, EXT2_S_IFBLK) and the
314 * permission bits.
315 * @param major the device's numbers (a device node only).
316 * @return KERR_OK, KERR_EXIST, KERR_NOTFOUND (no parent), KERR_NOSPC,
317 * KERR_INVAL (another type).
318 */
319kerr_t ext2_mknod(ext2_volume_t *volume, const char *path, uint32_t mode, uint32_t major,
321
322/**
323 * the numbers of a device node, as ext2_mknod stored them.
324 */
326
327/**
328 * open a file or directory by absolute path.
329 * @param volume initialized ext2 volume.
330 * @param path absolute path.
331 * @param file output file handle.
332 * @return KERR_OK on success, or an error code on failure.
333 */
334kerr_t ext2_open(ext2_volume_t *volume, const char *path, ext2_file_t *file);
335
336/**
337 * read bytes from an open ext2 file handle.
338 * @param file open file handle.
339 * @param byteCount max bytes to read.
340 * @param dataOut destination buffer.
341 * @return number of bytes read.
342 */
343uint32_t ext2_read(ext2_file_t *file, uint32_t byteCount, void *dataOut);
344
345/**
346 * write bytes to an open ext2 file at the current cursor position.
347 * allocates blocks as needed. advances the cursor.
348 * @param file open file handle.
349 * @param byteCount bytes to write.
350 * @param dataIn source buffer.
351 * @return number of bytes actually written, or 0 on failure.
352 */
353uint32_t ext2_write(ext2_file_t *file, uint32_t byteCount, const void *dataIn);
354
355/**
356 * cut or grow an open file to length bytes (growth reads as zeros). the
357 * cursor stays.
358 * @return KERR_OK, or KERR_IO.
359 */
361
362/**
363 * read one directory entry from an open directory handle.
364 * @param file open directory handle.
365 * @param entryOut output directory entry.
366 * @return KERR_OK when an entry is read. KERR_NOENT when done or on failure.
367 */
369
370/**
371 * close an open ext2 file handle.
372 * @param file file handle to close.
373 */
375
376/**
377 * write bytes to a file inode.
378 * allocates blocks as needed (direct blocks only, up to 48KB with 4K blocks).
379 * @param volume initialized ext2 volume.
380 * @param inode_number file inode number.
381 * @param offset byte offset in file to start writing.
382 * @param length bytes to write.
383 * @param buffer source data.
384 * @return KERR_OK on success, or an error code on failure.
385 */
386kerr_t ext2_write_file(ext2_volume_t *volume, uint32_t inode_number, uint64_t offset, uint32_t length, const void *buffer);
387
388/**
389 * cut or grow a file to length bytes. the blocks past a shorter end are
390 * freed; a longer file gets a hole, which reads as zeros.
391 * @param volume initialized ext2 volume.
392 * @param inode_number file inode number.
393 * @param length the new size.
394 * @return KERR_OK on success, or an error code on failure.
395 */
396kerr_t ext2_truncate_file(ext2_volume_t *volume, uint32_t inode_number, uint64_t length);
struct block_device block_device_t
Definition block_device.h:5
kerr_t
unified kernel error codes.
Definition error.h:14
kerr_t ext2_readlink(ext2_volume_t *volume, const char *path, char *target, uint32_t size)
read a symbolic link's target, with a NUL.
Definition ext2_link.c:134
kerr_t ext2_lookup_path(ext2_volume_t *volume, const char *path, uint32_t *inode_out)
resolve an absolute path to an inode.
Definition ext2_inode.c:347
kerr_t ext2_remove_dir(ext2_volume_t *volume, const char *path)
remove a directory at an absolute path.
Definition ext2_file.c:558
kerr_t ext2_create_dir(ext2_volume_t *volume, const char *path)
create a directory at an absolute path.
Definition ext2_file.c:415
kerr_t ext2_list_directory(ext2_volume_t *volume, uint32_t inode_number)
list entries in a directory inode.
Definition ext2_inode.c:289
kerr_t ext2_read_inode(ext2_volume_t *volume, uint32_t inode_number, ext2_inode_t *inode_out)
read one inode by inode number.
Definition ext2_inode.c:252
kerr_t ext2_read_file(ext2_volume_t *volume, uint32_t inode_number, uint64_t offset, uint32_t length, void *buffer)
read bytes from a file inode into buffer.
Definition ext2_file.c:282
kerr_t ext2_truncate(ext2_file_t *file, uint64_t length)
cut or grow an open file to length bytes (growth reads as zeros).
Definition ext2_file.c:228
ext2_superblock_t
Definition ext2.h:78
kerr_t ext2_read_entry(ext2_file_t *file, ext2_directory_entry_t *entryOut)
read one directory entry from an open directory handle.
Definition ext2_file.c:241
ext2_dir_entry_t
Definition ext2.h:120
#define EXT2_NAME_MAX
Definition ext2.h:43
uint32_t ext2_now(void)
the time for inode times: ext2_clock, or a fixed time without one.
Definition ext2_dir.c:8
void ext2_device_numbers(const ext2_inode_t *inode, uint32_t *major, uint32_t *minor)
the numbers of a device node, as ext2_mknod stored them.
Definition ext2_link.c:392
kerr_t ext2_open(ext2_volume_t *volume, const char *path, ext2_file_t *file)
open a file or directory by absolute path.
Definition ext2_file.c:126
kerr_t ext2_mknod(ext2_volume_t *volume, const char *path, uint32_t mode, uint32_t major, uint32_t minor)
make a named pipe or a device node.
Definition ext2_link.c:325
ext2_inode_t
Definition ext2.h:112
kerr_t ext2_find_link(ext2_volume_t *volume, const char *path, bool follow_last, char *target, uint32_t size, uint32_t *end_out)
find the first symbolic link along a path.
Definition ext2_link.c:69
uint32_t ext2_write(ext2_file_t *file, uint32_t byteCount, const void *dataIn)
write bytes to an open ext2 file at the current cursor position.
Definition ext2_file.c:195
kerr_t ext2_create_file(ext2_volume_t *volume, const char *path)
create a regular file at an absolute path.
Definition ext2_file.c:355
kerr_t ext2_link(ext2_volume_t *volume, const char *old_path, const char *new_path)
give the file at old_path one more name, new_path.
Definition ext2_link.c:280
kerr_t ext2_truncate_file(ext2_volume_t *volume, uint32_t inode_number, uint64_t length)
cut or grow a file to length bytes.
Definition ext2_file.c:1134
uint32_t(*) ext2_clock(void)
where the driver gets the time for inode times, in seconds since 1970.
Definition ext2_dir.c:6
void ext2_close(ext2_file_t *file)
close an open ext2 file handle.
Definition ext2_file.c:266
kerr_t ext2_rename(ext2_volume_t *volume, const char *old_path, const char *new_path)
rename a file or directory (both paths absolute and normalized).
Definition ext2_file.c:624
uint32_t ext2_read(ext2_file_t *file, uint32_t byteCount, void *dataOut)
read bytes from an open ext2 file handle.
Definition ext2_file.c:156
ext2_block_group_desc_t
Definition ext2.h:90
uint64_t ext2_max_file_size(const ext2_volume_t *volume)
the largest size a regular file can have on a volume: what the direct, single, double and triple indi...
Definition ext2_file.c:16
kerr_t ext2_write_file(ext2_volume_t *volume, uint32_t inode_number, uint64_t offset, uint32_t length, const void *buffer)
write bytes to a file inode.
Definition ext2_file.c:910
kerr_t ext2_symlink(ext2_volume_t *volume, const char *path, const char *target)
make a symbolic link at path that points at target.
Definition ext2_link.c:201
bool ext2_write_inode(ext2_volume_t *volume, uint32_t inode_number, const ext2_inode_t *inode)
write an inode back to the volume.
Definition ext2_alloc.c:593
kerr_t ext2_remove_file(ext2_volume_t *volume, const char *path)
remove a regular file at an absolute path.
Definition ext2_file.c:502
kerr_t ext2_initialize(ext2_volume_t *volume, block_device_t *disk)
initialize an ext2 volume from a disk.
Definition ext2_mount.c:7
uint64_t ext2_inode_size(const ext2_inode_t *inode)
the size of an inode's file in bytes.
Definition ext2_file.c:6
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
unsigned short uint16_t
Definition stdint.h:13
ELF32 file header.
Definition elf.h:51
Definition ext2.h:161
char name[EXT2_NAME_MAX]
Definition ext2.h:165
uint8_t file_type
Definition ext2.h:163
uint32_t size
Definition ext2.h:164
uint32_t inode
Definition ext2.h:162
Definition ext2.h:150
uint64_t cursor
Definition ext2.h:153
uint32_t inode
Definition ext2.h:151
ext2_inode_t inode_cache
Definition ext2.h:157
uint8_t is_open
Definition ext2.h:155
uint8_t file_type
Definition ext2.h:154
uint64_t size
Definition ext2.h:152
ext2_volume_t * volume
Definition ext2.h:156
Definition ext2.h:123
block_device_t * disk
Definition ext2.h:124
uint8_t * buf_block
Definition ext2.h:141
uint32_t blocks_per_group
Definition ext2.h:135
uint8_t * buf_inode
Definition ext2.h:145
uint32_t sectors_per_block
Definition ext2.h:128
uint8_t * buf_block3
Definition ext2.h:143
ext2_superblock_t superblock
Definition ext2.h:125
uint32_t first_data_block
Definition ext2.h:130
uint32_t block_group_count
Definition ext2.h:134
uint32_t inode_size
Definition ext2.h:129
uint8_t * buf_sector
Definition ext2.h:140
uint8_t * buf_block4
Definition ext2.h:144
uint32_t block_shift
Definition ext2.h:127
uint32_t block_size
Definition ext2.h:126
uint32_t block_count
Definition ext2.h:131
uint8_t * buf_bitmap
Definition ext2.h:146
uint8_t * buf_block2
Definition ext2.h:142
uint32_t inode_count
Definition ext2.h:132
uint32_t first_non_reserved_inode
Definition ext2.h:133
uint32_t inodes_per_group
Definition ext2.h:136
uint32_t bgdt_start_block
Definition ext2.h:137
an open-file description.
Definition file.h:64
#define minor(dev)
Definition sysmacros.h:10
#define major(dev)
Definition sysmacros.h:9