Fix building in Haiku

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21005 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
François Revol 2007-05-03 21:18:45 +00:00
parent ff517f433e
commit 835ec57dc2
2 changed files with 18 additions and 10 deletions

View File

@ -2,15 +2,16 @@ SubDir HAIKU_TOP src add-ons kernel drivers disk virtual nbd ;
SetSubDirSupportedPlatformsBeOSCompatible ;
#if $(TARGET_PLATFORM) != haiku {
# # Needed for <ACPI.h>. Unfortunately we also get the other headers there,
# # that we don't really want.
# UsePublicHeaders drivers ;
#}
# not Haiku-specific, ksocket.h also works in BONE.
UsePrivateHeaders drivers ;
if $(TARGET_PLATFORM) = haiku {
# lock.h wants debug.h and others.
#UsePrivateHeaders kernel ;
#UsePublicHeaders kernel ;
UsePrivateHeaders [ FDirName kernel ] ;
}
KernelAddon nbd :
nbd.c
;

View File

@ -9,10 +9,12 @@
* Maps a Network Block Device as virtual partitions.
*/
#include <ByteOrder.h>
#include <KernelExport.h>
#include <Drivers.h>
#include <Errors.h>
#include <driver_settings.h>
#include <Errors.h>
#include <errno.h>
#include <ksocket.h>
#include <netinet/in.h>
@ -24,6 +26,12 @@
*/
//#define MOUNT_KLUDGE
/* names, ohh names... */
#ifndef SHUT_RDWR
#define SHUT_RDWR SHUTDOWN_BOTH
#endif
/* locking support */
#ifdef __HAIKU__
#include <kernel/lock.h>
@ -388,7 +396,7 @@ status_t nbd_teardown(struct nbd_device *dev)
{
status_t err, ret;
PRINT((DP ">%s()\n", __FUNCTION__));
kshutdown(dev->sock, SHUTDOWN_BOTH);
kshutdown(dev->sock, SHUT_RDWR);
kclosesocket(dev->sock);
dev->sock = -1;
err = wait_for_thread(dev->postoffice, &ret);
@ -784,7 +792,6 @@ init_driver (void)
const driver_settings *settings = get_driver_settings(handle);
driver_parameter *p = NULL;
char keyname[10];
char *v;
sprintf(keyname, "%d", i);
for (j = 0; j < settings->parameter_count; j++)
if (!strcmp(settings->parameters[j].name, keyname))
@ -824,7 +831,7 @@ uninit_driver (void)
PRINT((DP ">%s()\n", __FUNCTION__));
for (i = 0; i < MAX_NBDS; i++) {
free(nbd_name[i]);
err = benaphore_destroy(&nbd_devices[i].ben);
benaphore_destroy(&nbd_devices[i].ben);
}
err = ksocket_cleanup();
/* HACK */