Fixes to allow versionless packages on cd
[minix3.git] / lib / libpuffs / time.c
blob26b1b3cc0a28b91d12188e1597b1edd3960ac4b3
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 PUBLIC int fs_utime()
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.REQ_INODE_NR)) == NULL)
30 return(EINVAL);
32 puffs_vattr_null(&va);
33 va.va_atime.tv_nsec = va.va_mtime.tv_nsec = va.va_ctime.tv_nsec = 0;
34 va.va_atime.tv_sec = fs_m_in.REQ_ACTIME;
35 va.va_mtime.tv_sec = fs_m_in.REQ_MODTIME;
36 va.va_ctime.tv_sec = clock_time();
38 if (global_pu->pu_ops.puffs_node_setattr(global_pu, pn, &va, pcr) != 0)
39 return(EINVAL);
41 return(OK);