Module Name: src Committed By: mlelstv Date: Sat Oct 6 14:59:11 UTC 2018
Modified Files: src/sys/dev/dm: device-mapper.c Log Message: Add ioctls to query geometry. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 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.39 src/sys/dev/dm/device-mapper.c:1.40 --- src/sys/dev/dm/device-mapper.c:1.39 Sat Oct 28 04:53:55 2017 +++ src/sys/dev/dm/device-mapper.c Sat Oct 6 14:59:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: device-mapper.c,v 1.39 2017/10/28 04:53:55 riastradh Exp $ */ +/* $NetBSD: device-mapper.c,v 1.40 2018/10/06 14:59:11 mlelstv Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -508,6 +508,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");