nfs4, dns_resolver: fix numerous style violations

This commit is contained in:
Pawel Dziepak
2012-10-31 16:17:22 +01:00
parent cae470f922
commit bcb18a9b36
25 changed files with 90 additions and 87 deletions
@@ -48,6 +48,7 @@ CacheRevalidator::Lock()
mutex_lock(&fDirectoryCachesLock); mutex_lock(&fDirectoryCachesLock);
} }
inline void inline void
CacheRevalidator::Unlock() CacheRevalidator::Unlock()
{ {
@@ -34,6 +34,7 @@ PeerAddress::operator==(const PeerAddress& address)
&& fProtocol == address.fProtocol; && fProtocol == address.fProtocol;
} }
bool bool
PeerAddress::operator<(const PeerAddress& address) PeerAddress::operator<(const PeerAddress& address)
{ {
@@ -257,7 +258,6 @@ ConnectionBase::ConnectionBase(const PeerAddress& address)
} }
ConnectionStream::ConnectionStream(const PeerAddress& address) ConnectionStream::ConnectionStream(const PeerAddress& address)
: :
Connection(address) Connection(address)
@@ -360,8 +360,8 @@ ConnectionStream::Receive(void** _buffer, uint32* _size)
do { do {
result = wait_for_objects(object, 2); result = wait_for_objects(object, 2);
if (result < B_OK || if (result < B_OK
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) { || (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
free(buffer); free(buffer);
return ECONNABORTED; return ECONNABORTED;
} else if ((object[1].events & B_EVENT_READ) == 0) } else if ((object[1].events & B_EVENT_READ) == 0)
@@ -438,8 +438,8 @@ ConnectionPacket::Receive(void** _buffer, uint32* _size)
do { do {
result = wait_for_objects(object, 2); result = wait_for_objects(object, 2);
if (result < B_OK || if (result < B_OK
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) { || (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
free(buffer); free(buffer);
return ECONNABORTED; return ECONNABORTED;
} else if ((object[1].events & B_EVENT_READ) == 0) } else if ((object[1].events & B_EVENT_READ) == 0)
@@ -695,8 +695,8 @@ ConnectionListener::AcceptConnection(Connection** connection)
do { do {
status_t result = wait_for_objects(object, 2); status_t result = wait_for_objects(object, 2);
if (result < B_OK || if (result < B_OK
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) { || (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
return ECONNABORTED; return ECONNABORTED;
} else if ((object[1].events & B_EVENT_READ) == 0) } else if ((object[1].events & B_EVENT_READ) == 0)
continue; continue;
@@ -128,6 +128,7 @@ DirectoryCache::AddEntry(const char* name, ino_t node, bool created)
return B_OK; return B_OK;
} }
void void
DirectoryCache::RemoveEntry(const char* name) DirectoryCache::RemoveEntry(const char* name)
{ {
@@ -244,8 +245,8 @@ DirectoryCache::NotifyChanges(DirectoryCacheSnapshot* oldSnapshot,
bool found = false; bool found = false;
NameCacheEntry* prev = NULL; NameCacheEntry* prev = NULL;
while (oldCurrent != NULL) { while (oldCurrent != NULL) {
if (oldCurrent->fNode == newCurrent->fNode && if (oldCurrent->fNode == newCurrent->fNode
strcmp(oldCurrent->fName, newCurrent->fName) == 0) { && strcmp(oldCurrent->fName, newCurrent->fName) == 0) {
found = true; found = true;
break; break;
} }
@@ -138,12 +138,12 @@ FileSystem::Mount(FileSystem** pfs, RPC::Server* serv, const char* fsPath,
fs->fExpireType = values[1].fData.fValue32; fs->fExpireType = values[1].fData.fValue32;
// FATTR4_FSID is mandatory // FATTR4_FSID is mandatory
FileSystemId* fsid = FileSystemId* fsid
reinterpret_cast<FileSystemId*>(values[2].fData.fPointer); = reinterpret_cast<FileSystemId*>(values[2].fData.fPointer);
if (count == 4 && values[3].fAttribute == FATTR4_FS_LOCATIONS) { if (count == 4 && values[3].fAttribute == FATTR4_FS_LOCATIONS) {
FSLocations* locs = FSLocations* locs
reinterpret_cast<FSLocations*>(values[3].fData.fLocations); = reinterpret_cast<FSLocations*>(values[3].fData.fLocations);
fs->fPath = strdup(locs->fRootPath); fs->fPath = strdup(locs->fRootPath);
} else } else
@@ -230,8 +230,8 @@ FileSystem::Migrate(const RPC::Server* serv)
if (result != B_OK) if (result != B_OK)
return result; return result;
FSLocations* locs = FSLocations* locs
reinterpret_cast<FSLocations*>(values[0].fData.fLocations); = reinterpret_cast<FSLocations*>(values[0].fData.fLocations);
RPC::Server* server = fServer; RPC::Server* server = fServer;
PeerAddress addr = fServer->ID(); PeerAddress addr = fServer->ID();
@@ -39,7 +39,7 @@ Inode::Inode()
status_t status_t
Inode::CreateInode(FileSystem* fs, const FileInfo &fi, Inode** _inode) Inode::CreateInode(FileSystem* fs, const FileInfo& fi, Inode** _inode)
{ {
Inode* inode = NULL; Inode* inode = NULL;
if (fs->Root() == NULL) if (fs->Root() == NULL)
@@ -104,8 +104,8 @@ Inode::CreateInode(FileSystem* fs, const FileInfo &fi, Inode** _inode)
size = values[2].fData.fValue64; size = values[2].fData.fValue64;
// FATTR4_FSID is mandatory // FATTR4_FSID is mandatory
FileSystemId* fsid = FileSystemId* fsid
reinterpret_cast<FileSystemId*>(values[3].fData.fPointer); = reinterpret_cast<FileSystemId*>(values[3].fData.fPointer);
if (*fsid != fs->FsId()) { if (*fsid != fs->FsId()) {
delete[] values; delete[] values;
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
@@ -653,6 +653,7 @@ Inode::CheckLockType(short ltype, uint32 mode)
} }
} }
status_t status_t
Inode::TestLock(OpenFileCookie* cookie, struct flock* lock) Inode::TestLock(OpenFileCookie* cookie, struct flock* lock)
{ {
@@ -685,6 +686,7 @@ Inode::TestLock(OpenFileCookie* cookie, struct flock* lock)
return B_OK; return B_OK;
} }
status_t status_t
Inode::AcquireLock(OpenFileCookie* cookie, const struct flock* lock, Inode::AcquireLock(OpenFileCookie* cookie, const struct flock* lock,
bool wait) bool wait)
+2 -2
View File
@@ -82,12 +82,12 @@ public:
status_t Read(OpenFileCookie* cookie, off_t pos, status_t Read(OpenFileCookie* cookie, off_t pos,
void* buffer, size_t* length); void* buffer, size_t* length);
status_t Write(OpenFileCookie* cookie, off_t pos, status_t Write(OpenFileCookie* cookie, off_t pos,
const void* buffer, size_t *_length); const void* buffer, size_t* _length);
status_t ReadDirect(OpenStateCookie* cookie, off_t pos, status_t ReadDirect(OpenStateCookie* cookie, off_t pos,
void* buffer, size_t* length, bool* eof); void* buffer, size_t* length, bool* eof);
status_t WriteDirect(OpenStateCookie* cookie, off_t pos, status_t WriteDirect(OpenStateCookie* cookie, off_t pos,
const void* buffer, size_t *_length); const void* buffer, size_t* _length);
status_t CreateDir(const char* name, int mode); status_t CreateDir(const char* name, int mode);
status_t OpenDir(OpenDirCookie* cookie); status_t OpenDir(OpenDirCookie* cookie);
@@ -210,7 +210,6 @@ FileToAttrName(const char* path)
} }
status_t status_t
Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot, Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
OpenDirCookie* cookie, uint64* _change, bool attribute) OpenDirCookie* cookie, uint64* _change, bool attribute)
@@ -284,8 +284,8 @@ Inode::CloseAttr(OpenAttrCookie* cookie)
status_t status_t
Inode::ReadDirect(OpenStateCookie* cookie, off_t pos, void* buffer, size_t* _length, Inode::ReadDirect(OpenStateCookie* cookie, off_t pos, void* buffer,
bool* eof) size_t* _length, bool* eof)
{ {
*eof = false; *eof = false;
uint32 size = 0; uint32 size = 0;
@@ -327,7 +327,7 @@ Inode::Read(OpenFileCookie* cookie, off_t pos, void* buffer, size_t* _length)
status_t status_t
Inode::WriteDirect(OpenStateCookie* cookie, off_t pos, const void* _buffer, Inode::WriteDirect(OpenStateCookie* cookie, off_t pos, const void* _buffer,
size_t *_length) size_t* _length)
{ {
uint32 size = 0; uint32 size = 0;
const char* buffer = reinterpret_cast<const char*>(_buffer); const char* buffer = reinterpret_cast<const char*>(_buffer);
@@ -370,7 +370,7 @@ Inode::WriteDirect(OpenStateCookie* cookie, off_t pos, const void* _buffer,
status_t status_t
Inode::Write(OpenFileCookie* cookie, off_t pos, const void* _buffer, Inode::Write(OpenFileCookie* cookie, off_t pos, const void* _buffer,
size_t *_length) size_t* _length)
{ {
struct stat st; struct stat st;
status_t result = Stat(&st); status_t result = Stat(&st);
@@ -153,15 +153,15 @@ static inline bool sIsAttrSet(Attribute attr, const uint32* bitmap,
enum FileType { enum FileType {
NF4REG = 1, /* Regular File */ NF4REG = 1, /* Regular File */
NF4DIR = 2, /* Directory */ NF4DIR = 2, /* Directory */
NF4BLK = 3, /* Special File - block device */ NF4BLK = 3, /* Special File - block device */
NF4CHR = 4, /* Special File - character device */ NF4CHR = 4, /* Special File - character device */
NF4LNK = 5, /* Symbolic Link */ NF4LNK = 5, /* Symbolic Link */
NF4SOCK = 6, /* Special File - socket */ NF4SOCK = 6, /* Special File - socket */
NF4FIFO = 7, /* Special File - fifo */ NF4FIFO = 7, /* Special File - fifo */
NF4ATTRDIR = 8, /* Attribute Directory */ NF4ATTRDIR = 8, /* Attribute Directory */
NF4NAMEDATTR = 9 /* Named Attribute */ NF4NAMEDATTR = 9 /* Named Attribute */
}; };
static const mode_t sNFSFileTypeToHaiku[] = { static const mode_t sNFSFileTypeToHaiku[] = {
@@ -173,8 +173,8 @@ NFS4Inode::LookUp(const char* name, uint64* change, uint64* fileID,
return result; return result;
// FATTR4_FSID is mandatory // FATTR4_FSID is mandatory
FileSystemId* fsid = FileSystemId* fsid
reinterpret_cast<FileSystemId*>(values[0].fData.fPointer); = reinterpret_cast<FileSystemId*>(values[0].fData.fPointer);
if (*fsid != fFileSystem->FsId()) { if (*fsid != fFileSystem->FsId()) {
delete[] values; delete[] values;
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
@@ -562,8 +562,8 @@ NFS4Inode::OpenFile(OpenState* state, int mode, OpenDelegationData* delegation)
// Verify if the file we want to open is the file this Inode // Verify if the file we want to open is the file this Inode
// represents. // represents.
if (fFileSystem->IsAttrSupported(FATTR4_FILEID) || if (fFileSystem->IsAttrSupported(FATTR4_FILEID)
fFileSystem->ExpireType() == FH4_PERSISTENT) { || fFileSystem->ExpireType() == FH4_PERSISTENT) {
reply.PutFH(); reply.PutFH();
result = reply.LookUp(); result = reply.LookUp();
if (result != B_OK) { if (result != B_OK) {
@@ -1004,7 +1004,7 @@ NFS4Inode::TestLock(OpenFileCookie* cookie, LockType* type, uint64* position,
if (result != B_OK) if (result != B_OK)
return result; return result;
ReplyInterpreter &reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), serv, cookie)) if (HandleErrors(reply.NFS4Error(), serv, cookie))
continue; continue;
@@ -1043,7 +1043,7 @@ NFS4Inode::AcquireLock(OpenFileCookie* cookie, LockInfo* lockInfo, bool wait)
return result; return result;
} }
ReplyInterpreter &reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
sequence += IncrementSequence(reply.NFS4Error()); sequence += IncrementSequence(reply.NFS4Error());
@@ -1087,7 +1087,7 @@ NFS4Inode::ReleaseLock(OpenFileCookie* cookie, LockInfo* lockInfo)
if (result != B_OK) if (result != B_OK)
return result; return result;
ReplyInterpreter &reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
reply.PutFH(); reply.PutFH();
result = reply.LockU(lockInfo); result = reply.LockU(lockInfo);
@@ -209,7 +209,7 @@ NFS4Server::_StartRenewing()
fThreadCancel = false; fThreadCancel = false;
fThread = spawn_kernel_thread(&NFS4Server::_RenewalThreadStart, fThread = spawn_kernel_thread(&NFS4Server::_RenewalThreadStart,
"NFSv4 Renewal", B_NORMAL_PRIORITY, this); "NFSv4 Renewal", B_NORMAL_PRIORITY, this);
if (fThread < B_OK) if (fThread < B_OK)
return fThread; return fThread;
@@ -123,7 +123,7 @@ OpenState::_ReleaseLockOwner(LockOwner* owner)
if (result != B_OK) if (result != B_OK)
return result; return result;
ReplyInterpreter &reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), server)) if (HandleErrors(reply.NFS4Error(), server))
continue; continue;
@@ -191,7 +191,7 @@ OpenState::_ReclaimOpen(uint64 newClientID)
result = reply.Open(fStateID, &fStateSeq, &confirm, &delegation); result = reply.Open(fStateID, &fStateSeq, &confirm, &delegation);
if (result != B_OK) { if (result != B_OK) {
fFileSystem->OpenOwnerSequenceUnlock(sequence); fFileSystem->OpenOwnerSequenceUnlock(sequence);
return result; return result;
} }
@@ -241,7 +241,7 @@ OpenState::_ReclaimLocks(uint64 newClientID)
if (result != B_OK) if (result != B_OK)
break; break;
ReplyInterpreter &reply = request.Reply(); ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), server)) if (HandleErrors(reply.NFS4Error(), server))
continue; continue;
@@ -18,7 +18,7 @@
using namespace RPC; using namespace RPC;
CallbackRequest::CallbackRequest(void *buffer, int size) CallbackRequest::CallbackRequest(void* buffer, int size)
: :
fError(B_BAD_VALUE), fError(B_BAD_VALUE),
fRPCError(GARBAGE_ARGS), fRPCError(GARBAGE_ARGS),
@@ -17,7 +17,7 @@ namespace RPC {
class CallbackRequest { class CallbackRequest {
public: public:
CallbackRequest(void *buffer, int size); CallbackRequest(void* buffer, int size);
~CallbackRequest(); ~CallbackRequest();
inline uint32 XID(); inline uint32 XID();
@@ -36,17 +36,17 @@ enum {
}; };
enum AcceptStat { enum AcceptStat {
SUCCESS = 0, /* RPC executed successfully */ SUCCESS = 0, /* RPC executed successfully */
PROG_UNAVAIL = 1, /* remote hasn't exported program */ PROG_UNAVAIL = 1, /* remote hasn't exported program */
PROG_MISMATCH = 2, /* remote can't support version # */ PROG_MISMATCH = 2, /* remote can't support version # */
PROC_UNAVAIL = 3, /* program can't support procedure */ PROC_UNAVAIL = 3, /* program can't support procedure */
GARBAGE_ARGS = 4, /* procedure can't decode params */ GARBAGE_ARGS = 4, /* procedure can't decode params */
SYSTEM_ERR = 5 /* e.g. memory allocation failure */ SYSTEM_ERR = 5 /* e.g. memory allocation failure */
}; };
enum RejectStat { enum RejectStat {
RPC_MISMATCH = 0, /* RPC version number != 2 */ RPC_MISMATCH = 0, /* RPC version number != 2 */
AUTH_ERROR = 1 /* remote can't authenticate caller */ AUTH_ERROR = 1 /* remote can't authenticate caller */
}; };
enum AuthFlavour { enum AuthFlavour {
@@ -17,7 +17,7 @@
using namespace RPC; using namespace RPC;
Reply::Reply(void *buffer, int size) Reply::Reply(void* buffer, int size)
: :
fError(B_OK), fError(B_OK),
fStream(buffer, size), fStream(buffer, size),
@@ -16,7 +16,7 @@ namespace RPC {
class Reply { class Reply {
public: public:
Reply(void *buffer, int size); Reply(void* buffer, int size);
~Reply(); ~Reply();
inline uint32 GetXID(); inline uint32 GetXID();
@@ -158,7 +158,6 @@ ReplyInterpreter::Create(uint64* before, uint64* after, bool& atomic)
} }
// Bit Twiddling Hacks // Bit Twiddling Hacks
// http://graphics.stanford.edu/~seander/bithacks.html // http://graphics.stanford.edu/~seander/bithacks.html
static inline uint32 CountBits(uint32 v) static inline uint32 CountBits(uint32 v)
@@ -555,7 +554,7 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs,
uint32* count) uint32* count)
{ {
uint32 bcount = fReply->Stream().GetUInt(); uint32 bcount = fReply->Stream().GetUInt();
uint32 *bitmap = new(std::nothrow) uint32[bcount]; uint32* bitmap = new(std::nothrow) uint32[bcount];
if (bitmap == NULL) if (bitmap == NULL)
return B_NO_MEMORY; return B_NO_MEMORY;
@@ -667,8 +666,8 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs,
for (uint32 i = 0; i < locs->fCount; i++) { for (uint32 i = 0; i < locs->fCount; i++) {
locs->fLocations[i].fRootPath = sFlattenPathname(stream); locs->fLocations[i].fRootPath = sFlattenPathname(stream);
locs->fLocations[i].fCount = stream.GetUInt(); locs->fLocations[i].fCount = stream.GetUInt();
locs->fLocations[i].fLocations = locs->fLocations[i].fLocations
new const char*[locs->fLocations[i].fCount]; = new const char*[locs->fLocations[i].fCount];
for (uint32 j = 0; j < locs->fLocations[i].fCount; j++) for (uint32 j = 0; j < locs->fLocations[i].fCount; j++)
locs->fLocations[i].fLocations[j] = stream.GetString(); locs->fLocations[i].fLocations[j] = stream.GetString();
} }
@@ -28,8 +28,8 @@ Request::Send(Cookie* cookie)
status_t status_t
Request::_SendUDP(Cookie* cookie) Request::_SendUDP(Cookie* cookie)
{ {
RPC::Reply *rpl = NULL; RPC::Reply* rpl = NULL;
RPC::Request *rpc; RPC::Request* rpc;
status_t result = fServer->SendCallAsync(fBuilder.Request(), &rpl, &rpc); status_t result = fServer->SendCallAsync(fBuilder.Request(), &rpl, &rpc);
if (result != B_OK) if (result != B_OK)
@@ -87,8 +87,8 @@ Request::_SendUDP(Cookie* cookie)
status_t status_t
Request::_SendTCP(Cookie* cookie) Request::_SendTCP(Cookie* cookie)
{ {
RPC::Reply *rpl = NULL; RPC::Reply* rpl = NULL;
RPC::Request *rpc; RPC::Request* rpc;
status_t result; status_t result;
int attempts = 0; int attempts = 0;
@@ -837,8 +837,8 @@ RequestBuilder::_EncodeAttrs(XDR::WriteStream& stream, AttrValue* attr,
return; return;
} }
Attribute* attrs = Attribute* attrs
reinterpret_cast<Attribute*>(malloc(sizeof(Attribute) * count)); = reinterpret_cast<Attribute*>(malloc(sizeof(Attribute) * count));
for (uint32 i = 0; i < count; i++) for (uint32 i = 0; i < count; i++)
attrs[i] = static_cast<Attribute>(attr[i].fAttribute); attrs[i] = static_cast<Attribute>(attr[i].fAttribute);
_AttrBitmap(stream, attrs, count); _AttrBitmap(stream, attrs, count);
@@ -885,8 +885,8 @@ RequestBuilder::_EncodeAttrs(XDR::WriteStream& stream, AttrValue* attr,
if (i < count && attr[i].fAttribute == FATTR4_TIME_ACCESS_SET) { if (i < count && attr[i].fAttribute == FATTR4_TIME_ACCESS_SET) {
str.AddInt(1); // SET_TO_CLIENT_TIME4 str.AddInt(1); // SET_TO_CLIENT_TIME4
struct timespec* ts = struct timespec* ts
reinterpret_cast<timespec*>(attr[i].fData.fPointer); = reinterpret_cast<timespec*>(attr[i].fData.fPointer);
str.AddHyper(ts->tv_sec); str.AddHyper(ts->tv_sec);
str.AddUInt(ts->tv_nsec); str.AddUInt(ts->tv_nsec);
@@ -896,8 +896,8 @@ RequestBuilder::_EncodeAttrs(XDR::WriteStream& stream, AttrValue* attr,
if (i < count && attr[i].fAttribute == FATTR4_TIME_MODIFY_SET) { if (i < count && attr[i].fAttribute == FATTR4_TIME_MODIFY_SET) {
str.AddInt(1); // SET_TO_CLIENT_TIME4 str.AddInt(1); // SET_TO_CLIENT_TIME4
struct timespec* ts = struct timespec* ts
reinterpret_cast<timespec*>(attr[i].fData.fPointer); = reinterpret_cast<timespec*>(attr[i].fData.fPointer);
str.AddHyper(ts->tv_sec); str.AddHyper(ts->tv_sec);
str.AddUInt(ts->tv_nsec); str.AddUInt(ts->tv_nsec);
@@ -94,8 +94,8 @@ WorkQueue::WorkingThread()
status_t result = wait_for_objects(object, 2); status_t result = wait_for_objects(object, 2);
if (result < B_OK || if (result < B_OK
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) { || (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
return result; return result;
} else if ((object[1].events & B_EVENT_ACQUIRE_SEMAPHORE) == 0) } else if ((object[1].events & B_EVENT_ACQUIRE_SEMAPHORE) == 0)
continue; continue;
+1 -1
View File
@@ -277,7 +277,7 @@ WriteStream::AddString(const char* str, uint32 maxlen)
status_t status_t
WriteStream::AddOpaque(const void *ptr, uint32 size) WriteStream::AddOpaque(const void* ptr, uint32 size)
{ {
uint32 real_size = _RealSize(size); uint32 real_size = _RealSize(size);
status_t err = _CheckResize(real_size + sizeof(uint32)); status_t err = _CheckResize(real_size + sizeof(uint32));
@@ -132,13 +132,13 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags,
PeerAddress address; PeerAddress address;
MountConfiguration config; MountConfiguration config;
char *path; char* path;
result = ParseArguments(args, &address, &path, &config); result = ParseArguments(args, &address, &path, &config);
if (result != B_OK) if (result != B_OK)
return result; return result;
MemoryDeleter pathDeleter(path); MemoryDeleter pathDeleter(path);
RPC::Server *server; RPC::Server* server;
result = gRPCServerManager->Acquire(&server, address, CreateNFS4Server); result = gRPCServerManager->Acquire(&server, address, CreateNFS4Server);
if (result != B_OK) if (result != B_OK)
return result; return result;
@@ -1065,7 +1065,7 @@ static file_system_module_info sNFSv4ModuleInfo = {
}; };
module_info* modules[] = { module_info* modules[] = {
(module_info* )&sNFSv4ModuleInfo, (module_info*)&sNFSv4ModuleInfo,
NULL, NULL,
}; };
@@ -105,16 +105,16 @@ RelocateEntries(struct addrinfo* addr)
uint64 nextOffset = reinterpret_cast<uint64>(current->ai_next); uint64 nextOffset = reinterpret_cast<uint64>(current->ai_next);
if (current->ai_addr != NULL) { if (current->ai_addr != NULL) {
current->ai_addr = current->ai_addr
reinterpret_cast<sockaddr*>(generalOffset + addrOffset); = reinterpret_cast<sockaddr*>(generalOffset + addrOffset);
} }
if (current->ai_canonname != NULL) if (current->ai_canonname != NULL)
current->ai_canonname = generalOffset + nameOffset; current->ai_canonname = generalOffset + nameOffset;
if (current->ai_next != NULL) { if (current->ai_next != NULL) {
current->ai_next = current->ai_next
reinterpret_cast<addrinfo*>(generalOffset + nextOffset); = reinterpret_cast<addrinfo*>(generalOffset + nextOffset);
} }
current = current->ai_next; current = current->ai_next;
@@ -150,8 +150,8 @@ GetAddrInfo(const char* node, const char* service,
if (hints != NULL) if (hints != NULL)
memcpy(buffer + off, hints, sizeof(*hints)); memcpy(buffer + off, hints, sizeof(*hints));
else { else {
struct addrinfo *nullHints = struct addrinfo *nullHints
reinterpret_cast<struct addrinfo*>(buffer + off); = reinterpret_cast<struct addrinfo*>(buffer + off);
memset(nullHints, 0, sizeof(*nullHints)); memset(nullHints, 0, sizeof(*nullHints));
nullHints->ai_family = AF_UNSPEC; nullHints->ai_family = AF_UNSPEC;
} }
@@ -190,7 +190,7 @@ GetAddrInfo(const char* node, const char* service,
continue; continue;
} }
struct addrinfo *addr; struct addrinfo* addr;
switch (code) { switch (code) {
case MsgReply: case MsgReply:
addr = reinterpret_cast<struct addrinfo*>(reply); addr = reinterpret_cast<struct addrinfo*>(reply);
@@ -223,6 +223,7 @@ dns_resolver_std_ops(int32 op, ...)
} }
} }
static dns_resolver_module sDNSResolverModule = { static dns_resolver_module sDNSResolverModule = {
{ {
DNS_RESOLVER_MODULE_NAME, DNS_RESOLVER_MODULE_NAME,
@@ -33,8 +33,8 @@ GetAddrInfo(const char* buffer)
const char* service = buffer[nodeSize] == '\0' ? NULL : buffer + nodeSize; const char* service = buffer[nodeSize] == '\0' ? NULL : buffer + nodeSize;
uint32 serviceSize = service != NULL ? strlen(service) + 1 : 1; uint32 serviceSize = service != NULL ? strlen(service) + 1 : 1;
const struct addrinfo* hints = const struct addrinfo* hints
reinterpret_cast<const addrinfo*>(buffer + nodeSize + serviceSize); = reinterpret_cast<const addrinfo*>(buffer + nodeSize + serviceSize);
struct addrinfo* ai; struct addrinfo* ai;
status_t result = getaddrinfo(node, service, hints, &ai); status_t result = getaddrinfo(node, service, hints, &ai);