Module Name:    src
Committed By:   martin
Date:           Sat Oct 13 17:09:41 UTC 2018

Modified Files:
        src/sys/dev/dm [netbsd-8]: device-mapper.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1055):

        sys/dev/dm/device-mapper.c: revision 1.40

Add ioctls to query geometry.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.38.10.1 src/sys/dev/dm/device-mapper.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/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.38 src/sys/dev/dm/device-mapper.c:1.38.10.1
--- src/sys/dev/dm/device-mapper.c:1.38	Mon Jul 11 11:31:50 2016
+++ src/sys/dev/dm/device-mapper.c	Sat Oct 13 17:09:41 2018
@@ -1,4 +1,4 @@
-/*        $NetBSD: device-mapper.c,v 1.38 2016/07/11 11:31:50 msaitoh Exp $ */
+/*        $NetBSD: device-mapper.c,v 1.38.10.1 2018/10/13 17:09:41 martin Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -510,6 +510,42 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		break;
 	}
 
+	case DIOCGSECTORSIZE:
+	{
+		u_int *valp = data;
+		uint64_t numsec;
+		unsigned int secsize;
+
+		if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
+			return ENODEV;
+
+		aprint_debug("DIOCGSECTORSIZE ioctl called\n");
+
+		dm_table_disksize(&dmv->table_head, &numsec, &secsize);
+		*valp = secsize;
+
+		dm_dev_unbusy(dmv);
+		break;
+	}
+
+	case DIOCGMEDIASIZE:
+	{
+		off_t *valp = data;
+		uint64_t numsec;
+		unsigned int secsize;
+
+		if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
+			return ENODEV;
+
+		aprint_debug("DIOCGMEDIASIZE ioctl called\n");
+
+		dm_table_disksize(&dmv->table_head, &numsec, &secsize);
+		*valp = numsec;
+
+		dm_dev_unbusy(dmv);
+		break;
+	}
+
 
 	default:
 		aprint_debug("unknown disk_ioctl called\n");

Reply via email to