UserlandFS: Make 64 bit clean and enable build for x86_64.

I did not bother to fix the BeOS kernel emulation, so this part is
still left out of the x86_64 build.
This commit is contained in:
Michael Lotz
2015-03-29 16:25:17 +02:00
parent 47ff5824b8
commit ffba66060b
16 changed files with 159 additions and 99 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ local packages = [ FFilterByBuildFeatures
HaikuWelcome HaikuWelcome
MakefileEngine MakefileEngine
NetFS@!x86_64 NetFS@!x86_64
UserlandFS@!x86_64 UserlandFS
] ]
; ;
+7 -5
View File
@@ -11,11 +11,13 @@ AddFilesToPackage servers : userlandfs_server ;
# libs # libs
local userlandfsLibs = local userlandfsLibs = [ FFilterByBuildFeatures
libuserlandfs_beos_kernel.so libuserlandfs_beos_kernel.so@!x86_64
libuserlandfs_haiku_kernel.so libuserlandfs_haiku_kernel.so
libuserlandfs_fuse.so libuserlandfs_fuse.so
; ]
;
AddLibrariesToPackage lib : $(userlandfsLibs) ; AddLibrariesToPackage lib : $(userlandfsLibs) ;
# TODO move development stuff to a separate package? # TODO move development stuff to a separate package?
+1 -1
View File
@@ -16,7 +16,7 @@ local packages = [ FFilterByBuildFeatures
haiku_welcome haiku_welcome
makefile_engine makefile_engine
netfs@!x86_64 netfs@!x86_64
userland_fs@!x86_64 userland_fs
haiku_$(secondaryArchs) haiku_$(secondaryArchs)
haiku_$(secondaryArchs)_devel haiku_$(secondaryArchs)_devel
@@ -303,6 +303,44 @@ struct HashKey64 {
}; };
// HashKeyPointer
template<typename Value>
struct HashKeyPointer {
HashKeyPointer() {}
HashKeyPointer(const Value& value) : value(value) {}
uint32 GetHashCode() const
{
#if __HAIKU_ARCH_BITS == 32
return (uint32)(addr_t)value;
#elif __HAIKU_ARCH_BITS == 64
uint64 v = (uint64)(addr_t)value;
return (uint32)(v >> 32) ^ (uint32)v;
#else
#error unknown bitness
#endif
}
HashKeyPointer<Value> operator=(const HashKeyPointer<Value>& other)
{
value = other.value;
return *this;
}
bool operator==(const HashKeyPointer<Value>& other) const
{
return (value == other.value);
}
bool operator!=(const HashKeyPointer<Value>& other) const
{
return (value != other.value);
}
Value value;
};
// HashMap // HashMap
// constructor // constructor
@@ -35,7 +35,7 @@ static const bigtime_t kNotificationRequestTimeout = 50000; // 50 ms
struct FileSystem::SelectSyncMap struct FileSystem::SelectSyncMap
: public SynchronizedHashMap<HashKey32<selectsync*>, int32*> { : public SynchronizedHashMap<HashKeyPointer<selectsync*>, int32*> {
}; };
@@ -221,7 +221,7 @@ FileSystem::~FileSystem()
ops = next; ops = next;
} }
if (count > 0) if (count > 0)
WARN(("Deleted %ld vnode ops vectors!\n", count)); WARN(("Deleted %" B_PRId32 " vnode ops vectors!\n", count));
mutex_destroy(&fVolumeLock); mutex_destroy(&fVolumeLock);
@@ -81,7 +81,7 @@ public:
RequestPortPool* GetPortPool(); RequestPortPool* GetPortPool();
status_t Mount(fs_volume* fsVolume, const char* device, status_t Mount(fs_volume* fsVolume, const char* device,
ulong flags, const char* parameters, uint32 flags, const char* parameters,
Volume** volume); Volume** volume);
// status_t Initialize(const char* deviceName, // status_t Initialize(const char* deviceName,
// const char* parameters, size_t len); // const char* parameters, size_t len);
@@ -63,7 +63,7 @@ FileSystemInitializer::FirstTimeInit()
// prepare the command line arguments // prepare the command line arguments
char portID[16]; char portID[16];
snprintf(portID, sizeof(portID), "%ld", port); snprintf(portID, sizeof(portID), "%" B_PRId32, port);
const char* args[4] = { const char* args[4] = {
"/system/servers/userlandfs_server", "/system/servers/userlandfs_server",
@@ -33,7 +33,8 @@ KernelDebug::DebugUFS(int argc, char** argv)
int32 volumeCount = fs->fVolumes.Count(); int32 volumeCount = fs->fVolumes.Count();
for (int32 i = 0; i < volumeCount; i++) { for (int32 i = 0; i < volumeCount; i++) {
Volume* volume = fs->fVolumes.ElementAt(i); Volume* volume = fs->fVolumes.ElementAt(i);
kprintf(" volume %p: %ld\n", volume, volume->GetID()); kprintf(" volume %p: %" B_PRId32 "\n", volume,
volume->GetID());
} }
} }
} }
@@ -55,8 +56,9 @@ KernelDebug::DebugPortPool(int argc, char** argv)
} }
kprintf("used ports:\n"); kprintf("used ports:\n");
for (int32 i = portPool->fFreePorts; i < portPool->fPortCount; i++) { for (int32 i = portPool->fFreePorts; i < portPool->fPortCount; i++) {
kprintf(" port %p, owner: %ld, count: %ld\n", portPool->fPorts[i].port, kprintf(" port %p, owner: %" B_PRId32 ", count: %" B_PRId32 "\n",
portPool->fPorts[i].owner, portPool->fPorts[i].count); portPool->fPorts[i].port, portPool->fPorts[i].owner,
portPool->fPorts[i].count);
} }
return 0; return 0;
} }
@@ -71,12 +73,12 @@ KernelDebug::DebugPort(int argc, char** argv)
} }
RequestPort *port = (RequestPort*)parse_expression(argv[1]); RequestPort *port = (RequestPort*)parse_expression(argv[1]);
kprintf("port %p:\n", port); kprintf("port %p:\n", port);
kprintf(" status : %lx\n", port->fPort.fInitStatus); kprintf(" status : %" B_PRIx32 "\n", port->fPort.fInitStatus);
kprintf(" is owner : %d\n", port->fPort.fOwner); kprintf(" is owner : %d\n", port->fPort.fOwner);
kprintf(" owner port: %ld\n", port->fPort.fInfo.owner_port); kprintf(" owner port: %" B_PRId32 "\n", port->fPort.fInfo.owner_port);
kprintf(" client port: %ld\n", port->fPort.fInfo.client_port); kprintf(" client port: %" B_PRId32 "\n", port->fPort.fInfo.client_port);
kprintf(" size: %ld\n", port->fPort.fInfo.size); kprintf(" size: %" B_PRId32 "\n", port->fPort.fInfo.size);
kprintf(" capacity: %ld\n", port->fPort.fCapacity); kprintf(" capacity: %" B_PRId32 "\n", port->fPort.fCapacity);
kprintf(" buffer: %p\n", port->fPort.fBuffer); kprintf(" buffer: %p\n", port->fPort.fBuffer);
return 0; return 0;
} }
@@ -167,8 +167,8 @@ KernelRequestHandler::_HandleRequest(NotifyListenerRequest* request)
case B_ENTRY_REMOVED: case B_ENTRY_REMOVED:
case B_ATTR_CHANGED: case B_ATTR_CHANGED:
if (!name) { if (!name) {
ERROR(("NotifyListenerRequest: NULL name for opcode: %ld\n", ERROR(("NotifyListenerRequest: NULL name for opcode: %"
request->operation)); B_PRId32 "\n", request->operation));
result = B_BAD_VALUE; result = B_BAD_VALUE;
} }
break; break;
@@ -181,22 +181,25 @@ KernelRequestHandler::_HandleRequest(NotifyListenerRequest* request)
if (result == B_OK) { if (result == B_OK) {
switch (request->operation) { switch (request->operation) {
case B_ENTRY_CREATED: case B_ENTRY_CREATED:
PRINT(("notify_entry_created(%ld, %lld, \"%s\", %lld)\n", PRINT(("notify_entry_created(%" B_PRId32 ", %" B_PRId64 ", "
request->device, request->directory, name, request->node)); \"%s\", %" B_PRId64 ")\n", request->device,
request->directory, name, request->node));
result = notify_entry_created(request->device, result = notify_entry_created(request->device,
request->directory, name, request->node); request->directory, name, request->node);
break; break;
case B_ENTRY_REMOVED: case B_ENTRY_REMOVED:
PRINT(("notify_entry_removed(%ld, %lld, \"%s\", %lld)\n", PRINT(("notify_entry_removed(%" B_PRId32 ", %" B_PRId64 ", "
request->device, request->directory, name, request->node)); \"%s\", %" B_PRId64 ")\n", request->device,
request->directory, name, request->node));
result = notify_entry_removed(request->device, result = notify_entry_removed(request->device,
request->directory, name, request->node); request->directory, name, request->node);
break; break;
case B_ENTRY_MOVED: case B_ENTRY_MOVED:
PRINT(("notify_entry_moved(%ld, %lld, \"%s\", %lld, \"%s\", " PRINT(("notify_entry_moved(%" B_PRId32 ", %" B_PRId64 ", "
"%lld)\n", request->device, request->oldDirectory, oldName, "\"%s\", %" B_PRId64 ", \"%s\", %" B_PRId64 ")\n",
request->device, request->oldDirectory, oldName,
request->directory, name, request->node)); request->directory, name, request->node));
result = notify_entry_moved(request->device, result = notify_entry_moved(request->device,
request->oldDirectory, oldName, request->directory, name, request->oldDirectory, oldName, request->directory, name,
@@ -204,23 +207,24 @@ KernelRequestHandler::_HandleRequest(NotifyListenerRequest* request)
break; break;
case B_STAT_CHANGED: case B_STAT_CHANGED:
PRINT(("notify_stat_changed(%ld, %lld, 0x%lx)\n", PRINT(("notify_stat_changed(%" B_PRId32 ", %" B_PRId64 ", "
request->device, request->node, request->details)); "0x%" B_PRIx32 ")\n", request->device, request->node,
request->details));
result = notify_stat_changed(request->device, request->node, result = notify_stat_changed(request->device, request->node,
request->details); request->details);
break; break;
case B_ATTR_CHANGED: case B_ATTR_CHANGED:
PRINT(("notify_attribute_changed(%ld, %lld, \"%s\", 0x%lx)\n", PRINT(("notify_attribute_changed(%" B_PRId32 ", %" B_PRId64 ", "
request->device, request->node, name, "\"%s\", 0x%" B_PRIx32 ")\n", request->device,
(int32)request->details)); request->node, name, (int32)request->details));
result = notify_attribute_changed(request->device, result = notify_attribute_changed(request->device,
request->node, name, (int32)request->details); request->node, name, (int32)request->details);
break; break;
default: default:
ERROR(("NotifyQueryRequest: unsupported operation: %ld\n", ERROR(("NotifyQueryRequest: unsupported operation: %" B_PRId32
request->operation)); "\n", request->operation));
result = B_BAD_VALUE; result = B_BAD_VALUE;
break; break;
} }
@@ -295,18 +299,20 @@ KernelRequestHandler::_HandleRequest(NotifyQueryRequest* request)
if (result == B_OK) { if (result == B_OK) {
switch (request->operation) { switch (request->operation) {
case B_ENTRY_CREATED: case B_ENTRY_CREATED:
PRINT(("notify_query_entry_created(%ld, %ld, %ld, %lld," PRINT(("notify_query_entry_created(%" B_PRId32 ", %" B_PRId32
" \"%s\", %lld)\n", request->port, request->token, ", %" B_PRId32 ", %" B_PRId64 ", \"%s\", %" B_PRId64 ")\n",
request->device, request->directory, name, request->node)); request->port, request->token, request->device,
request->directory, name, request->node));
result = notify_query_entry_created(request->port, result = notify_query_entry_created(request->port,
request->token, request->device, request->directory, name, request->token, request->device, request->directory, name,
request->node); request->node);
break; break;
case B_ENTRY_REMOVED: case B_ENTRY_REMOVED:
PRINT(("notify_query_entry_removed(%ld, %ld, %ld, %lld," PRINT(("notify_query_entry_removed(%" B_PRId32 ", %" B_PRId32
" \"%s\", %lld)\n", request->port, request->token, ", %" B_PRId32 ", %" B_PRId64 ", \"%s\", %" B_PRId64 ")\n",
request->device, request->directory, name, request->node)); request->port, request->token, request->device,
request->directory, name, request->node));
result = notify_query_entry_removed(request->port, result = notify_query_entry_removed(request->port,
request->token, request->device, request->directory, name, request->token, request->device, request->directory, name,
request->node); request->node);
@@ -314,8 +320,8 @@ KernelRequestHandler::_HandleRequest(NotifyQueryRequest* request)
case B_ENTRY_MOVED: case B_ENTRY_MOVED:
default: default:
ERROR(("NotifyQueryRequest: unsupported operation: %ld\n", ERROR(("NotifyQueryRequest: unsupported operation: %" B_PRId32
request->operation)); "\n", request->operation));
result = B_BAD_VALUE; result = B_BAD_VALUE;
break; break;
} }
@@ -82,7 +82,7 @@ protected: // should be private, but gcc 2.95.3 issues a warning
{ {
if (fileCache != NULL) if (fileCache != NULL)
{ {
ERROR(("VNode %lld still has a file cache!\n", id)); ERROR(("VNode %" B_PRId64 " still has a file cache!\n", id));
file_cache_delete(fileCache); file_cache_delete(fileCache);
} }
} }
@@ -334,7 +334,7 @@ Volume::~Volume()
status_t status_t
Volume::GetVNode(ino_t vnid, void** _node) Volume::GetVNode(ino_t vnid, void** _node)
{ {
PRINT(("get_vnode(%ld, %lld)\n", GetID(), vnid)); PRINT(("get_vnode(%" B_PRId32 ", %" B_PRId64 ")\n", GetID(), vnid));
void* vnode; void* vnode;
status_t error = get_vnode(fFSVolume, vnid, &vnode); status_t error = get_vnode(fFSVolume, vnid, &vnode);
if (error == B_OK) { if (error == B_OK) {
@@ -349,7 +349,7 @@ PRINT(("get_vnode(%ld, %lld)\n", GetID(), vnid));
status_t status_t
Volume::PutVNode(ino_t vnid) Volume::PutVNode(ino_t vnid)
{ {
PRINT(("put_vnode(%ld, %lld)\n", GetID(), vnid)); PRINT(("put_vnode(%" B_PRId32 ", %" B_PRId64 ")\n", GetID(), vnid));
// Decrement the count first. We might not have another chance, since // Decrement the count first. We might not have another chance, since
// put_vnode() could put the last reference, thus causing the node to be // put_vnode() could put the last reference, thus causing the node to be
// removed from our map. This is all not very dramatic, but this way we // removed from our map. This is all not very dramatic, but this way we
@@ -364,7 +364,7 @@ PRINT(("put_vnode(%ld, %lld)\n", GetID(), vnid));
status_t status_t
Volume::AcquireVNode(ino_t vnid) Volume::AcquireVNode(ino_t vnid)
{ {
PRINT(("acquire_vnode(%ld, %lld)\n", GetID(), vnid)); PRINT(("acquire_vnode(%" B_PRId32 ", %" B_PRId64 ")\n", GetID(), vnid));
status_t error = acquire_vnode(fFSVolume, vnid); status_t error = acquire_vnode(fFSVolume, vnid);
if (error == B_OK) if (error == B_OK)
_IncrementVNodeCount(vnid); _IncrementVNodeCount(vnid);
@@ -377,7 +377,7 @@ status_t
Volume::NewVNode(ino_t vnid, void* clientNode, Volume::NewVNode(ino_t vnid, void* clientNode,
const FSVNodeCapabilities& capabilities) const FSVNodeCapabilities& capabilities)
{ {
PRINT(("new_vnode(%ld, %lld)\n", GetID(), vnid)); PRINT(("new_vnode(%" B_PRId32 ", %" B_PRId64 ")\n", GetID(), vnid));
// lookup the node // lookup the node
MutexLocker locker(fLock); MutexLocker locker(fLock);
VNode* node = fVNodes->Lookup(vnid); VNode* node = fVNodes->Lookup(vnid);
@@ -427,7 +427,9 @@ status_t
Volume::PublishVNode(ino_t vnid, void* clientNode, int type, uint32 flags, Volume::PublishVNode(ino_t vnid, void* clientNode, int type, uint32 flags,
const FSVNodeCapabilities& capabilities) const FSVNodeCapabilities& capabilities)
{ {
PRINT(("publish_vnode(%ld, %lld, %p)\n", GetID(), vnid, clientNode)); PRINT(("publish_vnode(%" B_PRId32 ", %" B_PRId64 ", %p)\n", GetID(), vnid,
clientNode));
// lookup the node // lookup the node
MutexLocker locker(fLock); MutexLocker locker(fLock);
VNode* node = fVNodes->Lookup(vnid); VNode* node = fVNodes->Lookup(vnid);
@@ -435,8 +437,8 @@ PRINT(("publish_vnode(%ld, %lld, %p)\n", GetID(), vnid, clientNode));
if (nodeKnown) { if (nodeKnown) {
if (node->published) { if (node->published) {
WARN(("publish_vnode(): vnode (%ld, %lld) already published!\n", WARN(("publish_vnode(): vnode (%" B_PRId32 ", %" B_PRId64
GetID(), vnid)); ") already published!\n", GetID(), vnid));
RETURN_ERROR(B_BAD_VALUE); RETURN_ERROR(B_BAD_VALUE);
} }
} else if (!nodeKnown) { } else if (!nodeKnown) {
@@ -492,7 +494,7 @@ PRINT(("publish_vnode(%ld, %lld, %p)\n", GetID(), vnid, clientNode));
status_t status_t
Volume::RemoveVNode(ino_t vnid) Volume::RemoveVNode(ino_t vnid)
{ {
PRINT(("remove_vnode(%ld, %lld)\n", GetID(), vnid)); PRINT(("remove_vnode(%" B_PRId32 ", %" B_PRId64 ")\n", GetID(), vnid));
return remove_vnode(fFSVolume, vnid); return remove_vnode(fFSVolume, vnid);
} }
@@ -500,7 +502,7 @@ PRINT(("remove_vnode(%ld, %lld)\n", GetID(), vnid));
status_t status_t
Volume::UnremoveVNode(ino_t vnid) Volume::UnremoveVNode(ino_t vnid)
{ {
PRINT(("unremove_vnode(%ld, %lld)\n", GetID(), vnid)); PRINT(("unremove_vnode(%" B_PRId32 ", %" B_PRId64 ")\n", GetID(), vnid));
return unremove_vnode(fFSVolume, vnid); return unremove_vnode(fFSVolume, vnid);
} }
@@ -508,7 +510,8 @@ PRINT(("unremove_vnode(%ld, %lld)\n", GetID(), vnid));
status_t status_t
Volume::GetVNodeRemoved(ino_t vnid, bool* removed) Volume::GetVNodeRemoved(ino_t vnid, bool* removed)
{ {
PRINT(("get_vnode_removed(%ld, %lld, %p)\n", GetID(), vnid, removed)); PRINT(("get_vnode_removed(%" B_PRId32 ", %" B_PRId64 ", %p)\n", GetID(),
vnid, removed));
return get_vnode_removed(fFSVolume, vnid, removed); return get_vnode_removed(fFSVolume, vnid, removed);
} }
@@ -2448,8 +2451,9 @@ Volume::ReadDir(void* _node, void* cookie, void* buffer, size_t bufferSize,
return B_BAD_DATA; return B_BAD_DATA;
if ((int32)bufferSize < reply->buffer.GetSize()) if ((int32)bufferSize < reply->buffer.GetSize())
return B_BAD_DATA; return B_BAD_DATA;
PRINT(("Volume::ReadDir(): buffer returned: %ld bytes\n",
reply->buffer.GetSize())); PRINT(("Volume::ReadDir(): buffer returned: %" B_PRId32 " bytes\n",
reply->buffer.GetSize()));
*countRead = reply->count; *countRead = reply->count;
if (*countRead > 0) { if (*countRead > 0) {
@@ -4427,8 +4431,8 @@ Volume::_IncrementVNodeCount(ino_t vnid)
VNode* vnode = fVNodes->Lookup(vnid); VNode* vnode = fVNodes->Lookup(vnid);
if (vnode == NULL) { if (vnode == NULL) {
ERROR(("Volume::_IncrementVNodeCount(): Node with ID %lld not " ERROR(("Volume::_IncrementVNodeCount(): Node with ID %" B_PRId64
"known!\n", vnid)); " not known!\n", vnid));
return; return;
} }
@@ -4448,7 +4452,7 @@ Volume::_DecrementVNodeCount(ino_t vnid)
VNode* vnode = fVNodes->Lookup(vnid); VNode* vnode = fVNodes->Lookup(vnid);
if (vnode == NULL) { if (vnode == NULL) {
ERROR(("Volume::_DecrementVNodeCount(): Node with ID %lld not " ERROR(("Volume::_DecrementVNodeCount(): Node with ID %" B_PRId64 " not "
"known!\n", vnid)); "known!\n", vnid));
return; return;
} }
@@ -4466,8 +4470,8 @@ Volume::_RemoveInvalidVNode(ino_t vnid)
VNode* vnode = fVNodes->Lookup(vnid); VNode* vnode = fVNodes->Lookup(vnid);
if (vnode == NULL) { if (vnode == NULL) {
ERROR(("Volume::_RemoveInvalidVNode(): Node with ID %lld not known!\n", ERROR(("Volume::_RemoveInvalidVNode(): Node with ID %" B_PRId64
vnid)); " not known!\n", vnid));
return; return;
} }
@@ -4591,8 +4595,8 @@ PRINT(("Volume::_PutAllPendingVNodes()\n"));
} }
} while (nodeFound); } while (nodeFound);
PRINT(("Volume::_PutAllPendingVNodes() successful: Put %ld vnodes\n", PRINT(("Volume::_PutAllPendingVNodes() successful: Put %" B_PRId32
putVNodeCount)); " vnodes\n", putVNodeCount));
return B_OK; return B_OK;
} }
@@ -637,7 +637,7 @@ UserlandRequestHandler::_HandleRequest(IterativeIOGetVecsRequest* request)
request->offset, request->size, vecs, &vecCount); request->offset, request->size, vecs, &vecCount);
if (result == B_OK) { if (result == B_OK) {
vecCount = std::min(vecCount, vecCount = std::min(vecCount,
(uint32)IterativeIOGetVecsReply::MAX_VECS); (size_t)IterativeIOGetVecsReply::MAX_VECS);
} }
} }
@@ -999,8 +999,8 @@ FUSEVolume::CreateSymlink(void* _dir, const char* name, const char* target,
int mode) int mode)
{ {
FUSENode* dir = (FUSENode*)_dir; FUSENode* dir = (FUSENode*)_dir;
PRINT(("FUSEVolume::CreateSymlink(%p (%lld), \"%s\" -> \"%s\", %#x)\n", dir, PRINT(("FUSEVolume::CreateSymlink(%p (%" B_PRId64 "), \"%s\" -> \"%s\", "
dir->id, name, target, mode)); "%#x)\n", dir, dir->id, name, target, mode));
// lock the directory // lock the directory
NodeWriteLocker nodeLocker(this, dir, false); NodeWriteLocker nodeLocker(this, dir, false);
@@ -1046,8 +1046,8 @@ FUSEVolume::Link(void* _dir, const char* name, void* _node)
{ {
FUSENode* dir = (FUSENode*)_dir; FUSENode* dir = (FUSENode*)_dir;
FUSENode* node = (FUSENode*)_node; FUSENode* node = (FUSENode*)_node;
PRINT(("FUSEVolume::Link(%p (%lld), \"%s\" -> %p (%lld))\n", dir, dir->id, name, PRINT(("FUSEVolume::Link(%p (%" B_PRId64 "), \"%s\" -> %p (%" B_PRId64
node, node->id)); "))\n", dir, dir->id, name, node, node->id));
// lock the directories -- the target directory for writing, the node's // lock the directories -- the target directory for writing, the node's
// parent for reading // parent for reading
@@ -1095,7 +1095,8 @@ status_t
FUSEVolume::Unlink(void* _dir, const char* name) FUSEVolume::Unlink(void* _dir, const char* name)
{ {
FUSENode* dir = (FUSENode*)_dir; FUSENode* dir = (FUSENode*)_dir;
PRINT(("FUSEVolume::Unlink(%p (%lld), \"%s\")\n", dir, dir->id, name)); PRINT(("FUSEVolume::Unlink(%p (%" B_PRId64 "), \"%s\")\n", dir, dir->id,
name));
// lock the directory // lock the directory
NodeWriteLocker nodeLocker(this, dir, false); NodeWriteLocker nodeLocker(this, dir, false);
@@ -1146,8 +1147,9 @@ FUSEVolume::Rename(void* _oldDir, const char* oldName, void* _newDir,
{ {
FUSENode* oldDir = (FUSENode*)_oldDir; FUSENode* oldDir = (FUSENode*)_oldDir;
FUSENode* newDir = (FUSENode*)_newDir; FUSENode* newDir = (FUSENode*)_newDir;
PRINT(("FUSEVolume::Rename(%p (%lld), \"%s\", %p (%lld), \"%s\")\n", oldDir, PRINT(("FUSEVolume::Rename(%p (%" B_PRId64 "), \"%s\", %p (%" B_PRId64
oldDir->id, oldName, newDir, newDir->id, newName)); "), \"%s\")\n", oldDir, oldDir->id, oldName, newDir, newDir->id,
newName));
// lock the directories // lock the directories
MultiNodeLocker nodeLocker(this, oldDir, false, true, newDir, false, true); MultiNodeLocker nodeLocker(this, oldDir, false, true, newDir, false, true);
@@ -1229,7 +1231,8 @@ status_t
FUSEVolume::ReadStat(void* _node, struct stat* st) FUSEVolume::ReadStat(void* _node, struct stat* st)
{ {
FUSENode* node = (FUSENode*)_node; FUSENode* node = (FUSENode*)_node;
PRINT(("FUSEVolume::ReadStat(%p (%lld), %p)\n", node, node->id, st)); PRINT(("FUSEVolume::ReadStat(%p (%" B_PRId64 "), %p)\n", node, node->id,
st));
// lock the directory // lock the directory
NodeReadLocker nodeLocker(this, node, true); NodeReadLocker nodeLocker(this, node, true);
@@ -1260,8 +1263,8 @@ status_t
FUSEVolume::WriteStat(void* _node, const struct stat* st, uint32 mask) FUSEVolume::WriteStat(void* _node, const struct stat* st, uint32 mask)
{ {
FUSENode* node = (FUSENode*)_node; FUSENode* node = (FUSENode*)_node;
PRINT(("FUSEVolume::WriteStat(%p (%lld), %p, %#lx)\n", node, node->id, st, PRINT(("FUSEVolume::WriteStat(%p (%" B_PRId64 "), %p, %#lx)\n", node,
mask)); node->id, st, mask));
// lock the directory // lock the directory
NodeReadLocker nodeLocker(this, node, true); NodeReadLocker nodeLocker(this, node, true);
@@ -1356,8 +1359,8 @@ FUSEVolume::Create(void* _dir, const char* name, int openMode, int mode,
void** _cookie, ino_t* _vnid) void** _cookie, ino_t* _vnid)
{ {
FUSENode* dir = (FUSENode*)_dir; FUSENode* dir = (FUSENode*)_dir;
PRINT(("FUSEVolume::Create(%p (%lld), \"%s\", %#x, %#x)\n", dir, dir->id, name, PRINT(("FUSEVolume::Create(%p (%" B_PRId64 "), \"%s\", %#x, %#x)\n", dir,
openMode, mode)); dir->id, name, openMode, mode));
// lock the directory // lock the directory
NodeWriteLocker nodeLocker(this, dir, false); NodeWriteLocker nodeLocker(this, dir, false);
@@ -1420,7 +1423,8 @@ status_t
FUSEVolume::Open(void* _node, int openMode, void** _cookie) FUSEVolume::Open(void* _node, int openMode, void** _cookie)
{ {
FUSENode* node = (FUSENode*)_node; FUSENode* node = (FUSENode*)_node;
PRINT(("FUSEVolume::Open(%p (%lld), %#x)\n", node, node->id, openMode)); PRINT(("FUSEVolume::Open(%p (%" B_PRId64 "), %#x)\n", node, node->id,
openMode));
// lock the directory // lock the directory
NodeReadLocker nodeLocker(this, node, true); NodeReadLocker nodeLocker(this, node, true);
@@ -1641,8 +1645,8 @@ status_t
FUSEVolume::CreateDir(void* _dir, const char* name, int mode) FUSEVolume::CreateDir(void* _dir, const char* name, int mode)
{ {
FUSENode* dir = (FUSENode*)_dir; FUSENode* dir = (FUSENode*)_dir;
PRINT(("FUSEVolume::CreateDir(%p (%lld), \"%s\", %#x)\n", dir, dir->id, name, PRINT(("FUSEVolume::CreateDir(%p (%" B_PRId64 "), \"%s\", %#x)\n", dir,
mode)); dir->id, name, mode));
// lock the directory // lock the directory
NodeWriteLocker nodeLocker(this, dir, false); NodeWriteLocker nodeLocker(this, dir, false);
@@ -1684,7 +1688,8 @@ status_t
FUSEVolume::RemoveDir(void* _dir, const char* name) FUSEVolume::RemoveDir(void* _dir, const char* name)
{ {
FUSENode* dir = (FUSENode*)_dir; FUSENode* dir = (FUSENode*)_dir;
PRINT(("FUSEVolume::RemoveDir(%p (%lld), \"%s\")\n", dir, dir->id, name)); PRINT(("FUSEVolume::RemoveDir(%p (%" B_PRId64 "), \"%s\")\n", dir, dir->id,
name));
// lock the directory // lock the directory
NodeWriteLocker nodeLocker(this, dir, false); NodeWriteLocker nodeLocker(this, dir, false);
@@ -1732,7 +1737,8 @@ status_t
FUSEVolume::OpenDir(void* _node, void** _cookie) FUSEVolume::OpenDir(void* _node, void** _cookie)
{ {
FUSENode* node = (FUSENode*)_node; FUSENode* node = (FUSENode*)_node;
PRINT(("FUSEVolume::OpenDir(%p (%lld), %p)\n", node, node->id, _cookie)); PRINT(("FUSEVolume::OpenDir(%p (%" B_PRId64 "), %p)\n", node, node->id,
_cookie));
// lock the parent directory // lock the parent directory
NodeReadLocker nodeLocker(this, node, true); NodeReadLocker nodeLocker(this, node, true);
@@ -1821,8 +1827,8 @@ status_t
FUSEVolume::ReadDir(void* _node, void* _cookie, void* buffer, size_t bufferSize, FUSEVolume::ReadDir(void* _node, void* _cookie, void* buffer, size_t bufferSize,
uint32 count, uint32* _countRead) uint32 count, uint32* _countRead)
{ {
PRINT(("FUSEVolume::ReadDir(%p, %p, %p, %lu, %ld)\n", _node, _cookie, buffer, PRINT(("FUSEVolume::ReadDir(%p, %p, %p, %" B_PRIu32 ", %" B_PRId32 ")\n",
bufferSize, count)); _node, _cookie, buffer, bufferSize, count));
*_countRead = 0; *_countRead = 0;
FUSENode* node = (FUSENode*)_node; FUSENode* node = (FUSENode*)_node;
@@ -2115,8 +2121,9 @@ FUSEVolume::_GetNode(FUSENode* dir, const char* entryName, FUSENode** _node)
if (privateNode != node) { if (privateNode != node) {
// weird, the node changed! // weird, the node changed!
ERROR(("FUSEVolume::_GetNode(): cookie for node %lld changed: " ERROR(("FUSEVolume::_GetNode(): cookie for node %" B_PRId64
"expected: %p, got: %p\n", nodeID, node, privateNode)); " changed: expected: %p, got: %p\n", nodeID, node,
privateNode));
UserlandFS::KernelEmu::put_vnode(fID, nodeID); UserlandFS::KernelEmu::put_vnode(fID, nodeID);
_PutNode(node); _PutNode(node);
continue; continue;
@@ -2753,8 +2760,8 @@ int
FUSEVolume::_AddReadDirEntry(ReadDirBuffer* buffer, const char* name, int type, FUSEVolume::_AddReadDirEntry(ReadDirBuffer* buffer, const char* name, int type,
ino_t nodeID, off_t offset) ino_t nodeID, off_t offset)
{ {
PRINT(("FUSEVolume::_AddReadDirEntry(%p, \"%s\", %#x, %lld, %lld\n", buffer, PRINT(("FUSEVolume::_AddReadDirEntry(%p, \"%s\", %#x, %" B_PRId64 ", %"
name, type, nodeID, offset)); B_PRId64 "\n", buffer, name, type, nodeID, offset));
AutoLocker<Locker> locker(fLock); AutoLocker<Locker> locker(fLock);
@@ -2781,8 +2788,8 @@ name, type, nodeID, offset));
// parent dir entry // parent dir entry
FUSEEntry* parentEntry = buffer->directory->entries.Head(); FUSEEntry* parentEntry = buffer->directory->entries.Head();
if (parentEntry == NULL) { if (parentEntry == NULL) {
ERROR(("FUSEVolume::_AddReadDirEntry(): dir %lld has no entry!\n", ERROR(("FUSEVolume::_AddReadDirEntry(): dir %" B_PRId64
dirID)); " has no entry!\n", dirID));
return 0; return 0;
} }
nodeID = parentEntry->parent->id; nodeID = parentEntry->parent->id;
@@ -2830,7 +2837,7 @@ name, type, nodeID, offset));
buffer->error = B_NO_MEMORY; buffer->error = B_NO_MEMORY;
return 1; return 1;
} }
PRINT((" -> create node: %p, id: %lld\n", node, nodeID)); PRINT((" -> create node: %p, id: %" B_PRId64 "\n", node, nodeID));
fNodes.Insert(node); fNodes.Insert(node);
} else { } else {
@@ -320,7 +320,7 @@ do_iterative_fd_io(int fd, io_request *_request, iterative_io_get_vecs getVecs,
// get the first vecs already -- this saves a guaranteed trip back from // get the first vecs already -- this saves a guaranteed trip back from
// kernel to userland // kernel to userland
file_io_vec fileVecs[DoIterativeFDIORequest::MAX_VECS]; file_io_vec fileVecs[DoIterativeFDIORequest::MAX_VECS];
uint32 fileVecCount = DoIterativeFDIORequest::MAX_VECS; size_t fileVecCount = DoIterativeFDIORequest::MAX_VECS;
status_t error = getVecs(_cookie, _request, request->offset, status_t error = getVecs(_cookie, _request, request->offset,
request->length, fileVecs, &fileVecCount); request->length, fileVecs, &fileVecCount);
if (error != B_OK && error != B_BUFFER_OVERFLOW) if (error != B_OK && error != B_BUFFER_OVERFLOW)
+4 -4
View File
@@ -434,11 +434,11 @@ _rw_lock_read_unlock(rw_lock* lock)
if (--lock->active_readers > 0) if (--lock->active_readers > 0)
return; return;
if (lock->active_readers < 0) { if (lock->active_readers < 0) {
panic("rw_lock_read_unlock(): lock %p not read-locked", lock); panic("rw_lock_read_unlock(): lock %p not read-locked", lock);
lock->active_readers = 0; lock->active_readers = 0;
return; return;
} }
rw_lock_unblock(lock); rw_lock_unblock(lock);
} }
@@ -200,7 +200,8 @@ ConditionVariable::_Notify(bool all, status_t result)
if (!fEntries.IsEmpty()) { if (!fEntries.IsEmpty()) {
if (result > B_OK) { if (result > B_OK) {
panic("tried to notify with invalid result %ld\n", result); panic("tried to notify with invalid result %" B_PRId32 "\n",
result);
result = B_ERROR; result = B_ERROR;
} }
@@ -688,7 +688,7 @@ _mutex_lock_threads_locked(mutex* lock)
lock->holder = find_thread(NULL); lock->holder = find_thread(NULL);
return B_OK; return B_OK;
} else if (lock->holder == find_thread(NULL)) { } else if (lock->holder == find_thread(NULL)) {
panic("_mutex_lock(): double lock of %p by thread %ld", lock, panic("_mutex_lock(): double lock of %p by thread %" B_PRId32, lock,
lock->holder); lock->holder);
} else if (lock->holder == 0) } else if (lock->holder == 0)
panic("_mutex_lock(): using unitialized lock %p", lock); panic("_mutex_lock(): using unitialized lock %p", lock);
@@ -743,9 +743,9 @@ _mutex_unlock_threads_locked(mutex* lock)
{ {
#if KDEBUG #if KDEBUG
if (find_thread(NULL) != lock->holder) { if (find_thread(NULL) != lock->holder) {
panic("_mutex_unlock() failure: thread %ld is trying to release " panic("_mutex_unlock() failure: thread %" B_PRId32 " is trying to "
"mutex %p (current holder %ld)\n", find_thread(NULL), "release mutex %p (current holder %" B_PRId32 ")\n",
lock, lock->holder); find_thread(NULL), lock, lock->holder);
return; return;
} }
#endif #endif