Source-Changes-HG archive

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

[src/trunk]: src/sys/sys Misc style fixes. No binary changes.



details:   https://anonhg.NetBSD.org/src/rev/c2a5278d153f
branches:  trunk
changeset: 959608:c2a5278d153f
user:      rin <rin%NetBSD.org@localhost>
date:      Sat Feb 20 09:51:20 2021 +0000

description:
Misc style fixes. No binary changes.

- Use uint{32,8}_t instead of unsigned {int, char}.
- Sort headers.
- KNF

diffstat:

 sys/dev/dkwedge/dkwedge_rdb.c |  27 ++++++++++++++-------------
 sys/sys/disklabel_rdb.h       |   7 ++++---
 2 files changed, 18 insertions(+), 16 deletions(-)

diffs (116 lines):

diff -r d8fe8ae34e56 -r c2a5278d153f sys/dev/dkwedge/dkwedge_rdb.c
--- a/sys/dev/dkwedge/dkwedge_rdb.c     Sat Feb 20 09:40:42 2021 +0000
+++ b/sys/dev/dkwedge/dkwedge_rdb.c     Sat Feb 20 09:51:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dkwedge_rdb.c,v 1.7 2020/05/03 06:30:45 rin Exp $      */
+/*     $NetBSD: dkwedge_rdb.c,v 1.8 2021/02/20 09:51:20 rin Exp $      */
 
 /*
  * Adapted from arch/amiga/amiga/disksubr.c:
@@ -68,14 +68,14 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dkwedge_rdb.c,v 1.7 2020/05/03 06:30:45 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dkwedge_rdb.c,v 1.8 2021/02/20 09:51:20 rin Exp $");
 
 #include <sys/param.h>
+#include <sys/buf.h>
 #include <sys/disklabel_rdb.h>
 #include <sys/disk.h>
 #include <sys/endian.h>
 #include <sys/systm.h>
-#include <sys/buf.h>
 
 /*
  * In /usr/src/sys/dev/scsipi/sd.c, routine sdstart() adjusts the
@@ -95,8 +95,8 @@
 #endif
 
 static unsigned rdbchksum(void *);
-static unsigned char getarchtype(unsigned);
-static const char *archtype_to_ptype(unsigned char);
+static unsigned char getarchtype(uint32_t);
+static const char *archtype_to_ptype(uint8_t);
 
 static int
 dkwedge_discover_rdb(struct disk *pdk, struct vnode *vp)
@@ -106,9 +106,9 @@
        struct rdblock *rbp;
        struct buf *bp;
        int error;
-       unsigned blk_per_cyl, bufsize, newsecsize, nextb, secsize, tabsize;
+       uint32_t blk_per_cyl, bufsize, newsecsize, nextb, secsize, tabsize;
        const char *ptype;
-       unsigned char archtype;
+       uint8_t archtype;
        bool found, root, swap;
 
        secsize = DEV_BSIZE << pdk->dk_blkshift;
@@ -276,10 +276,10 @@
        return error;
 }
 
-static unsigned
+static uint32_t
 rdbchksum(void *bdata)
 {
-       unsigned *blp, cnt, val;
+       uint32_t *blp, cnt, val;
 
        blp = bdata;
        cnt = be32toh(blp[1]);
@@ -287,13 +287,13 @@
 
        while (cnt--)
                val += be32toh(*blp++);
-       return(val);
+       return val;
 }
 
-static unsigned char
-getarchtype(unsigned dostype)
+static uint8_t
+getarchtype(uint32_t dostype)
 {
-       unsigned t3, b1;
+       uint32_t t3, b1;
 
        t3 = dostype & 0xffffff00;
        b1 = dostype & 0x000000ff;
@@ -341,6 +341,7 @@
 static const char *
 archtype_to_ptype(unsigned char archtype)
 {
+
        switch (archtype) {
        case ADT_NETBSDROOT:
        case ADT_NETBSDUSER:
diff -r d8fe8ae34e56 -r c2a5278d153f sys/sys/disklabel_rdb.h
--- a/sys/sys/disklabel_rdb.h   Sat Feb 20 09:40:42 2021 +0000
+++ b/sys/sys/disklabel_rdb.h   Sat Feb 20 09:51:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel_rdb.h,v 1.4 2017/02/26 11:51:38 rin Exp $    */
+/*     $NetBSD: disklabel_rdb.h,v 1.5 2021/02/20 09:51:20 rin Exp $    */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -29,6 +29,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #ifndef _SYS_DISKLABEL_RDB_H_
 #define _SYS_DISKLABEL_RDB_H_
 
@@ -211,8 +212,8 @@
 #define DOST_SFS       0x53465300      /* 'SFSx' Smart fs partition */
 
 struct adostype {
-       unsigned char archtype; /* see ADT_xxx below */
-       unsigned char fstype;   /* byte 3 from amiga dostype */
+       uint8_t archtype;       /* see ADT_xxx below */
+       uint8_t fstype;         /* byte 3 from amiga dostype */
 };
 
 /* archtypes */



Home | Main Index | Thread Index | Old Index