nfs4: Make buildable under userlandfs
* Adjust some nfs4 code depending on _KERNEL_MODE / USER. * Add several functions needed by this driver to kernelland_emu. * Fixes #15556. Change-Id: I36c1727d9cff088aa93870806bfe69b46dbdd4e2 Reviewed-on: https://review.haiku-os.org/c/haiku/+/8712 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
@@ -11,13 +11,18 @@
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <errno.h>
|
||||
#ifdef USER
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#ifdef _KERNEL_MODE
|
||||
#include <net/dns_resolver.h>
|
||||
#endif
|
||||
#include <util/kernel_cpp.h>
|
||||
#include <util/Random.h>
|
||||
|
||||
@@ -221,7 +226,8 @@ AddressResolver::AddressResolver(const char* name)
|
||||
|
||||
AddressResolver::~AddressResolver()
|
||||
{
|
||||
freeaddrinfo(fHead);
|
||||
if (fHead != NULL)
|
||||
freeaddrinfo(fHead);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -166,8 +166,12 @@ IdMap::_Repair()
|
||||
strlcat(path, "/nfs4_idmapper_server", sizeof(path));
|
||||
|
||||
const char* args[] = { path, NULL };
|
||||
#ifdef _KERNEL_MODE
|
||||
thread_id thread = load_image_etc(1, args, NULL, B_NORMAL_PRIORITY,
|
||||
B_SYSTEM_TEAM, 0);
|
||||
#else
|
||||
thread_id thread = load_image(1, args, const_cast<const char**>(environ));
|
||||
#endif // _KERNEL_MODE
|
||||
if (thread < B_OK) {
|
||||
delete_port(fReplyPort);
|
||||
delete_port(fRequestPort);
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef USER
|
||||
extern "C" void dprintf(const char *format,...);
|
||||
#endif
|
||||
|
||||
|
||||
enum Procedure {
|
||||
ProcNull = 0,
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <AutoDeleter.h>
|
||||
#include <fs_cache.h>
|
||||
#include <fs_interface.h>
|
||||
|
||||
@@ -26,9 +26,12 @@ SharedLibrary libuserlandfs_haiku_kernel.so
|
||||
# kernelland_emu
|
||||
condition_variable.cpp
|
||||
debug.cpp
|
||||
heap.cpp
|
||||
KernelReferenceable.cpp
|
||||
lock.cpp
|
||||
low_resource_manager.cpp
|
||||
misc.cpp
|
||||
Random.cpp
|
||||
slab.cpp
|
||||
vm.cpp
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ SubDir HAIKU_TOP src tests add-ons kernel file_systems userlandfs ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs bfs ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs fat ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs cdda ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs nfs4 ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs ntfs ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs ramfs ;
|
||||
SubInclude HAIKU_TOP src tests add-ons kernel file_systems userlandfs reiserfs ;
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
SubDir HAIKU_TOP src tests add-ons kernel file_systems userlandfs nfs4 ;
|
||||
|
||||
local nfs4Top = [ FDirName $(HAIKU_TOP) src add-ons kernel file_systems nfs4 ] ;
|
||||
|
||||
SEARCH_SOURCE += $(nfs4Top) ;
|
||||
|
||||
# set some additional defines
|
||||
{
|
||||
local defines =
|
||||
USER=1
|
||||
;
|
||||
|
||||
defines = [ FDefines $(defines) ] ;
|
||||
SubDirC++Flags $(defines) -fno-rtti ;
|
||||
}
|
||||
|
||||
UsePrivateKernelHeaders ;
|
||||
UsePrivateHeaders shared ;
|
||||
|
||||
Addon <userland>nfs4
|
||||
:
|
||||
Cookie.cpp
|
||||
Connection.cpp
|
||||
Delegation.cpp
|
||||
DirectoryCache.cpp
|
||||
FileInfo.cpp
|
||||
FileSystem.cpp
|
||||
IdMap.cpp
|
||||
Inode.cpp
|
||||
InodeIdMap.cpp
|
||||
InodeDir.cpp
|
||||
InodeRegular.cpp
|
||||
kernel_interface.cpp
|
||||
MetadataCache.cpp
|
||||
NFS4Inode.cpp
|
||||
NFS4Object.cpp
|
||||
NFS4Server.cpp
|
||||
OpenState.cpp
|
||||
ReplyBuilder.cpp
|
||||
ReplyInterpreter.cpp
|
||||
Request.cpp
|
||||
RequestBuilder.cpp
|
||||
RequestInterpreter.cpp
|
||||
RootInode.cpp
|
||||
RPCAuth.cpp
|
||||
RPCCall.cpp
|
||||
RPCCallback.cpp
|
||||
RPCCallbackReply.cpp
|
||||
RPCCallbackRequest.cpp
|
||||
RPCCallbackServer.cpp
|
||||
RPCReply.cpp
|
||||
RPCServer.cpp
|
||||
VnodeToInode.cpp
|
||||
WorkQueue.cpp
|
||||
XDR.cpp
|
||||
:
|
||||
libnetwork.so
|
||||
libuserlandfs_haiku_kernel.so
|
||||
[ TargetLibsupc++ ]
|
||||
;
|
||||
|
||||
SubInclude HAIKU_TOP src add-ons kernel file_systems nfs4 idmapper ;
|
||||
@@ -9,6 +9,8 @@ SharedLibrary libkernelland_emu.so :
|
||||
condition_variable.cpp
|
||||
debug.cpp
|
||||
device_manager.cpp
|
||||
heap.cpp
|
||||
KernelReferenceable.cpp
|
||||
KPath.cpp
|
||||
lock.cpp
|
||||
low_resource_manager.cpp
|
||||
@@ -16,6 +18,7 @@ SharedLibrary libkernelland_emu.so :
|
||||
misc.cpp
|
||||
module.cpp
|
||||
node_monitor.cpp
|
||||
Random.cpp
|
||||
slab.cpp
|
||||
smp.cpp
|
||||
team.cpp
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2025, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <util/KernelReferenceable.h>
|
||||
|
||||
|
||||
void
|
||||
KernelReferenceable::LastReferenceReleased()
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2025, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <util/Random.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <Debug.h>
|
||||
|
||||
|
||||
unsigned int
|
||||
random_value()
|
||||
{
|
||||
unsigned int value;
|
||||
int status = getentropy(&value, sizeof(value));
|
||||
if (status != 0)
|
||||
SERIAL_PRINT(("kernelland_emu random_value() error: %s\n", strerror(errno)));
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Copyright 2025, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <heap.h>
|
||||
|
||||
|
||||
DeferredDeletable::~DeferredDeletable()
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user