Message types for VFS stat

Change-Id: I1d40ae7c3c32a4f7b80c82bc2fa8b157b20a6837
This commit is contained in:
Lionel Sambuc 2014-05-01 10:05:07 +02:00
parent 88f2d881a1
commit df7e2766c5
9 changed files with 27 additions and 17 deletions

View file

@ -378,6 +378,15 @@ typedef struct {
} mess_vfs_fs_slink;
_ASSERT_MSG_SIZE(mess_vfs_fs_slink);
typedef struct {
ino_t inode;
cp_grant_id_t grant;
uint8_t data[44];
} mess_vfs_fs_stat;
_ASSERT_MSG_SIZE(mess_vfs_fs_stat);
typedef struct {
ino_t inode;
time_t actime;
@ -480,6 +489,7 @@ typedef struct {
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
mess_vfs_fs_rename m_vfs_fs_rename;
mess_vfs_fs_slink m_vfs_fs_slink;
mess_vfs_fs_stat m_vfs_fs_stat;
mess_vfs_fs_utime m_vfs_fs_utime;
mess_vfs_utimens m_vfs_utimens;
mess_vm_vfs_mmap m_vm_vfs_mmap;

View file

@ -20,7 +20,7 @@ int fs_stat(void)
register struct puffs_node *pn; /* target pnode */
struct vattr va;
struct stat statbuf;
pmode_t mo;
mode_t mo;
int s;
PUFFS_MAKECRED(pcr, &global_kcred);
@ -29,7 +29,7 @@ int fs_stat(void)
return(EINVAL);
}
if ((pn = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_INODE_NR)) == NULL) {
if ((pn = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_stat.inode)) == NULL) {
lpuffs_debug("walk failed...\n");
return(EINVAL);
}
@ -67,7 +67,7 @@ int fs_stat(void)
statbuf.st_gen = va.va_gen;
/* Copy the struct to user space. */
r = sys_safecopyto(fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT,
r = sys_safecopyto(fs_m_in.m_source, fs_m_in.m_vfs_fs_stat.grant,
(vir_bytes) 0, (vir_bytes) &statbuf,
(size_t) sizeof(statbuf));

View file

@ -48,7 +48,7 @@ int do_stat(void)
pino_t ino_nr;
int r;
ino_nr = m_in.REQ_INODE_NR;
ino_nr = m_in.m_vfs_fs_stat.inode;
/* Don't increase the inode refcount: it's already open anyway */
if ((ino = find_inode(ino_nr)) == NULL)
@ -91,7 +91,7 @@ int do_stat(void)
if (HAS_CHILDREN(ino)) stat.st_nlink++;
}
return sys_safecopyto(m_in.m_source, m_in.REQ_GRANT, 0,
return sys_safecopyto(m_in.m_source, m_in.m_vfs_fs_stat.grant, 0,
(vir_bytes) &stat, sizeof(stat));
}

View file

@ -19,7 +19,7 @@ int fs_stat(void)
struct inode *node;
int r;
if ((node = find_inode(fs_m_in.REQ_INODE_NR)) == NULL)
if ((node = find_inode(fs_m_in.m_vfs_fs_stat.inode)) == NULL)
return EINVAL;
memset(&statbuf, 0, sizeof(struct stat));
@ -50,7 +50,7 @@ int fs_stat(void)
statbuf.st_ctime = cur_time;
/* Copy the struct to user space. */
return sys_safecopyto(fs_m_in.m_source, fs_m_in.REQ_GRANT, 0,
return sys_safecopyto(fs_m_in.m_source, fs_m_in.m_vfs_fs_stat.grant, 0,
(vir_bytes) &statbuf, (phys_bytes) sizeof(statbuf));
}

View file

@ -67,10 +67,10 @@ int fs_stat()
register int r; /* return value */
register struct inode *rip; /* target inode */
if ((rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
if ((rip = get_inode(fs_dev, fs_m_in.m_vfs_fs_stat.inode)) == NULL)
return(EINVAL);
r = stat_inode(rip, fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT);
r = stat_inode(rip, fs_m_in.m_source, fs_m_in.m_vfs_fs_stat.grant);
put_inode(rip); /* release the inode */
return(r);
}

View file

@ -83,8 +83,8 @@ int fs_stat()
struct dir_record *dir;
r = EINVAL;
if ((dir = get_dir_record(fs_m_in.REQ_INODE_NR)) != NULL) {
r = stat_dir_record(dir, 0, fs_m_in.m_source, fs_m_in.REQ_GRANT);
if ((dir = get_dir_record(fs_m_in.m_vfs_fs_stat.inode)) != NULL) {
r = stat_dir_record(dir, 0, fs_m_in.m_source, fs_m_in.m_vfs_fs_stat.grant);
release_dir_record(dir);
}

View file

@ -127,10 +127,10 @@ int fs_stat()
register int r; /* return value */
register struct inode *rip; /* target inode */
if ((rip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_INODE_NR)) == NULL)
if ((rip = get_inode(fs_dev, fs_m_in.m_vfs_fs_stat.inode)) == NULL)
return(EINVAL);
r = stat_inode(rip, fs_m_in.m_source, (cp_grant_id_t) fs_m_in.REQ_GRANT);
r = stat_inode(rip, fs_m_in.m_source, fs_m_in.m_vfs_fs_stat.grant);
put_inode(rip); /* release the inode */
return(r);
}

View file

@ -62,9 +62,9 @@ int fs_stat(message *fs_m_in, message *fs_m_out)
register int r; /* return value */
register struct inode *rip; /* target inode */
if( (rip = find_inode(fs_m_in->REQ_INODE_NR)) == NULL) return(EINVAL);
if( (rip = find_inode(fs_m_in->m_vfs_fs_stat.inode)) == NULL) return(EINVAL);
get_inode(rip->i_dev, rip->i_num); /* mark inode in use */
r = stat_inode(rip, fs_m_in->m_source, (cp_grant_id_t) fs_m_in->REQ_GRANT);
r = stat_inode(rip, fs_m_in->m_source, fs_m_in->m_vfs_fs_stat.grant);
put_inode(rip); /* release the inode */
return(r);
}

View file

@ -1092,8 +1092,8 @@ int req_stat_actual(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e,
/* Fill in request message */
m.m_type = REQ_STAT;
m.REQ_INODE_NR = (pino_t) inode_nr;
m.REQ_GRANT = grant_id;
m.m_vfs_fs_stat.inode = inode_nr;
m.m_vfs_fs_stat.grant = grant_id;
/* Send/rec request */
r = fs_sendrec(fs_e, &m);