Derived from: (none)
Declared in: be/nustorage/VolumeRoster.h
Library: libbe.so
The BVolumeRoster class keeps track of the volumes thatare mounted in the file system hierarchy. It lets you know about volumes in two ways:
It lists the volumes that are currently mounted. You can step through the list through iterative calls to the GetNextVolume() function.
| ||
It lets you know when new volumes are mounted, and when existing volumes are unmounted. (See StartWatching().) |
How you create your BVolumeRoster object depends on what you're going to do with it:
If you simply want to step through the volume list, then creating a BVolumeRoster on the stack is acceptable and sufficient. |
However, if you want to watch for volumes being mounted and unmounted, then you must keep your BVolumeRoster object around. The watching stops when the object is deleted. |
A single BVolumeRoster object can perform both functions: You can use it to step through the volume list at the same time that it's watching volumes.
BVolumeRoster(void)
Creates a new BVolumeRoster object. You don't have to "initialize" the object before using it (as you do with most other Storage Kit classes). You can call GetNextVolume() (or whatever) immediately after constructing.
~BVolumeRoster(void)
Destroys the object. If this BVolumeRoster object was watching volumes, the watch is called off.
status_t GetBootVolume(BVolume *boot_vol)
Initializes boot_vol to refer to the "boot volume." This is the volume that was used to boot the computer. boot_vol must be allocated before you pass it in. If the boot volume can't be found, the argument is uninitialized.
(Currently, this function looks for the volume that's mounted at /boot. The only way to fool the system into thinking that there isn't a boot volume is to rename /boot--not a smart thing to do.)
RETURN CODES
status_t GetNextVolume(BVolume *volume) void Rewind(void)
GetNextVolume() retrieves the "next" volume from the volume list and uses it to initialize the argument (which must be allocated). When the function return B_BAD_VALUE, you've reached the end of the list.
Rewind() rewinds the volume list such that the next GetNextVolume() will return the first element in the list.
RETURN CODES
status_t StartWatching(BMessenger messenger = be_app_messenger) status_t StopWatching(void) BMessenger Messenger(void) const
These functions start and stop the BVolumeRoster's volume-watching facility. (This is actually just a convenient cover for the Node Monitor.)
There are separate notifications (BMessages) for volume-mounted and volume-unmounted. The fields are...
Volume Mounted |
Volume Unmounted |
RETURN CODES
The Be Book, in lovely HTML, for the BeOS Preview Release.
Copyright © 1997 Be, Inc. All rights reserved.
Be is a registered trademark; BeOS, BeBox, BeWare, GeekPort, the Be logo, and the BeOS logo are trademarks of Be, Inc.
Last modified July 17, 1997.