minix/servers/mfs/time.c
Thomas Veerman 6bbcab3ec4 Clean up MFS a bit:
- Remove unused includes.
 - Add include guards to headers.
 - Use unsigned variables in case they're never going to hold a negative
   value. This causes GCC's complaints to disappear and should make flexelint
   a lot happier, too.
 - Make functions private when they're used only within a module.
 - Remove unused variables.
 - Add casts where appropriate.
2010-06-01 12:35:33 +00:00

32 lines
835 B
C

#include "fs.h"
#include "inode.h"
#include <minix/vfsif.h>
/*===========================================================================*
* fs_utime *
*===========================================================================*/
PUBLIC int fs_utime()
{
register struct inode *rip;
register int r;
/* Temporarily open the file. */
if( (rip = get_inode(fs_dev, (ino_t) fs_m_in.REQ_INODE_NR)) == NULL)
return(EINVAL);
/* Only the owner of a file or the super_user can change its time. */
r = OK;
if(read_only(rip) != OK) r = EROFS; /* not even su can touch if R/O */
if(r == OK) {
rip->i_atime = fs_m_in.REQ_ACTIME;
rip->i_mtime = fs_m_in.REQ_MODTIME;
rip->i_update = CTIME; /* discard any stale ATIME and MTIME flags */
rip->i_dirt = DIRTY;
}
put_inode(rip);
return(r);
}