Message types for VFS utime
Change-Id: If7e5faa13a824528fd8ca02bd6982e04d48032e9
This commit is contained in:
parent
135346dfc3
commit
cadcb6d061
6 changed files with 52 additions and 40 deletions
|
@ -291,6 +291,18 @@ typedef struct {
|
||||||
} mess_vfs_fs_rename;
|
} mess_vfs_fs_rename;
|
||||||
_ASSERT_MSG_SIZE(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 {
|
typedef struct {
|
||||||
time_t atime;
|
time_t atime;
|
||||||
time_t mtime;
|
time_t mtime;
|
||||||
|
@ -372,6 +384,7 @@ typedef struct {
|
||||||
mess_vfs_fs_readsuper m_vfs_fs_readsuper;
|
mess_vfs_fs_readsuper m_vfs_fs_readsuper;
|
||||||
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
|
mess_fs_vfs_readsuper m_fs_vfs_readsuper;
|
||||||
mess_vfs_fs_rename m_vfs_fs_rename;
|
mess_vfs_fs_rename m_vfs_fs_rename;
|
||||||
|
mess_vfs_fs_utime m_vfs_fs_utime;
|
||||||
mess_vfs_utimens m_vfs_utimens;
|
mess_vfs_utimens m_vfs_utimens;
|
||||||
mess_vm_vfs_mmap m_vm_vfs_mmap;
|
mess_vm_vfs_mmap m_vm_vfs_mmap;
|
||||||
mess_vmmcp m_vmmcp;
|
mess_vmmcp m_vmmcp;
|
||||||
|
|
|
@ -26,14 +26,14 @@ int fs_utime(void)
|
||||||
if (global_pu->pu_ops.puffs_node_setattr == NULL)
|
if (global_pu->pu_ops.puffs_node_setattr == NULL)
|
||||||
return(EINVAL);
|
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);
|
return(EINVAL);
|
||||||
|
|
||||||
puffs_vattr_null(&va);
|
puffs_vattr_null(&va);
|
||||||
va.va_atime.tv_sec = fs_m_in.REQ_ACTIME;
|
va.va_atime.tv_sec = fs_m_in.m_vfs_fs_utime.actime;
|
||||||
va.va_atime.tv_nsec = fs_m_in.REQ_ACNSEC;
|
va.va_atime.tv_nsec = fs_m_in.m_vfs_fs_utime.acnsec;
|
||||||
va.va_mtime.tv_sec = fs_m_in.REQ_MODTIME;
|
va.va_mtime.tv_sec = fs_m_in.m_vfs_fs_utime.modtime;
|
||||||
va.va_mtime.tv_nsec = fs_m_in.REQ_MODNSEC;
|
va.va_mtime.tv_nsec = fs_m_in.m_vfs_fs_utime.modnsec;
|
||||||
va.va_ctime = clock_timespec();
|
va.va_ctime = clock_timespec();
|
||||||
|
|
||||||
if (global_pu->pu_ops.puffs_node_setattr(global_pu, pn, &va, pcr) != 0)
|
if (global_pu->pu_ops.puffs_node_setattr(global_pu, pn, &va, pcr) != 0)
|
||||||
|
|
|
@ -147,7 +147,7 @@ int do_utime(void)
|
||||||
if (state.s_read_only)
|
if (state.s_read_only)
|
||||||
return EROFS;
|
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;
|
return EINVAL;
|
||||||
|
|
||||||
if ((r = verify_inode(ino, path, NULL)) != OK)
|
if ((r = verify_inode(ino, path, NULL)) != OK)
|
||||||
|
@ -155,35 +155,35 @@ int do_utime(void)
|
||||||
|
|
||||||
attr.a_mask = 0;
|
attr.a_mask = 0;
|
||||||
|
|
||||||
switch(m_in.REQ_ACNSEC) {
|
switch(m_in.m_vfs_fs_utime.acnsec) {
|
||||||
case UTIME_OMIT: /* do not touch */
|
case UTIME_OMIT: /* do not touch */
|
||||||
break;
|
break;
|
||||||
case UTIME_NOW:
|
case UTIME_NOW:
|
||||||
/* XXX VFS should have time() into ACTIME, for compat; we trust it! */
|
/* 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*/
|
/*FALLTHROUGH*/
|
||||||
default:
|
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
|
* are caught by VFS to cooperate with old instances of EXT2
|
||||||
*/
|
*/
|
||||||
attr.a_atime.tv_sec = m_in.REQ_ACTIME;
|
attr.a_atime.tv_sec = m_in.m_vfs_fs_utime.actime;
|
||||||
attr.a_atime.tv_nsec = m_in.REQ_ACNSEC;
|
attr.a_atime.tv_nsec = m_in.m_vfs_fs_utime.acnsec;
|
||||||
attr.a_mask |= SFFS_ATTR_ATIME;
|
attr.a_mask |= SFFS_ATTR_ATIME;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch(m_in.REQ_MODNSEC) {
|
switch(m_in.m_vfs_fs_utime.modnsec) {
|
||||||
case UTIME_OMIT: /* do not touch */
|
case UTIME_OMIT: /* do not touch */
|
||||||
break;
|
break;
|
||||||
case UTIME_NOW:
|
case UTIME_NOW:
|
||||||
/* XXX VFS should have time() into MODTIME, for compat; we trust it! */
|
/* 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*/
|
/*FALLTHROUGH*/
|
||||||
default:
|
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
|
* are caught by VFS to cooperate with old instances
|
||||||
*/
|
*/
|
||||||
attr.a_mtime.tv_sec = m_in.REQ_MODTIME;
|
attr.a_mtime.tv_sec = m_in.m_vfs_fs_utime.modtime;
|
||||||
attr.a_mtime.tv_nsec = m_in.REQ_MODNSEC;
|
attr.a_mtime.tv_nsec = m_in.m_vfs_fs_utime.modnsec;
|
||||||
attr.a_mask |= SFFS_ATTR_MTIME;
|
attr.a_mask |= SFFS_ATTR_MTIME;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ int fs_utime()
|
||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* 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);
|
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(read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */
|
||||||
if(r == OK) {
|
if(r == OK) {
|
||||||
rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */
|
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:
|
case UTIME_NOW:
|
||||||
rip->i_update |= ATIME;
|
rip->i_update |= ATIME;
|
||||||
break;
|
break;
|
||||||
|
@ -39,18 +39,18 @@ int fs_utime()
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
* 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,
|
* Ext2FS does not support better than second resolution,
|
||||||
* so we discard REQ_ACNSEC to round down
|
* so we discard ACNSEC to round down
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(fs_m_in.REQ_MODNSEC) {
|
switch(fs_m_in.m_vfs_fs_utime.modnsec) {
|
||||||
case UTIME_NOW:
|
case UTIME_NOW:
|
||||||
rip->i_update |= MTIME;
|
rip->i_update |= MTIME;
|
||||||
break;
|
break;
|
||||||
|
@ -58,13 +58,13 @@ int fs_utime()
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
* 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,
|
* Ext2FS does not support better than second resolution,
|
||||||
* so we discard REQ_MODNSEC to round down
|
* so we discard MODNSEC to round down
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ int fs_utime()
|
||||||
register int r;
|
register int r;
|
||||||
|
|
||||||
/* Temporarily open the file. */
|
/* 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);
|
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(read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */
|
||||||
if(r == OK) {
|
if(r == OK) {
|
||||||
rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */
|
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:
|
case UTIME_NOW:
|
||||||
rip->i_update |= ATIME;
|
rip->i_update |= ATIME;
|
||||||
break;
|
break;
|
||||||
|
@ -33,18 +33,18 @@ int fs_utime()
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
* 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,
|
* MFS does not support better than second resolution,
|
||||||
* so we discard REQ_ACNSEC to round down
|
* so we discard ACNSEC to round down
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(fs_m_in.REQ_MODNSEC) {
|
switch(fs_m_in.m_vfs_fs_utime.modnsec) {
|
||||||
case UTIME_NOW:
|
case UTIME_NOW:
|
||||||
rip->i_update |= MTIME;
|
rip->i_update |= MTIME;
|
||||||
break;
|
break;
|
||||||
|
@ -52,13 +52,13 @@ int fs_utime()
|
||||||
break;
|
break;
|
||||||
default:
|
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
|
* 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,
|
* MFS does not support better than second resolution,
|
||||||
* so we discard REQ_MODNSEC to round down
|
* so we discard MODNSEC to round down
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1202,12 +1202,11 @@ int req_utime(endpoint_t fs_e, ino_t inode_nr, struct timespec * actimespec,
|
||||||
|
|
||||||
/* Fill in request message */
|
/* Fill in request message */
|
||||||
m.m_type = REQ_UTIME;
|
m.m_type = REQ_UTIME;
|
||||||
m.REQ_INODE_NR = (pino_t) inode_nr;
|
m.m_vfs_fs_utime.inode = inode_nr;
|
||||||
m.REQ_INODE_NR = inode_nr;
|
m.m_vfs_fs_utime.actime = actimespec->tv_sec;
|
||||||
m.REQ_ACTIME = actimespec->tv_sec;
|
m.m_vfs_fs_utime.modtime = modtimespec->tv_sec;
|
||||||
m.REQ_MODTIME = modtimespec->tv_sec;
|
m.m_vfs_fs_utime.acnsec = actimespec->tv_nsec;
|
||||||
m.REQ_ACNSEC = actimespec->tv_nsec;
|
m.m_vfs_fs_utime.modnsec = modtimespec->tv_nsec;
|
||||||
m.REQ_MODNSEC = modtimespec->tv_nsec;
|
|
||||||
|
|
||||||
/* Send/rec request */
|
/* Send/rec request */
|
||||||
return fs_sendrec(fs_e, &m);
|
return fs_sendrec(fs_e, &m);
|
||||||
|
|
Loading…
Reference in a new issue