xref: /minix/minix/lib/libpuffs/time.c (revision 9f988b79)
1 /* Created (MFS based):
2  *   February 2010 (Evgeniy Ivanov)
3  */
4 
5 #include "fs.h"
6 
7 
8 /*===========================================================================*
9  *				fs_utime				     *
10  *===========================================================================*/
11 int fs_utime(ino_t ino_nr, struct timespec *atime, struct timespec *mtime)
12 {
13   struct puffs_node *pn;
14   struct vattr va;
15   PUFFS_MAKECRED(pcr, &global_kcred);
16 
17   if (global_pu->pu_ops.puffs_node_setattr == NULL)
18 	return(EINVAL);
19 
20   if( (pn = puffs_pn_nodewalk(global_pu, find_inode_cb, &ino_nr)) == NULL)
21         return(EINVAL);
22 
23   puffs_vattr_null(&va);
24   va.va_atime = *atime;
25   va.va_mtime = *mtime;
26   (void)clock_time(&va.va_ctime);
27 
28   if (global_pu->pu_ops.puffs_node_setattr(global_pu, pn, &va, pcr) != 0)
29 	return(EINVAL);
30 
31   return(OK);
32 }
33