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
+1 -1
View File
@@ -8,7 +8,7 @@ local packages = [ FFilterByBuildFeatures
HaikuUserguide HaikuUserguide
HaikuWelcome HaikuWelcome
MakefileEngine MakefileEngine
NetFS@!x86_64 NetFS
UserlandFS UserlandFS
] ]
; ;
+1 -1
View File
@@ -40,7 +40,7 @@ if $(HAIKU_IS_BOOTSTRAP) != 1 {
haiku_userguide_zh_CN haiku_userguide_zh_CN
haiku_welcome haiku_welcome
makefile_engine makefile_engine
netfs@!x86_64 netfs
userland_fs userland_fs
] ; ] ;
} }
@@ -132,7 +132,7 @@ struct ShareVolume::AttrDirCookie {
} }
ShareAttrDirIterator* iterator; ShareAttrDirIterator* iterator;
int32 cookie; intptr_t cookie;
bool rewind; bool rewind;
}; };
@@ -747,7 +747,7 @@ ShareVolume::Close(Node* _node, void* cookie)
status_t status_t
ShareVolume::FreeCookie(Node* _node, void* cookie) ShareVolume::FreeCookie(Node* _node, void* cookie)
{ {
return _Close((int32)cookie); return _Close((intptr_t)cookie);
} }
// Read // Read
@@ -765,7 +765,7 @@ ShareVolume::Read(Node* _node, void* cookie, off_t pos, void* _buffer,
// prepare the request // prepare the request
ReadRequest request; ReadRequest request;
request.volumeID = fID; request.volumeID = fID;
request.cookie = (int32)cookie; request.cookie = (intptr_t)cookie;
request.pos = pos; request.pos = pos;
request.size = bufferSize; request.size = bufferSize;
@@ -861,7 +861,7 @@ ShareVolume::Write(Node* _node, void* cookie, off_t pos, const void* _buffer,
// prepare the request // prepare the request
WriteRequest request; WriteRequest request;
request.volumeID = fID; request.volumeID = fID;
request.cookie = (int32)cookie; request.cookie = (intptr_t)cookie;
request.pos = pos; request.pos = pos;
request.data.SetTo(buffer, toWrite); request.data.SetTo(buffer, toWrite);
@@ -2951,7 +2951,7 @@ ShareVolume::_MultiWalk(RequestMemberArray<EntryInfo>& _entryInfos,
// _Close // _Close
status_t status_t
ShareVolume::_Close(int32 cookie) ShareVolume::_Close(intptr_t cookie)
{ {
if (!_EnsureShareMounted()) if (!_EnsureShareMounted())
return ERROR_NOT_CONNECTED; return ERROR_NOT_CONNECTED;
@@ -217,7 +217,7 @@ private:
status_t _MultiWalk( status_t _MultiWalk(
RequestMemberArray<EntryInfo>& entryInfos, RequestMemberArray<EntryInfo>& entryInfos,
MultiWalkReply** reply); MultiWalkReply** reply);
status_t _Close(int32 cookie); status_t _Close(intptr_t cookie);
uint32 _GetConnectionState(); uint32 _GetConnectionState();
bool _IsConnected(); bool _IsConnected();
@@ -468,7 +468,7 @@ struct CreateFileReply : ReplyRequest {
} }
EntryInfo entryInfo; EntryInfo entryInfo;
int32 cookie; intptr_t cookie;
}; };
// OpenRequest // OpenRequest
@@ -500,7 +500,7 @@ struct OpenReply : ReplyRequest {
} }
NodeInfo nodeInfo; NodeInfo nodeInfo;
int32 cookie; intptr_t cookie;
}; };
// CloseRequest // CloseRequest
@@ -514,7 +514,7 @@ struct CloseRequest : VolumeRequest {
visitor->Visit(this, cookie); visitor->Visit(this, cookie);
} }
int32 cookie; intptr_t cookie;
}; };
// CloseReply // CloseReply
@@ -542,7 +542,7 @@ struct ReadRequest : VolumeRequest {
visitor->Visit(this, size); visitor->Visit(this, size);
} }
int32 cookie; intptr_t cookie;
off_t pos; off_t pos;
int32 size; int32 size;
}; };
@@ -578,7 +578,7 @@ struct WriteRequest : VolumeRequest {
visitor->Visit(this, data); visitor->Visit(this, data);
} }
int32 cookie; intptr_t cookie;
off_t pos; off_t pos;
Data data; Data data;
}; };
@@ -825,7 +825,7 @@ struct OpenDirReply : ReplyRequest {
} }
NodeInfo nodeInfo; NodeInfo nodeInfo;
int32 cookie; intptr_t cookie;
}; };
// ReadDirRequest // ReadDirRequest
@@ -841,7 +841,7 @@ struct ReadDirRequest : VolumeRequest {
visitor->Visit(this, rewind); visitor->Visit(this, rewind);
} }
int32 cookie; intptr_t cookie;
int32 count; int32 count;
bool rewind; bool rewind;
}; };
@@ -955,7 +955,7 @@ struct OpenAttrDirReply : ReplyRequest {
} }
AttrDirInfo attrDirInfo; AttrDirInfo attrDirInfo;
int32 cookie; intptr_t cookie;
}; };
// ReadAttrDirRequest // ReadAttrDirRequest
@@ -970,7 +970,7 @@ struct ReadAttrDirRequest : VolumeRequest {
visitor->Visit(this, rewind); visitor->Visit(this, rewind);
} }
int32 cookie; intptr_t cookie;
int32 count; int32 count;
bool rewind; bool rewind;
}; };
@@ -1180,7 +1180,7 @@ struct OpenQueryReply : ReplyRequest {
visitor->Visit(this, cookie); visitor->Visit(this, cookie);
} }
int32 cookie; intptr_t cookie;
}; };
// ReadQueryRequest // ReadQueryRequest
@@ -1193,7 +1193,7 @@ struct ReadQueryRequest : Request {
visitor->Visit(this, cookie); visitor->Visit(this, cookie);
} }
int32 cookie; intptr_t cookie;
int32 count; int32 count;
}; };
@@ -2046,15 +2046,15 @@ ClientConnection::VisitReadAttrRequest(ReadAttrRequest* request)
// the size of the attribute. // the size of the attribute.
attr_info info; attr_info info;
result = handle->StatAttr(request->name.GetString(), &info); result = handle->StatAttr(request->name.GetString(), &info);
off_t originalPos = max(request->pos, 0LL); off_t originalPos = max(request->pos, (off_t)0);
int32 originalSize = max(request->size, 0L); int32 originalSize = max(request->size, (int32)0);
off_t pos = originalPos; off_t pos = originalPos;
int32 size = originalSize; int32 size = originalSize;
type_code type = B_SWAP_INT32(request->type); type_code type = B_SWAP_INT32(request->type);
bool convert = false; bool convert = false;
if (result == B_OK) { 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; size = originalSize;
// deal with inverse endianess clients // deal with inverse endianess clients
@@ -2193,7 +2193,7 @@ ClientConnection::VisitWriteAttrRequest(WriteAttrRequest* request)
managerLocker.Unlock(); managerLocker.Unlock();
if (result == B_OK) { 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(); int32 size = request->data.GetSize();
type_code type = request->type; type_code type = request->type;
char* buffer = (char*)request->data.GetData(); char* buffer = (char*)request->data.GetData();
@@ -2204,8 +2204,8 @@ ClientConnection::VisitWriteAttrRequest(WriteAttrRequest* request)
if (pos != 0) { if (pos != 0) {
WARN("WriteAttr(): WARNING: Need to convert attribute " WARN("WriteAttr(): WARNING: Need to convert attribute "
"endianess, but position is not 0: attribute: %s, " "endianess, but position is not 0: attribute: %s, "
"pos: %lld, size: %ld\n", request->name.GetString(), "pos: %" B_PRIdOFF ", size: %" B_PRId32 "\n",
pos, size); request->name.GetString(), pos, size);
} }
swap_data(type, buffer, size, B_SWAP_ALWAYS); swap_data(type, buffer, size, B_SWAP_ALWAYS);
} else } else
@@ -2571,7 +2571,7 @@ ClientConnection::ProcessQueryEvent(NodeMonitoringEvent* event)
} else { } else {
// We only support "entry created" and "entry removed" query events. // We only support "entry created" and "entry removed" query events.
// "entry moved" is split by the volume manager into those. // "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); event->opcode);
return; return;
} }
@@ -1150,7 +1150,7 @@ NetFSServer::_ConnectionDeleter()
ClientConnection* connection = NULL; ClientConnection* connection = NULL;
if (error == B_OK) { if (error == B_OK) {
AutoLocker<Locker> _(fLock); AutoLocker<Locker> _(fLock);
connection = (ClientConnection*)fClosedConnections.RemoveItem(0L); connection = (ClientConnection*)fClosedConnections.RemoveItem((int32)0);
} }
if (connection) if (connection)
delete connection; delete connection;
@@ -151,7 +151,8 @@ Node::UpdateStat()
// check if it is the same node // check if it is the same node
if (st.st_dev != fStat.st_dev || st.st_ino != fStat.st_ino) { if (st.st_dev != fStat.st_dev || st.st_ino != fStat.st_ino) {
ERROR("Node::UpdateStat(): ERROR: GetPath() returned path that " 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()); GetVolumeID(), GetID(), path.GetPath());
return B_ENTRY_NOT_FOUND; return B_ENTRY_NOT_FOUND;
} }
@@ -329,7 +329,12 @@ struct SecurityContext::UserPath {
uint32 GetHashCode() const 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; return path.GetHashCode() * 31 + (uint32)user;
#endif
} }
UserPath& operator=(const UserPath& other) UserPath& operator=(const UserPath& other)
@@ -520,7 +525,11 @@ SecurityContext::Archive(BMessage* archive, bool deep) const
if (!tmpUserArchives) if (!tmpUserArchives)
return B_NO_MEMORY; return B_NO_MEMORY;
ArrayDeleter<BMessage> deleter(tmpUserArchives); ArrayDeleter<BMessage> deleter(tmpUserArchives);
#ifdef B_HAIKU_64_BIT
HashMap<HashKey64<User*>, BMessage*> userArchives;
#else
HashMap<HashKey32<User*>, BMessage*> userArchives; HashMap<HashKey32<User*>, BMessage*> userArchives;
#endif
int32 i = 0; int32 i = 0;
for (UserMap::Iterator it = fUsers->GetIterator(); it.HasNext();) { for (UserMap::Iterator it = fUsers->GetIterator(); it.HasNext();) {
User* user = it.Next().value; User* user = it.Next().value;