From: Lionel Sambuc Date: Tue, 29 Apr 2014 18:08:54 +0000 (+0200) Subject: Message types for VFS utime X-Git-Tag: v3.3.0~343 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.host.html?a=commitdiff_plain;h=cadcb6d0612e0487bde7a7f92ce3424ff0b1853e;p=minix.git Message types for VFS utime Change-Id: If7e5faa13a824528fd8ca02bd6982e04d48032e9 --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 95dcea1b1..7fc034651 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -291,6 +291,18 @@ typedef struct { } mess_vfs_fs_rename; _ASSERT_MSG_SIZE(mess_vfs_fs_rename); +typedef struct { + ino_t inode; + time_t actime; + time_t modtime; + + uint32_t acnsec; + uint32_t modnsec; + + uint8_t data[24]; +} mess_vfs_fs_utime; +_ASSERT_MSG_SIZE(mess_vfs_fs_utime); + typedef struct { time_t atime; time_t mtime; @@ -372,6 +384,7 @@ typedef struct { 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_fs_utime m_vfs_fs_utime; mess_vfs_utimens m_vfs_utimens; mess_vm_vfs_mmap m_vm_vfs_mmap; mess_vmmcp m_vmmcp; diff --git a/lib/libpuffs/time.c b/lib/libpuffs/time.c index 412bbe11c..e752036f9 100644 --- a/lib/libpuffs/time.c +++ b/lib/libpuffs/time.c @@ -26,14 +26,14 @@ int fs_utime(void) if (global_pu->pu_ops.puffs_node_setattr == NULL) return(EINVAL); - 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_utime.inode)) == NULL) return(EINVAL); puffs_vattr_null(&va); - va.va_atime.tv_sec = fs_m_in.REQ_ACTIME; - va.va_atime.tv_nsec = fs_m_in.REQ_ACNSEC; - va.va_mtime.tv_sec = fs_m_in.REQ_MODTIME; - va.va_mtime.tv_nsec = fs_m_in.REQ_MODNSEC; + va.va_atime.tv_sec = fs_m_in.m_vfs_fs_utime.actime; + va.va_atime.tv_nsec = fs_m_in.m_vfs_fs_utime.acnsec; + va.va_mtime.tv_sec = fs_m_in.m_vfs_fs_utime.modtime; + va.va_mtime.tv_nsec = fs_m_in.m_vfs_fs_utime.modnsec; va.va_ctime = clock_timespec(); if (global_pu->pu_ops.puffs_node_setattr(global_pu, pn, &va, pcr) != 0) diff --git a/lib/libsffs/stat.c b/lib/libsffs/stat.c index c9b830223..2a78860bb 100644 --- a/lib/libsffs/stat.c +++ b/lib/libsffs/stat.c @@ -147,7 +147,7 @@ int do_utime(void) if (state.s_read_only) return EROFS; - if ((ino = find_inode(m_in.REQ_INODE_NR)) == NULL) + if ((ino = find_inode(m_in.m_vfs_fs_utime.inode)) == NULL) return EINVAL; if ((r = verify_inode(ino, path, NULL)) != OK) @@ -155,35 +155,35 @@ int do_utime(void) attr.a_mask = 0; - switch(m_in.REQ_ACNSEC) { + switch(m_in.m_vfs_fs_utime.acnsec) { case UTIME_OMIT: /* do not touch */ break; case UTIME_NOW: /* XXX VFS should have time() into ACTIME, for compat; we trust it! */ - m_in.REQ_ACNSEC = 0; + m_in.m_vfs_fs_utime.acnsec = 0; /*FALLTHROUGH*/ default: - /* cases m_in.REQ_ACNSEC < 0 || m_in.REQ_ACNSEC >= 1E9 + /* cases m_in.m_vfs_fs_utime.acnsec < 0 || m_in.m_vfs_fs_utime.acnsec >= 1E9 * are caught by VFS to cooperate with old instances of EXT2 */ - attr.a_atime.tv_sec = m_in.REQ_ACTIME; - attr.a_atime.tv_nsec = m_in.REQ_ACNSEC; + attr.a_atime.tv_sec = m_in.m_vfs_fs_utime.actime; + attr.a_atime.tv_nsec = m_in.m_vfs_fs_utime.acnsec; attr.a_mask |= SFFS_ATTR_ATIME; break; } - switch(m_in.REQ_MODNSEC) { + switch(m_in.m_vfs_fs_utime.modnsec) { case UTIME_OMIT: /* do not touch */ break; case UTIME_NOW: /* XXX VFS should have time() into MODTIME, for compat; we trust it! */ - m_in.REQ_MODNSEC = 0; + m_in.m_vfs_fs_utime.modnsec = 0; /*FALLTHROUGH*/ default: - /* cases m_in.REQ_MODNSEC < 0 || m_in.REQ_MODNSEC >= 1E9 + /* cases m_in.m_vfs_fs_utime.modnsec < 0 || m_in.m_vfs_fs_utime.modnsec >= 1E9 * are caught by VFS to cooperate with old instances */ - attr.a_mtime.tv_sec = m_in.REQ_MODTIME; - attr.a_mtime.tv_nsec = m_in.REQ_MODNSEC; + attr.a_mtime.tv_sec = m_in.m_vfs_fs_utime.modtime; + attr.a_mtime.tv_nsec = m_in.m_vfs_fs_utime.modnsec; attr.a_mask |= SFFS_ATTR_MTIME; break; } diff --git a/servers/ext2/time.c b/servers/ext2/time.c index 413308155..647bedfb0 100644 --- a/servers/ext2/time.c +++ b/servers/ext2/time.c @@ -19,7 +19,7 @@ int fs_utime() register int r; /* 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_utime.inode)) == NULL) return(EINVAL); /* @@ -31,7 +31,7 @@ int fs_utime() if(read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */ if(r == OK) { rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */ - switch(fs_m_in.REQ_ACNSEC) { + switch(fs_m_in.m_vfs_fs_utime.acnsec) { case UTIME_NOW: rip->i_update |= ATIME; break; @@ -39,18 +39,18 @@ int fs_utime() break; default: /* - * cases fs_m_in.REQ_ACNSEC < 0 || fs_m_in.REQ_ACNSEC >= 1E9 + * cases fs_m_in.m_vfs_fs_utime.acnsec < 0 || fs_m_in.m_vfs_fs_utime.acnsec >= 1E9 * are caught by VFS to cooperate with old instances of EXT2 */ - rip->i_atime = fs_m_in.REQ_ACTIME; + rip->i_atime = fs_m_in.m_vfs_fs_utime.actime; /* * Ext2FS does not support better than second resolution, - * so we discard REQ_ACNSEC to round down + * so we discard ACNSEC to round down */ break; } - switch(fs_m_in.REQ_MODNSEC) { + switch(fs_m_in.m_vfs_fs_utime.modnsec) { case UTIME_NOW: rip->i_update |= MTIME; break; @@ -58,13 +58,13 @@ int fs_utime() break; default: /* - * cases fs_m_in.REQ_MODNSEC < 0 || fs_m_in.REQ_MODNSEC >= 1E9 + * cases fs_m_in.m_vfs_fs_utime.modnsec < 0 || fs_m_in.m_vfs_fs_utime.modnsec >= 1E9 * are caught by VFS to cooperate with old instances of EXT2 */ - rip->i_mtime = fs_m_in.REQ_MODTIME; + rip->i_mtime = fs_m_in.m_vfs_fs_utime.modtime; /* * Ext2FS does not support better than second resolution, - * so we discard REQ_MODNSEC to round down + * so we discard MODNSEC to round down */ break; } diff --git a/servers/mfs/time.c b/servers/mfs/time.c index 4c5b3b91a..d70e4b578 100644 --- a/servers/mfs/time.c +++ b/servers/mfs/time.c @@ -13,7 +13,7 @@ int fs_utime() register int r; /* 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_utime.inode)) == NULL) return(EINVAL); /* @@ -25,7 +25,7 @@ int fs_utime() if(read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */ if(r == OK) { rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */ - switch(fs_m_in.REQ_ACNSEC) { + switch(fs_m_in.m_vfs_fs_utime.acnsec) { case UTIME_NOW: rip->i_update |= ATIME; break; @@ -33,18 +33,18 @@ int fs_utime() break; default: /* - * cases fs_m_in.REQ_ACNSEC < 0 || fs_m_in.REQ_ACNSEC >= 1E9 + * cases fs_m_in.m_vfs_fs_utime.acnsec < 0 || fs_m_in.m_vfs_fs_utime.acnsec >= 1E9 * are caught by VFS to cooperate with old instances of MFS */ - rip->i_atime = fs_m_in.REQ_ACTIME; + rip->i_atime = fs_m_in.m_vfs_fs_utime.actime; /* * MFS does not support better than second resolution, - * so we discard REQ_ACNSEC to round down + * so we discard ACNSEC to round down */ break; } - switch(fs_m_in.REQ_MODNSEC) { + switch(fs_m_in.m_vfs_fs_utime.modnsec) { case UTIME_NOW: rip->i_update |= MTIME; break; @@ -52,13 +52,13 @@ int fs_utime() break; default: /* - * cases fs_m_in.REQ_MODNSEC < 0 || fs_m_in.REQ_MODNSEC >= 1E9 + * cases fs_m_in.m_vfs_fs_utime.modnsec < 0 || fs_m_in.m_vfs_fs_utime.modnsec >= 1E9 * are caught by VFS to cooperate with old instances of MFS */ - rip->i_mtime = fs_m_in.REQ_MODTIME; + rip->i_mtime = fs_m_in.m_vfs_fs_utime.modtime; /* * MFS does not support better than second resolution, - * so we discard REQ_MODNSEC to round down + * so we discard MODNSEC to round down */ break; } diff --git a/servers/vfs/request.c b/servers/vfs/request.c index 23350b9c9..ad3777d8d 100644 --- a/servers/vfs/request.c +++ b/servers/vfs/request.c @@ -1202,12 +1202,11 @@ int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec, /* Fill in request message */ m.m_type = REQ_UTIME; - m.REQ_INODE_NR = (pino_t) inode_nr; - m.REQ_INODE_NR = inode_nr; - m.REQ_ACTIME = actimespec->tv_sec; - m.REQ_MODTIME = modtimespec->tv_sec; - m.REQ_ACNSEC = actimespec->tv_nsec; - m.REQ_MODNSEC = modtimespec->tv_nsec; + m.m_vfs_fs_utime.inode = inode_nr; + m.m_vfs_fs_utime.actime = actimespec->tv_sec; + m.m_vfs_fs_utime.modtime = modtimespec->tv_sec; + m.m_vfs_fs_utime.acnsec = actimespec->tv_nsec; + m.m_vfs_fs_utime.modnsec = modtimespec->tv_nsec; /* Send/rec request */ return fs_sendrec(fs_e, &m);