Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src uppercase the lkm kernel-userspace dev macros and prefix the...
details: https://anonhg.NetBSD.org/src/rev/b19db474a272
branches: trunk
changeset: 536576:b19db474a272
user: lha <lha%NetBSD.org@localhost>
date: Wed Sep 18 22:59:36 2002 +0000
description:
uppercase the lkm kernel-userspace dev macros and prefix them with LKM_
make modload print the bdev and cdev major when its a dev lkm
diffstat:
sbin/modload/modload.c | 8 ++++----
sys/kern/kern_lkm.c | 8 ++++----
sys/sys/lkm.h | 8 ++++----
usr.bin/modstat/modstat.c | 19 ++++++++++++-------
4 files changed, 24 insertions(+), 19 deletions(-)
diffs (129 lines):
diff -r a945fffc34f0 -r b19db474a272 sbin/modload/modload.c
--- a/sbin/modload/modload.c Wed Sep 18 20:58:56 2002 +0000
+++ b/sbin/modload/modload.c Wed Sep 18 22:59:36 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: modload.c,v 1.31 2002/09/13 15:30:36 gehenna Exp $ */
+/* $NetBSD: modload.c,v 1.32 2002/09/18 22:59:36 lha Exp $ */
/*
* Copyright (c) 1993 Terrence R. Lambert.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: modload.c,v 1.31 2002/09/13 15:30:36 gehenna Exp $");
+__RCSID("$NetBSD: modload.c,v 1.32 2002/09/18 22:59:36 lha Exp $");
#endif /* not lint */
#include <sys/param.h>
@@ -463,8 +463,8 @@
(void)snprintf(type, sizeof(type), "0x%x", sbuf.type);
if (sbuf.type == LM_DEV) {
char arg3[16], arg4[16];
- int bmajor = block_major(sbuf.offset);
- int cmajor = char_major(sbuf.offset);
+ int bmajor = LKM_BLOCK_MAJOR(sbuf.offset);
+ int cmajor = LKM_CHAR_MAJOR(sbuf.offset);
(void)snprintf(arg3, sizeof(arg3), "%d", cmajor);
(void)snprintf(arg4, sizeof(arg4), "%d", bmajor);
execl(post, post, id, type, arg3, arg4, 0);
diff -r a945fffc34f0 -r b19db474a272 sys/kern/kern_lkm.c
--- a/sys/kern/kern_lkm.c Wed Sep 18 20:58:56 2002 +0000
+++ b/sys/kern/kern_lkm.c Wed Sep 18 22:59:36 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lkm.c,v 1.59 2002/09/13 13:08:53 gehenna Exp $ */
+/* $NetBSD: kern_lkm.c,v 1.60 2002/09/18 22:59:36 lha Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lkm.c,v 1.59 2002/09/13 13:08:53 gehenna Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lkm.c,v 1.60 2002/09/18 22:59:36 lha Exp $");
#include "opt_ddb.h"
@@ -747,8 +747,8 @@
if (error != 0)
return (error);
- args->lkm_offset = makemajor(args->lkm_bdevmaj,
- args->lkm_cdevmaj);
+ args->lkm_offset =
+ LKM_MAKEMAJOR(args->lkm_bdevmaj, args->lkm_cdevmaj);
break;
case LKM_E_UNLOAD:
diff -r a945fffc34f0 -r b19db474a272 sys/sys/lkm.h
--- a/sys/sys/lkm.h Wed Sep 18 20:58:56 2002 +0000
+++ b/sys/sys/lkm.h Wed Sep 18 22:59:36 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lkm.h,v 1.23 2002/09/13 14:51:25 gehenna Exp $ */
+/* $NetBSD: lkm.h,v 1.24 2002/09/18 22:59:36 lha Exp $ */
/*
* Header file used by loadable kernel modules and loadable kernel module
@@ -392,8 +392,8 @@
int ver; /* OUT: lkm compile version */
};
-#define makemajor(b, c) ((((b) & 0xffff) << 16) | ((c) & 0xffff))
-#define block_major(v) (int)((int16_t)(((v) >> 16) & 0xffff))
-#define char_major(v) (int)((int16_t)((v) & 0xffff))
+#define LKM_MAKEMAJOR(b, c) ((((b) & 0xffff) << 16) | ((c) & 0xffff))
+#define LKM_BLOCK_MAJOR(v) (int)((int16_t)(((v) >> 16) & 0xffff))
+#define LKM_CHAR_MAJOR(v) (int)((int16_t)((v) & 0xffff))
#endif /* !_SYS_LKM_H_ */
diff -r a945fffc34f0 -r b19db474a272 usr.bin/modstat/modstat.c
--- a/usr.bin/modstat/modstat.c Wed Sep 18 20:58:56 2002 +0000
+++ b/usr.bin/modstat/modstat.c Wed Sep 18 22:59:36 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: modstat.c,v 1.17 2002/09/13 17:16:00 tron Exp $ */
+/* $NetBSD: modstat.c,v 1.18 2002/09/18 22:59:36 lha Exp $ */
/*
* Copyright (c) 1993 Terrence R. Lambert.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: modstat.c,v 1.17 2002/09/13 17:16:00 tron Exp $");
+__RCSID("$NetBSD: modstat.c,v 1.18 2002/09/18 22:59:36 lha Exp $");
#endif
#include <sys/param.h>
@@ -113,13 +113,18 @@
* Decode this stat buffer...
*/
offset = (long)sbuf.offset;
- if (offset < 0)
- (void) strlcpy(offset_string, "-", sizeof (offset_string));
+ if (sbuf.type == LM_DEV)
+ (void) snprintf(offset_string, sizeof(offset_string),
+ "%3d/%-3d",
+ LKM_BLOCK_MAJOR(offset),
+ LKM_CHAR_MAJOR(offset));
+ else if (offset < 0)
+ (void) strlcpy(offset_string, " -", sizeof (offset_string));
else
- (void) snprintf(offset_string, sizeof (offset_string), "%3ld",
+ (void) snprintf(offset_string, sizeof (offset_string), " %3ld",
offset);
- printf("%-7s %3d %3s %0*lx %04lx %0*lx %3ld %s\n",
+ printf("%-7s %3d %7s %0*lx %04lx %0*lx %3ld %s\n",
(sbuf.type < tn_nentries) ? type_names[sbuf.type] : "(UNKNOWN)",
sbuf.id, /* module id */
offset_string, /* offset into modtype struct */
@@ -192,7 +197,7 @@
atexit(cleanup);
- printf("Type Id Off %-*s Size %-*s Rev Module Name\n",
+ printf("Type Id Offset %-*s Size %-*s Rev Module Name\n",
POINTERSIZE, "Loadaddr",
POINTERSIZE, "Info");
Home |
Main Index |
Thread Index |
Old Index