Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / fs / ext2 / time.c
blobfa98f8e9af688f3ff550922f803fa3702dc6c988
1 /* Created (MFS based):
2 * February 2010 (Evgeniy Ivanov)
3 */
5 #include "fs.h"
6 #include "inode.h"
7 #include <sys/time.h>
8 #include <sys/stat.h>
11 /*===========================================================================*
12 * fs_utime *
13 *===========================================================================*/
14 int fs_utime(ino_t ino_nr, struct timespec *atime, struct timespec *mtime)
16 register struct inode *rip;
18 /* Temporarily open the file. */
19 if( (rip = get_inode(fs_dev, ino_nr)) == NULL)
20 return(EINVAL);
22 rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */
24 switch (atime->tv_nsec) {
25 case UTIME_NOW:
26 rip->i_update |= ATIME;
27 break;
28 case UTIME_OMIT: /* do not touch */
29 break;
30 default:
31 /* Ext2FS does not support subsecond resolution, so we round down. */
32 rip->i_atime = atime->tv_sec;
33 break;
36 switch (mtime->tv_nsec) {
37 case UTIME_NOW:
38 rip->i_update |= MTIME;
39 break;
40 case UTIME_OMIT: /* do not touch */
41 break;
42 default:
43 /* Ext2FS does not support subsecond resolution, so we round down. */
44 rip->i_mtime = mtime->tv_sec;
45 break;
48 rip->i_dirt = IN_DIRTY;
50 put_inode(rip);
51 return(OK);