netfs: Fix and enable on 64-bit.

This commit is contained in:
Augustin Cavalier 2018-11-18 14:37:06 -05:00
parent f0d5e5b062
commit 59ecfa6cb6
9 changed files with 38 additions and 28 deletions

View File

@ -8,7 +8,7 @@ local packages = [ FFilterByBuildFeatures
HaikuUserguide
HaikuWelcome
MakefileEngine
NetFS@!x86_64
NetFS
UserlandFS
]
;

View File

@ -40,7 +40,7 @@ if $(HAIKU_IS_BOOTSTRAP) != 1 {
haiku_userguide_zh_CN
haiku_welcome
makefile_engine
netfs@!x86_64
netfs
userland_fs
] ;
}

View File

@ -132,7 +132,7 @@ struct ShareVolume::AttrDirCookie {
}
ShareAttrDirIterator* iterator;
int32 cookie;
intptr_t cookie;
bool rewind;
};
@ -747,7 +747,7 @@ ShareVolume::Close(Node* _node, void* cookie)
status_t
ShareVolume::FreeCookie(Node* _node, void* cookie)
{
return _Close((int32)cookie);
return _Close((intptr_t)cookie);
}
// Read
@ -765,7 +765,7 @@ ShareVolume::Read(Node* _node, void* cookie, off_t pos, void* _buffer,
// prepare the request
ReadRequest request;
request.volumeID = fID;
request.cookie = (int32)cookie;
request.cookie = (intptr_t)cookie;
request.pos = pos;
request.size = bufferSize;
@ -861,7 +861,7 @@ ShareVolume::Write(Node* _node, void* cookie, off_t pos, const void* _buffer,
// prepare the request
WriteRequest request;
request.volumeID = fID;
request.cookie = (int32)cookie;
request.cookie = (intptr_t)cookie;
request.pos = pos;
request.data.SetTo(buffer, toWrite);
@ -2951,7 +2951,7 @@ ShareVolume::_MultiWalk(RequestMemberArray<EntryInfo>& _entryInfos,
// _Close
status_t
ShareVolume::_Close(int32 cookie)
ShareVolume::_Close(intptr_t cookie)
{
if (!_EnsureShareMounted())
return ERROR_NOT_CONNECTED;

View File

@ -217,7 +217,7 @@ private:
status_t _MultiWalk(
RequestMemberArray<EntryInfo>& entryInfos,
MultiWalkReply** reply);
status_t _Close(int32 cookie);
status_t _Close(intptr_t cookie);
uint32 _GetConnectionState();
bool _IsConnected();

View File

@ -468,7 +468,7 @@ struct CreateFileReply : ReplyRequest {
}
EntryInfo entryInfo;
int32 cookie;
intptr_t cookie;
};
// OpenRequest
@ -500,7 +500,7 @@ struct OpenReply : ReplyRequest {
}
NodeInfo nodeInfo;
int32 cookie;
intptr_t cookie;
};
// CloseRequest
@ -514,7 +514,7 @@ struct CloseRequest : VolumeRequest {
visitor->Visit(this, cookie);
}
int32 cookie;
intptr_t cookie;
};
// CloseReply
@ -542,7 +542,7 @@ struct ReadRequest : VolumeRequest {
visitor->Visit(this, size);
}
int32 cookie;
intptr_t cookie;
off_t pos;
int32 size;
};
@ -578,7 +578,7 @@ struct WriteRequest : VolumeRequest {
visitor->Visit(this, data);
}
int32 cookie;
intptr_t cookie;
off_t pos;
Data data;
};
@ -825,7 +825,7 @@ struct OpenDirReply : ReplyRequest {
}
NodeInfo nodeInfo;
int32 cookie;
intptr_t cookie;
};
// ReadDirRequest
@ -841,7 +841,7 @@ struct ReadDirRequest : VolumeRequest {
visitor->Visit(this, rewind);
}
int32 cookie;
intptr_t cookie;
int32 count;
bool rewind;
};
@ -955,7 +955,7 @@ struct OpenAttrDirReply : ReplyRequest {
}
AttrDirInfo attrDirInfo;
int32 cookie;
intptr_t cookie;
};
// ReadAttrDirRequest
@ -970,7 +970,7 @@ struct ReadAttrDirRequest : VolumeRequest {
visitor->Visit(this, rewind);
}
int32 cookie;
intptr_t cookie;
int32 count;
bool rewind;
};
@ -1180,7 +1180,7 @@ struct OpenQueryReply : ReplyRequest {
visitor->Visit(this, cookie);
}
int32 cookie;
intptr_t cookie;
};
// ReadQueryRequest
@ -1193,7 +1193,7 @@ struct ReadQueryRequest : Request {
visitor->Visit(this, cookie);
}
int32 cookie;
intptr_t cookie;
int32 count;
};

