Message types for VFS link
Change-Id: Ibe03e7c9fded7f3764ecbe3e35b92df3662e54a4
This commit is contained in:
parent
111969b623
commit
afcde4d208
5 changed files with 28 additions and 16 deletions
|
@ -207,6 +207,17 @@ typedef struct {
|
|||
} mess_fs_vfs_getdents;
|
||||
_ASSERT_MSG_SIZE(mess_fs_vfs_getdents);
|
||||
|
||||
typedef struct {
|
||||
ino_t inode;
|
||||
ino_t dir_ino;
|
||||
|
||||
cp_grant_id_t grant;
|
||||
size_t path_len;
|
||||
|
||||
uint8_t data[32];
|
||||
} mess_vfs_fs_link;
|
||||
_ASSERT_MSG_SIZE(mess_vfs_fs_link);
|
||||
|
||||
typedef struct {
|
||||
ino_t dir_ino;
|
||||
ino_t root_ino;
|
||||
|
@ -441,6 +452,7 @@ typedef struct {
|
|||
mess_vfs_fs_ftrunc m_vfs_fs_ftrunc;
|
||||
mess_vfs_fs_getdents m_vfs_fs_getdents;
|
||||
mess_fs_vfs_getdents m_fs_vfs_getdents;
|
||||
mess_vfs_fs_link m_vfs_fs_link;
|
||||
mess_vfs_fs_lookup m_vfs_fs_lookup;
|
||||
mess_fs_vfs_lookup m_fs_vfs_lookup;
|
||||
mess_vfs_fs_mountpoint m_vfs_fs_mountpoint;
|
||||
|
|
|
@ -85,16 +85,16 @@ int fs_link(void)
|
|||
return(OK);
|
||||
|
||||
/* Copy the link name's last component */
|
||||
len = fs_m_in.REQ_PATH_LEN;
|
||||
len = fs_m_in.m_vfs_fs_link.path_len;
|
||||
if (len > NAME_MAX + 1)
|
||||
return(ENAMETOOLONG);
|
||||
|
||||
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, 0,
|
||||
r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_link.grant, 0,
|
||||
(vir_bytes) string, (size_t) len);
|
||||
if (r != OK) return(r);
|
||||
NUL(string, len, sizeof(string));
|
||||
|
||||
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_link.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
/* Check to see if the file has maximum number of links already. */
|
||||
|
@ -105,7 +105,7 @@ int fs_link(void)
|
|||
if ((pn->pn_va.va_mode & I_TYPE) == I_DIRECTORY && caller_uid != SU_UID)
|
||||
return(EPERM);
|
||||
|
||||
if ((pn_dir = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_DIR_INO)) == NULL)
|
||||
if ((pn_dir = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_link.dir_ino)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
if (pn_dir->pn_va.va_nlink == NO_LINK) {
|
||||
|
|
|
@ -42,17 +42,17 @@ int fs_link()
|
|||
phys_bytes len;
|
||||
|
||||
/* Copy the link name's last component */
|
||||
len = fs_m_in.REQ_PATH_LEN; /* including trailing '\0' */
|
||||
len = fs_m_in.m_vfs_fs_link.path_len; /* including trailing '\0' */
|
||||
if (len > NAME_MAX + 1 || len > EXT2_NAME_MAX + 1)
|
||||
return(ENAMETOOLONG);
|
||||
|
||||
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT, 0,
|
||||
r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_link.grant, 0,
|
||||
(vir_bytes) string, (size_t) len);
|
||||
if (r != OK) return r;
|
||||
NUL(string, len, sizeof(string));
|
||||
|
||||
/* Temporarily open the file. */
|
||||
if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NULL)
|
||||
if( (rip = get_inode(fs_dev, fs_m_in.m_vfs_fs_link.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
/* Check to see if the file has maximum number of links already. */
|
||||
|
@ -74,7 +74,7 @@ int fs_link()
|
|||
}
|
||||
|
||||
/* Temporarily open the last dir */
|
||||
if( (ip = get_inode(fs_dev, fs_m_in.REQ_DIR_INO)) == NULL) {
|
||||
if( (ip = get_inode(fs_dev, fs_m_in.m_vfs_fs_link.dir_ino)) == NULL) {
|
||||
put_inode(rip);
|
||||
return(EINVAL);
|
||||
}
|
||||
|
|
|
@ -39,15 +39,15 @@ int fs_link()
|
|||
struct inode *new_ip;
|
||||
phys_bytes len;
|
||||
|
||||
len = min( (unsigned) fs_m_in.REQ_PATH_LEN, sizeof(string));
|
||||
len = min(fs_m_in.m_vfs_fs_link.path_len, sizeof(string));
|
||||
/* Copy the link name's last component */
|
||||
r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_GRANT,
|
||||
r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_link.grant,
|
||||
(vir_bytes) 0, (vir_bytes) string, (size_t) len);
|
||||
if (r != OK) return r;
|
||||
NUL(string, len, sizeof(string));
|
||||
|
||||
/* 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_link.inode)) == NULL)
|
||||
return(EINVAL);
|
||||
|
||||
/* Check to see if the file has maximum number of links already. */
|
||||
|
@ -67,7 +67,7 @@ int fs_link()
|
|||
}
|
||||
|
||||
/* Temporarily open the last dir */
|
||||
if( (ip = get_inode(fs_dev, (pino_t) fs_m_in.REQ_DIR_INO)) == NULL) {
|
||||
if( (ip = get_inode(fs_dev, fs_m_in.m_vfs_fs_link.dir_ino)) == NULL) {
|
||||
put_inode(rip);
|
||||
return(EINVAL);
|
||||
}
|
||||
|
|
|
@ -401,10 +401,10 @@ int req_link(
|
|||
|
||||
/* Fill in request message */
|
||||
m.m_type = REQ_LINK;
|
||||
m.REQ_INODE_NR = (pino_t) linked_file;
|
||||
m.REQ_DIR_INO = (pino_t) link_parent;
|
||||
m.REQ_GRANT = grant_id;
|
||||
m.REQ_PATH_LEN = len;
|
||||
m.m_vfs_fs_link.inode = linked_file;
|
||||
m.m_vfs_fs_link.dir_ino = link_parent;
|
||||
m.m_vfs_fs_link.grant = grant_id;
|
||||
m.m_vfs_fs_link.path_len = len;
|
||||
|
||||
/* Send/rec request */
|
||||
r = fs_sendrec(fs_e, &m);
|
||||
|
|
Loading…
Reference in a new issue