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);
}
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();
@@ -39,7 +39,7 @@ Inode::Inode()
status_t
Inode::CreateInode(FileSystem* fs, const FileInfo &fi, Inode** _inode)
Inode::CreateInode(FileSystem* fs, const FileInfo& fi, Inode** _inode)
{
Inode* inode = NULL;
if (fs->Root() == NULL)
@@ -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)
+2 -2
View File
@@ -82,12 +82,12 @@ public:
status_t Read(OpenFileCookie* cookie, off_t pos,
void* buffer, size_t* length);
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,
void* buffer, size_t* length, bool* eof);
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 OpenDir(OpenDirCookie* cookie);
@@ -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;
@@ -327,7 +327,7 @@ Inode::Read(OpenFileCookie* cookie, off_t pos, void* buffer, size_t* _length)
status_t
Inode::WriteDirect(OpenStateCookie* cookie, off_t pos, const void* _buffer,
size_t *_length)
size_t* _length)
{
uint32 size = 0;
const char* buffer = reinterpret_cast<const char*>(_buffer);
@@ -370,7 +370,7 @@ Inode::WriteDirect(OpenStateCookie* cookie, off_t pos, const void* _buffer,
status_t
Inode::Write(OpenFileCookie* cookie, off_t pos, const void* _buffer,
size_t *_length)
size_t* _length)
{
struct stat st;
status_t result = Stat(&st);
@@ -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) {
@@ -1004,7 +1004,7 @@ NFS4Inode::TestLock(OpenFileCookie* cookie, LockType* type, uint64* position,
if (result != B_OK)
return result;
ReplyInterpreter &reply = request.Reply();
ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), serv, cookie))
continue;
@@ -1043,7 +1043,7 @@ NFS4Inode::AcquireLock(OpenFileCookie* cookie, LockInfo* lockInfo, bool wait)
return result;
}
ReplyInterpreter &reply = request.Reply();
ReplyInterpreter& reply = request.Reply();
sequence += IncrementSequence(reply.NFS4Error());
@@ -1087,7 +1087,7 @@ NFS4Inode::ReleaseLock(OpenFileCookie* cookie, LockInfo* lockInfo)
if (result != B_OK)
return result;
ReplyInterpreter &reply = request.Reply();
ReplyInterpreter& reply = request.Reply();
reply.PutFH();
result = reply.LockU(lockInfo);
@@ -123,7 +123,7 @@ OpenState::_ReleaseLockOwner(LockOwner* owner)
if (result != B_OK)
return result;
ReplyInterpreter &reply = request.Reply();
ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), server))
continue;
@@ -241,7 +241,7 @@ OpenState::_ReclaimLocks(uint64 newClientID)
if (result != B_OK)
break;
ReplyInterpreter &reply = request.Reply();
ReplyInterpreter& reply = request.Reply();
if (HandleErrors(reply.NFS4Error(), server))
continue;
@@ -18,7 +18,7 @@
using namespace RPC;
CallbackRequest::CallbackRequest(void *buffer, int size)
CallbackRequest::CallbackRequest(void* buffer, int size)
:
fError(B_BAD_VALUE),
fRPCError(GARBAGE_ARGS),
@@ -17,7 +17,7 @@ namespace RPC {
class CallbackRequest {
public:
CallbackRequest(void *buffer, int size);
CallbackRequest(void* buffer, int size);
~CallbackRequest();
inline uint32 XID();
@@ -17,7 +17,7 @@
using namespace RPC;
Reply::Reply(void *buffer, int size)
Reply::Reply(void* buffer, int size)
:
fError(B_OK),
fStream(buffer, size),
@@ -16,7 +16,7 @@ namespace RPC {
class Reply {
public:
Reply(void *buffer, int size);
Reply(void* buffer, int size);
~Reply();
inline uint32 GetXID();
@@ -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)
@@ -555,7 +554,7 @@ ReplyInterpreter::_DecodeAttrs(XDR::ReadStream& str, AttrValue** attrs,
uint32* count)
{
uint32 bcount = fReply->Stream().GetUInt();
uint32 *bitmap = new(std::nothrow) uint32[bcount];
uint32* bitmap = new(std::nothrow) uint32[bcount];
if (bitmap == NULL)
return B_NO_MEMORY;
@@ -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();
}
@@ -28,8 +28,8 @@ Request::Send(Cookie* cookie)
status_t
Request::_SendUDP(Cookie* cookie)
{
RPC::Reply *rpl = NULL;
RPC::Request *rpc;
RPC::Reply* rpl = NULL;
RPC::Request* rpc;
status_t result = fServer->SendCallAsync(fBuilder.Request(), &rpl, &rpc);
if (result != B_OK)
@@ -87,8 +87,8 @@ Request::_SendUDP(Cookie* cookie)
status_t
Request::_SendTCP(Cookie* cookie)
{
RPC::Reply *rpl = NULL;
RPC::Request *rpc;
RPC::Reply* rpl = NULL;
RPC::Request* rpc;
status_t result;
int attempts = 0;
@@ -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;
+1 -1
View File
@@ -277,7 +277,7 @@ WriteStream::AddString(const char* str, uint32 maxlen)
status_t
WriteStream::AddOpaque(const void *ptr, uint32 size)
WriteStream::AddOpaque(const void* ptr, uint32 size)
{
uint32 real_size = _RealSize(size);
status_t err = _CheckResize(real_size + sizeof(uint32));
@@ -132,13 +132,13 @@ nfs4_mount(fs_volume* volume, const char* device, uint32 flags,
PeerAddress address;
MountConfiguration config;
char *path;
char* path;
result = ParseArguments(args, &address, &path, &config);
if (result != B_OK)
return result;
MemoryDeleter pathDeleter(path);
RPC::Server *server;
RPC::Server* server;
result = gRPCServerManager->Acquire(&server, address, CreateNFS4Server);
if (result != B_OK)
return result;
@@ -1065,7 +1065,7 @@ static file_system_module_info sNFSv4ModuleInfo = {
};
module_info* modules[] = {
(module_info* )&sNFSv4ModuleInfo,
(module_info*)&sNFSv4ModuleInfo,
NULL,
};
@@ -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;
}
@@ -190,7 +190,7 @@ GetAddrInfo(const char* node, const char* service,
continue;
}
struct addrinfo *addr;
struct addrinfo* addr;
switch (code) {
case MsgReply:
addr = reinterpret_cast<struct addrinfo*>(reply);
@@ -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);