Message types for VFS stat
Change-Id: I1d40ae7c3c32a4f7b80c82bc2fa8b157b20a6837
This commit is contained in:
parent
88f2d881a1
commit
df7e2766c5
9 changed files with 27 additions and 17 deletions
|
@ -378,6 +378,15 @@ typedef struct {
|
||||||
} mess_vfs_fs_slink;
|
} mess_vfs_fs_slink;
|
||||||
_ASSERT_MSG_SIZE(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 {
|
typedef struct {
|
||||||
ino_t inode;
|
ino_t inode;
|
||||||
time_t actime;
|
time_t actime;
|
||||||
|
@ -480,6 +489,7 @@ typedef struct {
|
||||||
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
|
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
|
||||||
mess_vfs_fs_rename m_vfs_fs_rename;
|
mess_vfs_fs_rename m_vfs_fs_rename;
|
||||||
mess_vfs_fs_slink m_vfs_fs_slink;
|
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_fs_utime m_vfs_fs_utime;
|
||||||
mess_vfs_utimens m_vfs_utimens;
|
mess_vfs_utimens m_vfs_utimens;
|
||||||
mess_vm_vfs_mmap m_vm_vfs_mmap;
|
mess_vm_vfs_mmap m_vm_vfs_mmap;
|
||||||
|
|
|
@ -20,7 +20,7 @@ int fs_stat(void)
|
||||||
register struct puffs_node *pn; /* target pnode */
|
register struct puffs_node *pn; /* target pnode */
|
||||||
struct vattr va;
|
struct vattr va;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
pmode_t mo;
|
mode_t mo;
|
||||||
int s;
|
int s;
|
||||||
PUFFS_MAKECRED(pcr, &global_kcred);
|
PUFFS_MAKECRED(pcr, &global_kcred);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ int fs_stat(void)
|
||||||
return(EINVAL);
|
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");
|
lpuffs_debug("walk failed...\n");
|
||||||
return(EINVAL);
|
return(EINVAL);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ int fs_stat(void)
|
||||||
statbuf.st_gen = va.va_gen;
|
statbuf.st_gen = va.va_gen;
|
||||||
|
|
||||||
/* Copy the struct to user space. */
|
/* 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,
|
(vir_bytes) 0, (vir_bytes) &statbuf,
|
||||||
(size_t) sizeof(statbuf));
|
(size_t) sizeof(statbuf));
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ int do_stat(void)
|
||||||
pino_t ino_nr;
|
pino_t ino_nr;
|
||||||
int r;
|
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 */
|
/* Don't increase the inode refcount: it's already open anyway */
|
||||||
if ((ino = find_inode(ino_nr)) == NULL)
|
if ((ino = find_inode(ino_nr)) == NULL)
|
||||||
|
@ -91,7 +91,7 @@ int do_stat(void)
|
||||||
if (HAS_CHILDREN(ino)) stat.st_nlink++;
|
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));
|
(vir_bytes) &stat, sizeof(stat));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ int fs_stat(void)
|
||||||
struct inode *node;
|
struct inode *node;
|
||||||
int r;
|
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;
|
return EINVAL;
|
||||||
|
|
||||||
memset(&statbuf, 0, sizeof(struct stat));
|
memset(&statbuf, 0, sizeof(struct stat));
|
||||||
|
@ -50,7 +50,7 @@ int fs_stat(void)
|
||||||
statbuf.st_ctime = cur_time;
|
statbuf.st_ctime = cur_time;
|
||||||
|
|
||||||
/* Copy the struct to user space. */
|
/* 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));
|
(vir_bytes) &statbuf, (phys_bytes) sizeof(statbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,10 +67,10 @@ int fs_stat()
|
||||||
register int r; /* return value */
|
register int r; /* return value */
|
||||||
register struct inode *rip; /* target inode */
|
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);
|
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 */
|
put_inode(rip); /* release the inode */
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,8 +83,8 @@ int fs_stat()
|
||||||
struct dir_record *dir;
|
struct dir_record *dir;
|
||||||
r = EINVAL;
|
r = EINVAL;
|
||||||
|
|
||||||
if ((dir = get_dir_record(fs_m_in.REQ_INODE_NR)) != NULL) {
|
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.REQ_GRANT);
|
r = stat_dir_record(dir, 0, fs_m_in.m_source, fs_m_in.m_vfs_fs_stat.grant);
|
||||||
release_dir_record(dir);
|
release_dir_record(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,10 +127,10 @@ int fs_stat()
|
||||||
register int r; /* return value */
|
register int r; /* return value */
|
||||||
register struct inode *rip; /* target inode */
|
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);
|
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 */
|
put_inode(rip); /* release the inode */
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,9 +62,9 @@ int fs_stat(message *fs_m_in, message *fs_m_out)
|
||||||
register int r; /* return value */
|
register int r; /* return value */
|
||||||
register struct inode *rip; /* target inode */
|
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 */
|
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 */
|
put_inode(rip); /* release the inode */
|
||||||
return(r);
|
return(r);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1092,8 +1092,8 @@ int req_stat_actual(endpoint_t fs_e, ino_t inode_nr, endpoint_t proc_e,
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_STAT;
|
m.m_type = REQ_STAT;
|
||||||
m.REQ_INODE_NR = (pino_t) inode_nr;
|
m.m_vfs_fs_stat.inode = inode_nr;
|
||||||
m.REQ_GRANT = grant_id;
|
m.m_vfs_fs_stat.grant = grant_id;
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
r = fs_sendrec(fs_e, &m);
|
r = fs_sendrec(fs_e, &m);
|
||||||
|
|
Loading…
Reference in a new issue