#define NR_VFS_CALLS 49 /* highest number from base plus one */
-/* Field names for the open(2), chdir(2), chmod(2), chroot(2), rmdir(2), and
- * unlink(2) calls.
- */
-#define VFS_PATH_NAME m3_p1 /* const char * */
-#define VFS_PATH_LEN m3_i1 /* size_t */
-#define VFS_PATH_FLAGS m3_i2 /* int */
-#define VFS_PATH_MODE m3_i2 /* mode_t */
-#define VFS_PATH_BUF m3_ca1 /* char[M3_STRING] */
-
/* Field names for the creat(2) call. */
#define VFS_CREAT_NAME m1_p1 /* const char * */
#define VFS_CREAT_LEN m1_i1 /* size_t */
#define M1 1
#define M3 3
#define M4 4
-#define M3_STRING 44 /* legacy m3_ca1 size (must not be changed) */
-#define M3_LONG_STRING 44 /* current m3_ca1 size (may be increased) */
+#define M_PATH_STRING_MAX 40
typedef struct {
uint8_t data[56];
typedef struct {
int m3i1, m3i2;
char *m3p1;
- char m3ca1[M3_LONG_STRING];
+ char m3ca1[44];
} mess_3;
_ASSERT_MSG_SIZE(mess_3);
} mess_lc_vfs_mount;
_ASSERT_MSG_SIZE(mess_lc_vfs_mount);
+typedef struct {
+ vir_bytes name;
+ size_t len;
+ int flags;
+ mode_t mode;
+ char buf[M_PATH_STRING_MAX];
+} mess_lc_vfs_path;
+_ASSERT_MSG_SIZE(mess_lc_vfs_path);
+
typedef struct {
int fd0;
int fd1;
mess_lc_vfs_lseek m_lc_vfs_lseek;
mess_lc_vfs_mknod m_lc_vfs_mknod;
mess_lc_vfs_mount m_lc_vfs_mount;
+ mess_lc_vfs_path m_lc_vfs_path;
mess_lc_vfs_pipe2 m_lc_vfs_pipe2;
mess_lc_vfs_readlink m_lc_vfs_readlink;
mess_lc_vfs_select m_lc_vfs_select;
message m;
memset(&m, 0, sizeof(m));
- m.VFS_PATH_MODE = mode;
+ m.m_lc_vfs_path.mode = mode;
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, VFS_ACCESS, &m));
}
message m;
memset(&m, 0, sizeof(m));
- m.VFS_PATH_MODE = mode;
+ m.m_lc_vfs_path.mode = mode;
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, VFS_CHMOD, &m));
}
register size_t k;
k = strlen(name) + 1;
- msgptr->VFS_PATH_LEN = k;
- msgptr->VFS_PATH_NAME = (char *) __UNCONST(name);
- if (k <= M3_STRING) strcpy(msgptr->VFS_PATH_BUF, name);
+ msgptr->m_lc_vfs_path.len = k;
+ msgptr->m_lc_vfs_path.name = (vir_bytes)name;
+ if (k <= M_PATH_STRING_MAX) strcpy(msgptr->m_lc_vfs_path.buf, name);
}
message m;
memset(&m, 0, sizeof(m));
- m.VFS_PATH_MODE = mode;
+ m.m_lc_vfs_path.mode = mode;
_loadname(name, &m);
return(_syscall(VFS_PROC_NR, VFS_MKDIR, &m));
}
call = VFS_CREAT;
} else {
_loadname(name, &m);
- m.VFS_PATH_FLAGS = flags;
+ m.m_lc_vfs_path.flags = flags;
call = VFS_OPEN;
}
va_end(argp);
msg.m_type = USB_RQ_INIT;
- strncpy(msg.USB_RB_INIT_NAME, name, M3_LONG_STRING);
+ strncpy(msg.USB_RB_INIT_NAME, name, M_PATH_STRING_MAX);
res = ipc_sendrec(hcd_ep, &msg);
#define LABEL_MAX 16 /* maximum label size (including '\0'). Should
* not be smaller than 16 or bigger than
- * M3_LONG_STRING.
+ * M_PATH_STRING_MAX.
*/
#define FSTYPE_MAX VFS_NAMELEN /* maximum file system type size */
int open_flags;
char fullpath[PATH_MAX];
- open_flags = job_m_in.VFS_PATH_FLAGS;
+ open_flags = job_m_in.m_lc_vfs_path.flags;
if (open_flags & O_CREAT)
return EINVAL;
if (copy_path(fullpath, sizeof(fullpath)) != OK)
return(err_code);
- dirmode = (mode_t) job_m_in.VFS_PATH_MODE;
+ dirmode = job_m_in.m_lc_vfs_path.mode;
lookup_init(&resolve, fullpath, PATH_NOFLAGS, &vmp, &vp);
resolve.l_vmnt_lock = VMNT_WRITE;
resolve.l_vnode_lock = VNODE_WRITE;
if (job_call_nr == VFS_CHMOD) {
- new_mode = job_m_in.VFS_PATH_MODE;
+ new_mode = job_m_in.m_lc_vfs_path.mode;
/* Temporarily open the file */
if (copy_path(fullpath, sizeof(fullpath)) != OK)
return(err_code);
struct lookup resolve;
mode_t access;
- access = job_m_in.VFS_PATH_MODE;
+ access = job_m_in.m_lc_vfs_path.mode;
lookup_init(&resolve, fullpath, PATH_NOFLAGS, &vmp, &vp);
resolve.l_vmnt_lock = VMNT_READ;
assert(size >= PATH_MAX);
- name = (vir_bytes) job_m_in.VFS_PATH_NAME;
- len = job_m_in.VFS_PATH_LEN;
+ name = job_m_in.m_lc_vfs_path.name;
+ len = job_m_in.m_lc_vfs_path.len;
if (len > size) { /* 'len' includes terminating-nul */
err_code = ENAMETOOLONG;
}
/* Is the string contained in the message? If not, perform a normal copy. */
- if (len > M3_STRING)
+ if (len > M_PATH_STRING_MAX)
return fetch_name(name, len, dest);
/* Just copy the path from the message */
- strncpy(dest, job_m_in.VFS_PATH_BUF, len);
+ strncpy(dest, job_m_in.m_lc_vfs_path.buf, len);
if (dest[len - 1] != '\0') {
err_code = ENAMETOOLONG;