Module Name: src
Committed By: rin
Date: Sat Feb 20 09:51:20 UTC 2021
Modified Files:
src/sys/dev/dkwedge: dkwedge_rdb.c
src/sys/sys: disklabel_rdb.h
Log Message:
Misc style fixes. No binary changes.
- Use uint{32,8}_t instead of unsigned {int, char}.
- Sort headers.
- KNF
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/dkwedge/dkwedge_rdb.c
cvs rdiff -u -r1.4 -r1.5 src/sys/sys/disklabel_rdb.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/dkwedge/dkwedge_rdb.c
diff -u src/sys/dev/dkwedge/dkwedge_rdb.c:1.7 src/sys/dev/dkwedge/dkwedge_rdb.c:1.8
--- src/sys/dev/dkwedge/dkwedge_rdb.c:1.7 Sun May 3 06:30:45 2020
+++ src/sys/dev/dkwedge/dkwedge_rdb.c Sat Feb 20 09:51:20 2021
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: dkwedge_rdb.
#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 @@ dkwedge_discover_rdb(struct disk *pdk, s
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 @@ done:
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 @@ rdbchksum(void *bdata)
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 @@ getarchtype(unsigned dostype)
static const char *
archtype_to_ptype(unsigned char archtype)
{
+
switch (archtype) {
case ADT_NETBSDROOT:
case ADT_NETBSDUSER:
Index: src/sys/sys/disklabel_rdb.h
diff -u src/sys/sys/disklabel_rdb.h:1.4 src/sys/sys/disklabel_rdb.h:1.5
--- src/sys/sys/disklabel_rdb.h:1.4 Sun Feb 26 11:51:38 2017
+++ src/sys/sys/disklabel_rdb.h Sat Feb 20 09:51:20 2021
@@ -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 @@ struct lsegblock {
#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 */