View File

@ -2046,15 +2046,15 @@ ClientConnection::VisitReadAttrRequest(ReadAttrRequest* request)
// the size of the attribute.
attr_info info;
result = handle->StatAttr(request->name.GetString(), &info);
off_t originalPos = max(request->pos, 0LL);
int32 originalSize = max(request->size, 0L);
off_t originalPos = max(request->pos, (off_t)0);
int32 originalSize = max(request->size, (int32)0);
off_t pos = originalPos;
int32 size = originalSize;
type_code type = B_SWAP_INT32(request->type);
bool convert = false;
if (result == B_OK) {
originalSize = min((off_t)originalSize, max(0LL, info.size - pos));
originalSize = min((off_t)originalSize, max((off_t)0, info.size - pos));
size = originalSize;
// deal with inverse endianess clients
@ -2193,7 +2193,7 @@ ClientConnection::VisitWriteAttrRequest(WriteAttrRequest* request)
managerLocker.Unlock();
if (result == B_OK) {
off_t pos = max(request->pos, 0LL);
off_t pos = max(request->pos, (off_t)0);
int32 size = request->data.GetSize();
type_code type = request->type;
char* buffer = (char*)request->data.GetData();
@ -2204,8 +2204,8 @@ ClientConnection::VisitWriteAttrRequest(WriteAttrRequest* request)
if (pos != 0) {
WARN("WriteAttr(): WARNING: Need to convert attribute "
"endianess, but position is not 0: attribute: %s, "
"pos: %lld, size: %ld\n", request->name.GetString(),
pos, size);
"pos: %" B_PRIdOFF ", size: %" B_PRId32 "\n",
request->name.GetString(), pos, size);
}
swap_data(type, buffer, size, B_SWAP_ALWAYS);
} else
@ -2571,7 +2571,7 @@ ClientConnection::ProcessQueryEvent(NodeMonitoringEvent* event)
} else {
// We only support "entry created" and "entry removed" query events.
// "entry moved" is split by the volume manager into those.
ERROR("Ignoring unexpected query event: opcode: 0x%lx\n",
ERROR("Ignoring unexpected query event: opcode: 0x%" B_PRIx32 "\n",
event->opcode);
return;
}

View File

@ -1150,7 +1150,7 @@ NetFSServer::_ConnectionDeleter()
ClientConnection* connection = NULL;
if (error == B_OK) {
AutoLocker<Locker> _(fLock);
connection = (ClientConnection*)fClosedConnections.RemoveItem(0L);
connection = (ClientConnection*)fClosedConnections.RemoveItem((int32)0);
}
if (connection)
delete connection;

View File

@ -151,7 +151,8 @@ Node::UpdateStat()
// check if it is the same node
if (st.st_dev != fStat.st_dev || st.st_ino != fStat.st_ino) {
ERROR("Node::UpdateStat(): ERROR: GetPath() returned path that "
"doesn't point to this node: node: (%ld, %lld), path: `%s'\n",
"doesn't point to this node: node: (%" B_PRIdDEV ", %" B_PRIdINO "), "
"path: `%s'\n",
GetVolumeID(), GetID(), path.GetPath());
return B_ENTRY_NOT_FOUND;
}

View File

@ -329,7 +329,12 @@ struct SecurityContext::UserPath {
uint32 GetHashCode() const
{
#ifdef B_HAIKU_64_BIT
uint64 v = (uint64)user;
return (path.GetHashCode() * 31) + ((uint32)(v >> 32) ^ (uint32)v);
#else
return path.GetHashCode() * 31 + (uint32)user;
#endif
}
UserPath& operator=(const UserPath& other)
@ -520,7 +525,11 @@ SecurityContext::Archive(BMessage* archive, bool deep) const
if (!tmpUserArchives)
return B_NO_MEMORY;
ArrayDeleter<BMessage> deleter(tmpUserArchives);
#ifdef B_HAIKU_64_BIT
HashMap<HashKey64<User*>, BMessage*> userArchives;
#else
HashMap<HashKey32<User*>, BMessage*> userArchives;
#endif
int32 i = 0;
for (UserMap::Iterator it = fUsers->GetIterator(); it.HasNext();) {
User* user = it.Next().value;