From cf844822db58eed3db11f93243e38503eb1a4b91 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 25 Nov 2009 12:02:20 +0000 Subject: [PATCH] * Added B_PRIdTIME and B_PRIiTIME macros (for time_t). * Added FSSH_[S]SIZE_MAX to headers/private/fs_shell/fssh_types.h. * Fixed various 64 bit compiler warnings. Nothing too serious, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34241 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/build/os/support/SupportDefs.h | 3 ++ headers/os/support/SupportDefs.h | 3 ++ headers/private/fs_shell/fssh_api_wrapper.h | 7 ++-- headers/private/fs_shell/fssh_types.h | 8 ++++ src/add-ons/kernel/file_systems/bfs/Debug.cpp | 6 +-- src/bin/addattr/main.cpp | 6 +-- src/bin/copyattr.cpp | 2 +- .../platform/bios_ia32/makebootable.cpp | 8 ++-- src/bin/xres.cpp | 12 +++--- src/tools/fs_shell/Jamfile | 6 ++- src/tools/fs_shell/block_cache.cpp | 40 ++++++++++--------- src/tools/fs_shell/fd.cpp | 32 +++++++-------- src/tools/fs_shell/file_cache.cpp | 7 ++-- src/tools/fs_shell/file_map.cpp | 7 ++-- src/tools/fs_shell/fssh.cpp | 23 ++++++----- src/tools/fs_shell/vfs.cpp | 15 ++++--- 16 files changed, 104 insertions(+), 81 deletions(-) diff --git a/headers/build/os/support/SupportDefs.h b/headers/build/os/support/SupportDefs.h index f24cfb6af1..d10b2af50a 100644 --- a/headers/build/os/support/SupportDefs.h +++ b/headers/build/os/support/SupportDefs.h @@ -136,6 +136,9 @@ typedef uint32 perform_code; /* ino_t */ #define B_PRIdINO B_PRId64 #define B_PRIiINO B_PRIi64 +/* time_t */ +#define B_PRIdTIME B_PRId32 +#define B_PRIiTIME B_PRIi32 /* Empty string ("") */ diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h index 6266ff236c..401d5d99d2 100644 --- a/headers/os/support/SupportDefs.h +++ b/headers/os/support/SupportDefs.h @@ -126,6 +126,9 @@ typedef uint32 perform_code; /* ino_t */ #define B_PRIdINO B_PRId64 #define B_PRIiINO B_PRIi64 +/* time_t */ +#define B_PRIdTIME B_PRId32 +#define B_PRIiTIME B_PRIi32 /* Empty string ("") */ diff --git a/headers/private/fs_shell/fssh_api_wrapper.h b/headers/private/fs_shell/fssh_api_wrapper.h index 3f8af443de..2e583f3da2 100644 --- a/headers/private/fs_shell/fssh_api_wrapper.h +++ b/headers/private/fs_shell/fssh_api_wrapper.h @@ -1503,8 +1503,6 @@ #define gid_t fssh_gid_t #define pid_t fssh_pid_t -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) - /* printf()/scanf() format strings for [u]int* types */ #define B_PRId8 FSSH_B_PRId8 #define B_PRIi8 FSSH_B_PRIi8 @@ -1575,8 +1573,9 @@ /* ino_t */ #define B_PRIdINO FSSH_B_PRIdINO #define B_PRIiINO FSSH_B_PRIiINO - -#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */ +/* time_t */ +#define B_PRIdTIME FSSH_B_PRId32 +#define B_PRIiTIME FSSH_B_PRIi32 //////////////////////////////////////////////////////////////////////////////// diff --git a/headers/private/fs_shell/fssh_types.h b/headers/private/fs_shell/fssh_types.h index a5624b8596..b1718b2b99 100644 --- a/headers/private/fs_shell/fssh_types.h +++ b/headers/private/fs_shell/fssh_types.h @@ -123,6 +123,14 @@ typedef int32_t fssh_pid_t; /* ino_t */ #define FSSH_B_PRIdINO FSSH_B_PRId64 #define FSSH_B_PRIiINO FSSH_B_PRIi64 +/* time_t */ +#define FSSH_B_PRIdTIME FSSH_B_PRId32 +#define FSSH_B_PRIiTIME FSSH_B_PRIi32 + + +/* limits */ +#define FSSH_SIZE_MAX UINT32_MAX +#define FSSH_SSIZE_MAX INT32_MAX #endif // _FSSH_TYPES_H diff --git a/src/add-ons/kernel/file_systems/bfs/Debug.cpp b/src/add-ons/kernel/file_systems/bfs/Debug.cpp index 9d52a028a6..eb9c26df04 100644 --- a/src/add-ons/kernel/file_systems/bfs/Debug.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Debug.cpp @@ -119,13 +119,13 @@ dump_inode(const bfs_inode* inode) kprintf(" gid = %u\n", (unsigned)inode->GroupID()); kprintf(" mode = %08x\n", (int)inode->Mode()); kprintf(" flags = %08x\n", (int)inode->Flags()); - kprintf(" create_time = %" B_PRIx64 " (%ld.%u)\n", + kprintf(" create_time = %" B_PRIx64 " (%" B_PRIdTIME ".%u)\n", inode->CreateTime(), bfs_inode::ToSecs(inode->CreateTime()), (unsigned)bfs_inode::ToUsecs(inode->CreateTime())); - kprintf(" last_modified_time = %" B_PRIx64 " (%ld.%u)\n", + kprintf(" last_modified_time = %" B_PRIx64 " (%" B_PRIdTIME ".%u)\n", inode->LastModifiedTime(), bfs_inode::ToSecs(inode->LastModifiedTime()), (unsigned)bfs_inode::ToUsecs(inode->LastModifiedTime())); - kprintf(" status_change_time = %" B_PRIx64 " (%ld.%u)\n", + kprintf(" status_change_time = %" B_PRIx64 " (%" B_PRIdTIME ".%u)\n", inode->StatusChangeTime(), bfs_inode::ToSecs(inode->StatusChangeTime()), (unsigned)bfs_inode::ToUsecs(inode->StatusChangeTime())); dump_block_run( " parent = ", inode->parent); diff --git a/src/bin/addattr/main.cpp b/src/bin/addattr/main.cpp index 2059cbd3dc..8552e11362 100644 --- a/src/bin/addattr/main.cpp +++ b/src/bin/addattr/main.cpp @@ -70,7 +70,7 @@ typeForString(const char *string, type_code *_result) // type didn't show up - in this case, we parse the string // as number and use it directly as type code - if (sscanf(string, "%lu", _result) == 1) + if (sscanf(string, "%" B_SCNu32, _result) == 1) return B_OK; uchar type[4]; @@ -173,8 +173,8 @@ main(int argc, char *argv[]) return 1; } if (size > 4 * 1024 * 1024) { - fprintf(stderr, "%s: attribute value is too large: %Ld bytes\n", - gProgramName, size); + fprintf(stderr, "%s: attribute value is too large: %" B_PRIdOFF + " bytes\n", gProgramName, size); return 1; } diff --git a/src/bin/copyattr.cpp b/src/bin/copyattr.cpp index 6683df6f7d..c7b9aa30c9 100644 --- a/src/bin/copyattr.cpp +++ b/src/bin/copyattr.cpp @@ -222,7 +222,7 @@ copy_attributes(const char *sourcePath, BNode &source, const char *destPath, // created as well do { size_t toRead = kCopyBufferSize; - if (toRead > bytesLeft) + if ((off_t)toRead > bytesLeft) toRead = bytesLeft; // read diff --git a/src/bin/makebootable/platform/bios_ia32/makebootable.cpp b/src/bin/makebootable/platform/bios_ia32/makebootable.cpp index 919e42fc91..7208b3e7a7 100644 --- a/src/bin/makebootable/platform/bios_ia32/makebootable.cpp +++ b/src/bin/makebootable/platform/bios_ia32/makebootable.cpp @@ -237,8 +237,8 @@ dump_partition_map(const PartitionMap& map) continue; } - fprintf(stderr, "offset: %16lld, size: %16lld, type: %x%s\n", - (int64)partition->Offset(), (int64)partition->Size(), + fprintf(stderr, "offset: %16" B_PRIdOFF ", size: %16" B_PRIdOFF + ", type: %x%s\n", partition->Offset(), partition->Size(), partition->Type(), partition->IsExtended() ? " (extended)" : ""); } } @@ -658,8 +658,8 @@ main(int argc, const char *const *argv) = B_HOST_TO_LENDIAN_INT32((uint32)(partitionOffset / 512)); // write the boot code - printf("Writing boot code to \"%s\" (partition offset: %lld bytes, " - "start offset = %lld) " + printf("Writing boot code to \"%s\" (partition offset: %" B_PRId64 + " bytes, start offset = %" B_PRIdOFF ") " "...\n", fileName, partitionOffset, startOffset); write_boot_code_part(fileName, fd, startOffset, bootCodeData, 0, diff --git a/src/bin/xres.cpp b/src/bin/xres.cpp index b51404edba..9d2cc510ba 100644 --- a/src/bin/xres.cpp +++ b/src/bin/xres.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2005, Ingo Weinhold, bonefish@users.sf.net. + * Copyright 2005-2009, Ingo Weinhold, bonefish@users.sf.net. * Distributed under the terms of the MIT License. */ @@ -364,8 +364,8 @@ struct ListState : State { size_t size; for (int32 i = 0; resources.GetResourceInfo(i, &type, &id, &name, &size); i++) { - printf("'%s' %11ld %11lu %s\n", resource_type(type), id, size, - (name && strlen(name) > 0 ? name : "(no name)")); + printf("'%s' %11" B_PRId32 " %11lu %s\n", resource_type(type), id, + size, (name && strlen(name) > 0 ? name : "(no name)")); } } }; @@ -479,9 +479,9 @@ struct WriteFileState : State { status_t error = fResources->AddResource(id.type, id.id, data, size, name); if (error != B_OK) { - fprintf(stderr, "Error: Failed to add resource type '%s', ID %ld " - "to output file \"%s\": %s\n", resource_type(id.type), id.id, - fOutputFilePath.c_str(), strerror(error)); + fprintf(stderr, "Error: Failed to add resource type '%s', ID %" + B_PRId32 " to output file \"%s\": %s\n", resource_type(id.type), + id.id, fOutputFilePath.c_str(), strerror(error)); exit(1); } } diff --git a/src/tools/fs_shell/Jamfile b/src/tools/fs_shell/Jamfile index b084796071..0c9f386e2e 100644 --- a/src/tools/fs_shell/Jamfile +++ b/src/tools/fs_shell/Jamfile @@ -65,18 +65,20 @@ local kernelEmulationSources = vfs.cpp ; +BuildPlatformMergeObject fs_shell_kernel.o : $(kernelEmulationSources) ; + BuildPlatformStaticLibrary fuse_module.a : - $(kernelEmulationSources) $(externalCommandsSources) fuse.cpp + : fs_shell_kernel.o ; BuildPlatformStaticLibrary fs_shell.a : - $(kernelEmulationSources) $(externalCommandsSources) fssh.cpp + : fs_shell_kernel.o ; SEARCH on [ FGristFiles rootfs.cpp ] diff --git a/src/tools/fs_shell/block_cache.cpp b/src/tools/fs_shell/block_cache.cpp index c657a7ed77..98addc6214 100644 --- a/src/tools/fs_shell/block_cache.cpp +++ b/src/tools/fs_shell/block_cache.cpp @@ -319,8 +319,8 @@ notify_transaction_listeners(block_cache* cache, cache_transaction* transaction, while (iterator.HasNext()) { cache_listener* listener = iterator.Next(); - bool remove = isClosing && !is_written_event(listener->events) - || isWritten && is_written_event(listener->events); + bool remove = (isClosing && !is_written_event(listener->events)) + || (isWritten && is_written_event(listener->events)); if (remove) iterator.Remove(); @@ -536,8 +536,9 @@ block_cache::FreeBlock(cached_block* block) Free(block->current_data); if (block->original_data != NULL || block->parent_data != NULL) { - fssh_panic("block_cache::FreeBlock(): %Ld, original %p, parent %p\n", - block->block_number, block->original_data, block->parent_data); + fssh_panic("block_cache::FreeBlock(): %" FSSH_B_PRIdOFF + ", original %p, parent %p\n", block->block_number, + block->original_data, block->parent_data); } #ifdef DEBUG_CHANGED @@ -560,7 +561,7 @@ block_cache::NewBlock(fssh_off_t blockNumber) // if we hit the limit of blocks to cache¸ try to free one or more if (allocated_block_count >= kMaxBlockCount) { - RemoveUnusedBlocks(LONG_MAX, + RemoveUnusedBlocks(INT32_MAX, allocated_block_count - kMaxBlockCount + 1); } @@ -685,7 +686,7 @@ put_cached_block(block_cache* cache, cached_block* block) } if (cache->allocated_block_count > kMaxBlockCount) { - cache->RemoveUnusedBlocks(LONG_MAX, + cache->RemoveUnusedBlocks(INT32_MAX, cache->allocated_block_count - kMaxBlockCount); } } @@ -695,8 +696,8 @@ static void put_cached_block(block_cache* cache, fssh_off_t blockNumber) { if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - fssh_panic("put_cached_block: invalid block number %lld (max %lld)", - blockNumber, cache->max_blocks - 1); + fssh_panic("put_cached_block: invalid block number %" FSSH_B_PRIdOFF + " (max %" FSSH_B_PRIdOFF ")", blockNumber, cache->max_blocks - 1); } cached_block* block = (cached_block*)hash_lookup(cache->hash, &blockNumber); @@ -719,8 +720,8 @@ get_cached_block(block_cache* cache, fssh_off_t blockNumber, bool* _allocated, bool readBlock = true) { if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - fssh_panic("get_cached_block: invalid block number %lld (max %lld)", - blockNumber, cache->max_blocks - 1); + fssh_panic("get_cached_block: invalid block number %" FSSH_B_PRIdOFF + " (max %" FSSH_B_PRIdOFF ")", blockNumber, cache->max_blocks - 1); return NULL; } @@ -744,7 +745,7 @@ get_cached_block(block_cache* cache, fssh_off_t blockNumber, bool* _allocated, if (fssh_read_pos(cache->fd, blockNumber * blockSize, block->current_data, blockSize) < blockSize) { cache->RemoveBlock(block); - FATAL(("could not read block %Ld\n", blockNumber)); + FATAL(("could not read block %" FSSH_B_PRIdOFF "\n", blockNumber)); return NULL; } } @@ -777,8 +778,9 @@ get_writable_cached_block(block_cache* cache, fssh_off_t blockNumber, fssh_off_t blockNumber, transactionID)); if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - fssh_panic("get_writable_cached_block: invalid block number %lld (max %lld)", - blockNumber, cache->max_blocks - 1); + fssh_panic("get_writable_cached_block: invalid block number %" + FSSH_B_PRIdOFF " (max %" FSSH_B_PRIdOFF ")", blockNumber, + cache->max_blocks - 1); } bool allocated; @@ -894,8 +896,8 @@ write_cached_block(block_cache* cache, cached_block* block, data, blockSize); if (written < blockSize) { - FATAL(("could not write back block %Ld (%s)\n", block->block_number, - fssh_strerror(fssh_get_errno()))); + FATAL(("could not write back block %" FSSH_B_PRIdOFF " (%s)\n", + block->block_number, fssh_strerror(fssh_get_errno()))); return FSSH_B_IO_ERROR; } @@ -1548,8 +1550,8 @@ fssh_block_cache_sync_etc(void* _cache, fssh_off_t blockNumber, // transaction or no transaction only if (blockNumber < 0 || blockNumber >= cache->max_blocks) { - fssh_panic("block_cache_sync_etc: invalid block number %Ld (max %Ld)", - blockNumber, cache->max_blocks - 1); + fssh_panic("block_cache_sync_etc: invalid block number %" FSSH_B_PRIdOFF + " (max %" FSSH_B_PRIdOFF ")", blockNumber, cache->max_blocks - 1); return FSSH_B_BAD_VALUE; } @@ -1595,8 +1597,8 @@ fssh_block_cache_discard(void* _cache, fssh_off_t blockNumber, } else { if (block->transaction != NULL && block->parent_data != NULL && block->parent_data != block->current_data) { - fssh_panic("Discarded block %Ld has already been changed in " - "this transaction!", blockNumber); + fssh_panic("Discarded block %" FSSH_B_PRIdOFF " has already " + "been changed in this transaction!", blockNumber); } // mark it as discarded (in the current transaction only, if any) diff --git a/src/tools/fs_shell/fd.cpp b/src/tools/fs_shell/fd.cpp index d61499cbed..305a867b3a 100644 --- a/src/tools/fs_shell/fd.cpp +++ b/src/tools/fs_shell/fd.cpp @@ -361,13 +361,13 @@ select_fd(int fd, uint8_t event, uint32_t ref, struct select_sync *sync, bool ke { // struct file_descriptor *descriptor; // fssh_status_t status; -// +// // TRACE(("select_fd(fd = %d, event = %u, ref = %lu, selectsync = %p)\n", fd, event, ref, sync)); -// +// // descriptor = get_fd(get_current_io_context(kernel), fd); // if (descriptor == NULL) // return FSSH_B_FILE_ERROR; -// +// // if (descriptor->ops->fd_select) { // status = descriptor->ops->fd_select(descriptor, event, ref, sync); // } else { @@ -375,7 +375,7 @@ select_fd(int fd, uint8_t event, uint32_t ref, struct select_sync *sync, bool ke // // immediately notify the select call // status = notify_select_event((void *)sync, ref, event); // } -// +// // put_fd(descriptor); // return status; @@ -388,18 +388,18 @@ deselect_fd(int fd, uint8_t event, struct select_sync *sync, bool kernel) { // struct file_descriptor *descriptor; // fssh_status_t status; -// +// // TRACE(("deselect_fd(fd = %d, event = %u, selectsync = %p)\n", fd, event, sync)); -// +// // descriptor = get_fd(get_current_io_context(kernel), fd); // if (descriptor == NULL) // return FSSH_B_FILE_ERROR; -// +// // if (descriptor->ops->fd_deselect) // status = descriptor->ops->fd_deselect(descriptor, event, sync); // else // status = FSSH_B_OK; -// +// // put_fd(descriptor); // return status; @@ -485,8 +485,8 @@ _kern_read(int fd, fssh_off_t pos, void *buffer, fssh_size_t length) if (descriptor->ops->fd_read) { bytesRead = descriptor->ops->fd_read(descriptor, pos, buffer, &length); if (bytesRead >= FSSH_B_OK) { - if (length > SSIZE_MAX) - bytesRead = SSIZE_MAX; + if (length > FSSH_SSIZE_MAX) + bytesRead = FSSH_SSIZE_MAX; else bytesRead = (fssh_ssize_t)length; @@ -528,8 +528,8 @@ _kern_readv(int fd, fssh_off_t pos, const fssh_iovec *vecs, fssh_size_t count) break; } - if ((uint32_t)bytesRead + length > SSIZE_MAX) - bytesRead = SSIZE_MAX; + if ((uint32_t)bytesRead + length > FSSH_SSIZE_MAX) + bytesRead = FSSH_SSIZE_MAX; else bytesRead += (fssh_ssize_t)length; @@ -564,8 +564,8 @@ _kern_write(int fd, fssh_off_t pos, const void *buffer, fssh_size_t length) if (descriptor->ops->fd_write) { bytesWritten = descriptor->ops->fd_write(descriptor, pos, buffer, &length); if (bytesWritten >= FSSH_B_OK) { - if (length > SSIZE_MAX) - bytesWritten = SSIZE_MAX; + if (length > FSSH_SSIZE_MAX) + bytesWritten = FSSH_SSIZE_MAX; else bytesWritten = (fssh_ssize_t)length; @@ -607,8 +607,8 @@ _kern_writev(int fd, fssh_off_t pos, const fssh_iovec *vecs, fssh_size_t count) break; } - if ((uint32_t)bytesWritten + length > SSIZE_MAX) - bytesWritten = SSIZE_MAX; + if ((uint32_t)bytesWritten + length > FSSH_SSIZE_MAX) + bytesWritten = FSSH_SSIZE_MAX; else bytesWritten += (fssh_ssize_t)length; diff --git a/src/tools/fs_shell/file_cache.cpp b/src/tools/fs_shell/file_cache.cpp index c66195005a..de5d28e454 100644 --- a/src/tools/fs_shell/file_cache.cpp +++ b/src/tools/fs_shell/file_cache.cpp @@ -249,15 +249,16 @@ fssh_file_cache_create(fssh_mount_id mountID, fssh_vnode_id vnodeID, // get vnode fssh_status_t error = vfs_lookup_vnode(mountID, vnodeID, &ref->node); if (error != FSSH_B_OK) { - fssh_dprintf("file_cache_create(): Failed get vnode %d:%lld: %s\n", - mountID, vnodeID, fssh_strerror(error)); + fssh_dprintf("file_cache_create(): Failed get vnode %d:%" FSSH_B_PRIdINO + ": %s\n", mountID, vnodeID, fssh_strerror(error)); delete ref; return NULL; } // create lock char buffer[32]; - fssh_snprintf(buffer, sizeof(buffer), "file cache %d:%lld", (int)mountID, vnodeID); + fssh_snprintf(buffer, sizeof(buffer), "file cache %d:%" FSSH_B_PRIdINO, + (int)mountID, vnodeID); fssh_mutex_init(&ref->lock, buffer); return ref; diff --git a/src/tools/fs_shell/file_map.cpp b/src/tools/fs_shell/file_map.cpp index f75f38fcdd..df65abce79 100644 --- a/src/tools/fs_shell/file_map.cpp +++ b/src/tools/fs_shell/file_map.cpp @@ -318,7 +318,8 @@ FileMap::_Cache(fssh_off_t offset, fssh_off_t size) while (status == FSSH_B_OK && mapEnd < end) { // We don't have the requested extents yet, retrieve them fssh_size_t vecCount = kMaxVecs; - status = vfs_get_file_map(Vnode(), mapEnd, ~0UL, vecs, &vecCount); + status = vfs_get_file_map(Vnode(), mapEnd, FSSH_SIZE_MAX, vecs, + &vecCount); if (status == FSSH_B_OK || status == FSSH_B_BUFFER_OVERFLOW) status = _Add(vecs, vecCount, mapEnd); } @@ -336,8 +337,8 @@ FileMap::SetMode(uint32_t mode) MutexLocker _(fLock); - if (mode == FSSH_FILE_MAP_CACHE_ALL && fCacheAll - || mode == FSSH_FILE_MAP_CACHE_ON_DEMAND && !fCacheAll) + if ((mode == FSSH_FILE_MAP_CACHE_ALL && fCacheAll) + || (mode == FSSH_FILE_MAP_CACHE_ON_DEMAND && !fCacheAll)) return FSSH_B_OK; if (mode == FSSH_FILE_MAP_CACHE_ALL) { diff --git a/src/tools/fs_shell/fssh.cpp b/src/tools/fs_shell/fssh.cpp index 65b00e5ed0..5f6a2f507e 100644 --- a/src/tools/fs_shell/fssh.cpp +++ b/src/tools/fs_shell/fssh.cpp @@ -300,7 +300,7 @@ byte_string(int64_t numBlocks, int64_t blockSize) static char string[64]; if (blocks < 1024) - sprintf(string, "%Ld", numBlocks * blockSize); + sprintf(string, "%" FSSH_B_PRId64, numBlocks * blockSize); else { const char* units[] = {"K", "M", "G", NULL}; int i = -1; @@ -406,7 +406,8 @@ list_entry(const char* file, const char* name = NULL) nameSuffix += buffer; } - printf("%c%s %2d %2d %10lld %d-%02d-%02d %02d:%02d:%02d %s%s\n", + printf("%c%s %2d %2d %10" FSSH_B_PRIdOFF + " %d-%02d-%02d %02d:%02d:%02d %s%s\n", fileType, permissions.c_str(), (int)st.fssh_st_uid, (int)st.fssh_st_gid, st.fssh_st_size, 1900 + time.tm_year, 1 + time.tm_mon, time.tm_mday, @@ -706,7 +707,7 @@ command_info(int argc, const char* const* argv) if (status != FSSH_B_OK) return status; - printf("root inode: %lld\n", info.root); + printf("root inode: %" FSSH_B_PRIdINO "\n", info.root); printf("flags: "); print_flag(info.flags, FSSH_B_FS_HAS_QUERY, "Q", "-"); print_flag(info.flags, FSSH_B_FS_HAS_ATTR, "A", "-"); @@ -716,14 +717,14 @@ command_info(int argc, const char* const* argv) print_flag(info.flags, FSSH_B_FS_IS_REMOVABLE, "R", "-"); print_flag(info.flags, FSSH_B_FS_IS_READONLY, "-", "W"); - printf("\nblock size: %lld\n", info.block_size); - printf("I/O size: %lld\n", info.io_size); - printf("total size: %s (%lld blocks)\n", + printf("\nblock size: %" FSSH_B_PRIdOFF "\n", info.block_size); + printf("I/O size: %" FSSH_B_PRIdOFF "\n", info.io_size); + printf("total size: %s (%" FSSH_B_PRIdOFF " blocks)\n", byte_string(info.total_blocks, info.block_size), info.total_blocks); - printf("free size: %s (%lld blocks)\n", + printf("free size: %s (%" FSSH_B_PRIdOFF " blocks)\n", byte_string(info.free_blocks, info.block_size), info.free_blocks); - printf("total nodes: %lld\n", info.total_nodes); - printf("free nodes: %lld\n", info.free_nodes); + printf("total nodes: %" FSSH_B_PRIdOFF "\n", info.total_nodes); + printf("free nodes: %" FSSH_B_PRIdOFF "\n", info.free_nodes); printf("volume name: %s\n", info.volume_name); printf("fs name: %s\n", info.fsh_name); @@ -1089,8 +1090,8 @@ command_query(int argc, const char* const* argv) if (error == FSSH_B_OK) { printf(" %s\n", path); } else { - fprintf(stderr, " failed to resolve entry (%8lld, \"%s\")\n", - entry->d_pino, entry->d_name); + fprintf(stderr, " failed to resolve entry (%8" FSSH_B_PRIdINO + ", \"%s\")\n", entry->d_pino, entry->d_name); } } diff --git a/src/tools/fs_shell/vfs.cpp b/src/tools/fs_shell/vfs.cpp index 2036a6ad53..28b0e859bc 100644 --- a/src/tools/fs_shell/vfs.cpp +++ b/src/tools/fs_shell/vfs.cpp @@ -793,7 +793,8 @@ restart: fssh_mutex_unlock(&sVnodeMutex); if (--tries < 0) { // vnode doesn't seem to become unbusy - fssh_panic("vnode %d:%lld is not becoming unbusy!\n", (int)mountID, vnodeID); + fssh_panic("vnode %d:%" FSSH_B_PRIdINO " is not becoming unbusy!\n", + (int)mountID, vnodeID); return FSSH_B_BUSY; } fssh_snooze(10000); // 10 ms @@ -1080,8 +1081,8 @@ lookup_dir_entry(struct vnode* dir, const char* name, struct vnode** _vnode) fssh_mutex_unlock(&sVnodeMutex); if (*_vnode == NULL) { - fssh_panic("lookup_dir_entry(): could not lookup vnode (mountid 0x%x vnid " - "0x%Lx)\n", (int)dir->device, id); + fssh_panic("lookup_dir_entry(): could not lookup vnode (mountid %d " + "vnid %" FSSH_B_PRIdINO ")\n", (int)dir->device, id); return FSSH_B_ENTRY_NOT_FOUND; } @@ -1906,8 +1907,9 @@ fssh_new_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID, struct vnode *vnode = lookup_vnode(volume->id, vnodeID); if (vnode != NULL) { - fssh_panic("vnode %d:%Ld already exists (node = %p, vnode->node = %p)!", - (int)volume->id, vnodeID, privateNode, vnode->private_node); + fssh_panic("vnode %d:%" FSSH_B_PRIdINO " already exists (node = %p, " + "vnode->node = %p)!", (int)volume->id, vnodeID, privateNode, + vnode->private_node); } fssh_status_t status = create_new_vnode(&vnode, volume->id, vnodeID); @@ -4868,7 +4870,8 @@ fs_sync(fssh_dev_t device) // but this vnode won't go away since we keep a reference to it. previousVnode = vnode; } else { - fssh_dprintf("syncing of mount %d stopped due to vnode %lld.\n", (int)mount->id, id); + fssh_dprintf("syncing of mount %d stopped due to vnode %" + FSSH_B_PRIdINO ".\n", (int)mount->id, id); break; } }