VFS: start off cleanup of pipe2 IPC message
There is no reason to use a single message for nonoverlapping requests and replies combined, and in fact splitting them out allows reuse of messages and avoids various problems with field layouts. Since the upcoming socketpair(2) system call will be using the same reply as pipe2(2), split up the single message used for the latter. In order to keep the used parts of messages at the front, start a transitional phase to move the pipe(2) flags field to the front of its request. Change-Id: If3f1c3d348ec7e27b7f5b7147ce1b9ef490dfab9
This commit is contained in:
parent
17580212b4
commit
c33d6ef392
@ -760,9 +760,14 @@ typedef struct {
|
|||||||
_ASSERT_MSG_SIZE(mess_lc_vfs_path);
|
_ASSERT_MSG_SIZE(mess_lc_vfs_path);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int fd0;
|
/*
|
||||||
int fd1;
|
* We are in the process of cleaning up this message, by moving the
|
||||||
|
* flags value from the third integer into the first. Once enough time
|
||||||
|
* has passed, we can get rid of the second and third integer fields.
|
||||||
|
*/
|
||||||
int flags;
|
int flags;
|
||||||
|
int _unused;
|
||||||
|
int oflags;
|
||||||
|
|
||||||
uint8_t padding[44];
|
uint8_t padding[44];
|
||||||
} mess_lc_vfs_pipe2;
|
} mess_lc_vfs_pipe2;
|
||||||
@ -1949,6 +1954,14 @@ typedef struct {
|
|||||||
} mess_vfs_fs_utime;
|
} mess_vfs_fs_utime;
|
||||||
_ASSERT_MSG_SIZE(mess_vfs_fs_utime);
|
_ASSERT_MSG_SIZE(mess_vfs_fs_utime);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int fd0;
|
||||||
|
int fd1;
|
||||||
|
|
||||||
|
uint8_t padding[48];
|
||||||
|
} mess_vfs_lc_fdpair;
|
||||||
|
_ASSERT_MSG_SIZE(mess_vfs_lc_fdpair);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
off_t offset;
|
off_t offset;
|
||||||
|
|
||||||
@ -2262,6 +2275,7 @@ typedef struct noxfer_message {
|
|||||||
mess_vfs_fs_statvfs m_vfs_fs_statvfs;
|
mess_vfs_fs_statvfs m_vfs_fs_statvfs;
|
||||||
mess_vfs_fs_unlink m_vfs_fs_unlink;
|
mess_vfs_fs_unlink m_vfs_fs_unlink;
|
||||||
mess_vfs_fs_utime m_vfs_fs_utime;
|
mess_vfs_fs_utime m_vfs_fs_utime;
|
||||||
|
mess_vfs_lc_fdpair m_vfs_lc_fdpair;
|
||||||
mess_vfs_lc_lseek m_vfs_lc_lseek;
|
mess_vfs_lc_lseek m_vfs_lc_lseek;
|
||||||
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;
|
mess_vfs_lchardriver_cancel m_vfs_lchardriver_cancel;
|
||||||
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
|
mess_vfs_lchardriver_openclose m_vfs_lchardriver_openclose;
|
||||||
|
@ -16,10 +16,11 @@ pipe2(int fild[2], int flags)
|
|||||||
|
|
||||||
memset(&m, 0, sizeof(m));
|
memset(&m, 0, sizeof(m));
|
||||||
m.m_lc_vfs_pipe2.flags = flags;
|
m.m_lc_vfs_pipe2.flags = flags;
|
||||||
|
m.m_lc_vfs_pipe2.oflags = flags; /* backward compatibility */
|
||||||
|
|
||||||
if (_syscall(VFS_PROC_NR, VFS_PIPE2, &m) < 0) return(-1);
|
if (_syscall(VFS_PROC_NR, VFS_PIPE2, &m) < 0) return(-1);
|
||||||
fild[0] = m.m_lc_vfs_pipe2.fd0;
|
fild[0] = m.m_vfs_lc_fdpair.fd0;
|
||||||
fild[1] = m.m_lc_vfs_pipe2.fd1;
|
fild[1] = m.m_vfs_lc_fdpair.fd1;
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,11 +43,12 @@ int do_pipe2(void)
|
|||||||
int fil_des[2]; /* reply goes here */
|
int fil_des[2]; /* reply goes here */
|
||||||
|
|
||||||
flags = job_m_in.m_lc_vfs_pipe2.flags;
|
flags = job_m_in.m_lc_vfs_pipe2.flags;
|
||||||
|
flags |= job_m_in.m_lc_vfs_pipe2.oflags; /* backward compatibility */
|
||||||
|
|
||||||
r = create_pipe(fil_des, flags);
|
r = create_pipe(fil_des, flags);
|
||||||
if (r == OK) {
|
if (r == OK) {
|
||||||
job_m_out.m_lc_vfs_pipe2.fd0 = fil_des[0];
|
job_m_out.m_vfs_lc_fdpair.fd0 = fil_des[0];
|
||||||
job_m_out.m_lc_vfs_pipe2.fd1 = fil_des[1];
|
job_m_out.m_vfs_lc_fdpair.fd1 = fil_des[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -678,8 +678,8 @@ vfs_pipe2_in(struct trace_proc * proc, const message * m_out,
|
|||||||
|
|
||||||
if (!failed) {
|
if (!failed) {
|
||||||
put_open(proc, "fd", PF_NONAME, "[", ", ");
|
put_open(proc, "fd", PF_NONAME, "[", ", ");
|
||||||
put_fd(proc, "rfd", m_in->m_lc_vfs_pipe2.fd0);
|
put_fd(proc, "rfd", m_in->m_vfs_lc_fdpair.fd0);
|
||||||
put_fd(proc, "wfd", m_in->m_lc_vfs_pipe2.fd1);
|
put_fd(proc, "wfd", m_in->m_vfs_lc_fdpair.fd1);
|
||||||
put_close(proc, "]");
|
put_close(proc, "]");
|
||||||
} else
|
} else
|
||||||
put_field(proc, "fd", "&..");
|
put_field(proc, "fd", "&..");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user