Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys overload block/character into u_long field.
details: https://anonhg.NetBSD.org/src/rev/12ee9cb79ba2
branches: trunk
changeset: 536321:12ee9cb79ba2
user: gehenna <gehenna%NetBSD.org@localhost>
date: Fri Sep 13 13:08:53 2002 +0000
description:
overload block/character into u_long field.
kern/18234: slightly modified
diffstat:
sys/kern/kern_lkm.c | 13 +++++++++----
sys/sys/lkm.h | 6 +++++-
2 files changed, 14 insertions(+), 5 deletions(-)
diffs (66 lines):
diff -r 68381ca24e57 -r 12ee9cb79ba2 sys/kern/kern_lkm.c
--- a/sys/kern/kern_lkm.c Fri Sep 13 08:40:05 2002 +0000
+++ b/sys/kern/kern_lkm.c Fri Sep 13 13:08:53 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_lkm.c,v 1.58 2002/09/06 13:18:43 gehenna Exp $ */
+/* $NetBSD: kern_lkm.c,v 1.59 2002/09/13 13:08:53 gehenna Exp $ */
/*
* Copyright (c) 1994 Christopher G. Demetriou
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_lkm.c,v 1.58 2002/09/06 13:18:43 gehenna Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lkm.c,v 1.59 2002/09/13 13:08:53 gehenna Exp $");
#include "opt_ddb.h"
@@ -733,7 +733,7 @@
int cmd;
{
struct lkm_dev *args = lkmtp->private.lkm_dev;
- int error = 0;
+ int error;
switch(cmd) {
case LKM_E_LOAD:
@@ -744,6 +744,11 @@
error = devsw_attach(args->lkm_devname,
args->lkm_bdev, &args->lkm_bdevmaj,
args->lkm_cdev, &args->lkm_cdevmaj);
+ if (error != 0)
+ return (error);
+
+ args->lkm_offset = makemajor(args->lkm_bdevmaj,
+ args->lkm_cdevmaj);
break;
case LKM_E_UNLOAD:
@@ -756,7 +761,7 @@
break;
}
- return (error);
+ return (0);
}
#ifdef STREAMS
diff -r 68381ca24e57 -r 12ee9cb79ba2 sys/sys/lkm.h
--- a/sys/sys/lkm.h Fri Sep 13 08:40:05 2002 +0000
+++ b/sys/sys/lkm.h Fri Sep 13 13:08:53 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lkm.h,v 1.21 2002/09/06 13:18:43 gehenna Exp $ */
+/* $NetBSD: lkm.h,v 1.22 2002/09/13 13:08:54 gehenna Exp $ */
/*
* Header file used by loadable kernel modules and loadable kernel module
@@ -392,4 +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))
+
#endif /* !_SYS_LKM_H_ */
Home |
Main Index |
Thread Index |
Old Index