Module Name:    src
Committed By:   christos
Date:           Fri Jan  2 01:14:23 UTC 2015

Modified Files:
        src/sys/dev/dkwedge: dk.c
        src/sys/kern: subr_disk.c

Log Message:
- Use NODEV instead of 0
- Return EBUSY if there was no label


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/dkwedge/dk.c
cvs rdiff -u -r1.110 -r1.111 src/sys/kern/subr_disk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.78 src/sys/dev/dkwedge/dk.c:1.79
--- src/sys/dev/dkwedge/dk.c:1.78	Wed Dec 31 14:52:05 2014
+++ src/sys/dev/dkwedge/dk.c	Thu Jan  1 20:14:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.78 2014/12/31 19:52:05 christos Exp $	*/
+/*	$NetBSD: dk.c,v 1.79 2015/01/02 01:14:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.78 2014/12/31 19:52:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.79 2015/01/02 01:14:22 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1359,10 +1359,10 @@ dkioctl(dev_t dev, u_long cmd, void *dat
 		return (ENXIO);
 
 	/*
-	 * We pass 0 instead of our device to indicate we don't
+	 * We pass NODEV instead of our device to indicate we don't
 	 * want to handle disklabel ioctls
 	 */
-	error = disk_ioctl(&sc->sc_dk, 0, cmd, data, flag, l);
+	error = disk_ioctl(&sc->sc_dk, NODEV, cmd, data, flag, l);
 	if (error != EPASSTHROUGH)
 		return (error);
 

Index: src/sys/kern/subr_disk.c
diff -u src/sys/kern/subr_disk.c:1.110 src/sys/kern/subr_disk.c:1.111
--- src/sys/kern/subr_disk.c:1.110	Wed Dec 31 15:13:41 2014
+++ src/sys/kern/subr_disk.c	Thu Jan  1 20:14:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_disk.c,v 1.110 2014/12/31 20:13:41 mlelstv Exp $	*/
+/*	$NetBSD: subr_disk.c,v 1.111 2015/01/02 01:14:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1999, 2000, 2009 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.110 2014/12/31 20:13:41 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.111 2015/01/02 01:14:22 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -502,7 +502,7 @@ disk_ioctl(struct disk *dk, dev_t dev, u
 		break;
 	}
 
-	if (dev == 0)
+	if (dev == NODEV)
 		return EPASSTHROUGH;
 
 	/* The following should be moved to dk_ioctl */
@@ -521,6 +521,8 @@ disk_ioctl(struct disk *dk, dev_t dev, u
 #endif
 
 	case DIOCGPART:
+		if (dk->dk_label == NULL)
+			return EBUSY;
 		pt = data;
 		pt->disklab = dk->dk_label;
 		pt->part = &dk->dk_label->d_partitions[DISKPART(dev)];

Reply via email to