custom message type for VM_INFO
[minix3.git] / lib / libpuffs / time.c
blobe752036f9b6d7e3b40f896a6ec37c297b1d69e2e
1 /* Created (MFS based):
2 * February 2010 (Evgeniy Ivanov)
3 */
5 #include "fs.h"
6 #include <minix/callnr.h>
7 #include <minix/com.h>
8 #include <minix/vfsif.h>
10 #include "puffs.h"
11 #include "puffs_priv.h"
14 /*===========================================================================*
15 * fs_utime *
16 *===========================================================================*/
17 int fs_utime(void)
19 struct puffs_node *pn;
20 struct vattr va;
21 PUFFS_MAKECRED(pcr, &global_kcred);
23 if (is_readonly_fs)
24 return(EROFS);
26 if (global_pu->pu_ops.puffs_node_setattr == NULL)
27 return(EINVAL);
29 if( (pn = puffs_pn_nodewalk(global_pu, 0, &fs_m_in.m_vfs_fs_utime.inode)) == NULL)
30 return(EINVAL);
32 puffs_vattr_null(&va);
33 va.va_atime.tv_sec = fs_m_in.m_vfs_fs_utime.actime;
34 va.va_atime.tv_nsec = fs_m_in.m_vfs_fs_utime.acnsec;
35 va.va_mtime.tv_sec = fs_m_in.m_vfs_fs_utime.modtime;
36 va.va_mtime.tv_nsec = fs_m_in.m_vfs_fs_utime.modnsec;
37 va.va_ctime = clock_timespec();
39 if (global_pu->pu_ops.puffs_node_setattr(global_pu, pn, &va, pcr) != 0)
40 return(EINVAL);
42 return(OK);