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:
Stephan Aßmus 2009-11-18 09:47:42 +00:00
parent 1e179f36e2
commit d0f1a68746
2 changed files with 26 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2008, Haiku Inc. All Rights Reserved.
* Copyright 2002-2009, Haiku Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _VOLUME_H
@ -34,6 +34,7 @@ public:
off_t Capacity() const;
off_t FreeBytes() const;
off_t BlockSize() const;
status_t GetName(char* name) const;
status_t SetName(const char* name);

View File

@ -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.