sofs19
0.1
FUSE based file system
|
Functions to manage directory entries. More...
Functions | |
uint32_t | soTraversePath (char *path) |
Get the inode associated to a given path. More... | |
uint32_t | soGetDirEntry (int pih, const char *name) |
Get the inode associated to a given name. More... | |
void | soAddDirEntry (int pih, const char *name, uint32_t cin) |
Add a new entry to the parent directory. More... | |
uint32_t | soDeleteDirEntry (int pih, const char *name) |
Delete an entry from a parent directory. More... | |
void | soRenameDirEntry (int pih, const char *name, const char *newName) |
Rename an entry of a directory. More... | |
bool | soCheckDirEmpty (int ih) |
Check directory emptiness. More... | |
Functions to manage directory entries.
uint32_t sofs19::soTraversePath | ( | char * | path | ) |
Get the inode associated to a given path.
The directory hierarchy of the file system is traversed to find an entry whose name is the rightmost component of the given path
[in] | path | the path to be traversed |
path
is not absolute, error EINVAL
is thrown; path
components, with the exception of the rightmost one, is not a directory, error ENODIR
is thrown; EACCES
is thrown; path
does not contain symbolic links; so
is used.uint32_t sofs19::soGetDirEntry | ( | int | pih, |
const char * | name | ||
) |
Get the inode associated to a given name.
The directory contents, seen as an array of directory entries, is parsed to find an entry whose name is the given one.
[in] | pih | inode handler of the parent directory |
[in] | name | the name of the entry to be searched for |
pih
is a valid inode handler of a directory EINVAL
is thrown if name
is not a base name, that is, if it contains the character '/'. so
is used.NullReference
) void sofs19::soAddDirEntry | ( | int | pih, |
const char * | name, | ||
uint32_t | cin | ||
) |
Add a new entry to the parent directory.
A direntry is added connecting the parent inode to the child inode.
[in] | pih | inode handler of the parent inode |
[in] | name | the name of the entry to be created |
[in] | cin | inode number of the entry to be created |
pih
is a valid inode handler of a directory where the user has write access cin
is a valid inode number EEXIST
is thrown if name
already exists lnkcnt
of the child inode is not changed by this function. so
is used. uint32_t sofs19::soDeleteDirEntry | ( | int | pih, |
const char * | name | ||
) |
Delete an entry from a parent directory.
A direntry associated from the given directory is deleted.
[in] | pih | inode handler of the parent inode |
[in] | name | name of the entry |
pih
is a valid inode handler of a directory where the user has write access ENOENT
is thrown if name
does not exist lnkcnt
of the child inode is not changed by this function. so
is used.void sofs19::soRenameDirEntry | ( | int | pih, |
const char * | name, | ||
const char * | newName | ||
) |
Rename an entry of a directory.
A direntry associated from the given directory is renamed.
[in] | pih | inode handler of the parent inode |
[in] | name | current name of the entry |
[in] | newName | new name for the entry |
pih
is a valid inode handler of a directory where the user has write access ENOENT
is thrown if name
does not exist so
is used. bool sofs19::soCheckDirEmpty | ( | int | ih | ) |
Check directory emptiness.
The directory is traversed to verified if the only existing entries are "." and "..".
[in] | ih | handler of the inode to be checked |
ih
is a valid inode handler of a directory so
is used.