1 /* Created (MFS based):
2 * February 2010 (Evgeniy Ivanov)
8 #include <sys/statvfs.h>
13 /*===========================================================================*
15 *===========================================================================*/
16 int fs_stat(ino_t ino_nr
, struct stat
*statbuf
)
22 if ((rip
= get_inode(fs_dev
, ino_nr
)) == NULL
)
25 /* Update the atime, ctime, and mtime fields in the inode, if need be. */
26 if (rip
->i_update
) update_times(rip
);
28 /* Fill in the statbuf struct. */
29 mo
= rip
->i_mode
& I_TYPE
;
31 /* true iff special */
32 s
= (mo
== I_CHAR_SPECIAL
|| mo
== I_BLOCK_SPECIAL
);
34 statbuf
->st_mode
= rip
->i_mode
;
35 statbuf
->st_nlink
= rip
->i_links_count
;
36 statbuf
->st_uid
= rip
->i_uid
;
37 statbuf
->st_gid
= rip
->i_gid
;
38 statbuf
->st_rdev
= (s
? (dev_t
)rip
->i_block
[0] : NO_DEV
);
39 statbuf
->st_size
= rip
->i_size
;
40 statbuf
->st_atime
= rip
->i_atime
;
41 statbuf
->st_mtime
= rip
->i_mtime
;
42 statbuf
->st_ctime
= rip
->i_ctime
;
43 statbuf
->st_blksize
= rip
->i_sp
->s_block_size
;
44 statbuf
->st_blocks
= rip
->i_blocks
;
46 put_inode(rip
); /* release the inode */
51 /*===========================================================================*
53 *===========================================================================*/
54 int fs_statvfs(struct statvfs
*st
)
56 struct super_block
*sp
;
58 sp
= get_super(fs_dev
);
60 st
->f_flag
= ST_NOTRUNC
;
61 st
->f_bsize
= sp
->s_block_size
;
62 st
->f_frsize
= sp
->s_block_size
;
63 st
->f_iosize
= sp
->s_block_size
;
64 st
->f_blocks
= sp
->s_blocks_count
;
65 st
->f_bfree
= sp
->s_free_blocks_count
;
66 st
->f_bavail
= sp
->s_free_blocks_count
- sp
->s_r_blocks_count
;
67 st
->f_files
= sp
->s_inodes_count
;
68 st
->f_ffree
= sp
->s_free_inodes_count
;
69 st
->f_favail
= sp
->s_free_inodes_count
;
70 st
->f_namemax
= EXT2_NAME_MAX
;