nfs4, dns_resolver: fix numerous style violations
This commit is contained in:
@@ -48,6 +48,7 @@ CacheRevalidator::Lock()
|
||||
mutex_lock(&fDirectoryCachesLock);
|
||||
}
|
||||
|
||||
|
||||
inline void
|
||||
CacheRevalidator::Unlock()
|
||||
{
|
||||
|
||||
@@ -34,6 +34,7 @@ PeerAddress::operator==(const PeerAddress& address)
|
||||
&& fProtocol == address.fProtocol;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
PeerAddress::operator<(const PeerAddress& address)
|
||||
{
|
||||
@@ -257,7 +258,6 @@ ConnectionBase::ConnectionBase(const PeerAddress& address)
|
||||
}
|
||||
|
||||
|
||||
|
||||
ConnectionStream::ConnectionStream(const PeerAddress& address)
|
||||
:
|
||||
Connection(address)
|
||||
@@ -360,8 +360,8 @@ ConnectionStream::Receive(void** _buffer, uint32* _size)
|
||||
|
||||
do {
|
||||
result = wait_for_objects(object, 2);
|
||||
if (result < B_OK ||
|
||||
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
if (result < B_OK
|
||||
|| (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
free(buffer);
|
||||
return ECONNABORTED;
|
||||
} else if ((object[1].events & B_EVENT_READ) == 0)
|
||||
@@ -438,8 +438,8 @@ ConnectionPacket::Receive(void** _buffer, uint32* _size)
|
||||
|
||||
do {
|
||||
result = wait_for_objects(object, 2);
|
||||
if (result < B_OK ||
|
||||
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
if (result < B_OK
|
||||
|| (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
free(buffer);
|
||||
return ECONNABORTED;
|
||||
} else if ((object[1].events & B_EVENT_READ) == 0)
|
||||
@@ -695,8 +695,8 @@ ConnectionListener::AcceptConnection(Connection** connection)
|
||||
|
||||
do {
|
||||
status_t result = wait_for_objects(object, 2);
|
||||
if (result < B_OK ||
|
||||
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
if (result < B_OK
|
||||
|| (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
return ECONNABORTED;
|
||||
} else if ((object[1].events & B_EVENT_READ) == 0)
|
||||
continue;
|
||||
|
||||
@@ -128,6 +128,7 @@ DirectoryCache::AddEntry(const char* name, ino_t node, bool created)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DirectoryCache::RemoveEntry(const char* name)
|
||||
{
|
||||
@@ -244,8 +245,8 @@ DirectoryCache::NotifyChanges(DirectoryCacheSnapshot* oldSnapshot,
|
||||
bool found = false;
|
||||
NameCacheEntry* prev = NULL;
|
||||
while (oldCurrent != NULL) {
|
||||
if (oldCurrent->fNode == newCurrent->fNode &&
|
||||
strcmp(oldCurrent->fName, newCurrent->fName) == 0) {
|
||||
if (oldCurrent->fNode == newCurrent->fNode
|
||||
&& strcmp(oldCurrent->fName, newCurrent->fName) == 0) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -138,12 +138,12 @@ FileSystem::Mount(FileSystem** pfs, RPC::Server* serv, const char* fsPath,
|
||||
fs->fExpireType = values[1].fData.fValue32;
|
||||
|
||||
// FATTR4_FSID is mandatory
|
||||
FileSystemId* fsid =
|
||||
reinterpret_cast<FileSystemId*>(values[2].fData.fPointer);
|
||||
FileSystemId* fsid
|
||||
= reinterpret_cast<FileSystemId*>(values[2].fData.fPointer);
|
||||
|
||||
if (count == 4 && values[3].fAttribute == FATTR4_FS_LOCATIONS) {
|
||||
FSLocations* locs =
|
||||
reinterpret_cast<FSLocations*>(values[3].fData.fLocations);
|
||||
FSLocations* locs
|
||||
= reinterpret_cast<FSLocations*>(values[3].fData.fLocations);
|
||||
|
||||
fs->fPath = strdup(locs->fRootPath);
|
||||
} else
|
||||
@@ -230,8 +230,8 @@ FileSystem::Migrate(const RPC::Server* serv)
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
|
||||
FSLocations* locs =
|
||||
reinterpret_cast<FSLocations*>(values[0].fData.fLocations);
|
||||
FSLocations* locs
|
||||
= reinterpret_cast<FSLocations*>(values[0].fData.fLocations);
|
||||
|
||||
RPC::Server* server = fServer;
|
||||
PeerAddress addr = fServer->ID();
|
||||
|
||||
@@ -104,8 +104,8 @@ Inode::CreateInode(FileSystem* fs, const FileInfo &fi, Inode** _inode)
|
||||
size = values[2].fData.fValue64;
|
||||
|
||||
// FATTR4_FSID is mandatory
|
||||
FileSystemId* fsid =
|
||||
reinterpret_cast<FileSystemId*>(values[3].fData.fPointer);
|
||||
FileSystemId* fsid
|
||||
= reinterpret_cast<FileSystemId*>(values[3].fData.fPointer);
|
||||
if (*fsid != fs->FsId()) {
|
||||
delete[] values;
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
@@ -653,6 +653,7 @@ Inode::CheckLockType(short ltype, uint32 mode)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Inode::TestLock(OpenFileCookie* cookie, struct flock* lock)
|
||||
{
|
||||
@@ -685,6 +686,7 @@ Inode::TestLock(OpenFileCookie* cookie, struct flock* lock)
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
Inode::AcquireLock(OpenFileCookie* cookie, const struct flock* lock,
|
||||
bool wait)
|
||||
|
||||
@@ -210,7 +210,6 @@ FileToAttrName(const char* path)
|
||||
}
|
||||
|
||||
|
||||
|
||||
status_t
|
||||
Inode::GetDirSnapshot(DirectoryCacheSnapshot** _snapshot,
|
||||
OpenDirCookie* cookie, uint64* _change, bool attribute)
|
||||
|
||||
@@ -284,8 +284,8 @@ Inode::CloseAttr(OpenAttrCookie* cookie)
|
||||
|
||||
|
||||
status_t
|
||||
Inode::ReadDirect(OpenStateCookie* cookie, off_t pos, void* buffer, size_t* _length,
|
||||
bool* eof)
|
||||
Inode::ReadDirect(OpenStateCookie* cookie, off_t pos, void* buffer,
|
||||
size_t* _length, bool* eof)
|
||||
{
|
||||
*eof = false;
|
||||
uint32 size = 0;
|
||||
|
||||
@@ -173,8 +173,8 @@ NFS4Inode::LookUp(const char* name, uint64* change, uint64* fileID,
|
||||
return result;
|
||||
|
||||
// FATTR4_FSID is mandatory
|
||||
FileSystemId* fsid =
|
||||
reinterpret_cast<FileSystemId*>(values[0].fData.fPointer);
|
||||
FileSystemId* fsid
|
||||
= reinterpret_cast<FileSystemId*>(values[0].fData.fPointer);
|
||||
if (*fsid != fFileSystem->FsId()) {
|
||||
delete[] values;
|
||||
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
|
||||
// represents.
|
||||
if (fFileSystem->IsAttrSupported(FATTR4_FILEID) ||
|
||||
fFileSystem->ExpireType() == FH4_PERSISTENT) {
|
||||
if (fFileSystem->IsAttrSupported(FATTR4_FILEID)
|
||||
|| fFileSystem->ExpireType() == FH4_PERSISTENT) {
|
||||
reply.PutFH();
|
||||
result = reply.LookUp();
|
||||
if (result != B_OK) {
|
||||
|
||||
@@ -158,7 +158,6 @@ ReplyInterpreter::Create(uint64* before, uint64* after, bool& atomic)
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Bit Twiddling Hacks
|
||||
// http://graphics.stanford.edu/~seander/bithacks.html
|
||||
static inline uint32 CountBits(uint32 v)
|
||||
@@ -667,8 +666,8 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs,
|
||||
for (uint32 i = 0; i < locs->fCount; i++) {
|
||||
locs->fLocations[i].fRootPath = sFlattenPathname(stream);
|
||||
locs->fLocations[i].fCount = stream.GetUInt();
|
||||
locs->fLocations[i].fLocations =
|
||||
new const char*[locs->fLocations[i].fCount];
|
||||
locs->fLocations[i].fLocations
|
||||
= new const char*[locs->fLocations[i].fCount];
|
||||
for (uint32 j = 0; j < locs->fLocations[i].fCount; j++)
|
||||
locs->fLocations[i].fLocations[j] = stream.GetString();
|
||||
}
|
||||
|
||||
@@ -837,8 +837,8 @@ RequestBuilder::_EncodeAttrs(XDR::WriteStream& stream, AttrValue* attr,
|
||||
return;
|
||||
}
|
||||
|
||||
Attribute* attrs =
|
||||
reinterpret_cast<Attribute*>(malloc(sizeof(Attribute) * count));
|
||||
Attribute* attrs
|
||||
= reinterpret_cast<Attribute*>(malloc(sizeof(Attribute) * count));
|
||||
for (uint32 i = 0; i < count; i++)
|
||||
attrs[i] = static_cast<Attribute>(attr[i].fAttribute);
|
||||
_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) {
|
||||
str.AddInt(1); // SET_TO_CLIENT_TIME4
|
||||
|
||||
struct timespec* ts =
|
||||
reinterpret_cast<timespec*>(attr[i].fData.fPointer);
|
||||
struct timespec* ts
|
||||
= reinterpret_cast<timespec*>(attr[i].fData.fPointer);
|
||||
str.AddHyper(ts->tv_sec);
|
||||
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) {
|
||||
str.AddInt(1); // SET_TO_CLIENT_TIME4
|
||||
|
||||
struct timespec* ts =
|
||||
reinterpret_cast<timespec*>(attr[i].fData.fPointer);
|
||||
struct timespec* ts
|
||||
= reinterpret_cast<timespec*>(attr[i].fData.fPointer);
|
||||
str.AddHyper(ts->tv_sec);
|
||||
str.AddUInt(ts->tv_nsec);
|
||||
|
||||
|
||||
@@ -94,8 +94,8 @@ WorkQueue::WorkingThread()
|
||||
|
||||
status_t result = wait_for_objects(object, 2);
|
||||
|
||||
if (result < B_OK ||
|
||||
(object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
if (result < B_OK
|
||||
|| (object[0].events & B_EVENT_ACQUIRE_SEMAPHORE) != 0) {
|
||||
return result;
|
||||
} else if ((object[1].events & B_EVENT_ACQUIRE_SEMAPHORE) == 0)
|
||||
continue;
|
||||
|
||||
@@ -105,16 +105,16 @@ RelocateEntries(struct addrinfo* addr)
|
||||
uint64 nextOffset = reinterpret_cast<uint64>(current->ai_next);
|
||||
|
||||
if (current->ai_addr != NULL) {
|
||||
current->ai_addr =
|
||||
reinterpret_cast<sockaddr*>(generalOffset + addrOffset);
|
||||
current->ai_addr
|
||||
= reinterpret_cast<sockaddr*>(generalOffset + addrOffset);
|
||||
}
|
||||
|
||||
if (current->ai_canonname != NULL)
|
||||
current->ai_canonname = generalOffset + nameOffset;
|
||||
|
||||
if (current->ai_next != NULL) {
|
||||
current->ai_next =
|
||||
reinterpret_cast<addrinfo*>(generalOffset + nextOffset);
|
||||
current->ai_next
|
||||
= reinterpret_cast<addrinfo*>(generalOffset + nextOffset);
|
||||
}
|
||||
|
||||
current = current->ai_next;
|
||||
@@ -150,8 +150,8 @@ GetAddrInfo(const char* node, const char* service,
|
||||
if (hints != NULL)
|
||||
memcpy(buffer + off, hints, sizeof(*hints));
|
||||
else {
|
||||
struct addrinfo *nullHints =
|
||||
reinterpret_cast<struct addrinfo*>(buffer + off);
|
||||
struct addrinfo *nullHints
|
||||
= reinterpret_cast<struct addrinfo*>(buffer + off);
|
||||
memset(nullHints, 0, sizeof(*nullHints));
|
||||
nullHints->ai_family = AF_UNSPEC;
|
||||
}
|
||||
@@ -223,6 +223,7 @@ dns_resolver_std_ops(int32 op, ...)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static dns_resolver_module sDNSResolverModule = {
|
||||
{
|
||||
DNS_RESOLVER_MODULE_NAME,
|
||||
|
||||
@@ -33,8 +33,8 @@ GetAddrInfo(const char* buffer)
|
||||
const char* service = buffer[nodeSize] == '\0' ? NULL : buffer + nodeSize;
|
||||
uint32 serviceSize = service != NULL ? strlen(service) + 1 : 1;
|
||||
|
||||
const struct addrinfo* hints =
|
||||
reinterpret_cast<const addrinfo*>(buffer + nodeSize + serviceSize);
|
||||
const struct addrinfo* hints
|
||||
= reinterpret_cast<const addrinfo*>(buffer + nodeSize + serviceSize);
|
||||
|
||||
struct addrinfo* ai;
|
||||
status_t result = getaddrinfo(node, service, hints, &ai);
|
||||
|
||||
Reference in New Issue
Block a user