diff --git a/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp b/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp index fa000a13ea..4a48019138 100644 --- a/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/FileSystem.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Haiku, Inc. All rights reserved. + * Copyright 2012-2020 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -19,6 +19,17 @@ #include "RootInode.h" +#define ERROR(x...) dprintf("nfs4: " x) + +#ifdef DEBUG +#define TRACE(x...) dprintf("nfs4: " x) +#define CALLED() dprintf("nfs4: called %s", __func__) +#else +#define TRACE(x...) +#define CALLED() +#endif + + extern RPC::ServerManager* gRPCServerManager; extern RPC::ProgramData* CreateNFS4Server(RPC::Server* serv); @@ -70,6 +81,8 @@ FileSystem::~FileSystem() static InodeNames* GetInodeNames(const char** root, const char* _path) { + CALLED(); + ASSERT(_path != NULL); int i; @@ -132,6 +145,8 @@ status_t FileSystem::Mount(FileSystem** _fs, RPC::Server* serv, const char* serverName, const char* fsPath, dev_t id, const MountConfiguration& configuration) { + CALLED(); + ASSERT(_fs != NULL); ASSERT(serv != NULL); ASSERT(fsPath != NULL); @@ -255,6 +270,8 @@ FileSystem::Mount(FileSystem** _fs, RPC::Server* serv, const char* serverName, status_t FileSystem::GetInode(ino_t id, Inode** _inode) { + CALLED(); + ASSERT(_inode != NULL); FileInfo fi; @@ -277,6 +294,8 @@ FileSystem::GetInode(ino_t id, Inode** _inode) status_t FileSystem::Migrate(const RPC::Server* serv) { + CALLED(); + ASSERT(serv != NULL); MutexLocker _(fOpenLock); @@ -344,6 +363,8 @@ FileSystem::Migrate(const RPC::Server* serv) DoublyLinkedList& FileSystem::OpenFilesLock() { + CALLED(); + mutex_lock(&fOpenLock); return fOpenFiles; } @@ -352,6 +373,8 @@ FileSystem::OpenFilesLock() void FileSystem::OpenFilesUnlock() { + CALLED(); + mutex_unlock(&fOpenLock); } @@ -359,6 +382,8 @@ FileSystem::OpenFilesUnlock() void FileSystem::AddOpenFile(OpenState* state) { + CALLED(); + ASSERT(state != NULL); MutexLocker _(fOpenLock); @@ -372,6 +397,8 @@ FileSystem::AddOpenFile(OpenState* state) void FileSystem::RemoveOpenFile(OpenState* state) { + CALLED(); + ASSERT(state != NULL); MutexLocker _(fOpenLock); @@ -385,6 +412,8 @@ FileSystem::RemoveOpenFile(OpenState* state) DoublyLinkedList& FileSystem::DelegationsLock() { + CALLED(); + mutex_lock(&fDelegationLock); return fDelegationList; } @@ -393,6 +422,8 @@ FileSystem::DelegationsLock() void FileSystem::DelegationsUnlock() { + CALLED(); + mutex_unlock(&fDelegationLock); } @@ -400,6 +431,8 @@ FileSystem::DelegationsUnlock() void FileSystem::AddDelegation(Delegation* delegation) { + CALLED(); + ASSERT(delegation != NULL); MutexLocker _(fDelegationLock); @@ -414,6 +447,8 @@ FileSystem::AddDelegation(Delegation* delegation) void FileSystem::RemoveDelegation(Delegation* delegation) { + CALLED(); + ASSERT(delegation != NULL); MutexLocker _(fDelegationLock); @@ -426,6 +461,8 @@ FileSystem::RemoveDelegation(Delegation* delegation) Delegation* FileSystem::GetDelegation(const FileHandle& handle) { + CALLED(); + MutexLocker _(fDelegationLock); AVLTreeMap::Iterator it; @@ -440,6 +477,8 @@ FileSystem::GetDelegation(const FileHandle& handle) status_t FileSystem::_ParsePath(RequestBuilder& req, uint32& count, const char* _path) { + CALLED(); + ASSERT(_path != NULL); char* path = strdup(_path); diff --git a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp index a965b9e8cd..051b8b2bf3 100644 --- a/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/ReplyInterpreter.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Haiku, Inc. All rights reserved. + * Copyright 2012-2020 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -17,8 +17,31 @@ #include "Cookie.h" +#define ERROR(x...) dprintf("nfs4: " x) + +#ifdef DEBUG +#define TRACE(x...) dprintf("nfs4: " x) +#define CALLED() dprintf("nfs4: called %s", __func__) +#else +#define TRACE(x...) +#define CALLED() +#endif + + +static status_t +ProcessStream(RPC::Reply* reply, const char* callName) +{ + status_t result = reply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + if (result != B_OK) + TRACE("call %s failed!\n", callName); + return result; +} + + FSLocation::~FSLocation() { + CALLED(); + if (fRootPath != NULL) { for (uint32 i = 0; fRootPath[i] != NULL; i++) free(const_cast(fRootPath[i])); @@ -33,6 +56,8 @@ FSLocation::~FSLocation() FSLocations::~FSLocations() { + CALLED(); + if (fRootPath != NULL) { for (uint32 i = 0; fRootPath[i] != NULL; i++) free(const_cast(fRootPath[i])); @@ -53,6 +78,8 @@ AttrValue::AttrValue() AttrValue::~AttrValue() { + CALLED(); + if (fFreePointer) free(fData.fPointer); if (fAttribute == FATTR4_FS_LOCATIONS) @@ -82,6 +109,8 @@ ReplyInterpreter::ReplyInterpreter(RPC::Reply* reply) fDecodeError(false), fReply(reply) { + CALLED(); + if (reply != NULL) _ParseHeader(); } @@ -96,6 +125,8 @@ ReplyInterpreter::~ReplyInterpreter() void ReplyInterpreter::_ParseHeader() { + CALLED(); + fNFS4Error = fReply->Stream().GetUInt(); fReply->Stream().GetOpaque(NULL); fReply->Stream().GetUInt(); @@ -105,6 +136,8 @@ ReplyInterpreter::_ParseHeader() status_t ReplyInterpreter::Access(uint32* supported, uint32* allowed) { + CALLED(); + status_t res = _OperationError(OpAccess); if (res != B_OK) return res; @@ -117,13 +150,15 @@ ReplyInterpreter::Access(uint32* supported, uint32* allowed) if (allowed != NULL) *allowed = allow; - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Close() { + CALLED(); + status_t res = _OperationError(OpClose); if (res != B_OK) return res; @@ -133,26 +168,30 @@ ReplyInterpreter::Close() fReply->Stream().GetUInt(); fReply->Stream().GetUInt(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Commit() { + CALLED(); + status_t res = _OperationError(OpCommit); if (res != B_OK) return res; fReply->Stream().GetOpaque(NULL); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Create(uint64* before, uint64* after, bool& atomic) { + CALLED(); + status_t res = _OperationError(OpCreate); if (res != B_OK) return res; @@ -165,7 +204,7 @@ ReplyInterpreter::Create(uint64* before, uint64* after, bool& atomic) for (uint32 i = 0; i < count; i++) fReply->Stream().GetUInt(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } @@ -173,6 +212,8 @@ ReplyInterpreter::Create(uint64* before, uint64* after, bool& atomic) // http://graphics.stanford.edu/~seander/bithacks.html static inline uint32 CountBits(uint32 v) { + CALLED(); + v = v - ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); return (((v + (v >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; @@ -182,6 +223,8 @@ static inline uint32 CountBits(uint32 v) status_t ReplyInterpreter::GetAttr(AttrValue** attrs, uint32* count) { + CALLED(); + status_t res = _OperationError(OpGetAttr); if (res != B_OK) return res; @@ -193,27 +236,33 @@ ReplyInterpreter::GetAttr(AttrValue** attrs, uint32* count) status_t ReplyInterpreter::GetFH(FileHandle* fh) { + CALLED(); + status_t res = _OperationError(OpGetFH); if (res != B_OK) return res; uint32 size; const void* ptr = fReply->Stream().GetOpaque(&size); - if (ptr == NULL || size > NFS4_FHSIZE) + if (ptr == NULL || size > NFS4_FHSIZE) { + ERROR("Unable to %s!\n", __func__); return B_BAD_VALUE; + } if (fh != NULL) { fh->fSize = size; memcpy(fh->fData, ptr, size); } - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Link(uint64* before, uint64* after, bool& atomic) { + CALLED(); + status_t res = _OperationError(OpLink); if (res != B_OK) return res; @@ -222,13 +271,15 @@ ReplyInterpreter::Link(uint64* before, uint64* after, bool& atomic) *before = fReply->Stream().GetUHyper(); *after = fReply->Stream().GetUHyper(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Lock(LockInfo* linfo) { + CALLED(); + status_t res = _OperationError(OpLock); if (res != B_OK) return res; @@ -238,13 +289,15 @@ ReplyInterpreter::Lock(LockInfo* linfo) linfo->fOwner->fStateId[1] = fReply->Stream().GetUInt(); linfo->fOwner->fStateId[2] = fReply->Stream().GetUInt(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::LockT(uint64* pos, uint64* len, LockType* type) { + CALLED(); + status_t res = _OperationError(OpLockT); if (res != B_WOULD_BLOCK || NFS4Error() != NFS4ERR_DENIED) return res; @@ -256,13 +309,15 @@ ReplyInterpreter::LockT(uint64* pos, uint64* len, LockType* type) fReply->Stream().GetUHyper(); fReply->Stream().GetOpaque(NULL); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::LockU(LockInfo* linfo) { + CALLED(); + status_t res = _OperationError(OpLockU); if (res != B_OK) return res; @@ -272,7 +327,7 @@ ReplyInterpreter::LockU(LockInfo* linfo) linfo->fOwner->fStateId[1] = fReply->Stream().GetUInt(); linfo->fOwner->fStateId[2] = fReply->Stream().GetUInt(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } @@ -280,6 +335,8 @@ status_t ReplyInterpreter::Open(uint32* id, uint32* seq, bool* confirm, OpenDelegationData* delegData, ChangeInfo* changeInfo) { + CALLED(); + status_t res = _OperationError(OpOpen); if (res != B_OK) return res; @@ -315,7 +372,7 @@ ReplyInterpreter::Open(uint32* id, uint32* seq, bool* confirm, if (delegation == OPEN_DELEGATE_NONE) { delegData->fType = OPEN_DELEGATE_NONE; - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } delegData->fStateSeq = fReply->Stream().GetUInt(); @@ -348,13 +405,15 @@ ReplyInterpreter::Open(uint32* id, uint32* seq, bool* confirm, fReply->Stream().GetUInt(); fReply->Stream().GetOpaque(NULL); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::OpenConfirm(uint32* stateSeq) { + CALLED(); + status_t res = _OperationError(OpOpenConfirm); if (res != B_OK) return res; @@ -364,13 +423,15 @@ ReplyInterpreter::OpenConfirm(uint32* stateSeq) fReply->Stream().GetUInt(); fReply->Stream().GetUInt(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Read(void* buffer, uint32* size, bool* eof) { + CALLED(); + status_t res = _OperationError(OpRead); if (res != B_OK) return res; @@ -379,7 +440,7 @@ ReplyInterpreter::Read(void* buffer, uint32* size, bool* eof) const void* ptr = fReply->Stream().GetOpaque(size); memcpy(buffer, ptr, *size); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } @@ -387,6 +448,8 @@ status_t ReplyInterpreter::ReadDir(uint64* cookie, uint64* cookieVerf, DirEntry** dirents, uint32* _count, bool* eof) { + CALLED(); + status_t res = _OperationError(OpReadDir); if (res != B_OK) return res; @@ -439,6 +502,7 @@ ReplyInterpreter::ReadDir(uint64* cookie, uint64* cookieVerf, if (fReply->Stream().IsEOF()) { delete[] entries; + ERROR("Unable to %s!\n", __func__); return B_BAD_VALUE; } @@ -449,6 +513,8 @@ ReplyInterpreter::ReadDir(uint64* cookie, uint64* cookieVerf, status_t ReplyInterpreter::ReadLink(void* buffer, uint32* size, uint32 maxSize) { + CALLED(); + status_t res = _OperationError(OpReadLink); if (res != B_OK) return res; @@ -456,13 +522,15 @@ ReplyInterpreter::ReadLink(void* buffer, uint32* size, uint32 maxSize) const void* ptr = fReply->Stream().GetOpaque(size); memcpy(buffer, ptr, min_c(*size, maxSize)); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Remove(uint64* before, uint64* after, bool& atomic) { + CALLED(); + status_t res = _OperationError(OpRemove); if (res != B_OK) return res; @@ -471,7 +539,7 @@ ReplyInterpreter::Remove(uint64* before, uint64* after, bool& atomic) *before = fReply->Stream().GetUHyper(); *after = fReply->Stream().GetUHyper(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } @@ -479,6 +547,8 @@ status_t ReplyInterpreter::Rename(uint64* fromBefore, uint64* fromAfter, bool& fromAtomic, uint64* toBefore, uint64* toAfter, bool& toAtomic) { + CALLED(); + status_t res = _OperationError(OpRename); if (res != B_OK) return res; @@ -490,13 +560,16 @@ ReplyInterpreter::Rename(uint64* fromBefore, uint64* fromAfter, toAtomic = fReply->Stream().GetBoolean(); *toBefore = fReply->Stream().GetUHyper(); *toAfter = fReply->Stream().GetUHyper(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::SetAttr() { + CALLED(); + status_t res = _OperationError(OpSetAttr); if (res != B_OK) return res; @@ -505,13 +578,15 @@ ReplyInterpreter::SetAttr() for (uint32 i = 0; i < bcount; i++) fReply->Stream().GetUInt(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::SetClientID(uint64* clientid, uint64* verifier) { + CALLED(); + status_t res = _OperationError(OpSetClientID); if (res != B_OK) return res; @@ -519,13 +594,15 @@ ReplyInterpreter::SetClientID(uint64* clientid, uint64* verifier) *clientid = fReply->Stream().GetUHyper(); *verifier = fReply->Stream().GetUHyper(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } status_t ReplyInterpreter::Write(uint32* size) { + CALLED(); + status_t res = _OperationError(OpWrite); if (res != B_OK) return res; @@ -534,13 +611,15 @@ ReplyInterpreter::Write(uint32* size) fReply->Stream().GetInt(); fReply->Stream().GetUHyper(); - return fReply->Stream().IsEOF() ? B_BAD_VALUE : B_OK; + return ProcessStream(fReply, __func__); } const char** ReplyInterpreter::_GetPath(XDR::ReadStream& stream) { + CALLED(); + uint32 count = stream.GetUInt(); char** path = new char*[count + 1]; if (path == NULL) @@ -568,6 +647,8 @@ status_t ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs, uint32* count) { + CALLED(); + uint32 bcount = fReply->Stream().GetUInt(); uint32* bitmap = new(std::nothrow) uint32[bcount]; if (bitmap == NULL) @@ -584,8 +665,10 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs, *attrs = NULL; *count = 0; return B_OK; - } else if (attr_count > FATTR4_MAXIMUM_ATTR_ID) + } else if (attr_count > FATTR4_MAXIMUM_ATTR_ID) { + ERROR("too many attr!\n"); return B_BAD_VALUE; + } uint32 size; const void* ptr = str.GetOpaque(&size); @@ -795,6 +878,7 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs, *attrs = values; if (str.IsEOF()) { delete[] values; + ERROR("call %s failed!\n", __func__); return B_BAD_VALUE; } return B_OK; @@ -804,25 +888,31 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs, status_t ReplyInterpreter::_OperationError(Opcode op) { - if (fDecodeError) + if (fDecodeError) { + ERROR("Decode Error!\n"); return B_BAD_VALUE; + } if (fReply == NULL) return B_NOT_INITIALIZED; if (fReply->Error() != B_OK || fReply->Stream().IsEOF()) { + ERROR("Error not B_OK or empty stream!\n"); fDecodeError = true; return fReply->Error(); } if (fReply->Stream().GetInt() != op) { + ERROR("Stream GetInt != op!\n"); fDecodeError = true; return B_BAD_VALUE; } status_t result = _NFS4ErrorToHaiku(fReply->Stream().GetUInt()); - if (result != B_OK) + if (result != B_OK) { + ERROR("NFS Error: %s\n", strerror(result)); fDecodeError = true; + } return result; } diff --git a/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp b/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp index 52c943a59f..3ca1fbf6c9 100644 --- a/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp +++ b/src/add-ons/kernel/file_systems/nfs4/kernel_interface.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2012 Haiku, Inc. All rights reserved. + * Copyright 2012-2020 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -26,21 +26,13 @@ #include "VnodeToInode.h" #include "WorkQueue.h" + +#define ERROR(format, args...) \ + dprintf("nfs4: %s()" format "\n", __func__, ##args) + #ifdef DEBUG -#define TRACE_NFS4 -#endif - -#ifdef TRACE_NFS4 -static mutex gTraceLock = MUTEX_INITIALIZER(NULL); - -#define TRACE(x...) \ - { \ - mutex_lock(&gTraceLock); \ - dprintf("nfs4: %s(): ", __FUNCTION__); \ - dprintf(x); \ - dprintf("\n"); \ - mutex_unlock(&gTraceLock); \ - } +#define TRACE(format, args...) \ + dprintf("nfs4: %s()" format "\n", __func__, ##args) #else #define TRACE(x...) (void)0 #endif @@ -160,8 +152,8 @@ static status_t nfs4_mount(fs_volume* volume, const char* device, uint32 flags, const char* args, ino_t* _rootVnodeID) { - TRACE("volume = %p, device = %s, flags = %" B_PRIu32 ", args = %s", volume, - device, flags, args); + TRACE("volume = %p, device = %s, flags = %" B_PRIu32 ", args = %s\n", + volume, device, flags, args); status_t result; @@ -186,21 +178,27 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags, char* path; char* serverName; result = ParseArguments(args, &resolver, &serverName, &path, &config); - if (result != B_OK) + if (result != B_OK) { + ERROR("Unable to parse mount arguments!\n"); return result; + } + MemoryDeleter pathDeleter(path); MemoryDeleter serverNameDeleter(serverName); RPC::Server* server; result = gRPCServerManager->Acquire(&server, resolver, CreateNFS4Server); delete resolver; - if (result != B_OK) + if (result != B_OK) { + ERROR("Unable to Acquire RPCServerManager!\n"); return result; + } FileSystem* fs; result = FileSystem::Mount(&fs, server, serverName, path, volume->id, config); if (result != B_OK) { + ERROR("Error mounting filesystem: %s\n", strerror(result)); gRPCServerManager->Release(server); return result; } @@ -209,7 +207,7 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags, if (inode == NULL) { delete fs; gRPCServerManager->Release(server); - + ERROR("Unable to locate root inode!\n"); return B_IO_ERROR; } @@ -220,6 +218,7 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags, if (vti == NULL) { delete fs; gRPCServerManager->Release(server); + ERROR("Unable to translate vnode to inode!\n"); return B_NO_MEMORY; } @@ -231,7 +230,7 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags, *_rootVnodeID = inode->ID(); - TRACE("*_rootVnodeID = %" B_PRIi64, inode->ID()); + TRACE("*_rootVnodeID = %" B_PRIi64 "\n", inode->ID()); return B_OK; } @@ -242,7 +241,7 @@ nfs4_get_vnode(fs_volume* volume, ino_t id, fs_vnode* vnode, int* _type, uint32* _flags, bool reenter) { FileSystem* fs = reinterpret_cast(volume->private_volume); - TRACE("volume = %p, id = %" B_PRIi64, volume, id); + TRACE("volume = %p, id = %" B_PRIi64 "\n", volume, id); VnodeToInode* vnodeToInode = new VnodeToInode(id, fs); if (vnodeToInode == NULL) @@ -269,7 +268,7 @@ nfs4_get_vnode(fs_volume* volume, ino_t id, fs_vnode* vnode, int* _type, static status_t nfs4_unmount(fs_volume* volume) { - TRACE("volume = %p", volume); + TRACE("volume = %p\n", volume); FileSystem* fs = reinterpret_cast(volume->private_volume); RPC::Server* server = fs->Server(); @@ -283,7 +282,7 @@ nfs4_unmount(fs_volume* volume) static status_t nfs4_read_fs_info(fs_volume* volume, struct fs_info* info) { - TRACE("volume = %p", volume); + TRACE("volume = %p\n", volume); FileSystem* fs = reinterpret_cast(volume->private_volume); RootInode* inode = reinterpret_cast(fs->Root()); @@ -308,7 +307,7 @@ nfs4_lookup(fs_volume* volume, fs_vnode* dir, const char* name, ino_t* _id) if (inode == NULL) return B_ENTRY_NOT_FOUND; - TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s", volume, vti->ID(), + TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s\n", volume, vti->ID(), name); status_t result = inode->LookUp(name, _id); @@ -316,7 +315,7 @@ nfs4_lookup(fs_volume* volume, fs_vnode* dir, const char* name, ino_t* _id) return result; locker.Unlock(); - TRACE("*_id = %" B_PRIi64, *_id); + TRACE("*_id = %" B_PRIi64 "\n", *_id); // If VTI holds an outdated Inode next operation performed on it will // return either ERR_STALE or ERR_FHEXPIRED. Both of these error codes @@ -336,7 +335,7 @@ static status_t nfs4_put_vnode(fs_volume* volume, fs_vnode* vnode, bool reenter) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64, volume, vti->ID()); + TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID()); delete vti; return B_OK; @@ -348,7 +347,7 @@ nfs4_remove_vnode(fs_volume* volume, fs_vnode* vnode, bool reenter) { FileSystem* fs = reinterpret_cast(volume->private_volume); VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64, volume, vti->ID()); + TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID()); if (fs->Root() == vti->GetPointer()) return B_OK; @@ -366,7 +365,7 @@ nfs4_read_pages(fs_volume* _volume, fs_vnode* vnode, void* _cookie, off_t pos, { VnodeToInode* vti = reinterpret_cast(vnode->private_node); TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, pos = %" B_PRIi64 \ - ", count = %lu, numBytes = %lu", _volume, vti->ID(), _cookie, pos, + ", count = %lu, numBytes = %lu\n", _volume, vti->ID(), _cookie, pos, count, *_numBytes); VnodeToInodeLocker _(vti); @@ -398,7 +397,7 @@ nfs4_read_pages(fs_volume* _volume, fs_vnode* vnode, void* _cookie, off_t pos, *_numBytes = totalRead; - TRACE("*numBytes = %lu", totalRead); + TRACE("*numBytes = %lu\n", totalRead); return B_OK; } @@ -410,7 +409,7 @@ nfs4_write_pages(fs_volume* _volume, fs_vnode* vnode, void* _cookie, off_t pos, { VnodeToInode* vti = reinterpret_cast(vnode->private_node); TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, pos = %" B_PRIi64 \ - ", count = %lu, numBytes = %lu", _volume, vti->ID(), _cookie, pos, + ", count = %lu, numBytes = %lu\n", _volume, vti->ID(), _cookie, pos, count, *_numBytes); VnodeToInodeLocker _(vti); @@ -449,8 +448,8 @@ static status_t nfs4_io(fs_volume* volume, fs_vnode* vnode, void* cookie, io_request* request) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p", volume, vti->ID(), - cookie); + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p\n", volume, + vti->ID(), cookie); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -484,9 +483,9 @@ nfs4_get_file_map(fs_volume* volume, fs_vnode* vnode, off_t _offset, static status_t nfs4_set_flags(fs_volume* volume, fs_vnode* vnode, void* _cookie, int flags) { - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, flags = %d", volume, - reinterpret_cast(vnode->private_node)->ID(), _cookie, - flags); + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, flags = %d\n", + volume, reinterpret_cast(vnode->private_node)->ID(), + _cookie, flags); OpenFileCookie* cookie = reinterpret_cast(_cookie); cookie->fMode = (cookie->fMode & ~(O_APPEND | O_NONBLOCK)) | flags; @@ -498,7 +497,7 @@ static status_t nfs4_fsync(fs_volume* volume, fs_vnode* vnode) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64, volume, vti->ID()); + TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID()); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -514,7 +513,7 @@ nfs4_read_symlink(fs_volume* volume, fs_vnode* link, char* buffer, size_t* _bufferSize) { VnodeToInode* vti = reinterpret_cast(link->private_node); - TRACE("volume = %p, link = %" B_PRIi64, volume, vti->ID()); + TRACE("volume = %p, link = %" B_PRIi64 "\n", volume, vti->ID()); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -530,7 +529,7 @@ nfs4_create_symlink(fs_volume* volume, fs_vnode* dir, const char* name, const char* path, int mode) { VnodeToInode* vti = reinterpret_cast(dir->private_node); - TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s, path = %s, mode = %d", + TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s, path = %s, mode = %d\n", volume, vti->ID(), name, path, mode); VnodeToInodeLocker _(vti); @@ -559,8 +558,8 @@ nfs4_link(fs_volume* volume, fs_vnode* dir, const char* name, fs_vnode* vnode) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); VnodeToInode* dirVti = reinterpret_cast(dir->private_node); - TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s, vnode = %" B_PRIi64, - volume, dirVti->ID(), name, vti->ID()); + TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s, vnode = %" B_PRIi64 + "\n", volume, dirVti->ID(), name, vti->ID()); VnodeToInodeLocker _dir(dirVti); Inode* dirInode = dirVti->Get(); @@ -587,7 +586,7 @@ nfs4_unlink(fs_volume* volume, fs_vnode* dir, const char* name) if (inode == NULL) return B_ENTRY_NOT_FOUND; - TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s", volume, vti->ID(), + TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s\n", volume, vti->ID(), name); ino_t id; @@ -619,8 +618,8 @@ nfs4_rename(fs_volume* volume, fs_vnode* fromDir, const char* fromName, VnodeToInode* fromVti = reinterpret_cast(fromDir->private_node); VnodeToInode* toVti = reinterpret_cast(toDir->private_node); - TRACE("volume = %p, fromDir = %" B_PRIi64 ", toDir = %" B_PRIi64 "," \ - " fromName = %s, toName = %s", volume, fromVti->ID(), toVti->ID(), \ + TRACE("volume = %p, fromDir = %" B_PRIi64 ", toDir = %" B_PRIi64 "," + " fromName = %s, toName = %s\n", volume, fromVti->ID(), toVti->ID(), fromName, toName); VnodeToInodeLocker _from(fromVti); @@ -679,7 +678,7 @@ static status_t nfs4_access(fs_volume* volume, fs_vnode* vnode, int mode) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", mode = %d", volume, vti->ID(), + TRACE("volume = %p, vnode = %" B_PRIi64 ", mode = %d\n", volume, vti->ID(), mode); VnodeToInodeLocker _(vti); @@ -695,7 +694,7 @@ static status_t nfs4_read_stat(fs_volume* volume, fs_vnode* vnode, struct stat* stat) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64, volume, vti->ID()); + TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID()); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -714,8 +713,8 @@ nfs4_write_stat(fs_volume* volume, fs_vnode* vnode, const struct stat* stat, uint32 statMask) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", statMask = %" B_PRIu32, volume, - vti->ID(), statMask); + TRACE("volume = %p, vnode = %" B_PRIi64 ", statMask = %" B_PRIu32 "\n", + volume, vti->ID(), statMask); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -772,7 +771,7 @@ nfs4_create(fs_volume* volume, fs_vnode* dir, const char* name, int openMode, VnodeToInode* vti = reinterpret_cast(dir->private_node); TRACE("volume = %p, dir = %" B_PRIi64 ", name = %s, openMode = %d," \ - " perms = %d", volume, vti->ID(), name, openMode, perms); + " perms = %d\n", volume, vti->ID(), name, openMode, perms); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -816,7 +815,8 @@ nfs4_create(fs_volume* volume, fs_vnode* dir, const char* name, int openMode, } } - TRACE("*cookie = %p, *newVnodeID = %" B_PRIi64, *_cookie, *_newVnodeID); + TRACE("*cookie = %p, *newVnodeID = %" B_PRIi64 "\n", *_cookie, + *_newVnodeID); return result; } @@ -825,7 +825,7 @@ static status_t nfs4_open(fs_volume* volume, fs_vnode* vnode, int openMode, void** _cookie) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", openMode = %d", volume, + TRACE("volume = %p, vnode = %" B_PRIi64 ", openMode = %d\n", volume, vti->ID(), openMode); VnodeToInodeLocker _(vti); @@ -848,7 +848,7 @@ nfs4_open(fs_volume* volume, fs_vnode* vnode, int openMode, void** _cookie) if (result != B_OK) delete cookie; - TRACE("*cookie = %p", *_cookie); + TRACE("*cookie = %p\n", *_cookie); return result; } @@ -859,8 +859,8 @@ nfs4_close(fs_volume* volume, fs_vnode* vnode, void* _cookie) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p", volume, vti->ID(), - _cookie); + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p\n", volume, + vti->ID(), _cookie); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -881,8 +881,8 @@ nfs4_free_cookie(fs_volume* volume, fs_vnode* vnode, void* _cookie) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p", volume, vti->ID(), - _cookie); + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p\n", volume, + vti->ID(), _cookie); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -907,7 +907,7 @@ nfs4_read(fs_volume* volume, fs_vnode* vnode, void* _cookie, off_t pos, { VnodeToInode* vti = reinterpret_cast(vnode->private_node); TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, pos = %" B_PRIi64 \ - ", length = %lu", volume, vti->ID(), _cookie, pos, *length); + ", length = %lu\n", volume, vti->ID(), _cookie, pos, *length); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -932,7 +932,7 @@ nfs4_write(fs_volume* volume, fs_vnode* vnode, void* _cookie, off_t pos, { VnodeToInode* vti = reinterpret_cast(vnode->private_node); TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, pos = %" B_PRIi64 \ - ", length = %lu", volume, vti->ID(), _cookie, pos, *length); + ", length = %lu\n", volume, vti->ID(), _cookie, pos, *length); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -956,7 +956,7 @@ nfs4_create_dir(fs_volume* volume, fs_vnode* parent, const char* name, int mode) { VnodeToInode* vti = reinterpret_cast(parent->private_node); - TRACE("volume = %p, parent = %" B_PRIi64 ", mode = %d", volume, vti->ID(), + TRACE("volume = %p, parent = %" B_PRIi64 ", mode = %d\n", volume, vti->ID(), mode); VnodeToInodeLocker _(vti); @@ -984,7 +984,7 @@ static status_t nfs4_remove_dir(fs_volume* volume, fs_vnode* parent, const char* name) { VnodeToInode* vti = reinterpret_cast(parent->private_node); - TRACE("volume = %p, parent = %" B_PRIi64 ", name = %s", volume, vti->ID(), + TRACE("volume = %p, parent = %" B_PRIi64 ", name = %s\n", volume, vti->ID(), name); VnodeToInodeLocker _(vti); @@ -1023,7 +1023,7 @@ nfs4_open_dir(fs_volume* volume, fs_vnode* vnode, void** _cookie) *_cookie = cookie; VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64, volume, vti->ID()); + TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID()); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -1034,7 +1034,7 @@ nfs4_open_dir(fs_volume* volume, fs_vnode* vnode, void** _cookie) if (result != B_OK) delete cookie; - TRACE("*cookie = %p", *_cookie); + TRACE("*cookie = %p\n", *_cookie); return result; } @@ -1043,7 +1043,7 @@ nfs4_open_dir(fs_volume* volume, fs_vnode* vnode, void** _cookie) static status_t nfs4_close_dir(fs_volume* volume, fs_vnode* vnode, void* _cookie) { - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p", volume, + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p\n", volume, reinterpret_cast(vnode->private_node)->ID(), _cookie); Cookie* cookie = reinterpret_cast(_cookie); @@ -1054,7 +1054,7 @@ nfs4_close_dir(fs_volume* volume, fs_vnode* vnode, void* _cookie) static status_t nfs4_free_dir_cookie(fs_volume* volume, fs_vnode* vnode, void* cookie) { - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p", volume, + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p\n", volume, reinterpret_cast(vnode->private_node)->ID(), cookie); delete reinterpret_cast(cookie); @@ -1068,7 +1068,7 @@ nfs4_read_dir(fs_volume* volume, fs_vnode* vnode, void* _cookie, { OpenDirCookie* cookie = reinterpret_cast(_cookie); VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p", volume, vti->ID(), + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p\n", volume, vti->ID(), _cookie); VnodeToInodeLocker _(vti); @@ -1083,7 +1083,7 @@ nfs4_read_dir(fs_volume* volume, fs_vnode* vnode, void* _cookie, static status_t nfs4_rewind_dir(fs_volume* volume, fs_vnode* vnode, void* _cookie) { - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p", volume, + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p\n", volume, reinterpret_cast(vnode->private_node)->ID(), _cookie); OpenDirCookie* cookie = reinterpret_cast(_cookie); @@ -1108,7 +1108,7 @@ nfs4_open_attr_dir(fs_volume* volume, fs_vnode* vnode, void** _cookie) *_cookie = cookie; VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64, volume, vti->ID()); + TRACE("volume = %p, vnode = %" B_PRIi64 "\n", volume, vti->ID()); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -1333,8 +1333,8 @@ nfs4_test_lock(fs_volume* volume, fs_vnode* vnode, void* _cookie, { VnodeToInode* vti = reinterpret_cast(vnode->private_node); OpenFileCookie* cookie = reinterpret_cast(_cookie); - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, lock = %p", volume, - vti->ID(), _cookie, lock); + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, lock = %p\n", + volume, vti->ID(), _cookie, lock); VnodeToInodeLocker _(vti); Inode* inode = vti->Get(); @@ -1351,8 +1351,8 @@ nfs4_acquire_lock(fs_volume* volume, fs_vnode* vnode, void* _cookie, { VnodeToInode* vti = reinterpret_cast(vnode->private_node); OpenFileCookie* cookie = reinterpret_cast(_cookie); - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, lock = %p", volume, - vti->ID(), _cookie, lock); + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, lock = %p\n", + volume, vti->ID(), _cookie, lock); VnodeToInodeLocker _(vti); @@ -1370,8 +1370,8 @@ nfs4_release_lock(fs_volume* volume, fs_vnode* vnode, void* _cookie, const struct flock* lock) { VnodeToInode* vti = reinterpret_cast(vnode->private_node); - TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, lock = %p", volume, - vti->ID(), _cookie, lock); + TRACE("volume = %p, vnode = %" B_PRIi64 ", cookie = %p, lock = %p\n", + volume, vti->ID(), _cookie, lock); VnodeToInodeLocker _(vti); Inode* inode = vti->Get();