Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
entry_ref Struct Reference

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_refoperator= (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
 

Detailed Description

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).

Since
BeOS R3

Constructor & Destructor Documentation

◆ entry_ref() [1/3]

entry_ref::entry_ref ( )

Creates an uninitialized entry_ref object.

Since
BeOS R3

◆ entry_ref() [2/3]

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.

Parameters
devThe device on which the entry's parent directory resides.
dirThe directory in which the entry resides.
nameThe leaf name of the entry, which is not required to exist.
Since
BeOS R3

◆ entry_ref() [3/3]

entry_ref::entry_ref ( const entry_ref ref)

Returns a copy of the passed in entry_ref object.

Parameters
refA reference to an entry_ref to copy.
Since
BeOS R3

◆ ~entry_ref()

entry_ref::~entry_ref ( )

Destroys the object and frees the storage allocated for the leaf name, if necessary.

Since
BeOS R3

Member Function Documentation

◆ operator!=()

bool entry_ref::operator!= ( const entry_ref ref) const

Compares the entry_ref object with the passed in entry_ref, returning true if they are NOT equal.

Returns
true if the entry_refs are NOT equal, false otherwise.
Since
BeOS R3

◆ operator=()

entry_ref & entry_ref::operator= ( const entry_ref ref)

Makes the entry_ref object a copy of the passed in entry_ref.

Parameters
refThe entry_ref to copy.
Returns
A pointer to the resulting entry_ref copy.
Since
BeOS R5

◆ operator==()

bool entry_ref::operator== ( const entry_ref ref) const

Compares the entry_ref object with the passed in entry_ref, returning true if they are equal.

Returns
true if he entry_refs are equal, false otherwise.
Since
BeOS R3

◆ set_name()

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.

Parameters
namePointer to a null-terminated string containing the new name for the entry. May be NULL.
Since
BeOS R3

Member Data Documentation

◆ device

dev_t entry_ref::device

The device id of the storage device on which the entry resides.

Since
BeOS R3

◆ directory

ino_t entry_ref::directory

The inode number of the directory in which the entry resides.

Since
BeOS R3

◆ name

char * entry_ref::name

The leaf name of the entry

Since
BeOS R3