mkfs, mkproto: minor improvements
[minix.git] / servers / mfs / time.c
blob48af75d03061b593790119baff61464aa3fab000
1 #include "fs.h"
2 #include "inode.h"
3 #include <minix/vfsif.h>
6 /*===========================================================================*
7 * fs_utime *
8 *===========================================================================*/
9 int fs_utime()
11 register struct inode *rip;
12 register int r;
14 /* Temporarily open the file. */
15 if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
16 return(EINVAL);
18 /* Only the owner of a file or the super_user can change its time. */
19 r = OK;
20 if(read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */
21 if(r == OK) {
22 rip->i_atime = fs_m_in.REQ_ACTIME;
23 rip->i_mtime = fs_m_in.REQ_MODTIME;
24 rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */
25 IN_MARKDIRTY(rip);
28 put_inode(rip);
29 return(r);