From: David van Moolenbroek Date: Sun, 21 Jun 2015 17:50:22 +0000 (+0000) Subject: libfsdriver: preinitialize stat.st_ino X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=22840dea11f020ba466a94352f644d4f75e0e1fd;p=minix.git libfsdriver: preinitialize stat.st_ino The stat.st_ino field must always be filled with the inode number given as part of the fdr_stat request anyway, so libfsdriver can simply fill in the number and allow the file system not to bother. Change-Id: Ia7a849d0b23dfc83010df0d48fa26e4225427694 --- diff --git a/lib/libpuffs/stadir.c b/lib/libpuffs/stadir.c index 6d1d14d07..c617bc4bf 100644 --- a/lib/libpuffs/stadir.c +++ b/lib/libpuffs/stadir.c @@ -45,7 +45,6 @@ int fs_stat(ino_t ino_nr, struct stat *statbuf) /* true iff special */ s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_SPECIAL); - statbuf->st_ino = va.va_fileid; statbuf->st_mode = va.va_mode; statbuf->st_nlink = va.va_nlink; statbuf->st_uid = va.va_uid; diff --git a/minix/fs/ext2/stadir.c b/minix/fs/ext2/stadir.c index 720b7389e..8045a53f7 100644 --- a/minix/fs/ext2/stadir.c +++ b/minix/fs/ext2/stadir.c @@ -31,8 +31,6 @@ int fs_stat(ino_t ino_nr, struct stat *statbuf) /* true iff special */ s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_SPECIAL); - statbuf->st_dev = rip->i_dev; - statbuf->st_ino = rip->i_num; statbuf->st_mode = rip->i_mode; statbuf->st_nlink = rip->i_links_count; statbuf->st_uid = rip->i_uid; diff --git a/minix/fs/mfs/stadir.c b/minix/fs/mfs/stadir.c index 91be2280a..2d161cdbd 100644 --- a/minix/fs/mfs/stadir.c +++ b/minix/fs/mfs/stadir.c @@ -59,8 +59,6 @@ int fs_stat(ino_t ino_nr, struct stat *statbuf) /* true iff special */ s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_SPECIAL); - statbuf->st_dev = rip->i_dev; - statbuf->st_ino = (ino_t) rip->i_num; statbuf->st_mode = (mode_t) rip->i_mode; statbuf->st_nlink = (nlink_t) rip->i_nlinks; statbuf->st_uid = rip->i_uid; diff --git a/minix/fs/pfs/pfs.c b/minix/fs/pfs/pfs.c index f73adb6fd..050edd153 100644 --- a/minix/fs/pfs/pfs.c +++ b/minix/fs/pfs/pfs.c @@ -338,7 +338,6 @@ pfs_stat(ino_t ino_nr, struct stat * statbuf) /* Fill the stat buffer. */ statbuf->st_dev = rip->i_rdev; /* workaround for old socketpair bug */ - statbuf->st_ino = rip->i_num; statbuf->st_mode = rip->i_mode; statbuf->st_nlink = 0; statbuf->st_uid = rip->i_uid; diff --git a/minix/lib/libfsdriver/call.c b/minix/lib/libfsdriver/call.c index 1f6189da1..7b4367396 100644 --- a/minix/lib/libfsdriver/call.c +++ b/minix/lib/libfsdriver/call.c @@ -726,6 +726,7 @@ fsdriver_stat(const struct fsdriver * __restrict fdp, memset(&buf, 0, sizeof(buf)); buf.st_dev = fsdriver_device; + buf.st_ino = ino_nr; if ((r = fdp->fdr_stat(ino_nr, &buf)) == OK) r = sys_safecopyto(m_in->m_source, grant, 0, (vir_bytes)&buf, diff --git a/minix/lib/libsffs/stat.c b/minix/lib/libsffs/stat.c index 330afbf08..1fce5675c 100644 --- a/minix/lib/libsffs/stat.c +++ b/minix/lib/libsffs/stat.c @@ -56,7 +56,6 @@ int do_stat(ino_t ino_nr, struct stat *stat) if ((r = verify_inode(ino, path, &attr)) != OK) return r; - stat->st_ino = ino_nr; stat->st_mode = get_mode(ino, attr.a_mode); stat->st_uid = sffs_params->p_uid; stat->st_gid = sffs_params->p_gid; diff --git a/minix/lib/libvtreefs/stadir.c b/minix/lib/libvtreefs/stadir.c index 3f0d17df7..5a4a5e5c8 100644 --- a/minix/lib/libvtreefs/stadir.c +++ b/minix/lib/libvtreefs/stadir.c @@ -17,7 +17,6 @@ fs_stat(ino_t ino_nr, struct stat * buf) return EINVAL; /* Fill in the basic info. */ - buf->st_ino = get_inode_number(node); buf->st_mode = node->i_stat.mode; buf->st_nlink = !is_inode_deleted(node); buf->st_uid = node->i_stat.uid;