Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/dm dm: Make numsec/secsize arguments in dm_table_dis...



details:   https://anonhg.NetBSD.org/src/rev/ce5ac0366c19
branches:  trunk
changeset: 967783:ce5ac0366c19
user:      tkusumi <tkusumi%NetBSD.org@localhost>
date:      Sun Dec 22 13:16:09 2019 +0000

description:
dm: Make numsec/secsize arguments in dm_table_disksize() optional

diffstat:

 sys/dev/dm/device-mapper.c |  11 ++++-------
 sys/dev/dm/dm_table.c      |  11 +++++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diffs (91 lines):

diff -r d8d73dd6035d -r ce5ac0366c19 sys/dev/dm/device-mapper.c
--- a/sys/dev/dm/device-mapper.c        Sun Dec 22 12:59:12 2019 +0000
+++ b/sys/dev/dm/device-mapper.c        Sun Dec 22 13:16:09 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: device-mapper.c,v 1.58 2019/12/22 12:28:54 tkusumi Exp $ */
+/*        $NetBSD: device-mapper.c,v 1.59 2019/12/22 13:16:09 tkusumi Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -431,7 +431,6 @@
        case DIOCGWEDGEINFO:
        {
                struct dkwedge_info *dkw = (void *) data;
-               unsigned int secsize;
 
                if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
                        return ENODEV;
@@ -443,7 +442,7 @@
                strlcpy(dkw->dkw_parent, dmv->name, 16);
 
                dkw->dkw_offset = 0;
-               dm_table_disksize(&dmv->table_head, &dkw->dkw_size, &secsize);
+               dm_table_disksize(&dmv->table_head, &dkw->dkw_size, NULL);
                strcpy(dkw->dkw_ptype, DKW_PTYPE_FFS);
 
                dm_dev_unbusy(dmv);
@@ -494,7 +493,6 @@
        }
        case DIOCGSECTORSIZE:
        {
-               uint64_t numsec;
                unsigned int secsize, *valp = data;
 
                if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
@@ -502,7 +500,7 @@
 
                aprint_debug("DIOCGSECTORSIZE ioctl called\n");
 
-               dm_table_disksize(&dmv->table_head, &numsec, &secsize);
+               dm_table_disksize(&dmv->table_head, NULL, &secsize);
                *valp = secsize;
 
                dm_dev_unbusy(dmv);
@@ -512,14 +510,13 @@
        {
                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);
+               dm_table_disksize(&dmv->table_head, &numsec, NULL);
                *valp = numsec;
 
                dm_dev_unbusy(dmv);
diff -r d8d73dd6035d -r ce5ac0366c19 sys/dev/dm/dm_table.c
--- a/sys/dev/dm/dm_table.c     Sun Dec 22 12:59:12 2019 +0000
+++ b/sys/dev/dm/dm_table.c     Sun Dec 22 13:16:09 2019 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: dm_table.c,v 1.17 2019/12/21 11:59:03 tkusumi Exp $      */
+/*        $NetBSD: dm_table.c,v 1.18 2019/12/22 13:16:09 tkusumi Exp $      */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.17 2019/12/21 11:59:03 tkusumi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_table.c,v 1.18 2019/12/22 13:16:09 tkusumi Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -262,8 +262,11 @@
                if (secsize < tsecsize)
                        secsize = tsecsize;
        }
-       *numsecp = secsize > 0 ? dbtob(length) / secsize : 0;
-       *secsizep = secsize;
+
+       if (numsecp)
+               *numsecp = secsize > 0 ? dbtob(length) / secsize : 0;
+       if (secsizep)
+               *secsizep = secsize;
 
        dm_table_unbusy(head);
 }



Home | Main Index | Thread Index | Old Index