Final Year Project:
Using Linux Filesystems Under Windows
Chris Bryden
BEng. Electronics and Software Engineering
School of Computer Science
University of Birmingham
77
20.7 Implementing the ext2_get_inode Function
INODE FAR PASCAL __export ext2_get_inode(unsigned long ulInode);
This function is used to return the inode for the inode number specified as
the argument to this function. The inode number can be retrieved form the
directory listing. The purpose of this function is mainly to display extra infomation
on files to the user.
It returns an inode structure as defined in ext2lib.h and given the type INODE:
·
=i_mode - The type of file (character, block, link, etc.) and access rights to the
file. This field is best described by representing it as an octal number. Since it
is a 16 bit number, there will be 6 octal digits. The rightmost four digits are
bitwise fields:
The last three digits (Octal digits 0,1 and 2) are the file permissions, in the
form rwxrwxrwx. Digit 2 refers to the user, digit 1 to the group and digit 2
to everyone else.
The leftmost two octal digits are used to indicate the type of file that the inode
points to:
/*
* Structure of an inode on the disk
*/
struct ext2_inode {
unsigned short i_mode;
unsigned short i_uid;
unsigned long i_size;
unsigned long i_atime;
unsigned long i_ctime;
unsigned long i_mtime;
unsigned long i_dtime;
unsigned short i_gid;
unsigned short i_links_count;
unsigned long i_blocks;
unsigned long i_flags;
unsigned long l_i_reserved1;
unsigned long i_block[EXT2_N_BLOCKS];
unsigned long i_version;
unsigned long i_file_acl;
unsigned long i_dir_acl;
unsigned long i_faddr;
unsigned char l_i_frag;
unsigned char l_i_fsize;
unsigned short i_pad1;
unsigned long l_i_reserved2[2];
};