nfs4, dns_resolver: fix numerous style violations
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user