The Storage Kit Table of Contents | The Storage Kit Index |
Derived from: none
Declared in: be/storage/Volume.h
Library: libbe.so
The BVolume class lets you ask questions about specific "volumes," where a volume is any independent file system. Most applications are usually only interested in "persistent" volumes, such as hard disks, floppies, or CD-ROMs, but you can also create BVolumes to virtual file systems, such as /pipe. Here's what a BVolume knows:
There are two ways to initialize a BVolume:
A BVolume object can't tell you directly whether the device that it represents is still mounted. If you want to ask, you can call a status_t-returning BVolume function; if the function returns B_BAD_VALUE, the device is no longer mounted.
Furthermore, you can't ask a BVolume to unmount itself. If you want to be told when devices are mounted and unmounted, you have to ask the Node Monitor to help you. Call watch_node() thus:
watch_node(NULL, B_WATCH_MOUNT, messenger);
messenger is a BMessenger object that acts as the target of subsequent mount and unmount notifications. See "The Node Monitor" section of this chapter for details.
|
Creates a new BVolume object and initializes it according to the argument. The status of the initialization is recorded by the InitCheck() function.
|
Destroys the BVolume object.
|
Returns the volume's total storage capacity and the amount of storage that's currently unused. Both measurements are in bytes.
|
Returns the object's dev_t number.
|
Returns the volume's icon in icon. which specifies the icon to retrieve, either B_MINI_ICON (16x16) or B_LARGE_ICON (32x32).
See also: get_device_icon()
|
Copies the name of the volume into buffer.
|
Initializes dir (which must be allocated) to refer to the volume's "root directory." The root directory stands at the "root" of the volume's file hierarchy. Note that this isn't necessarily the root of the entire file hierarchy.
|
Returns the status of the last initialization (from either the constructor or SetTo()).
|
These functions answer media-related questions about the volume:
|
These functions answer questions about the file system on the volume:
|
SetTo() initializes the BVolume object to represent the volume (device) identified by the argument.
Unset() uninitializes the BVolume.
|
In the expression
BVolume a = b;
BVolume a is initialized to refer to the same volume as b. To gauge the success of the assignment, you should call InitCheck() immediately afterwards. Assigning a BVolume to itself is safe.
Assigning from an uninitialized BVolume is "successful": The assigned-to BVolume will also be uninitialized (B_NO_INIT).
|
Two BVolume objects are said to be equal if they refer to the same volume, or if they're both uninitialized.
The Storage Kit Table of Contents | The Storage Kit Index |
Copyright © 2000 Be, Inc. All rights reserved..