Loading...
Searching...
No Matches
Public Member Functions | List of all members
BVolumeRoster Class Reference

Provides an interface for iterating through available volumes and watching for mounting/unmounting. More...

Public Member Functions

 BVolumeRoster ()
 Creates a BVolumeRoster object. The object is ready to be used.
 
virtual ~BVolumeRoster ()
 Deletes the volume roster and frees all associated resources.
 
status_t GetBootVolume (BVolume *volume)
 Fills out the passed in BVolume object with the boot volume.
 
status_t GetNextVolume (BVolume *volume)
 Fills out the passed in BVolume object with the next available volume.
 
BMessenger Messenger () const
 Returns the messenger currently watching the volume list.
 
void Rewind ()
 Rewinds the list of available volumes back to the first item.
 
status_t StartWatching (BMessenger messenger=be_app_messenger)
 Starts watching the available volumes for changes.
 
void StopWatching ()
 Stops watching volumes initiated by StartWatching().
 

Detailed Description

Provides an interface for iterating through available volumes and watching for mounting/unmounting.

This class wraps the next_dev() function for iterating through the list of available volumes and watch_node()/stop_watching() for watching volumes.

Since
BeOS R3

Constructor & Destructor Documentation

◆ BVolumeRoster()

BVolumeRoster::BVolumeRoster ( )

Creates a BVolumeRoster object. The object is ready to be used.

Since
BeOS R3

◆ ~BVolumeRoster()

BVolumeRoster::~BVolumeRoster ( )
virtual

Deletes the volume roster and frees all associated resources.

If a watch was activated (by StartWatching()), it is deactivated.

Since
BeOS R3

Member Function Documentation

◆ GetBootVolume()

status_t BVolumeRoster::GetBootVolume ( BVolume volume)

Fills out the passed in BVolume object with the boot volume.

Currently, this method looks for the volume that is mounted at "/boot". The only way to fool the system into thinking that there is not a boot volume is to rename "/boot" – but, please refrain from doing this.

Parameters
volumeA pointer to a pre-allocated BVolume to be initialized to refer to the boot volume.
Returns
A status code, B_OK if everything went fine or an error code otherwise.
Since
BeOS R3

◆ GetNextVolume()

status_t BVolumeRoster::GetNextVolume ( BVolume volume)

Fills out the passed in BVolume object with the next available volume.

Parameters
volumeA pointer to a pre-allocated BVolume object to be initialized to the next available volume.
Returns
A status code.
Return values
B_OKEverything went fine.
B_BAD_VALUEThe last volume in the list was already returned.
Since
BeOS R3

◆ Messenger()

BMessenger BVolumeRoster::Messenger ( ) const

Returns the messenger currently watching the volume list.

Returns
A messenger to the target currently watching the volume list, or an invalid messenger if not watching.
Since
BeOS R3

◆ Rewind()

void BVolumeRoster::Rewind ( )

Rewinds the list of available volumes back to the first item.

The next call to GetNextVolume() will return the first available volume.

Since
BeOS R3

◆ StartWatching()

status_t BVolumeRoster::StartWatching ( BMessenger  messenger = be_app_messenger)

Starts watching the available volumes for changes.

Notifications are sent to the specified target whenever a volume is mounted or unmounted. The format of the notification messages is described under watch_node(). Actually BVolumeRoster just provides a more convenient interface for it.

If StartWatching() has been called before with another target and no StopWatching() since, StopWatching() is called first, so that the former target won't receive any notifications anymore.

When the object is destroyed all watching ends as well.

Parameters
messengerThe target which the notification messages are sent.
Returns
A status code.
Return values
B_OKEverything went fine.
B_BAD_VALUEThe supplied BMessenger was invalid.
B_NO_MEMORYThere was insufficient memory to carry out this operation.
See also
watch_node()
Since
BeOS R3

◆ StopWatching()

void BVolumeRoster::StopWatching ( )

Stops watching volumes initiated by StartWatching().

See also
stop_watching()
Since
BeOS R3