Added method BlockSize() to get the block size of the underlying file system.
Untested but with good chances to actually work. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34106 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -232,6 +232,30 @@ BVolume::FreeBytes() const
|
||||
return (error == B_OK ? info.free_blocks * info.block_size : error);
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Returns the size of one block (in bytes). It depends on the
|
||||
underlying file system what this means exactly.
|
||||
\return
|
||||
- The block size in bytes.
|
||||
- \c B_NO_INIT if the volume is not initialized.
|
||||
- Other errors forwarded from the file system.
|
||||
*/
|
||||
off_t
|
||||
BVolume::BlockSize() const
|
||||
{
|
||||
// check initialization
|
||||
if (InitCheck() != B_OK)
|
||||
return B_NO_INIT;
|
||||
|
||||
// get FS stat
|
||||
fs_info info;
|
||||
if (fs_stat_dev(fDevice, &info) != 0)
|
||||
return errno;
|
||||
|
||||
return info.block_size;
|
||||
}
|
||||
|
||||
|
||||
// GetName
|
||||
/*! \brief Returns the name of the volume.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user