|
AquilaOS documentation
How it works, and its code
|
Links by path: hard links (link()), symbolic links (symlink(), readlink()), and renaming (rename()). More...
Go to the source code of this file.
Functions | |
| int | vfs_link (const char *oldpath, struct uio *ouio, const char *newpath, struct uio *nuio) |
| Makes a hard link: a new name for an existing file, in the same mounted filesystem. | |
| int | vfs_symlink (const char *target, const char *path, struct uio *uio) |
| Makes a symbolic link. | |
| ssize_t | vfs_readlink (const char *path, struct uio *uio, char *buf, size_t size) |
| Reads what a symbolic link contains. | |
| static int | entry_get (struct vnode *dir, const char *name, struct vnode **ref) |
| Gets the vnode of the entry name of dir, or NULL in *ref if there is none. | |
| int | vfs_rename (const char *oldpath, struct uio *ouio, const char *newpath, struct uio *nuio) |
| Renames a file or a directory, possibly to another directory of the same mounted filesystem. | |
Links by path: hard links (link()), symbolic links (symlink(), readlink()), and renaming (rename()).
Definition in file link.c.
Gets the vnode of the entry name of dir, or NULL in *ref if there is none.
Returns 0 or a negative errno.
Definition at line 127 of file link.c.
References entry_get(), NULL, vfs_finddir(), and vfs_vget().
Referenced by entry_get(), and vfs_rename().
Makes a hard link: a new name for an existing file, in the same mounted filesystem.
Directories can't be linked.
| oldpath | the file's path, followed if it's a symbolic link unless ouio has O_NOFOLLOW |
| ouio | who is asking, and the directory oldpath is relative to |
| newpath | the new name's path |
| nuio | who is asking, and the directory newpath is relative to |
Definition at line 24 of file link.c.
References kfree(), vnode::mode, NULL, vfs_access(), vfs_close(), vfs_link(), vfs_lookup_dir(), vfs_lookup_parent(), vfs_mount_root_of(), vfs_vlink(), VFS_W, and VFS_X.
Referenced by do_linkat(), and vfs_link().
Reads what a symbolic link contains.
| path | the link's path (not followed) |
| uio | who is asking |
| buf | where the contents go, not NUL-terminated |
| size | the buffer's size |
Definition at line 105 of file link.c.
References uio::flags, MIN, vnode::mode, NULL, vnode::size, vfs_close(), vfs_lookup(), vfs_read(), and vfs_readlink().
Referenced by creat_path(), sys_readlinkat(), and vfs_readlink().
Renames a file or a directory, possibly to another directory of the same mounted filesystem.
An entry at the new name is replaced: a file by a file, or an empty directory by a directory.
| oldpath | the path it has |
| ouio | who is asking, and the directory oldpath is relative to |
| newpath | the path it gets |
| nuio | the directory newpath is relative to |
Definition at line 154 of file link.c.
References entry_get(), kfree(), NULL, vfs_access(), vfs_close(), vfs_dir_empty(), vfs_lookup_parent(), vfs_mount_root_of(), vfs_rename(), vfs_under(), vfs_vrename(), VFS_W, and VFS_X.
Referenced by sys_renameat(), and vfs_rename().
| int vfs_symlink | ( | const char * | target, |
| const char * | path, | ||
| struct uio * | uio ) |
Makes a symbolic link.
| target | what the link contains (not checked: it may not exist) |
| path | the link's path |
| uio | who is asking |
Definition at line 72 of file link.c.
References NULL, vfs_close(), vfs_mknod(), vfs_symlink(), vfs_unlink(), and vfs_write().
Referenced by sys_symlinkat(), and vfs_symlink().