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
This commit is contained in:
parent
07cbc27cb0
commit
22840dea11
7 changed files with 1 additions and 8 deletions
|
@ -45,7 +45,6 @@ int fs_stat(ino_t ino_nr, struct stat *statbuf)
|
||||||
/* true iff special */
|
/* true iff special */
|
||||||
s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_SPECIAL);
|
s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_SPECIAL);
|
||||||
|
|
||||||
statbuf->st_ino = va.va_fileid;
|
|
||||||
statbuf->st_mode = va.va_mode;
|
statbuf->st_mode = va.va_mode;
|
||||||
statbuf->st_nlink = va.va_nlink;
|
statbuf->st_nlink = va.va_nlink;
|
||||||
statbuf->st_uid = va.va_uid;
|
statbuf->st_uid = va.va_uid;
|
||||||
|
|
|
@ -31,8 +31,6 @@ int fs_stat(ino_t ino_nr, struct stat *statbuf)
|
||||||
/* true iff special */
|
/* true iff special */
|
||||||
s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_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_mode = rip->i_mode;
|
||||||
statbuf->st_nlink = rip->i_links_count;
|
statbuf->st_nlink = rip->i_links_count;
|
||||||
statbuf->st_uid = rip->i_uid;
|
statbuf->st_uid = rip->i_uid;
|
||||||
|
|
|
@ -59,8 +59,6 @@ int fs_stat(ino_t ino_nr, struct stat *statbuf)
|
||||||
/* true iff special */
|
/* true iff special */
|
||||||
s = (mo == I_CHAR_SPECIAL || mo == I_BLOCK_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_mode = (mode_t) rip->i_mode;
|
||||||
statbuf->st_nlink = (nlink_t) rip->i_nlinks;
|
statbuf->st_nlink = (nlink_t) rip->i_nlinks;
|
||||||
statbuf->st_uid = rip->i_uid;
|
statbuf->st_uid = rip->i_uid;
|
||||||
|
|
|
@ -338,7 +338,6 @@ pfs_stat(ino_t ino_nr, struct stat * statbuf)
|
||||||
|
|
||||||
/* Fill the stat buffer. */
|
/* Fill the stat buffer. */
|
||||||
statbuf->st_dev = rip->i_rdev; /* workaround for old socketpair bug */
|
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_mode = rip->i_mode;
|
||||||
statbuf->st_nlink = 0;
|
statbuf->st_nlink = 0;
|
||||||
statbuf->st_uid = rip->i_uid;
|
statbuf->st_uid = rip->i_uid;
|
||||||
|
|
|
@ -726,6 +726,7 @@ fsdriver_stat(const struct fsdriver * __restrict fdp,
|
||||||
|
|
||||||
memset(&buf, 0, sizeof(buf));
|
memset(&buf, 0, sizeof(buf));
|
||||||
buf.st_dev = fsdriver_device;
|
buf.st_dev = fsdriver_device;
|
||||||
|
buf.st_ino = ino_nr;
|
||||||
|
|
||||||
if ((r = fdp->fdr_stat(ino_nr, &buf)) == OK)
|
if ((r = fdp->fdr_stat(ino_nr, &buf)) == OK)
|
||||||
r = sys_safecopyto(m_in->m_source, grant, 0, (vir_bytes)&buf,
|
r = sys_safecopyto(m_in->m_source, grant, 0, (vir_bytes)&buf,
|
||||||
|
|
|
@ -56,7 +56,6 @@ int do_stat(ino_t ino_nr, struct stat *stat)
|
||||||
if ((r = verify_inode(ino, path, &attr)) != OK)
|
if ((r = verify_inode(ino, path, &attr)) != OK)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
stat->st_ino = ino_nr;
|
|
||||||
stat->st_mode = get_mode(ino, attr.a_mode);
|
stat->st_mode = get_mode(ino, attr.a_mode);
|
||||||
stat->st_uid = sffs_params->p_uid;
|
stat->st_uid = sffs_params->p_uid;
|
||||||
stat->st_gid = sffs_params->p_gid;
|
stat->st_gid = sffs_params->p_gid;
|
||||||
|
|
|
@ -17,7 +17,6 @@ fs_stat(ino_t ino_nr, struct stat * buf)
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
|
|
||||||
/* Fill in the basic info. */
|
/* Fill in the basic info. */
|
||||||
buf->st_ino = get_inode_number(node);
|
|
||||||
buf->st_mode = node->i_stat.mode;
|
buf->st_mode = node->i_stat.mode;
|
||||||
buf->st_nlink = !is_inode_deleted(node);
|
buf->st_nlink = !is_inode_deleted(node);
|
||||||
buf->st_uid = node->i_stat.uid;
|
buf->st_uid = node->i_stat.uid;
|
||||||
|
|
Loading…
Reference in a new issue