ChVolume

a BVolume with indexing methods

The ChVolume class is an easy way of manipulating the indexes on a volume.

This indexing functionality was originally part of the BVolume class during the original Advanced Access: Preview Release of BeOS. It disappeared in Preview Release, leaving only the C indexing API.

The ChVolume object may keep a file descriptor open for its lifetime; this should only be a problem if your application is keeping hundreds of files open at a time. For more information about the limited number of file descriptors, see the BeBook's Storage Kit documentation.


Constructors

#include "Ch/ChVolume.h"

ChVolume();

Create a new, uninitialized ChVolume object. You'll have to use BVolume's SetTo() method to make it useful.

#include "Ch/ChVolume.h"

ChVolume( dev_t dev );

Create a new ChVolume object referring to the device dev.

#include "Ch/ChVolume.h"

ChVolume( const BVolume &vol );

Create a new ChVolume object from the existing BVolume vol.

#include "Ch/ChVolume.h"

ChVolume( const ChVolume &vol );

Create a new ChVolume object from the existing ChVolume vol.


Methods

AddIndex()

status_t AddIndex( const char *index, int type, uint flags );

Add a new index named index with the specific type and flags.

For a description of type and flags arguments, see fs_create_index() in the BeBook.

AddIndex() will return B_NO_ERROR for success, or:

B_BAD_VALUE
The device does not exist, or the name is reserved.
B_DEVICE_FULL
There isn't enough room on the device to create the specified index.
B_FILE_ERROR
Invalid directory reference.
B_FILE_EXISTS
The index name already exists.
B_NO_MEMORY
There isn't enough memory available to complete the operation.
B_NOT_ALLOWED
The device is read-only.

RemoveIndex()

status_t RemoveIndex( const char *index );

Remove the index named index.

RemoveIndex() returns B_NO_ERROR for success, or:

B_BAD_VALUE
An invalid device was specified.
B_ENTRY_NOT_FOUND
The specified index does not exist.
B_FILE_ERROR
A filesystem error made RemoveIndex fail.
B_NO_MEMORY
There isn't enough memory available to complete the operation.
B_NOT_ALLOWED
You tried to remove one of the system-reserved indexes (name, size, or last_modified), or the device is read-only.

GetIndexInfo()

status_t GetIndexInfo( const char *index, struct index_info *info );

Get the index information for the index named index, and store it in the buffer info.

For a description of the struct index_info structure, see fs_stat_index() in the BeBook, or the <kernel/fs_index.h> header.

GetIndexInfo() returns B_NO_ERROR for success, or:

B_BAD_VALUE
An invalid device was specified.
B_ENTRY_NOT_FOUND
The requested index was not found.

GetNextIndexName()

status_t GetNextIndexName( char *buf );

Get the next index name and store it in the buffer buf. If there is no "next" index name, GetNextIndexName will return B_NO_ERROR and buf will be a 0-length string.

You must allocate B_FILE_NAME_LENGTH bytes for buf; this is your buffer, and you must also take responsibility for deallocating it when necessary.

GetNextIndexName() returns B_NO_ERROR for success, or:

B_BAD_VALUE
An invalid device was specified.
B_BUSY
The next index is currently in use.
B_ENTRY_NOT_FOUND
There are no more index names on this volume (ie. you've gone through the entire list).
B_FILE_ERROR
A file error prevented the operation.
B_LINK_LIMIT
A cyclic loop was detected in the directory structure, preventing the operation.
B_NO_MEMORY
There isn't enough memory available to complete the operation.
B_NO_MORE_FDS
There are too many open files; all file descriptors are currently in use.
B_NOT_A_DIRECTORY
Unable to read the index directory on the device.

RewindIndexList()

status_t RewindIndexList( void );

Rewind the list of index names to the first index name.

RewindIndexList() returns B_NO_ERROR for success, or:

B_BAD_VALUE
An invalid device was specified.
B_BUSY
The index is currently in use.
B_FILE_ERROR
A file error prevented the operation.
B_LINK_LIMIT
A cyclic loop was detected in the directory structure, preventing the operation.
B_NO_MEMORY
There isn't enough memory available to complete the operation.
B_NO_MORE_FDS
There are too many open files; all file descriptors are currently in use.

operator=( BVolume )

ChVolume &operator=( const BVolume &vol );

Assign an existing BVolume to this ChVolume.

operator=( ChVolume )

ChVolume &operator=( const ChVolume &vol );

Assign an existing ChVolume to this ChVolume.


Please see the libCh Overview for licensing information.


Last modified: $Date: 1998/04/11 19:41:01 $