Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen reduce buffer size for format_number() so t...



details:   https://anonhg.NetBSD.org/src/rev/3f4af4acae77
branches:  trunk
changeset: 971767:3f4af4acae77
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun May 03 17:54:28 2020 +0000

description:
reduce buffer size for format_number() so that xbd(4) would show the size
in KB/GB/TB instead of bytes again; the '9' matches what xbd(4) used before,
and also e.g. wd(4)

diffstat:

 sys/arch/xen/xen/xbd_xenbus.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r d049306a5365 -r 3f4af4acae77 sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c     Sun May 03 17:36:33 2020 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c     Sun May 03 17:54:28 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.123 2020/04/25 15:26:18 bouyer Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.124 2020/05/03 17:54:28 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.123 2020/04/25 15:26:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.124 2020/05/03 17:54:28 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -676,7 +676,8 @@
                sc->sc_backend_status = BLKIF_STATE_CONNECTED;
                hypervisor_unmask_event(sc->sc_evtchn);
 
-               format_bytes(buf, sizeof(buf), sc->sc_sectors * sc->sc_secsize);
+               format_bytes(buf, uimin(9, sizeof(buf)),
+                   sc->sc_sectors * sc->sc_secsize);
                aprint_normal_dev(sc->sc_dksc.sc_dev,
                                "%s, %d bytes/sect x %" PRIu64 " sectors\n",
                                buf, (int)dg->dg_secsize, sc->sc_xbdsize);



Home | Main Index | Thread Index | Old Index