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:
parent
1e179f36e2
commit
d0f1a68746
@ -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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _VOLUME_H
|
#ifndef _VOLUME_H
|
||||||
@ -34,6 +34,7 @@ public:
|
|||||||
|
|
||||||
off_t Capacity() const;
|
off_t Capacity() const;
|
||||||
off_t FreeBytes() const;
|
off_t FreeBytes() const;
|
||||||
|
off_t BlockSize() const;
|
||||||
|
|
||||||
status_t GetName(char* name) const;
|
status_t GetName(char* name) const;
|
||||||
status_t SetName(const char* name);
|
status_t SetName(const char* name);
|
||||||
|
@ -232,6 +232,30 @@ BVolume::FreeBytes() const
|
|||||||
return (error == B_OK ? info.free_blocks * info.block_size : error);
|
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
|
// GetName
|
||||||
/*! \brief Returns the name of the volume.
|
/*! \brief Returns the name of the volume.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user