1 /* Created (MFS based):
2 * February 2010 (Evgeniy Ivanov)
7 /*===========================================================================*
9 *===========================================================================*/
10 int fs_stat(ino_t ino_nr
, struct stat
*statbuf
)
12 register struct puffs_node
*pn
; /* target pnode */
16 PUFFS_MAKECRED(pcr
, &global_kcred
);
18 if (global_pu
->pu_ops
.puffs_node_getattr
== NULL
) {
19 lpuffs_debug("fs_stat: puffs_node_getattr is missing\n");
23 if ((pn
= puffs_pn_nodewalk(global_pu
, find_inode_cb
, &ino_nr
)) == NULL
) {
24 lpuffs_debug("walk failed...\n");
28 if (global_pu
->pu_ops
.puffs_node_getattr(global_pu
, pn
, &va
, pcr
) != 0) {
30 if (errno
> 0) errno
= -errno
;
36 /* Fill in the statbuf struct. */
37 mo
= va
.va_mode
& I_TYPE
;
39 /* true iff special */
40 s
= (mo
== I_CHAR_SPECIAL
|| mo
== I_BLOCK_SPECIAL
);
42 statbuf
->st_mode
= va
.va_mode
;
43 statbuf
->st_nlink
= va
.va_nlink
;
44 statbuf
->st_uid
= va
.va_uid
;
45 statbuf
->st_gid
= va
.va_gid
;
46 statbuf
->st_rdev
= (s
? va
.va_rdev
: NO_DEV
);
47 statbuf
->st_size
= va
.va_size
;
48 statbuf
->st_atimespec
= va
.va_atime
;
49 statbuf
->st_mtimespec
= va
.va_mtime
;
50 statbuf
->st_ctimespec
= va
.va_ctime
;
52 statbuf
->st_birthtimespec
= va
.va_birthtime
;
53 statbuf
->st_blksize
= va
.va_blocksize
;
54 statbuf
->st_blocks
= va
.va_bytes
/ va
.va_blocksize
;
55 statbuf
->st_flags
= va
.va_flags
;
56 statbuf
->st_gen
= va
.va_gen
;
62 /*===========================================================================*
64 *===========================================================================*/
65 int fs_statvfs(struct statvfs
*st
)
68 if (global_pu
->pu_ops
.puffs_fs_statvfs(global_pu
, st
) != 0) {
69 lpuffs_debug("statvfs failed\n");
73 /* libpuffs doesn't truncate filenames */
74 st
->f_flag
|= ST_NOTRUNC
;