panic() cleanup.
[minix.git] / servers / mfs / time.c
blob7feb193b7d0032a32f2c7224d3b93c8d0305df82
1 #include "fs.h"
2 #include <minix/callnr.h>
3 #include <minix/com.h>
4 #include "inode.h"
5 #include <minix/vfsif.h>
8 /*===========================================================================*
9 * fs_utime *
10 *===========================================================================*/
11 PUBLIC int fs_utime()
13 register struct inode *rip;
14 register int r;
16 /* Temporarily open the file. */
17 if( (rip = get_inode(fs_dev, fs_m_in.REQ_INODE_NR)) == NIL_INODE)
18 return(EINVAL);
20 /* Only the owner of a file or the super_user can change its time. */
21 r = OK;
22 if(read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */
23 if(r == OK) {
24 rip->i_atime = fs_m_in.REQ_ACTIME;
25 rip->i_mtime = fs_m_in.REQ_MODTIME;
26 rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */
27 rip->i_dirt = DIRTY;
30 put_inode(rip);
31 return(r);