file_systems/reiserfs: Fix -WFormat=

Change-Id: Id8b4c3137cfcabaef09d8adf55a3ab6667b5c55c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3335
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
Murai Takashi
2020-10-22 05:57:50 +00:00
committed by Jérôme Duval
parent 6b48b59daf
commit f91802873f
5 changed files with 121 additions and 105 deletions
@@ -6,12 +6,12 @@
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -51,14 +51,15 @@ using std::nothrow;
// constructor // constructor
BlockCache::BlockCache() BlockCache::BlockCache()
: fDevice(-1), :
fBlockSize(0), fDevice(-1),
fBlockCount(0), fBlockSize(0),
fLock(), fBlockCount(0),
fBlocks(), fLock(),
fReads(0), fBlocks(),
fBlockGets(0), fReads(0),
fBlockReleases(0) fBlockGets(0),
fBlockReleases(0)
{ {
} }
@@ -73,9 +74,9 @@ BlockCache::~BlockCache()
} }
delete block; delete block;
} }
PRINT(("statistics: %Ld block reads\n", fReads)); PRINT(("statistics: %" B_PRId64 " block reads\n", fReads));
PRINT(("statistics: %Ld block gets\n", fBlockGets)); PRINT(("statistics: %" B_PRId64 " block gets\n", fBlockGets));
PRINT(("statistics: %Ld block releases\n", fBlockReleases)); PRINT(("statistics: %" B_PRId64 " block releases\n", fBlockReleases));
if (fCacheHandle) if (fCacheHandle)
block_cache_delete(fCacheHandle, false); block_cache_delete(fCacheHandle, false);
fLock.Unlock(); fLock.Unlock();
@@ -57,9 +57,9 @@ public:
void Dump() void Dump()
{ {
PRINT((" dir entry\n")); PRINT((" dir entry\n"));
PRINT((" offset: %lu\n", GetOffset())); PRINT((" offset: %" B_PRIu32 "\n", GetOffset()));
PRINT((" dir ID: %lu\n", GetDirID())); PRINT((" dir ID: %" B_PRIu32 "\n", GetDirID()));
PRINT((" object ID: %lu\n", GetObjectID())); PRINT((" object ID: %" B_PRIu32 "\n", GetObjectID()));
PRINT((" location: %hu\n", GetLocation())); PRINT((" location: %hu\n", GetLocation()));
PRINT((" state: %hx\n", GetState())); PRINT((" state: %hx\n", GetState()));
} }
@@ -6,12 +6,12 @@
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -39,10 +39,11 @@ static const bool kDefaultHideEsoteric = true;
// constructor // constructor
Settings::Settings() Settings::Settings()
: fDefaultVolumeName(), :
fVolumeName(), fDefaultVolumeName(),
fHideEsoteric(kDefaultHideEsoteric), fVolumeName(),
fHiddenEntries(5) fHideEsoteric(kDefaultHideEsoteric),
fHiddenEntries(5)
{ {
} }
@@ -74,7 +75,8 @@ Settings::SetTo(const char *volumeName)
status_t status_t
Settings::SetTo(off_t volumeOffset, off_t volumeSize) Settings::SetTo(off_t volumeOffset, off_t volumeSize)
{ {
PRINT(("Settings::SetTo(%Ld, %Ld)\n", volumeOffset, volumeSize)); PRINT(("Settings::SetTo(%" B_PRIdOFF ", %" B_PRIdOFF ")\n", volumeOffset,
volumeSize));
// unset // unset
Unset(); Unset();
// load the driver settings and find the entry for the volume // load the driver settings and find the entry for the volume
@@ -86,7 +88,8 @@ PRINT(("Settings::SetTo(%Ld, %Ld)\n", volumeOffset, volumeSize));
// init the object and unload the settings // init the object and unload the settings
_Init(ds, volume); _Init(ds, volume);
unload_driver_settings(settings); unload_driver_settings(settings);
PRINT(("Settings::SetTo(%Ld, %Ld) done: B_OK\n", volumeOffset, volumeSize)); PRINT(("Settings::SetTo(%" B_PRIdOFF ", %" B_PRIdOFF ") done: B_OK\n",
volumeOffset, volumeSize));
return B_OK; return B_OK;
} }
@@ -143,7 +146,7 @@ Settings::Dump()
PRINT((" default volume name: `%s'\n", GetDefaultVolumeName())); PRINT((" default volume name: `%s'\n", GetDefaultVolumeName()));
PRINT((" volume name: `%s'\n", GetVolumeName())); PRINT((" volume name: `%s'\n", GetVolumeName()));
PRINT((" hide esoteric entries: %d\n", GetHideEsoteric())); PRINT((" hide esoteric entries: %d\n", GetHideEsoteric()));
PRINT((" %ld hidden entries:\n", fHiddenEntries.CountItems())); PRINT((" %" B_PRId32 " hidden entries:\n", fHiddenEntries.CountItems()));
for (int32 i = 0; const char *entry = HiddenEntryAt(i); i++) for (int32 i = 0; const char *entry = HiddenEntryAt(i); i++)
PRINT((" `%s'\n", entry)); PRINT((" `%s'\n", entry));
} }
@@ -160,17 +163,17 @@ PRINT(("Settings::_Init(%p, %p)\n", settings, volume));
"default_volume_name", (const char*)NULL, NULL)); "default_volume_name", (const char*)NULL, NULL));
PRINT((" default_volume_name is: `%s'\n", fDefaultVolumeName.GetString())); PRINT((" default_volume_name is: `%s'\n", fDefaultVolumeName.GetString()));
fHideEsoteric = _GetParameterValue(settings, "hide_esoteric_entries", fHideEsoteric = _GetParameterValue(settings, "hide_esoteric_entries",
kDefaultHideEsoteric, kDefaultHideEsoteric,
kDefaultHideEsoteric); kDefaultHideEsoteric);
PRINT((" hide_esoteric_entries is: %d\n", fHideEsoteric)); PRINT((" hide_esoteric_entries is: %d\n", fHideEsoteric));
// get the per volume settings // get the per volume settings
if (volume) { if (volume) {
PRINT((" getting volume parameters:\n")); PRINT((" getting volume parameters:\n"));
fVolumeName.SetTo(_GetParameterValue(volume, "name", (const char*)NULL, fVolumeName.SetTo(_GetParameterValue(volume, "name", (const char*)NULL,
NULL)); NULL));
PRINT((" name is: `%s'\n", fVolumeName.GetString())); PRINT((" name is: `%s'\n", fVolumeName.GetString()));
fHideEsoteric = _GetParameterValue(volume, "hide_esoteric_entries", fHideEsoteric = _GetParameterValue(volume, "hide_esoteric_entries",
fHideEsoteric, fHideEsoteric); fHideEsoteric, fHideEsoteric);
PRINT((" hide_esoteric_entries is: %d\n", fHideEsoteric)); PRINT((" hide_esoteric_entries is: %d\n", fHideEsoteric));
int32 cookie = 0; int32 cookie = 0;
while (const driver_parameter *parameter while (const driver_parameter *parameter
@@ -202,7 +205,7 @@ PRINT(("Settings::_Init() done: %s\n", strerror(error)));
// _FindVolumeParameter // _FindVolumeParameter
const driver_parameter * const driver_parameter *
Settings::_FindVolumeParameter(const driver_settings *settings, Settings::_FindVolumeParameter(const driver_settings *settings,
const char *name) const char *name)
{ {
if (settings) { if (settings) {
int32 cookie = 0; int32 cookie = 0;
@@ -220,9 +223,10 @@ Settings::_FindVolumeParameter(const driver_settings *settings,
// _FindVolumeParameter // _FindVolumeParameter
const driver_parameter * const driver_parameter *
Settings::_FindVolumeParameter(const driver_settings *settings, Settings::_FindVolumeParameter(const driver_settings *settings,
off_t offset, off_t size) off_t offset, off_t size)
{ {
PRINT(("Settings::_FindVolumeParameter(%Ld, %Ld)\n", offset, size)); PRINT(("Settings::_FindVolumeParameter(%" B_PRIdOFF ", %" B_PRIdOFF ")\n",
offset, size));
if (settings) { if (settings) {
int32 cookie = 0; int32 cookie = 0;
while (const driver_parameter *parameter while (const driver_parameter *parameter
@@ -231,13 +235,13 @@ PRINT(("Settings::_FindVolumeParameter(%Ld, %Ld)\n", offset, size));
== offset == offset
&& _GetParameterValue(parameter, "size", size + 1, size + 1) && _GetParameterValue(parameter, "size", size + 1, size + 1)
== size) { == size) {
PRINT(("Settings::_FindVolumeParameter() done: found parameter: index: %ld, " PRINT(("Settings::_FindVolumeParameter() done: found parameter:"
"(%p)\n", cookie - 1, parameter)); " index: %" B_PRId32 ", (%p)\n", cookie - 1, parameter));
return parameter; return parameter;
} }
} }
} }
PRINT(("Settings::_FindVolumeParameter() done: failed\n")); PRINT(("Settings::_FindVolumeParameter() done: failed\n"));
return NULL; return NULL;
} }
@@ -6,12 +6,12 @@
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -103,61 +103,61 @@ public:
uint16 GetMode() const uint16 GetMode() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_mode) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_mode)
: le2h(fOldData->sd_mode)); : le2h(fOldData->sd_mode));
} }
uint32 GetNLink() const uint32 GetNLink() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_nlink) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_nlink)
: le2h(fOldData->sd_nlink)); : le2h(fOldData->sd_nlink));
} }
uint32 GetUID() const uint32 GetUID() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_uid) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_uid)
: le2h(fOldData->sd_uid)); : le2h(fOldData->sd_uid));
} }
uint32 GetGID() const uint32 GetGID() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_gid) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_gid)
: le2h(fOldData->sd_gid)); : le2h(fOldData->sd_gid));
} }
uint64 GetSize() const uint64 GetSize() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_size) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_size)
: le2h(fOldData->sd_size)); : le2h(fOldData->sd_size));
} }
uint32 GetATime() const uint32 GetATime() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_atime) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_atime)
: le2h(fOldData->sd_atime)); : le2h(fOldData->sd_atime));
} }
uint32 GetMTime() const uint32 GetMTime() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_mtime) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_mtime)
: le2h(fOldData->sd_mtime)); : le2h(fOldData->sd_mtime));
} }
uint32 GetCTime() const uint32 GetCTime() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_ctime) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_ctime)
: le2h(fOldData->sd_ctime)); : le2h(fOldData->sd_ctime));
} }
uint32 GetBlocks() const uint32 GetBlocks() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_blocks) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->sd_blocks)
: le2h(fOldData->u.sd_blocks)); : le2h(fOldData->u.sd_blocks));
} }
uint32 GetRDev() const uint32 GetRDev() const
{ {
return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->u.sd_rdev) return (GetVersion() == STAT_DATA_V2 ? le2h(fCurrentData->u.sd_rdev)
: le2h(fOldData->u.sd_rdev)); : le2h(fOldData->u.sd_rdev));
} }
uint32 GetGeneration() const uint32 GetGeneration() const
@@ -176,16 +176,16 @@ public:
{ {
PRINT(("StatData:\n")); PRINT(("StatData:\n"));
PRINT((" mode: %hx\n", GetMode())); PRINT((" mode: %hx\n", GetMode()));
PRINT((" nlink: %lu\n", GetNLink())); PRINT((" nlink: %" B_PRIu32 "\n", GetNLink()));
PRINT((" uid: %lx\n", GetUID())); PRINT((" uid: %" B_PRIx32 "\n", GetUID()));
PRINT((" gid: %lx\n", GetGID())); PRINT((" gid: %" B_PRIx32 "\n", GetGID()));
PRINT((" size: %Lu\n", GetSize())); PRINT((" size: %" B_PRIu64 "\n", GetSize()));
PRINT((" atime: %lu\n", GetATime())); PRINT((" atime: %" B_PRIu32 "\n", GetATime()));
PRINT((" mtime: %lu\n", GetMTime())); PRINT((" mtime: %" B_PRIu32 "\n", GetMTime()));
PRINT((" ctime: %lu\n", GetCTime())); PRINT((" ctime: %" B_PRIu32 "\n", GetCTime()));
PRINT((" blocks: %lu\n", GetBlocks())); PRINT((" blocks: %" B_PRIu32 "\n", GetBlocks()));
PRINT((" rdev: %lu\n", GetRDev())); PRINT((" rdev: %" B_PRIu32 "\n", GetRDev()));
PRINT((" generation: %lu\n", GetGeneration())); PRINT((" generation: %" B_PRIu32 "\n", GetGeneration()));
} }
StatData &operator=(const StatData &data) StatData &operator=(const StatData &data)
@@ -182,8 +182,10 @@ reiserfs_lookup(fs_volume* fs, fs_vnode* _dir, const char *entryName,
// FUNCTION_START(); // FUNCTION_START();
Volume *volume = (Volume*)fs->private_volume; Volume *volume = (Volume*)fs->private_volume;
VNode *dir = (VNode*)_dir->private_node; VNode *dir = (VNode*)_dir->private_node;
FUNCTION(("dir: (%Ld: %lu, %lu), entry: `%s'\n", dir->GetID(), dir->GetDirID(), FUNCTION(("dir: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 "), "
dir->GetObjectID(), entryName)); "entry: `%s'\n",
dir->GetID(), dir->GetDirID(), dir->GetObjectID(),
entryName));
status_t error = B_OK; status_t error = B_OK;
VNode *entryNode = NULL; VNode *entryNode = NULL;
@@ -236,8 +238,8 @@ reiserfs_read_vnode(fs_volume *fs, ino_t vnid, fs_vnode *node, int *_type,
{ {
TOUCH(reenter); TOUCH(reenter);
// FUNCTION_START(); // FUNCTION_START();
FUNCTION(("(%Ld: %lu, %ld)\n", vnid, VNode::GetDirIDFor(vnid), FUNCTION(("(%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
VNode::GetObjectIDFor(vnid))); vnid, VNode::GetDirIDFor(vnid), VNode::GetObjectIDFor(vnid)));
Volume *volume = (Volume*)fs->private_volume; Volume *volume = (Volume*)fs->private_volume;
status_t error = B_OK; status_t error = B_OK;
VNode *foundNode = new(nothrow) VNode; VNode *foundNode = new(nothrow) VNode;
@@ -287,8 +289,8 @@ reiserfs_read_symlink(fs_volume *fs, fs_vnode *_node, char *buffer,
// FUNCTION_START(); // FUNCTION_START();
Volume *volume = (Volume*)fs->private_volume; Volume *volume = (Volume*)fs->private_volume;
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
status_t error = B_OK; status_t error = B_OK;
// read symlinks only // read symlinks only
if (!node->IsSymlink()) if (!node->IsSymlink())
@@ -305,8 +307,8 @@ reiserfs_access(fs_volume *fs, fs_vnode *_node, int mode)
{ {
TOUCH(fs); TOUCH(fs);
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
// write access requested? // write access requested?
if (mode & W_OK) if (mode & W_OK)
@@ -326,8 +328,8 @@ reiserfs_read_stat(fs_volume *fs, fs_vnode *_node, struct stat *st)
// FUNCTION_START(); // FUNCTION_START();
Volume *volume = (Volume*)fs->private_volume; Volume *volume = (Volume*)fs->private_volume;
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
status_t error = B_OK; status_t error = B_OK;
StatData *statData = node->GetStatData(); StatData *statData = node->GetStatData();
st->st_dev = volume->GetID(); st->st_dev = volume->GetID();
@@ -355,8 +357,8 @@ reiserfs_open(fs_volume *fs, fs_vnode *_node, int openMode, void **cookie)
// FUNCTION_START(); // FUNCTION_START();
Volume *volume = (Volume*)fs->private_volume; Volume *volume = (Volume*)fs->private_volume;
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
status_t error = B_OK; status_t error = B_OK;
// check the open mode // check the open mode
if ((openMode & O_RWMASK) == O_WRONLY || (openMode & O_RWMASK) == O_RDWR if ((openMode & O_RWMASK) == O_WRONLY || (openMode & O_RWMASK) == O_RDWR
@@ -386,8 +388,8 @@ reiserfs_close(fs_volume *fs, fs_vnode *_node, void *cookie)
TOUCH(fs); TOUCH(cookie); TOUCH(fs); TOUCH(cookie);
// FUNCTION_START(); // FUNCTION_START();
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
TOUCH(node); TOUCH(node);
return B_OK; return B_OK;
} }
@@ -399,8 +401,8 @@ reiserfs_free_cookie(fs_volume *fs, fs_vnode *_node, void *cookie)
TOUCH(fs); TOUCH(fs);
// FUNCTION_START(); // FUNCTION_START();
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
TOUCH(node); TOUCH(node);
StreamReader *reader = (StreamReader*)cookie; StreamReader *reader = (StreamReader*)cookie;
delete reader; delete reader;
@@ -416,9 +418,10 @@ reiserfs_read(fs_volume *fs, fs_vnode *_node, void *cookie, off_t pos,
// FUNCTION_START(); // FUNCTION_START();
// Volume *volume = (Volume*)fs->private_volume; // Volume *volume = (Volume*)fs->private_volume;
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("((%Ld: %lu, %lu), %Ld, %p, %lu)\n", node->GetID(), FUNCTION(("((%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 "), "
node->GetDirID(), node->GetObjectID(), pos, buffer, "%" B_PRIdOFF ", %p, %lu)\n",
*bufferSize)); node->GetID(), node->GetDirID(), node->GetObjectID(),
pos, buffer, *bufferSize));
status_t error = B_OK; status_t error = B_OK;
// don't read anything but files // don't read anything but files
if (!node->IsFile()) { if (!node->IsFile()) {
@@ -446,8 +449,8 @@ public:
DirectoryCookie(Tree *tree, uint32 dirID, uint32 objectID, DirectoryCookie(Tree *tree, uint32 dirID, uint32 objectID,
uint64 startOffset = 0, bool fixedHash = false) uint64 startOffset = 0, bool fixedHash = false)
: DirEntryIterator(tree, dirID, objectID, startOffset, : DirEntryIterator(tree, dirID, objectID, startOffset,
fixedHash), fixedHash),
fEncounteredDotDot(false) fEncounteredDotDot(false)
{ {
} }
@@ -475,8 +478,8 @@ reiserfs_open_dir(fs_volume *fs, fs_vnode *_node, void **cookie)
// FUNCTION_START(); // FUNCTION_START();
Volume *volume = (Volume*)fs->private_volume; Volume *volume = (Volume*)fs->private_volume;
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
status_t error = (node->IsDir() ? B_OK : B_NOT_A_DIRECTORY); status_t error = (node->IsDir() ? B_OK : B_NOT_A_DIRECTORY);
if (error == B_OK) { if (error == B_OK) {
DirectoryCookie *iterator = new(nothrow) DirectoryCookie( DirectoryCookie *iterator = new(nothrow) DirectoryCookie(
@@ -497,7 +500,7 @@ FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
// set_dirent_name // set_dirent_name
static status_t static status_t
set_dirent_name(struct dirent *buffer, size_t bufferSize, set_dirent_name(struct dirent *buffer, size_t bufferSize,
const char *name, int32 nameLen) const char *name, int32 nameLen)
{ {
size_t length = (buffer->d_name + nameLen + 1) - (char*)buffer; size_t length = (buffer->d_name + nameLen + 1) - (char*)buffer;
if (length <= bufferSize) { if (length <= bufferSize) {
@@ -516,8 +519,8 @@ reiserfs_close_dir(fs_volume *fs, fs_vnode *_node, void *cookie)
TOUCH(fs); TOUCH(cookie); TOUCH(fs); TOUCH(cookie);
// FUNCTION_START(); // FUNCTION_START();
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
TOUCH(node); TOUCH(node);
return B_OK; return B_OK;
} }
@@ -529,8 +532,8 @@ reiserfs_free_dir_cookie(fs_volume *fs, fs_vnode *_node, void *cookie)
TOUCH(fs); TOUCH(fs);
// FUNCTION_START(); // FUNCTION_START();
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
TOUCH(node); TOUCH(node);
DirectoryCookie *iterator = (DirectoryCookie*)cookie; DirectoryCookie *iterator = (DirectoryCookie*)cookie;
delete iterator; delete iterator;
@@ -545,8 +548,8 @@ reiserfs_read_dir(fs_volume *fs, fs_vnode *_node, void *cookie,
// FUNCTION_START(); // FUNCTION_START();
Volume *volume = (Volume*)fs->private_volume; Volume *volume = (Volume*)fs->private_volume;
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
DirectoryCookie *iterator = (DirectoryCookie*)cookie; DirectoryCookie *iterator = (DirectoryCookie*)cookie;
status_t error = iterator->Resume(); status_t error = iterator->Resume();
if (error == B_OK) { if (error == B_OK) {
@@ -556,7 +559,7 @@ FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
DirEntry *entry = NULL; DirEntry *entry = NULL;
bool done = false; bool done = false;
while (error == B_OK && !done while (error == B_OK && !done
&& (error = iterator->GetNext(&item, &index, &entry)) == B_OK) { && (error = iterator->GetNext(&item, &index, &entry)) == B_OK) {
uint32 dirID = entry->GetDirID(); uint32 dirID = entry->GetDirID();
uint32 objectID = entry->GetObjectID(); uint32 objectID = entry->GetObjectID();
// skip hidden entries and entries the user specified to be hidden // skip hidden entries and entries the user specified to be hidden
@@ -585,18 +588,22 @@ FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(),
buffer->d_dev = volume->GetID(); buffer->d_dev = volume->GetID();
buffer->d_ino = VNode::GetIDFor(dirID, objectID); buffer->d_ino = VNode::GetIDFor(dirID, objectID);
*count = 1; *count = 1;
PRINT(("Successfully read entry: dir: (%Ld: %ld, %ld), name: `%s', " PRINT(("Successfully read entry: dir: (%" B_PRIdINO ": "
"id: (%Ld, %ld, %ld), reclen: %hu\n", node->GetID(), node->GetDirID(), "%" B_PRIu32 ", %" B_PRIu32 "), name: `%s', "
node->GetObjectID(), buffer->d_name, buffer->d_ino, dirID, objectID, "id: (%" B_PRIdINO ", %" B_PRIu32 ", %" B_PRIu32 "), "
buffer->d_reclen)); "reclen: %hu\n",
node->GetID(),
node->GetDirID(), node->GetObjectID(), buffer->d_name,
buffer->d_ino, dirID, objectID,
buffer->d_reclen));
if (!strcmp("..", buffer->d_name)) if (!strcmp("..", buffer->d_name))
iterator->SetEncounteredDotDot(true); iterator->SetEncounteredDotDot(true);
done = true; done = true;
} }
} }
if (error == B_ENTRY_NOT_FOUND) { if (error == B_ENTRY_NOT_FOUND) {
if (iterator->EncounteredDotDot()) { if (iterator->EncounteredDotDot()) {
error = B_OK; error = B_OK;
*count = 0; *count = 0;
} else { } else {
// this is necessary for the root directory // this is necessary for the root directory
@@ -614,17 +621,21 @@ PRINT(("Successfully read entry: dir: (%Ld: %ld, %ld), name: `%s', "
buffer->d_ino = node->GetID(); buffer->d_ino = node->GetID();
// < That's not correct! // < That's not correct!
*count = 1; *count = 1;
PRINT(("faking `..' entry: dir: (%Ld: %ld, %ld), name: `%s', " PRINT(("faking `..' entry: dir: (%" B_PRIdINO ": "
"id: (%Ld, %ld, %ld), reclen: %hu\n", node->GetID(), node->GetDirID(), "%" B_PRIu32 ", %" B_PRIu32 "), name: `%s', "
node->GetObjectID(), buffer->d_name, buffer->d_ino, node->GetDirID(), "id: (%" B_PRIdINO ", %" B_PRIu32 ", %" B_PRIu32
node->GetObjectID(), buffer->d_reclen)); "), reclen: %hu\n",
node->GetID(),
node->GetDirID(), node->GetObjectID(), buffer->d_name,
buffer->d_ino, node->GetDirID(), node->GetObjectID(),
buffer->d_reclen));
iterator->SetEncounteredDotDot(true); iterator->SetEncounteredDotDot(true);
} }
} }
} }
iterator->Suspend(); iterator->Suspend();
} }
PRINT(("returning %ld entries\n", *count)); PRINT(("returning %" B_PRIu32 " entries\n", *count));
RETURN_ERROR(error); RETURN_ERROR(error);
} }
@@ -635,8 +646,8 @@ reiserfs_rewind_dir(fs_volume *fs, fs_vnode *_node, void *cookie)
TOUCH(fs); TOUCH(fs);
// FUNCTION_START(); // FUNCTION_START();
VNode *node = (VNode*)_node->private_node; VNode *node = (VNode*)_node->private_node;
FUNCTION(("node: (%Ld: %lu, %lu)\n", node->GetID(), node->GetDirID(), FUNCTION(("node: (%" B_PRIdINO ": %" B_PRIu32 ", %" B_PRIu32 ")\n",
node->GetObjectID())); node->GetID(), node->GetDirID(), node->GetObjectID()));
TOUCH(node); TOUCH(node);
DirectoryCookie *iterator = (DirectoryCookie*)cookie; DirectoryCookie *iterator = (DirectoryCookie*)cookie;
status_t error = iterator->Rewind(); // no need to Resume() status_t error = iterator->Rewind(); // no need to Resume()