aboutsummaryrefslogtreecommitdiff
path: root/ufs-utils/dlabel.c
diff options
context:
space:
mode:
Diffstat (limited to 'ufs-utils/dlabel.c')
-rw-r--r--ufs-utils/dlabel.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ufs-utils/dlabel.c b/ufs-utils/dlabel.c
index e3678310..355cb3f6 100644
--- a/ufs-utils/dlabel.c
+++ b/ufs-utils/dlabel.c
@@ -1,8 +1,8 @@
/* Get the disklabel from a device node
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996,99,2001 Free Software Foundation, Inc.
- Written by Miles Bader <miles@gnu.ai.mit.edu>
+ Written by Miles Bader <miles@gnu.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -23,9 +23,15 @@
#include <mach.h>
#include <string.h>
#include <device/device.h>
-#include <mach/sa/sys/ioctl.h> /* Ick */
#include <device/disk_status.h>
#include <hurd/store.h>
+
+/* XXX Ick. */
+#define IOCPARM_MASK 0x1fff/* parameter length, at most 13 bits */
+#define IOC_OUT 0x40000000/* copy out parameters */
+#define _IOC(inout,group,num,len) \
+ (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
+#define _IOR(g,n,t) _IOC(IOC_OUT,(g), (n), sizeof(t))
static error_t
fd_get_device (int fd, device_t *device)
@@ -37,10 +43,10 @@ fd_get_device (int fd, device_t *device)
if (node == MACH_PORT_NULL)
return errno;
- err = store_create (node, 0, 0, &store);
+ err = store_create (node, 0, 0, &store); /* consumes NODE on success */
if (! err)
{
- if (store->class != STORAGE_DEVICE
+ if (store->class->id != STORAGE_DEVICE
/* In addition to requiring a device, we also want the *whole*
device -- one contiguous run starting at 0. */
|| store->num_runs != 1
@@ -57,8 +63,8 @@ fd_get_device (int fd, device_t *device)
}
store_free (store);
}
-
- mach_port_deallocate (mach_task_self (), node);
+ else
+ mach_port_deallocate (mach_task_self (), node);
return err;
}