summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/zaurus/stand/zboot/pathnames.h4
-rw-r--r--sys/arch/zaurus/stand/zbsdmod/compat_linux.h36
-rw-r--r--sys/arch/zaurus/stand/zbsdmod/zbsdmod.c12
3 files changed, 47 insertions, 5 deletions
diff --git a/sys/arch/zaurus/stand/zboot/pathnames.h b/sys/arch/zaurus/stand/zboot/pathnames.h
index 9280ce57db2..2c80cd92958 100644
--- a/sys/arch/zaurus/stand/zboot/pathnames.h
+++ b/sys/arch/zaurus/stand/zboot/pathnames.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pathnames.h,v 1.2 2005/01/10 21:10:57 uwe Exp $ */
+/* $OpenBSD: pathnames.h,v 1.3 2005/01/14 08:10:16 uwe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -16,4 +16,4 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define _PATH_ZBOOT "/dev/zboot"
+#define _PATH_ZBOOT "/proc/zboot"
diff --git a/sys/arch/zaurus/stand/zbsdmod/compat_linux.h b/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
index 92350d8c1c2..02bc35e85fc 100644
--- a/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
+++ b/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: compat_linux.h,v 1.2 2005/01/10 21:10:58 uwe Exp $ */
+/* $OpenBSD: compat_linux.h,v 1.3 2005/01/14 08:10:17 uwe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -46,7 +46,12 @@
* Declare the things that we need from the Linux headers.
*/
-#define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)-1000L)
+#define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)-1000L)
+
+#define MKDEV(ma,mi) ((ma)<<8 | (mi))
+
+#define S_IFBLK 0060000
+#define S_IFCHR 0020000
struct file;
struct inode;
@@ -100,4 +105,31 @@ static const char __module_using_checksums[] __attribute__((section(".modinfo"))
"using_checksums=1";
#endif
+/* procfs support */
+struct proc_dir_entry {
+ unsigned short low_ino;
+ unsigned short namelen;
+ const char *name;
+ unsigned short mode;
+ unsigned short nlink;
+ unsigned short uid;
+ unsigned short gid;
+ unsigned long size;
+ void *proc_iops; /* inode operations */
+ struct file_operations * proc_fops;
+ void *get_info;
+ struct module *owner;
+ struct proc_dir_entry *next, *parent, *subdir;
+ void *data;
+ void *read_proc;
+ void *write_proc;
+ volatile int count;
+ int deleted;
+ unsigned short rdev;
+};
+extern struct proc_dir_entry proc_root;
+extern struct proc_dir_entry *proc_mknod(const char*, unsigned short,
+ struct proc_dir_entry*, unsigned short);
+extern void remove_proc_entry(const char *, struct proc_dir_entry *);
+
#endif
diff --git a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c b/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
index 9d5a6b6ed1b..358c07fe90b 100644
--- a/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
+++ b/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zbsdmod.c,v 1.3 2005/01/10 21:50:54 deraadt Exp $ */
+/* $OpenBSD: zbsdmod.c,v 1.4 2005/01/14 08:10:17 uwe Exp $ */
/*
* Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
@@ -21,6 +21,7 @@
#include "compat_linux.h"
#define ZBOOTDEV_MAJOR 99
+#define ZBOOTDEV_MODE 0222
#define ZBOOTDEV_NAME "zboot"
#define ZBOOTMOD_NAME "zbsdmod"
@@ -127,6 +128,7 @@ elf32bsdboot(void)
int
init_module()
{
+ struct proc_dir_entry *entry;
int rc;
rc = register_chrdev(ZBOOTDEV_MAJOR, ZBOOTDEV_NAME, &fops);
@@ -136,6 +138,13 @@ init_module()
return 1;
}
+ entry = proc_mknod(ZBOOTDEV_NAME, ZBOOTDEV_MODE | S_IFCHR,
+ &proc_root, MKDEV(ZBOOTDEV_MAJOR, 0));
+ if (entry == (struct proc_dir_entry *)0) {
+ (void)unregister_chrdev(ZBOOTDEV_MAJOR, ZBOOTDEV_NAME);
+ return 1;
+ }
+
printk("%s: OpenBSD/" MACHINE " bootstrap device is %d,0\n",
ZBOOTMOD_NAME, ZBOOTDEV_MAJOR);
@@ -150,6 +159,7 @@ cleanup_module()
{
(void)unregister_chrdev(ZBOOTDEV_MAJOR, ZBOOTDEV_NAME);
+ remove_proc_entry(ZBOOTDEV_NAME, &proc_root);
printk("%s: OpenBSD/" MACHINE " bootstrap device unloaded\n",
ZBOOTMOD_NAME);