* 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
This commit is contained in:
@@ -136,6 +136,9 @@ typedef uint32 perform_code;
|
|||||||
/* ino_t */
|
/* ino_t */
|
||||||
#define B_PRIdINO B_PRId64
|
#define B_PRIdINO B_PRId64
|
||||||
#define B_PRIiINO B_PRIi64
|
#define B_PRIiINO B_PRIi64
|
||||||
|
/* time_t */
|
||||||
|
#define B_PRIdTIME B_PRId32
|
||||||
|
#define B_PRIiTIME B_PRIi32
|
||||||
|
|
||||||
|
|
||||||
/* Empty string ("") */
|
/* Empty string ("") */
|
||||||
|
|||||||
@@ -126,6 +126,9 @@ typedef uint32 perform_code;
|
|||||||
/* ino_t */
|
/* ino_t */
|
||||||
#define B_PRIdINO B_PRId64
|
#define B_PRIdINO B_PRId64
|
||||||
#define B_PRIiINO B_PRIi64
|
#define B_PRIiINO B_PRIi64
|
||||||
|
/* time_t */
|
||||||
|
#define B_PRIdTIME B_PRId32
|
||||||
|
#define B_PRIiTIME B_PRIi32
|
||||||
|
|
||||||
|
|
||||||
/* Empty string ("") */
|
/* Empty string ("") */
|
||||||
|
|||||||
@@ -1503,8 +1503,6 @@
|
|||||||
#define gid_t fssh_gid_t
|
#define gid_t fssh_gid_t
|
||||||
#define pid_t fssh_pid_t
|
#define pid_t fssh_pid_t
|
||||||
|
|
||||||
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
|
|
||||||
|
|
||||||
/* printf()/scanf() format strings for [u]int* types */
|
/* printf()/scanf() format strings for [u]int* types */
|
||||||
#define B_PRId8 FSSH_B_PRId8
|
#define B_PRId8 FSSH_B_PRId8
|
||||||
#define B_PRIi8 FSSH_B_PRIi8
|
#define B_PRIi8 FSSH_B_PRIi8
|
||||||
@@ -1575,8 +1573,9 @@
|
|||||||
/* ino_t */
|
/* ino_t */
|
||||||
#define B_PRIdINO FSSH_B_PRIdINO
|
#define B_PRIdINO FSSH_B_PRIdINO
|
||||||
#define B_PRIiINO FSSH_B_PRIiINO
|
#define B_PRIiINO FSSH_B_PRIiINO
|
||||||
|
/* time_t */
|
||||||
#endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
|
#define B_PRIdTIME FSSH_B_PRId32
|
||||||
|
#define B_PRIiTIME FSSH_B_PRIi32
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -123,6 +123,14 @@ typedef int32_t fssh_pid_t;
|
|||||||
/* ino_t */
|
/* ino_t */
|
||||||
#define FSSH_B_PRIdINO FSSH_B_PRId64
|
#define FSSH_B_PRIdINO FSSH_B_PRId64
|
||||||
#define FSSH_B_PRIiINO FSSH_B_PRIi64
|
#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
|
#endif // _FSSH_TYPES_H
|
||||||
|
|||||||
@@ -119,13 +119,13 @@ dump_inode(const bfs_inode* inode)
|
|||||||
kprintf(" gid = %u\n", (unsigned)inode->GroupID());
|
kprintf(" gid = %u\n", (unsigned)inode->GroupID());
|
||||||
kprintf(" mode = %08x\n", (int)inode->Mode());
|
kprintf(" mode = %08x\n", (int)inode->Mode());
|
||||||
kprintf(" flags = %08x\n", (int)inode->Flags());
|
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()),
|
inode->CreateTime(), bfs_inode::ToSecs(inode->CreateTime()),
|
||||||
(unsigned)bfs_inode::ToUsecs(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()),
|
inode->LastModifiedTime(), bfs_inode::ToSecs(inode->LastModifiedTime()),
|
||||||
(unsigned)bfs_inode::ToUsecs(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()),
|
inode->StatusChangeTime(), bfs_inode::ToSecs(inode->StatusChangeTime()),
|
||||||
(unsigned)bfs_inode::ToUsecs(inode->StatusChangeTime()));
|
(unsigned)bfs_inode::ToUsecs(inode->StatusChangeTime()));
|
||||||
dump_block_run( " parent = ", inode->parent);
|
dump_block_run( " parent = ", inode->parent);
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ typeForString(const char *string, type_code *_result)
|
|||||||
// type didn't show up - in this case, we parse the string
|
// type didn't show up - in this case, we parse the string
|
||||||
// as number and use it directly as type code
|
// 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;
|
return B_OK;
|
||||||
|
|
||||||
uchar type[4];
|
uchar type[4];
|
||||||
@@ -173,8 +173,8 @@ main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (size > 4 * 1024 * 1024) {
|
if (size > 4 * 1024 * 1024) {
|
||||||
fprintf(stderr, "%s: attribute value is too large: %Ld bytes\n",
|
fprintf(stderr, "%s: attribute value is too large: %" B_PRIdOFF
|
||||||
gProgramName, size);
|
" bytes\n", gProgramName, size);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ copy_attributes(const char *sourcePath, BNode &source, const char *destPath,
|
|||||||
// created as well
|
// created as well
|
||||||
do {
|
do {
|
||||||
size_t toRead = kCopyBufferSize;
|
size_t toRead = kCopyBufferSize;
|
||||||
if (toRead > bytesLeft)
|
if ((off_t)toRead > bytesLeft)
|
||||||
toRead = bytesLeft;
|
toRead = bytesLeft;
|
||||||
|
|
||||||
// read
|
// read
|
||||||
|
|||||||
@@ -237,8 +237,8 @@ dump_partition_map(const PartitionMap& map)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "offset: %16lld, size: %16lld, type: %x%s\n",
|
fprintf(stderr, "offset: %16" B_PRIdOFF ", size: %16" B_PRIdOFF
|
||||||
(int64)partition->Offset(), (int64)partition->Size(),
|
", type: %x%s\n", partition->Offset(), partition->Size(),
|
||||||
partition->Type(), partition->IsExtended() ? " (extended)" : "");
|
partition->Type(), partition->IsExtended() ? " (extended)" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -658,8 +658,8 @@ main(int argc, const char *const *argv)
|
|||||||
= B_HOST_TO_LENDIAN_INT32((uint32)(partitionOffset / 512));
|
= B_HOST_TO_LENDIAN_INT32((uint32)(partitionOffset / 512));
|
||||||
|
|
||||||
// write the boot code
|
// write the boot code
|
||||||
printf("Writing boot code to \"%s\" (partition offset: %lld bytes, "
|
printf("Writing boot code to \"%s\" (partition offset: %" B_PRId64
|
||||||
"start offset = %lld) "
|
" bytes, start offset = %" B_PRIdOFF ") "
|
||||||
"...\n", fileName, partitionOffset, startOffset);
|
"...\n", fileName, partitionOffset, startOffset);
|
||||||
|
|
||||||
write_boot_code_part(fileName, fd, startOffset, bootCodeData, 0,
|
write_boot_code_part(fileName, fd, startOffset, bootCodeData, 0,
|
||||||
|
|||||||
+6
-6
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Ingo Weinhold, [email protected].
|
* Copyright 2005-2009, Ingo Weinhold, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -364,8 +364,8 @@ struct ListState : State {
|
|||||||
size_t size;
|
size_t size;
|
||||||
for (int32 i = 0;
|
for (int32 i = 0;
|
||||||
resources.GetResourceInfo(i, &type, &id, &name, &size); i++) {
|
resources.GetResourceInfo(i, &type, &id, &name, &size); i++) {
|
||||||
printf("'%s' %11ld %11lu %s\n", resource_type(type), id, size,
|
printf("'%s' %11" B_PRId32 " %11lu %s\n", resource_type(type), id,
|
||||||
(name && strlen(name) > 0 ? name : "(no name)"));
|
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,
|
status_t error = fResources->AddResource(id.type, id.id, data, size,
|
||||||
name);
|
name);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
fprintf(stderr, "Error: Failed to add resource type '%s', ID %ld "
|
fprintf(stderr, "Error: Failed to add resource type '%s', ID %"
|
||||||
"to output file \"%s\": %s\n", resource_type(id.type), id.id,
|
B_PRId32 " to output file \"%s\": %s\n", resource_type(id.type),
|
||||||
fOutputFilePath.c_str(), strerror(error));
|
id.id, fOutputFilePath.c_str(), strerror(error));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,18 +65,20 @@ local kernelEmulationSources =
|
|||||||
vfs.cpp
|
vfs.cpp
|
||||||
;
|
;
|
||||||
|
|
||||||
|
BuildPlatformMergeObject <build>fs_shell_kernel.o : $(kernelEmulationSources) ;
|
||||||
|
|
||||||
BuildPlatformStaticLibrary <build>fuse_module.a :
|
BuildPlatformStaticLibrary <build>fuse_module.a :
|
||||||
$(kernelEmulationSources)
|
|
||||||
$(externalCommandsSources)
|
$(externalCommandsSources)
|
||||||
|
|
||||||
fuse.cpp
|
fuse.cpp
|
||||||
|
: <build>fs_shell_kernel.o
|
||||||
;
|
;
|
||||||
|
|
||||||
BuildPlatformStaticLibrary <build>fs_shell.a :
|
BuildPlatformStaticLibrary <build>fs_shell.a :
|
||||||
$(kernelEmulationSources)
|
|
||||||
$(externalCommandsSources)
|
$(externalCommandsSources)
|
||||||
|
|
||||||
fssh.cpp
|
fssh.cpp
|
||||||
|
: <build>fs_shell_kernel.o
|
||||||
;
|
;
|
||||||
|
|
||||||
SEARCH on [ FGristFiles rootfs.cpp ]
|
SEARCH on [ FGristFiles rootfs.cpp ]
|
||||||
|
|||||||
@@ -319,8 +319,8 @@ notify_transaction_listeners(block_cache* cache, cache_transaction* transaction,
|
|||||||
while (iterator.HasNext()) {
|
while (iterator.HasNext()) {
|
||||||
cache_listener* listener = iterator.Next();
|
cache_listener* listener = iterator.Next();
|
||||||
|
|
||||||
bool remove = isClosing && !is_written_event(listener->events)
|
bool remove = (isClosing && !is_written_event(listener->events))
|
||||||
|| isWritten && is_written_event(listener->events);
|
|| (isWritten && is_written_event(listener->events));
|
||||||
if (remove)
|
if (remove)
|
||||||
iterator.Remove();
|
iterator.Remove();
|
||||||
|
|
||||||
@@ -536,8 +536,9 @@ block_cache::FreeBlock(cached_block* block)
|
|||||||
Free(block->current_data);
|
Free(block->current_data);
|
||||||
|
|
||||||
if (block->original_data != NULL || block->parent_data != NULL) {
|
if (block->original_data != NULL || block->parent_data != NULL) {
|
||||||
fssh_panic("block_cache::FreeBlock(): %Ld, original %p, parent %p\n",
|
fssh_panic("block_cache::FreeBlock(): %" FSSH_B_PRIdOFF
|
||||||
block->block_number, block->original_data, block->parent_data);
|
", original %p, parent %p\n", block->block_number,
|
||||||
|
block->original_data, block->parent_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_CHANGED
|
#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 we hit the limit of blocks to cache¸ try to free one or more
|
||||||
if (allocated_block_count >= kMaxBlockCount) {
|
if (allocated_block_count >= kMaxBlockCount) {
|
||||||
RemoveUnusedBlocks(LONG_MAX,
|
RemoveUnusedBlocks(INT32_MAX,
|
||||||
allocated_block_count - kMaxBlockCount + 1);
|
allocated_block_count - kMaxBlockCount + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -685,7 +686,7 @@ put_cached_block(block_cache* cache, cached_block* block)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cache->allocated_block_count > kMaxBlockCount) {
|
if (cache->allocated_block_count > kMaxBlockCount) {
|
||||||
cache->RemoveUnusedBlocks(LONG_MAX,
|
cache->RemoveUnusedBlocks(INT32_MAX,
|
||||||
cache->allocated_block_count - kMaxBlockCount);
|
cache->allocated_block_count - kMaxBlockCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -695,8 +696,8 @@ static void
|
|||||||
put_cached_block(block_cache* cache, fssh_off_t blockNumber)
|
put_cached_block(block_cache* cache, fssh_off_t blockNumber)
|
||||||
{
|
{
|
||||||
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
||||||
fssh_panic("put_cached_block: invalid block number %lld (max %lld)",
|
fssh_panic("put_cached_block: invalid block number %" FSSH_B_PRIdOFF
|
||||||
blockNumber, cache->max_blocks - 1);
|
" (max %" FSSH_B_PRIdOFF ")", blockNumber, cache->max_blocks - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
cached_block* block = (cached_block*)hash_lookup(cache->hash, &blockNumber);
|
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)
|
bool readBlock = true)
|
||||||
{
|
{
|
||||||
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
||||||
fssh_panic("get_cached_block: invalid block number %lld (max %lld)",
|
fssh_panic("get_cached_block: invalid block number %" FSSH_B_PRIdOFF
|
||||||
blockNumber, cache->max_blocks - 1);
|
" (max %" FSSH_B_PRIdOFF ")", blockNumber, cache->max_blocks - 1);
|
||||||
return NULL;
|
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,
|
if (fssh_read_pos(cache->fd, blockNumber * blockSize, block->current_data,
|
||||||
blockSize) < blockSize) {
|
blockSize) < blockSize) {
|
||||||
cache->RemoveBlock(block);
|
cache->RemoveBlock(block);
|
||||||
FATAL(("could not read block %Ld\n", blockNumber));
|
FATAL(("could not read block %" FSSH_B_PRIdOFF "\n", blockNumber));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -777,8 +778,9 @@ get_writable_cached_block(block_cache* cache, fssh_off_t blockNumber, fssh_off_t
|
|||||||
blockNumber, transactionID));
|
blockNumber, transactionID));
|
||||||
|
|
||||||
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
||||||
fssh_panic("get_writable_cached_block: invalid block number %lld (max %lld)",
|
fssh_panic("get_writable_cached_block: invalid block number %"
|
||||||
blockNumber, cache->max_blocks - 1);
|
FSSH_B_PRIdOFF " (max %" FSSH_B_PRIdOFF ")", blockNumber,
|
||||||
|
cache->max_blocks - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool allocated;
|
bool allocated;
|
||||||
@@ -894,8 +896,8 @@ write_cached_block(block_cache* cache, cached_block* block,
|
|||||||
data, blockSize);
|
data, blockSize);
|
||||||
|
|
||||||
if (written < blockSize) {
|
if (written < blockSize) {
|
||||||
FATAL(("could not write back block %Ld (%s)\n", block->block_number,
|
FATAL(("could not write back block %" FSSH_B_PRIdOFF " (%s)\n",
|
||||||
fssh_strerror(fssh_get_errno())));
|
block->block_number, fssh_strerror(fssh_get_errno())));
|
||||||
return FSSH_B_IO_ERROR;
|
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
|
// transaction or no transaction only
|
||||||
|
|
||||||
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
if (blockNumber < 0 || blockNumber >= cache->max_blocks) {
|
||||||
fssh_panic("block_cache_sync_etc: invalid block number %Ld (max %Ld)",
|
fssh_panic("block_cache_sync_etc: invalid block number %" FSSH_B_PRIdOFF
|
||||||
blockNumber, cache->max_blocks - 1);
|
" (max %" FSSH_B_PRIdOFF ")", blockNumber, cache->max_blocks - 1);
|
||||||
return FSSH_B_BAD_VALUE;
|
return FSSH_B_BAD_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1595,8 +1597,8 @@ fssh_block_cache_discard(void* _cache, fssh_off_t blockNumber,
|
|||||||
} else {
|
} else {
|
||||||
if (block->transaction != NULL && block->parent_data != NULL
|
if (block->transaction != NULL && block->parent_data != NULL
|
||||||
&& block->parent_data != block->current_data) {
|
&& block->parent_data != block->current_data) {
|
||||||
fssh_panic("Discarded block %Ld has already been changed in "
|
fssh_panic("Discarded block %" FSSH_B_PRIdOFF " has already "
|
||||||
"this transaction!", blockNumber);
|
"been changed in this transaction!", blockNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mark it as discarded (in the current transaction only, if any)
|
// mark it as discarded (in the current transaction only, if any)
|
||||||
|
|||||||
+16
-16
@@ -361,13 +361,13 @@ select_fd(int fd, uint8_t event, uint32_t ref, struct select_sync *sync, bool ke
|
|||||||
{
|
{
|
||||||
// struct file_descriptor *descriptor;
|
// struct file_descriptor *descriptor;
|
||||||
// fssh_status_t status;
|
// fssh_status_t status;
|
||||||
//
|
//
|
||||||
// TRACE(("select_fd(fd = %d, event = %u, ref = %lu, selectsync = %p)\n", fd, event, ref, sync));
|
// 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);
|
// descriptor = get_fd(get_current_io_context(kernel), fd);
|
||||||
// if (descriptor == NULL)
|
// if (descriptor == NULL)
|
||||||
// return FSSH_B_FILE_ERROR;
|
// return FSSH_B_FILE_ERROR;
|
||||||
//
|
//
|
||||||
// if (descriptor->ops->fd_select) {
|
// if (descriptor->ops->fd_select) {
|
||||||
// status = descriptor->ops->fd_select(descriptor, event, ref, sync);
|
// status = descriptor->ops->fd_select(descriptor, event, ref, sync);
|
||||||
// } else {
|
// } 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
|
// // immediately notify the select call
|
||||||
// status = notify_select_event((void *)sync, ref, event);
|
// status = notify_select_event((void *)sync, ref, event);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// put_fd(descriptor);
|
// put_fd(descriptor);
|
||||||
// return status;
|
// return status;
|
||||||
|
|
||||||
@@ -388,18 +388,18 @@ deselect_fd(int fd, uint8_t event, struct select_sync *sync, bool kernel)
|
|||||||
{
|
{
|
||||||
// struct file_descriptor *descriptor;
|
// struct file_descriptor *descriptor;
|
||||||
// fssh_status_t status;
|
// fssh_status_t status;
|
||||||
//
|
//
|
||||||
// TRACE(("deselect_fd(fd = %d, event = %u, selectsync = %p)\n", fd, event, sync));
|
// TRACE(("deselect_fd(fd = %d, event = %u, selectsync = %p)\n", fd, event, sync));
|
||||||
//
|
//
|
||||||
// descriptor = get_fd(get_current_io_context(kernel), fd);
|
// descriptor = get_fd(get_current_io_context(kernel), fd);
|
||||||
// if (descriptor == NULL)
|
// if (descriptor == NULL)
|
||||||
// return FSSH_B_FILE_ERROR;
|
// return FSSH_B_FILE_ERROR;
|
||||||
//
|
//
|
||||||
// if (descriptor->ops->fd_deselect)
|
// if (descriptor->ops->fd_deselect)
|
||||||
// status = descriptor->ops->fd_deselect(descriptor, event, sync);
|
// status = descriptor->ops->fd_deselect(descriptor, event, sync);
|
||||||
// else
|
// else
|
||||||
// status = FSSH_B_OK;
|
// status = FSSH_B_OK;
|
||||||
//
|
//
|
||||||
// put_fd(descriptor);
|
// put_fd(descriptor);
|
||||||
// return status;
|
// 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) {
|
if (descriptor->ops->fd_read) {
|
||||||
bytesRead = descriptor->ops->fd_read(descriptor, pos, buffer, &length);
|
bytesRead = descriptor->ops->fd_read(descriptor, pos, buffer, &length);
|
||||||
if (bytesRead >= FSSH_B_OK) {
|
if (bytesRead >= FSSH_B_OK) {
|
||||||
if (length > SSIZE_MAX)
|
if (length > FSSH_SSIZE_MAX)
|
||||||
bytesRead = SSIZE_MAX;
|
bytesRead = FSSH_SSIZE_MAX;
|
||||||
else
|
else
|
||||||
bytesRead = (fssh_ssize_t)length;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((uint32_t)bytesRead + length > SSIZE_MAX)
|
if ((uint32_t)bytesRead + length > FSSH_SSIZE_MAX)
|
||||||
bytesRead = SSIZE_MAX;
|
bytesRead = FSSH_SSIZE_MAX;
|
||||||
else
|
else
|
||||||
bytesRead += (fssh_ssize_t)length;
|
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) {
|
if (descriptor->ops->fd_write) {
|
||||||
bytesWritten = descriptor->ops->fd_write(descriptor, pos, buffer, &length);
|
bytesWritten = descriptor->ops->fd_write(descriptor, pos, buffer, &length);
|
||||||
if (bytesWritten >= FSSH_B_OK) {
|
if (bytesWritten >= FSSH_B_OK) {
|
||||||
if (length > SSIZE_MAX)
|
if (length > FSSH_SSIZE_MAX)
|
||||||
bytesWritten = SSIZE_MAX;
|
bytesWritten = FSSH_SSIZE_MAX;
|
||||||
else
|
else
|
||||||
bytesWritten = (fssh_ssize_t)length;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((uint32_t)bytesWritten + length > SSIZE_MAX)
|
if ((uint32_t)bytesWritten + length > FSSH_SSIZE_MAX)
|
||||||
bytesWritten = SSIZE_MAX;
|
bytesWritten = FSSH_SSIZE_MAX;
|
||||||
else
|
else
|
||||||
bytesWritten += (fssh_ssize_t)length;
|
bytesWritten += (fssh_ssize_t)length;
|
||||||
|
|
||||||
|
|||||||
@@ -249,15 +249,16 @@ fssh_file_cache_create(fssh_mount_id mountID, fssh_vnode_id vnodeID,
|
|||||||
// get vnode
|
// get vnode
|
||||||
fssh_status_t error = vfs_lookup_vnode(mountID, vnodeID, &ref->node);
|
fssh_status_t error = vfs_lookup_vnode(mountID, vnodeID, &ref->node);
|
||||||
if (error != FSSH_B_OK) {
|
if (error != FSSH_B_OK) {
|
||||||
fssh_dprintf("file_cache_create(): Failed get vnode %d:%lld: %s\n",
|
fssh_dprintf("file_cache_create(): Failed get vnode %d:%" FSSH_B_PRIdINO
|
||||||
mountID, vnodeID, fssh_strerror(error));
|
": %s\n", mountID, vnodeID, fssh_strerror(error));
|
||||||
delete ref;
|
delete ref;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create lock
|
// create lock
|
||||||
char buffer[32];
|
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);
|
fssh_mutex_init(&ref->lock, buffer);
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
|
|||||||
@@ -318,7 +318,8 @@ FileMap::_Cache(fssh_off_t offset, fssh_off_t size)
|
|||||||
while (status == FSSH_B_OK && mapEnd < end) {
|
while (status == FSSH_B_OK && mapEnd < end) {
|
||||||
// We don't have the requested extents yet, retrieve them
|
// We don't have the requested extents yet, retrieve them
|
||||||
fssh_size_t vecCount = kMaxVecs;
|
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)
|
if (status == FSSH_B_OK || status == FSSH_B_BUFFER_OVERFLOW)
|
||||||
status = _Add(vecs, vecCount, mapEnd);
|
status = _Add(vecs, vecCount, mapEnd);
|
||||||
}
|
}
|
||||||
@@ -336,8 +337,8 @@ FileMap::SetMode(uint32_t mode)
|
|||||||
|
|
||||||
MutexLocker _(fLock);
|
MutexLocker _(fLock);
|
||||||
|
|
||||||
if (mode == FSSH_FILE_MAP_CACHE_ALL && fCacheAll
|
if ((mode == FSSH_FILE_MAP_CACHE_ALL && fCacheAll)
|
||||||
|| mode == FSSH_FILE_MAP_CACHE_ON_DEMAND && !fCacheAll)
|
|| (mode == FSSH_FILE_MAP_CACHE_ON_DEMAND && !fCacheAll))
|
||||||
return FSSH_B_OK;
|
return FSSH_B_OK;
|
||||||
|
|
||||||
if (mode == FSSH_FILE_MAP_CACHE_ALL) {
|
if (mode == FSSH_FILE_MAP_CACHE_ALL) {
|
||||||
|
|||||||
+12
-11
@@ -300,7 +300,7 @@ byte_string(int64_t numBlocks, int64_t blockSize)
|
|||||||
static char string[64];
|
static char string[64];
|
||||||
|
|
||||||
if (blocks < 1024)
|
if (blocks < 1024)
|
||||||
sprintf(string, "%Ld", numBlocks * blockSize);
|
sprintf(string, "%" FSSH_B_PRId64, numBlocks * blockSize);
|
||||||
else {
|
else {
|
||||||
const char* units[] = {"K", "M", "G", NULL};
|
const char* units[] = {"K", "M", "G", NULL};
|
||||||
int i = -1;
|
int i = -1;
|
||||||
@@ -406,7 +406,8 @@ list_entry(const char* file, const char* name = NULL)
|
|||||||
nameSuffix += buffer;
|
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,
|
fileType, permissions.c_str(), (int)st.fssh_st_uid, (int)st.fssh_st_gid,
|
||||||
st.fssh_st_size,
|
st.fssh_st_size,
|
||||||
1900 + time.tm_year, 1 + time.tm_mon, time.tm_mday,
|
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)
|
if (status != FSSH_B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
printf("root inode: %lld\n", info.root);
|
printf("root inode: %" FSSH_B_PRIdINO "\n", info.root);
|
||||||
printf("flags: ");
|
printf("flags: ");
|
||||||
print_flag(info.flags, FSSH_B_FS_HAS_QUERY, "Q", "-");
|
print_flag(info.flags, FSSH_B_FS_HAS_QUERY, "Q", "-");
|
||||||
print_flag(info.flags, FSSH_B_FS_HAS_ATTR, "A", "-");
|
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_REMOVABLE, "R", "-");
|
||||||
print_flag(info.flags, FSSH_B_FS_IS_READONLY, "-", "W");
|
print_flag(info.flags, FSSH_B_FS_IS_READONLY, "-", "W");
|
||||||
|
|
||||||
printf("\nblock size: %lld\n", info.block_size);
|
printf("\nblock size: %" FSSH_B_PRIdOFF "\n", info.block_size);
|
||||||
printf("I/O size: %lld\n", info.io_size);
|
printf("I/O size: %" FSSH_B_PRIdOFF "\n", info.io_size);
|
||||||
printf("total size: %s (%lld blocks)\n",
|
printf("total size: %s (%" FSSH_B_PRIdOFF " blocks)\n",
|
||||||
byte_string(info.total_blocks, info.block_size), info.total_blocks);
|
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);
|
byte_string(info.free_blocks, info.block_size), info.free_blocks);
|
||||||
printf("total nodes: %lld\n", info.total_nodes);
|
printf("total nodes: %" FSSH_B_PRIdOFF "\n", info.total_nodes);
|
||||||
printf("free nodes: %lld\n", info.free_nodes);
|
printf("free nodes: %" FSSH_B_PRIdOFF "\n", info.free_nodes);
|
||||||
printf("volume name: %s\n", info.volume_name);
|
printf("volume name: %s\n", info.volume_name);
|
||||||
printf("fs name: %s\n", info.fsh_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) {
|
if (error == FSSH_B_OK) {
|
||||||
printf(" %s\n", path);
|
printf(" %s\n", path);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, " failed to resolve entry (%8lld, \"%s\")\n",
|
fprintf(stderr, " failed to resolve entry (%8" FSSH_B_PRIdINO
|
||||||
entry->d_pino, entry->d_name);
|
", \"%s\")\n", entry->d_pino, entry->d_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -793,7 +793,8 @@ restart:
|
|||||||
fssh_mutex_unlock(&sVnodeMutex);
|
fssh_mutex_unlock(&sVnodeMutex);
|
||||||
if (--tries < 0) {
|
if (--tries < 0) {
|
||||||
// vnode doesn't seem to become unbusy
|
// 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;
|
return FSSH_B_BUSY;
|
||||||
}
|
}
|
||||||
fssh_snooze(10000); // 10 ms
|
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);
|
fssh_mutex_unlock(&sVnodeMutex);
|
||||||
|
|
||||||
if (*_vnode == NULL) {
|
if (*_vnode == NULL) {
|
||||||
fssh_panic("lookup_dir_entry(): could not lookup vnode (mountid 0x%x vnid "
|
fssh_panic("lookup_dir_entry(): could not lookup vnode (mountid %d "
|
||||||
"0x%Lx)\n", (int)dir->device, id);
|
"vnid %" FSSH_B_PRIdINO ")\n", (int)dir->device, id);
|
||||||
return FSSH_B_ENTRY_NOT_FOUND;
|
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);
|
struct vnode *vnode = lookup_vnode(volume->id, vnodeID);
|
||||||
if (vnode != NULL) {
|
if (vnode != NULL) {
|
||||||
fssh_panic("vnode %d:%Ld already exists (node = %p, vnode->node = %p)!",
|
fssh_panic("vnode %d:%" FSSH_B_PRIdINO " already exists (node = %p, "
|
||||||
(int)volume->id, vnodeID, privateNode, vnode->private_node);
|
"vnode->node = %p)!", (int)volume->id, vnodeID, privateNode,
|
||||||
|
vnode->private_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
fssh_status_t status = create_new_vnode(&vnode, volume->id, vnodeID);
|
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.
|
// but this vnode won't go away since we keep a reference to it.
|
||||||
previousVnode = vnode;
|
previousVnode = vnode;
|
||||||
} else {
|
} 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user