|
AquilaOS documentation
How it works, and its code
|
Changing a vnode's attributes: its mode (chmod()), its owner (chown()) and its times (utimensat()). More...
Go to the source code of this file.
Functions | |
| static int | store (struct vnode *vnode, struct vnode *saved) |
| Has the filesystem store a vnode's new attributes, and restores the old ones (saved) if it can't. | |
| int | vfs_chmod (struct vnode *vnode, mode_t mode, struct uio *uio) |
| Changes a vnode's permission bits. | |
| int | vfs_chown (struct vnode *vnode, uid_t uid, gid_t gid, struct uio *uio) |
| Changes a vnode's owner and group. | |
| static void | set_time (_time_t *time, const struct aquila_timespec *ts, struct timespec *now) |
| Sets one time as utimensat() asks: to now for UTIME_NOW (or no time given), unchanged for UTIME_OMIT, to the time given otherwise. | |
| int | vfs_utimens (struct vnode *vnode, const struct aquila_timespec times[2], struct uio *uio) |
| Changes a vnode's access and modification times, for utimensat(). | |
Changing a vnode's attributes: its mode (chmod()), its owner (chown()) and its times (utimensat()).
The vnode is changed in memory first, then the filesystem stores it (vops.setattr); if that fails, the vnode is restored as it was.
Definition in file attr.c.
Sets one time as utimensat() asks: to now for UTIME_NOW (or no time given), unchanged for UTIME_OMIT, to the time given otherwise.
Definition at line 97 of file attr.c.
References set_time(), timespec::tv_nsec, and timespec::tv_sec.
Referenced by set_time(), and vfs_utimens().
Has the filesystem store a vnode's new attributes, and restores the old ones (saved) if it can't.
Returns 0 or the filesystem's error.
Definition at line 14 of file attr.c.
References vnode::atime, vnode::ctime, vnode::gid, vnode::mode, vnode::mtime, store(), vnode::uid, and vfs_setattr().
Referenced by store(), vfs_chmod(), vfs_chown(), and vfs_utimens().
Changes a vnode's permission bits.
Only its owner, or root, may do it.
| vnode | the vnode |
| mode | the new permissions (the file type is kept) |
| uio | who is asking |
Definition at line 38 of file attr.c.
References vnode::ctime, gettime(), uio::gid, vnode::gid, vnode::mode, store(), uio::uid, vnode::uid, and vfs_chmod().
Referenced by do_fchmodat(), sys_fchmod(), and vfs_chmod().
Changes a vnode's owner and group.
Root may change both; a file's owner may only change its group, to their own group.
| vnode | the vnode |
| uid | the new owner, or (uid_t) -1 to keep it |
| gid | the new group, or (gid_t) -1 to keep it |
| uio | who is asking |
Definition at line 68 of file attr.c.
References vnode::ctime, gettime(), uio::gid, vnode::gid, vnode::mode, store(), uio::uid, vnode::uid, and vfs_chown().
Referenced by do_fchownat(), sys_fchown(), and vfs_chown().
Changes a vnode's access and modification times, for utimensat().
Setting them to the current time needs ownership or write permission; setting them to other times needs ownership.
| vnode | the vnode |
| times | the access and modification times (each may be UTIME_NOW or UTIME_OMIT), or NULL for now |
| uio | who is asking |
Definition at line 124 of file attr.c.
References vnode::atime, vnode::ctime, gettime(), vnode::mtime, NULL, set_time(), store(), uio::uid, vnode::uid, vfs_access(), vfs_utimens(), and VFS_W.
Referenced by sys_utimensat(), and vfs_utimens().