Message types for VFS newnode

Change-Id: I5c0790fc1104182ab08bcae699c60a364833c360
This commit is contained in:
Lionel Sambuc 2014-04-28 18:54:18 +02:00
parent 3f567bdb11
commit 83cd8ba616
3 changed files with 47 additions and 21 deletions

View file

@ -204,6 +204,30 @@ typedef struct {
} mess_fs_vfs_lookup;
_ASSERT_MSG_SIZE(mess_fs_vfs_lookup);
typedef struct {
dev_t device;
mode_t mode;
uid_t uid;
gid_t gid;
uint8_t data[36];
} mess_vfs_fs_newnode;
_ASSERT_MSG_SIZE(mess_vfs_fs_newnode);
typedef struct {
off_t file_size;
dev_t device;
ino_t inode;
mode_t mode;
uid_t uid;
gid_t gid;
uint8_t data[20];
} mess_fs_vfs_newnode;
_ASSERT_MSG_SIZE(mess_fs_vfs_newnode);
typedef struct {
dev_t device;
@ -300,6 +324,8 @@ typedef struct {
mess_mmap m_mmap;
mess_notify m_notify;
mess_sigcalls m_sigcalls;
mess_vfs_fs_newnode m_vfs_fs_newnode;
mess_fs_vfs_newnode m_fs_vfs_newnode;
mess_vfs_fs_create m_vfs_fs_create;
mess_fs_vfs_create m_fs_vfs_create;
mess_vfs_fs_lookup m_vfs_fs_lookup;

View file

@ -11,16 +11,16 @@
int fs_newnode(message *fs_m_in, message *fs_m_out)
{
register int r = OK;
pmode_t bits;
mode_t bits;
struct inode *rip;
uid_t uid;
gid_t gid;
dev_t dev;
uid = (uid_t) fs_m_in->REQ_UID;
gid = (gid_t) fs_m_in->REQ_GID;
bits = (pmode_t) fs_m_in->REQ_MODE;
dev = fs_m_in->REQ_DEV;
uid = fs_m_in->m_vfs_fs_newnode.uid;
gid = fs_m_in->m_vfs_fs_newnode.gid;
bits = fs_m_in->m_vfs_fs_newnode.mode;
dev = fs_m_in->m_vfs_fs_newnode.device;
/* Try to allocate the inode */
if( (rip = alloc_inode(dev, bits, uid, gid) ) == NULL) return(err_code);
@ -42,12 +42,12 @@ int fs_newnode(message *fs_m_in, message *fs_m_out)
free_inode(rip);
} else {
/* Fill in the fields of the response message */
fs_m_out->RES_INODE_NR = rip->i_num;
fs_m_out->RES_MODE = rip->i_mode;
fs_m_out->RES_FILE_SIZE = rip->i_size;
fs_m_out->RES_UID = rip->i_uid;
fs_m_out->RES_GID = rip->i_gid;
fs_m_out->RES_DEV = dev;
fs_m_out->m_fs_vfs_newnode.inode = rip->i_num;
fs_m_out->m_fs_vfs_newnode.mode = rip->i_mode;
fs_m_out->m_fs_vfs_newnode.file_size = rip->i_size;
fs_m_out->m_fs_vfs_newnode.uid = rip->i_uid;
fs_m_out->m_fs_vfs_newnode.gid = rip->i_gid;
fs_m_out->m_fs_vfs_newnode.device = dev;
}
return(r);

View file

@ -634,21 +634,21 @@ int req_newnode(
/* Fill in request message */
m.m_type = REQ_NEWNODE;
m.REQ_MODE = (pmode_t) dmode;
m.REQ_DEV = dev;
m.REQ_UID = (puid_t) uid;
m.REQ_GID = (pgid_t) gid;
m.m_vfs_fs_newnode.mode = dmode;
m.m_vfs_fs_newnode.device = dev;
m.m_vfs_fs_newnode.uid = uid;
m.m_vfs_fs_newnode.gid = gid;
/* Send/rec request */
r = fs_sendrec(fs_e, &m);
res->fs_e = m.m_source;
res->inode_nr = (ino_t) m.RES_INODE_NR;
res->fmode = (mode_t) m.RES_MODE;
res->fsize = m.RES_FILE_SIZE;
res->dev = m.RES_DEV;
res->uid = (uid_t) m.RES_UID;
res->gid = (gid_t) m.RES_GID;
res->inode_nr = m.m_fs_vfs_newnode.inode;
res->fmode = m.m_fs_vfs_newnode.mode;
res->fsize = m.m_fs_vfs_newnode.file_size;
res->dev = m.m_fs_vfs_newnode.device;
res->uid = m.m_fs_vfs_newnode.uid;
res->gid = m.m_fs_vfs_newnode.gid;
return(r);
}