Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Use the new DK_DEV_BSIZE_OK() macro.



details:   https://anonhg.NetBSD.org/src/rev/b7a75d6890c7
branches:  trunk
changeset: 811725:b7a75d6890c7
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 12 15:28:07 2015 +0000

description:
Use the new DK_DEV_BSIZE_OK() macro.

diffstat:

 sys/dev/vnd.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (46 lines):

diff -r ee29dc271fc1 -r b7a75d6890c7 sys/dev/vnd.c
--- a/sys/dev/vnd.c     Thu Nov 12 15:25:22 2015 +0000
+++ b/sys/dev/vnd.c     Thu Nov 12 15:28:07 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnd.c,v 1.253 2015/11/12 02:06:36 christos Exp $       */
+/*     $NetBSD: vnd.c,v 1.254 2015/11/12 15:28:07 christos Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.253 2015/11/12 02:06:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.254 2015/11/12 15:28:07 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -1262,8 +1262,7 @@
                        /* note last offset is the file byte size */
                        vnd->sc_comp_numoffs = ntohl(ch->num_blocks)+1;
                        free(ch, M_TEMP);
-                       if (vnd->sc_comp_blksz == 0 ||
-                           vnd->sc_comp_blksz % DEV_BSIZE !=0) {
+                       if (!DK_DEV_BSIZE_OK(vnd->sc_comp_blksz)) {
                                VOP_UNLOCK(nd.ni_vp);
                                error = EINVAL;
                                goto close_and_exit;
@@ -1358,14 +1357,11 @@
 
                        /*
                         * Sanity-check the sector size.
-                        * XXX Don't allow secsize < DEV_BSIZE.  Should
-                        * XXX we?
                         */
-                       if (vnd->sc_geom.vng_secsize < DEV_BSIZE ||
-                           (vnd->sc_geom.vng_secsize % DEV_BSIZE) != 0 ||
+                       if (!DK_DEV_BSIZE_OK(vnd->sc_geom.vng_secsize) ||
                            vnd->sc_geom.vng_ncylinders == 0 ||
-                           (vnd->sc_geom.vng_ntracks *
-                            vnd->sc_geom.vng_nsectors) == 0) {
+                           vnd->sc_geom.vng_ntracks == 0 ||
+                           vnd->sc_geom.vng_nsectors == 0) {
                                error = EINVAL;
                                goto close_and_exit;
                        }



Home | Main Index | Thread Index | Old Index