Message types for VFS chmod
Change-Id: I76e5df4c0a386682e863e640182c59e4ab7e30be
This commit is contained in:
parent
f90ed467fc
commit
ea84447ccd
7 changed files with 35 additions and 17 deletions
|
@ -146,6 +146,22 @@ typedef struct {
|
|||
} mess_sigcalls;
|
||||
_ASSERT_MSG_SIZE(mess_sigcalls);
|
||||
|
||||
typedef struct {
|
||||
ino_t inode;
|
||||
|
||||
mode_t mode;
|
||||
|
||||
uint8_t data[44];
|
||||
} mess_vfs_fs_chmod;
|
||||
_ASSERT_MSG_SIZE(mess_vfs_fs_chmod);
|
||||
|
||||
typedef struct {
|
||||
mode_t mode;
|
||||
|
||||
uint8_t data[52];
|
||||
} mess_fs_vfs_chmod;
|
||||
_ASSERT_MSG_SIZE(mess_fs_vfs_chmod);
|
||||
|
||||
typedef struct {
|
||||
ino_t inode;
|
||||
|
||||
|
@ -507,6 +523,8 @@ typedef struct {
|
|||
mess_sigcalls m_sigcalls;
|
||||
mess_vfs_fs_newnode m_vfs_fs_newnode;
|
||||
mess_fs_vfs_newnode m_fs_vfs_newnode;
|
||||
mess_vfs_fs_chmod m_vfs_fs_chmod;
|
||||
mess_fs_vfs_chmod m_fs_vfs_chmod;
|
||||
mess_vfs_fs_create m_vfs_fs_create;
|
||||
mess_fs_vfs_create m_fs_vfs_create;
|
||||
mess_vfs_fs_flush m_vfs_fs_flush;
|
||||
|
|
|
@ -25,9 +25,9 @@ int fs_chmod(void)
|
|||
if (global_pu->pu_ops.puffs_node_setattr == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
mode = (mode_t) fs_m_in.REQ_MODE;
|
||||
mode = fs_m_in.m_vfs_fs_chmod.mode;
|
||||
|
||||
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_chmod.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
puffs_vattr_null(&va);
|
||||
|
@ -39,7 +39,7 @@ int fs_chmod(void)
|
|||
return(EINVAL);
|
||||
|
||||
/* Return full new mode to caller. */
|
||||
fs_m_out.RES_MODE = pn->pn_va.va_mode;
|
||||
fs_m_out.m_fs_vfs_chmod.mode = pn->pn_va.va_mode;
|
||||
|
||||
return(OK);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ int do_chmod(void)
|
|||
if (state.s_read_only)
|
||||
return EROFS;
|
||||
|
||||
if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL)
|
||||
if ((ino = find_inode(m_in.m_vfs_fs_chmod.inode)) == NULL)
|
||||
return EINVAL;
|
||||
|
||||
if ((r = verify_inode(ino, path, NULL)) != OK)
|
||||
|
@ -118,7 +118,7 @@ int do_chmod(void)
|
|||
|
||||
/* Set the new file mode. */
|
||||
attr.a_mask = SFFS_ATTR_MODE;
|
||||
attr.a_mode = m_in.REQ_MODE; /* no need to convert in this direction */
|
||||
attr.a_mode = m_in.m_vfs_fs_chmod.mode; /* no need to convert in this direction */
|
||||
|
||||
if ((r = sffs_table->t_setattr(path, &attr)) != OK)
|
||||
return r;
|
||||
|
@ -127,7 +127,7 @@ int do_chmod(void)
|
|||
if ((r = verify_path(path, ino, &attr, NULL)) != OK)
|
||||
return r;
|
||||
|
||||
m_out.RES_MODE = get_mode(ino, attr.a_mode);
|
||||
m_out.m_fs_vfs_chmod.mode = get_mode(ino, attr.a_mode);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@ int fs_chmod()
|
|||
register struct inode *rip;
|
||||
pmode_t mode;
|
||||
|
||||
mode = (pmode_t) fs_m_in.REQ_MODE;
|
||||
mode = fs_m_in.m_vfs_fs_chmod.mode;
|
||||
|
||||
/* Temporarily open the file. */
|
||||
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_chmod.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
/* Now make the change. Clear setgid bit if file is not in caller's grp */
|
||||
|
@ -32,7 +32,7 @@ int fs_chmod()
|
|||
rip->i_dirt = IN_DIRTY;
|
||||
|
||||
/* Return full new mode to caller. */
|
||||
fs_m_out.RES_MODE = rip->i_mode;
|
||||
fs_m_out.m_fs_vfs_chmod.mode = rip->i_mode;
|
||||
|
||||
put_inode(rip);
|
||||
return(OK);
|
||||
|
|
|
@ -16,10 +16,10 @@ int fs_chmod()
|
|||
register struct inode *rip;
|
||||
pmode_t mode;
|
||||
|
||||
mode = (pmode_t) fs_m_in.REQ_MODE;
|
||||
mode = fs_m_in.m_vfs_fs_chmod.mode;
|
||||
|
||||
/* Temporarily open the file. */
|
||||
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_chmod.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
if(rip->i_sp->s_rd_only) {
|
||||
|
@ -33,7 +33,7 @@ int fs_chmod()
|
|||
IN_MARKDIRTY(rip);
|
||||
|
||||
/* Return full new mode to caller. */
|
||||
fs_m_out.RES_MODE = rip->i_mode;
|
||||
fs_m_out.m_fs_vfs_chmod.mode = rip->i_mode;
|
||||
|
||||
put_inode(rip);
|
||||
return(OK);
|
||||
|
|
|
@ -18,9 +18,9 @@ int fs_sync(message *fs_m_in, message *fs_m_out)
|
|||
int fs_chmod(message *fs_m_in, message *fs_m_out)
|
||||
{
|
||||
struct inode *rip; /* target inode */
|
||||
mode_t mode = (mode_t) fs_m_in->REQ_MODE;
|
||||
mode_t mode = fs_m_in->m_vfs_fs_chmod.mode;
|
||||
|
||||
if( (rip = find_inode(fs_m_in->REQ_INODE_NR)) == NULL) return(EINVAL);
|
||||
if( (rip = find_inode(fs_m_in->m_vfs_fs_chmod.inode)) == NULL) return(EINVAL);
|
||||
get_inode(rip->i_dev, rip->i_num); /* mark inode in use */
|
||||
rip->i_mode = (rip->i_mode & ~ALL_MODES) | (mode & ALL_MODES);
|
||||
put_inode(rip); /* release the inode */
|
||||
|
|
|
@ -115,14 +115,14 @@ int req_chmod(
|
|||
|
||||
/* Fill in request message */
|
||||
m.m_type = REQ_CHMOD;
|
||||
m.REQ_INODE_NR = (pino_t) inode_nr;
|
||||
m.REQ_MODE = (pmode_t) rmode;
|
||||
m.m_vfs_fs_chmod.inode = inode_nr;
|
||||
m.m_vfs_fs_chmod.mode = rmode;
|
||||
|
||||
/* Send/rec request */
|
||||
r = fs_sendrec(fs_e, &m);
|
||||
|
||||
/* Copy back actual mode. */
|
||||
*new_modep = (mode_t) m.RES_MODE;
|
||||
*new_modep = m.m_fs_vfs_chmod.mode;
|
||||
|
||||
return(r);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue