A filesystem entry represented as a name in a concrete directory. More...
Public Member Functions | |
entry_ref () | |
Creates an uninitialized entry_ref object. | |
entry_ref (const entry_ref &ref) | |
Returns a copy of the passed in entry_ref object. | |
entry_ref (dev_t dev, ino_t dir, const char *name) | |
Creates an entry_ref object initialized to the given file name in the given directory on the given device. | |
~entry_ref () | |
Destroys the object and frees the storage allocated for the leaf name, if necessary. | |
bool | operator!= (const entry_ref &ref) const |
Compares the entry_ref object with the passed in entry_ref, returning true if they are NOT equal. | |
entry_ref & | operator= (const entry_ref &ref) |
Makes the entry_ref object a copy of the passed in entry_ref. | |
bool | operator== (const entry_ref &ref) const |
Compares the entry_ref object with the passed in entry_ref, returning true if they are equal. | |
status_t | set_name (const char *name) |
Set the entry_ref's leaf name, freeing the storage allocated for any previous name and then making a copy of the new name. | |
Public Attributes | |
dev_t | device |
ino_t | directory |
char * | name |
A filesystem entry represented as a name in a concrete directory.
entry_refs may refer to pre-existing (concrete) files, as well as non-existing (abstract) files. However, the parent directory of the file must exist.
The result of this dichotomy is a blending of the persistence gained by referring to entries with a reference to their internal filesystem node and the flexibility gained by referring to entries by name.
For example, if the directory in which the entry resides (or a directory further up in the hierarchy) is moved or renamed, the entry_ref will still refer to the correct file (whereas a pathname to the previous location of the file would now be invalid).
On the other hand, say that the entry_ref refers to a concrete file. If the file itself is renamed, the entry_ref now refers to an abstract file with the old name (the upside in this case is that abstract entries may be represented by entry_refs without preallocating an internal filesystem node for them).
entry_ref::entry_ref | ( | ) |
Creates an uninitialized entry_ref object.
entry_ref::entry_ref | ( | dev_t | dev, |
ino_t | dir, | ||
const char * | name | ||
) |
Creates an entry_ref object initialized to the given file name in the given directory on the given device.
name may refer to either a pre-existing file in the given directory, or a non-existent file. No explicit checking is done to verify validity of the given arguments, but later use of the entry_ref will fail if dev
is not a valid device or dir is a not a directory on dev
.
dev | The device on which the entry's parent directory resides. |
dir | The directory in which the entry resides. |
name | The leaf name of the entry, which is not required to exist. |
entry_ref::entry_ref | ( | const entry_ref & | ref | ) |
entry_ref::~entry_ref | ( | ) |
Destroys the object and frees the storage allocated for the leaf name, if necessary.
bool entry_ref::operator!= | ( | const entry_ref & | ref | ) | const |
bool entry_ref::operator== | ( | const entry_ref & | ref | ) | const |
status_t entry_ref::set_name | ( | const char * | name | ) |
Set the entry_ref's leaf name, freeing the storage allocated for any previous name and then making a copy of the new name.
name | Pointer to a null-terminated string containing the new name for the entry. May be NULL . |
dev_t entry_ref::device |
The device id of the storage device on which the entry resides.
ino_t entry_ref::directory |
The inode number of the directory in which the entry resides.
char * entry_ref::name |
The leaf name of the entry