Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/dm Media size is in bytes (off_t), not sectors.



details:   https://anonhg.NetBSD.org/src/rev/1fddcab12810
branches:  trunk
changeset: 364485:1fddcab12810
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Mar 28 10:38:00 2022 +0000

description:
Media size is in bytes (off_t), not sectors.

diffstat:

 sys/dev/dm/device-mapper.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 9ee7a4ec68c2 -r 1fddcab12810 sys/dev/dm/device-mapper.c
--- a/sys/dev/dm/device-mapper.c        Sun Mar 27 20:18:05 2022 +0000
+++ b/sys/dev/dm/device-mapper.c        Mon Mar 28 10:38:00 2022 +0000
@@ -1,4 +1,4 @@
-/*        $NetBSD: device-mapper.c,v 1.62 2021/05/07 09:54:43 hannken Exp $ */
+/*        $NetBSD: device-mapper.c,v 1.63 2022/03/28 10:38:00 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -562,14 +562,15 @@
        {
                off_t *valp = data;
                uint64_t numsec;
+               unsigned 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, NULL);
-               *valp = numsec;
+               dm_table_disksize(&dmv->table_head, &numsec, &secsize);
+               *valp = (off_t) secsize * numsec;
 
                dm_dev_unbusy(dmv);
                break;



Home | Main Index | Thread Index | Old Index