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
@@ -51,7 +51,8 @@ using std::nothrow;
// constructor // constructor
BlockCache::BlockCache() BlockCache::BlockCache()
: fDevice(-1), :
fDevice(-1),
fBlockSize(0), fBlockSize(0),
fBlockCount(0), fBlockCount(0),
fLock(), fLock(),
@@ -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()));
} }
@@ -39,7 +39,8 @@ static const bool kDefaultHideEsoteric = true;
// constructor // constructor
Settings::Settings() Settings::Settings()
: fDefaultVolumeName(), :
fDefaultVolumeName(),
fVolumeName(), fVolumeName(),
fHideEsoteric(kDefaultHideEsoteric), fHideEsoteric(kDefaultHideEsoteric),
fHiddenEntries(5) 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));
} }
@@ -222,7 +225,8 @@ 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;
} }
@@ -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()) {
@@ -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(
@@ -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) {
@@ -585,9 +588,13 @@ 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 "), "
"reclen: %hu\n",
node->GetID(),
node->GetDirID(), node->GetObjectID(), buffer->d_name,
buffer->d_ino, dirID, objectID,
buffer->d_reclen)); buffer->d_reclen));
if (!strcmp("..", buffer->d_name)) if (!strcmp("..", buffer->d_name))
iterator->SetEncounteredDotDot(true); iterator->SetEncounteredDotDot(true);
@@ -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()