Info

EXT2_FT_UNKNOWN,

EXT2_FT_REG_FILE,

EXT2_FT_DIR,

EXT2_FT_CHRDEV,

EXT2_FT_BLKDEV,

EXT2_FT_FIFO,

EXT2_FT_SOCK,

EXT2_FT_SYMLINK,

EXT2_FT_MAX

ext2_ft_reg_file is used most frequently because it indicates a regular file (whose contents are of no relevance). ext2_ft_dir also occurs often and represents directories. The other constants denote character-special and block-special files (blkdev and chrdev), FIFOs (named pipes; FIFO), sockets (sock), and symbolic links (symlink).

rec_len is the only field in the directory structure whose meaning is not so obvious. It is an offset pointer indicating the number of bytes between the end of the rec_len field and the end of the next rec_len field. This enables the kernel to scan directories efficiently by jumping from one name to the next. By reference to an example, Figure 9-6 shows how different directory entries are represented on hard disk.

ls lists the contents of directories as follows:

[email protected]> ls -la total 20

drwxr-xr-x

3

wolfgang

drwxrwxrwt

13

wolfgang

brw-r--r--

1

wolfgang

lrwxrwxrwx

1

wolfgang

-rw-r--r--

1

wolfgang

drwxr-xr-x

2

wolfgang

users

4096

Feb

14

12

users

8192

Feb

14

12

users

3, 0

Feb

14

12

users

14

Feb

14

12

users

13

Feb

14

12

users

4096

Feb

14

12 harddisk

12 linux -> /usr/src/linux

12 sample

12 sources

12 harddisk

12 linux -> /usr/src/linux

12 sample

12 sources a

a ih jj

H I I

I a a

O S iH

inode ^ S id name

a ih jj

H I I

I a a

O S iH

inode ^ S id name

12

1

2

\0

\0 \

0

12

2

2

.h

\0 \

0

16

8

4

h

a

r I

d

i

s

k

32

5

7

1

i

n i

1 X

\0

\0

\0

16

6

2

d

e

1

i

r

\0

\0

16

6

1

s

a

m i p

1

e

\0

\0

16

7

2

s

o

u ■

i c

e

\0

\0

Continue reading here: Figure 96 Representation of files and directories in the Second Extended Filesystem

Was this article helpful?

0 0