Improve the process for GNU tools
[minix3.git] / minix / fs / mfs / time.c
bloba52b577106aab59cbaad4aba681623325efd548d
1 #include "fs.h"
2 #include "inode.h"
3 #include <sys/time.h>
4 #include <sys/stat.h>
7 /*===========================================================================*
8 * fs_utime *
9 *===========================================================================*/
10 int fs_utime(ino_t ino_nr, struct timespec *atime, struct timespec *mtime)
12 register struct inode *rip;
14 /* Temporarily open the file. */
15 if( (rip = get_inode(fs_dev, ino_nr)) == NULL)
16 return(EINVAL);
18 rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */
20 switch (atime->tv_nsec) {
21 case UTIME_NOW:
22 rip->i_update |= ATIME;
23 break;
24 case UTIME_OMIT: /* do not touch */
25 break;
26 default:
27 /* MFS does not support subsecond resolution, so we round down. */
28 rip->i_atime = atime->tv_sec;
29 break;
32 switch (mtime->tv_nsec) {
33 case UTIME_NOW:
34 rip->i_update |= MTIME;
35 break;
36 case UTIME_OMIT: /* do not touch */
37 break;
38 default:
39 /* MFS does not support subsecond resolution, so we round down. */
40 rip->i_mtime = mtime->tv_sec;
41 break;
44 IN_MARKDIRTY(rip);
46 put_inode(rip);
47 return(OK);