} mess_fs_vfs_readsuper;
_ASSERT_MSG_SIZE(mess_fs_vfs_readsuper);
+typedef struct {
+ ino_t dir_old;
+ ino_t dir_new;
+
+ size_t len_old;
+ size_t len_new;
+ cp_grant_id_t grant_old;
+ cp_grant_id_t grant_new;
+
+ uint8_t data[24];
+} mess_vfs_fs_rename;
+_ASSERT_MSG_SIZE(mess_vfs_fs_rename);
+
typedef struct {
time_t atime;
time_t mtime;
mess_vfs_fs_mountpoint m_vfs_fs_mountpoint;
mess_vfs_fs_readsuper m_vfs_fs_readsuper;
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
+ mess_vfs_fs_rename m_vfs_fs_rename;
mess_vfs_utimens m_vfs_utimens;
mess_vm_vfs_mmap m_vm_vfs_mmap;
mess_vmmcp m_vmmcp;
return(EINVAL);
/* Copy the last component of the old name */
- len = fs_m_in.REQ_REN_LEN_OLD; /* including trailing '\0' */
+ len = fs_m_in.m_vfs_fs_rename.len_old; /* including trailing '\0' */
if (len > NAME_MAX + 1)
return(ENAMETOOLONG);
- r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_OLD,
+ r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_rename.grant_old,
(vir_bytes) 0, (vir_bytes) pcn_src.pcn_name, (size_t) len);
if (r != OK) return(r);
NUL(pcn_src.pcn_name, len, sizeof(pcn_src.pcn_name));
pcn_src.pcn_namelen = len - 1;
/* Copy the last component of the new name */
- len = fs_m_in.REQ_REN_LEN_NEW; /* including trailing '\0' */
+ len = fs_m_in.m_vfs_fs_rename.len_new; /* including trailing '\0' */
if (len > NAME_MAX + 1)
return(ENAMETOOLONG);
- r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_NEW,
+ r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_rename.grant_new,
(vir_bytes) 0, (vir_bytes) pcn_targ.pcn_name, (size_t) len);
if (r != OK) return(r);
NUL(pcn_targ.pcn_name, len, sizeof(pcn_targ.pcn_name));
pcn_targ.pcn_namelen = len - 1;
/* Get old dir pnode */
- if ((old_dirp = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_REN_OLD_DIR))
+ if ((old_dirp = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_rename.dir_old))
== NULL)
return(ENOENT);
}
/* Get new dir pnode */
- if ((new_dirp = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.REQ_REN_NEW_DIR))
+ if ((new_dirp = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_rename.dir_new))
== NULL) {
r = ENOENT;
} else {
/* Get path strings, names, directory inodes and possibly preexisting inodes
* for the old and new paths.
*/
- if ((r = get_name(m_in.REQ_REN_GRANT_OLD, m_in.REQ_REN_LEN_OLD,
+ if ((r = get_name(m_in.m_vfs_fs_rename.grant_old, m_in.m_vfs_fs_rename.len_old,
old_name)) != OK) return r;
- if ((r = get_name(m_in.REQ_REN_GRANT_NEW, m_in.REQ_REN_LEN_NEW,
+ if ((r = get_name(m_in.m_vfs_fs_rename.grant_new, m_in.m_vfs_fs_rename.len_new,
new_name)) != OK) return r;
if (!strcmp(old_name, ".") || !strcmp(old_name, "..") ||
!strcmp(new_name, ".") || !strcmp(new_name, "..")) return EINVAL;
- if ((old_parent = find_inode(m_in.REQ_REN_OLD_DIR)) == NULL ||
- (new_parent = find_inode(m_in.REQ_REN_NEW_DIR)) == NULL)
+ if ((old_parent = find_inode(m_in.m_vfs_fs_rename.dir_old)) == NULL ||
+ (new_parent = find_inode(m_in.m_vfs_fs_rename.dir_new)) == NULL)
return EINVAL;
if ((r = verify_dentry(old_parent, old_name, old_path, &old_ino)) != OK)
phys_bytes len;
/* Copy the last component of the old name */
- len = fs_m_in.REQ_REN_LEN_OLD; /* including trailing '\0' */
+ len = fs_m_in.m_vfs_fs_rename.len_old; /* 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_REN_GRANT_OLD,
+ r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_rename.grant_old,
(vir_bytes) 0, (vir_bytes) old_name, (size_t) len);
if (r != OK) return r;
NUL(old_name, len, sizeof(old_name));
/* Copy the last component of the new name */
- len = fs_m_in.REQ_REN_LEN_NEW; /* including trailing '\0' */
+ len = fs_m_in.m_vfs_fs_rename.len_new; /* 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_REN_GRANT_NEW,
+ r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_rename.grant_new,
(vir_bytes) 0, (vir_bytes) new_name, (size_t) len);
if (r != OK) return r;
NUL(new_name, len, sizeof(new_name));
/* Get old dir inode */
- if( (old_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_OLD_DIR)) == NULL)
+ if( (old_dirp = get_inode(fs_dev, (pino_t) fs_m_in.m_vfs_fs_rename.dir_old)) == NULL)
return(err_code);
old_ip = advance(old_dirp, old_name, IGN_PERM);
}
/* Get new dir inode */
- if ((new_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL){
+ if ((new_dirp = get_inode(fs_dev, (pino_t) fs_m_in.m_vfs_fs_rename.dir_new)) == NULL){
put_inode(old_ip);
put_inode(old_dirp);
return(err_code);
phys_bytes len;
/* Copy the last component of the old name */
- len = min( (unsigned) fs_m_in.REQ_REN_LEN_OLD, sizeof(old_name));
- r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_OLD,
+ len = min( (unsigned) fs_m_in.m_vfs_fs_rename.len_old, sizeof(old_name));
+ r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_rename.grant_old,
(vir_bytes) 0, (vir_bytes) old_name, (size_t) len);
if (r != OK) return r;
NUL(old_name, len, sizeof(old_name));
/* Copy the last component of the new name */
- len = min( (unsigned) fs_m_in.REQ_REN_LEN_NEW, sizeof(new_name));
- r = sys_safecopyfrom(VFS_PROC_NR, (cp_grant_id_t) fs_m_in.REQ_REN_GRANT_NEW,
+ len = min( (unsigned) fs_m_in.m_vfs_fs_rename.len_new, sizeof(new_name));
+ r = sys_safecopyfrom(VFS_PROC_NR, fs_m_in.m_vfs_fs_rename.grant_new,
(vir_bytes) 0, (vir_bytes) new_name, (size_t) len);
if (r != OK) return r;
NUL(new_name, len, sizeof(new_name));
/* Get old dir inode */
- if ((old_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_OLD_DIR)) == NULL)
+ if ((old_dirp = get_inode(fs_dev, fs_m_in.m_vfs_fs_rename.dir_old)) == NULL)
return(err_code);
old_ip = advance(old_dirp, old_name, IGN_PERM);
}
/* Get new dir inode */
- if ((new_dirp = get_inode(fs_dev, (pino_t) fs_m_in.REQ_REN_NEW_DIR)) == NULL){
+ if ((new_dirp = get_inode(fs_dev, (pino_t) fs_m_in.m_vfs_fs_rename.dir_new)) == NULL){
put_inode(old_ip);
put_inode(old_dirp);
return(err_code);
/* Fill in request message */
m.m_type = REQ_RENAME;
- m.REQ_REN_OLD_DIR = (pino_t) old_dir;
- m.REQ_REN_NEW_DIR = (pino_t) new_dir;
- m.REQ_REN_GRANT_OLD = gid_old;
- m.REQ_REN_LEN_OLD = len_old;
- m.REQ_REN_GRANT_NEW = gid_new;
- m.REQ_REN_LEN_NEW = len_new;
+ m.m_vfs_fs_rename.dir_old = old_dir;
+ m.m_vfs_fs_rename.grant_old = gid_old;
+ m.m_vfs_fs_rename.len_old = len_old;
+
+ m.m_vfs_fs_rename.dir_new = new_dir;
+ m.m_vfs_fs_rename.grant_new = gid_new;
+ m.m_vfs_fs_rename.len_new = len_new;
/* Send/rec request */
r = fs_sendrec(fs_e, &m);