Message type for VFS_LSEEK

Change-Id: I592284078572e4abf2b181d3b4e8281c9baf8a7b
This commit is contained in:
Lionel Sambuc 2014-05-12 13:16:40 +02:00
parent 9ceebd7a4b
commit 268d670a85
4 changed files with 27 additions and 12 deletions

View file

@ -232,11 +232,6 @@
#define NR_VFS_CALLS 49 /* highest number from base plus one */
/* Field names for the lseek(2) call. */
#define VFS_LSEEK_FD m2_i1 /* int */
#define VFS_LSEEK_OFF m2_ll1 /* off_t */
#define VFS_LSEEK_WHENCE m2_i2 /* int */
/* Field names for the truncate(2) and ftruncate(2) calls. */
#define VFS_TRUNCATE_FD m2_i1 /* int */
#define VFS_TRUNCATE_NAME m2_p1 /* const char * */

View file

@ -171,6 +171,23 @@ typedef struct {
} mess_lc_vfs_ioctl;
_ASSERT_MSG_SIZE(mess_lc_vfs_ioctl);
typedef struct {
off_t offset;
int fd;
int whence;
uint8_t padding[40];
} mess_lc_vfs_lseek;
_ASSERT_MSG_SIZE(mess_lc_vfs_lseek);
typedef struct {
off_t offset;
uint8_t padding[48];
} mess_vfs_lc_lseek;
_ASSERT_MSG_SIZE(mess_vfs_lc_lseek);
typedef struct {
int flags;
size_t devlen;
@ -699,6 +716,7 @@ typedef struct {
mess_lc_vfs_fsync m_lc_vfs_fsync;
mess_lc_vfs_getvfsstat m_lc_vfs_getvfsstat;
mess_lc_vfs_ioctl m_lc_vfs_ioctl;
mess_lc_vfs_lseek m_lc_vfs_lseek;
mess_lc_vfs_mount m_lc_vfs_mount;
mess_lc_vfs_select m_lc_vfs_select;
mess_lc_vfs_statvfs1 m_lc_vfs_statvfs1;
@ -734,6 +752,8 @@ typedef struct {
mess_vfs_fs_unlink m_vfs_fs_unlink;
mess_vfs_fs_utime m_vfs_fs_utime;
mess_vfs_lc_lseek m_vfs_lc_lseek;
mess_vfs_utimens m_vfs_utimens;
mess_vm_vfs_mmap m_vm_vfs_mmap;
mess_vmmcp m_vmmcp;

View file

@ -16,9 +16,9 @@ lseek(int fd, off_t offset, int whence)
message m;
memset(&m, 0, sizeof(m));
m.VFS_LSEEK_FD = fd;
m.VFS_LSEEK_OFF = offset;
m.VFS_LSEEK_WHENCE = whence;
m.m_lc_vfs_lseek.fd = fd;
m.m_lc_vfs_lseek.offset = offset;
m.m_lc_vfs_lseek.whence = whence;
if (_syscall(VFS_PROC_NR, VFS_LSEEK, &m) < 0) return( (off_t) -1);
return( (off_t) m.VFS_LSEEK_OFF);
return(m.m_vfs_lc_lseek.offset);
}

View file

@ -646,13 +646,13 @@ int do_lseek(void)
off_t newpos;
int r;
if ((r = actual_lseek(fp, job_m_in.VFS_LSEEK_FD,
job_m_in.VFS_LSEEK_WHENCE, job_m_in.VFS_LSEEK_OFF,
if ((r = actual_lseek(fp, job_m_in.m_lc_vfs_lseek.fd,
job_m_in.m_lc_vfs_lseek.whence, job_m_in.m_lc_vfs_lseek.offset,
&newpos)) != OK)
return r;
/* insert the new position into the output message */
job_m_out.VFS_LSEEK_OFF = newpos;
job_m_out.m_vfs_lc_lseek.offset = newpos;
return OK;
}