Annotation of sys/arch/zaurus/stand/zbsdmod/compat_linux.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: compat_linux.h,v 1.5 2006/01/15 17:58:27 deraadt Exp $ */
2:
3: /*
4: * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
5: *
6: * Permission to use, copy, modify, and distribute this software for any
7: * purpose with or without fee is hereby granted, provided that the above
8: * copyright notice and this permission notice appear in all copies.
9: *
10: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17: */
18:
19: #if 0
20:
21: /* Define these unconditionally to get the .modinfo section. */
22: #undef __KERNEL__
23: #undef MODULE
24: #define __KERNEL__
25: #define MODULE
26:
27: /* Standard headers for Linux LKMs */
28: #include <linux/kernel.h>
29: #include <linux/modsetver.h>
30: #include <linux/module.h>
31:
32: /*
33: * Include Linux 2.4.x headers.
34: */
35: #include <linux/elf.h>
36: #include <linux/errno.h>
37: #include <linux/fs.h>
38: #include <linux/pagemap.h>
39: #include <linux/file.h>
40: #include <linux/slab.h>
41: #include <asm/mach/map.h>
42:
43: #else
44:
45: /*
46: * Declare the things that we need from the Linux headers.
47: */
48:
49: #define IS_ERR(ptr) ((unsigned long)(ptr) > (unsigned long)-1000L)
50:
51: #define MKDEV(ma,mi) ((ma)<<8 | (mi))
52:
53: #define S_IFBLK 0060000
54: #define S_IFCHR 0020000
55:
56: struct file;
57: struct inode;
58:
59: typedef long loff_t;
60: typedef long ssize_t;
61: typedef unsigned long size_t;
62:
63: struct file_operations {
64: struct module *owner;
65: void (*llseek) (void);
66: ssize_t (*read) (struct file *, char *, size_t, loff_t *);
67: ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
68: void (*readdir) (void);
69: void (*poll) (void);
70: void (*ioctl) (void);
71: void (*mmap) (void);
72: int (*open) (struct inode *, struct file *);
73: void (*flush) (void);
74: int (*release) (struct inode *, struct file *);
75: void (*fsync) (void);
76: void (*fasync) (void);
77: void (*lock) (void);
78: void (*readv) (void);
79: void (*writev) (void);
80: void (*sendpage) (void);
81: void (*get_unmapped_area)(void);
82: #ifdef MAGIC_ROM_PTR
83: void (*romptr) (void);
84: #endif /* MAGIC_ROM_PTR */
85: };
86:
87: extern struct file * open_exec(const char *);
88: extern void fput(struct file *);
89: extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
90: extern int memcmp(const void *, const void *, size_t);
91: extern int register_chrdev(unsigned int, const char *, struct file_operations *);
92: extern int unregister_chrdev(unsigned int, const char *);
93: extern void printk(const char *, ...);
94: extern void *memcpy(void *, const void *, size_t);
95:
96: /* BSD headers */
97: #include <sys/exec_elf.h>
98: #include <sys/types.h>
99: #include <errno.h>
100:
101: /* Linux LKM support */
102: static const char __module_kernel_version[] __attribute__((section(".modinfo"))) =
103: "kernel_version=" UTS_RELEASE;
104: #if 1 /* def MODVERSIONS */
105: static const char __module_using_checksums[] __attribute__((section(".modinfo"))) =
106: "using_checksums=1";
107: #endif
108:
109: /* procfs support */
110: struct proc_dir_entry {
111: unsigned short low_ino;
112: unsigned short namelen;
113: const char *name;
114: unsigned short mode;
115: unsigned short nlink;
116: unsigned short uid;
117: unsigned short gid;
118: unsigned long size;
119: void *proc_iops; /* inode operations */
120: struct file_operations * proc_fops;
121: void *get_info;
122: struct module *owner;
123: struct proc_dir_entry *next, *parent, *subdir;
124: void *data;
125: void *read_proc;
126: void *write_proc;
127: volatile int count;
128: int deleted;
129: unsigned short rdev;
130: };
131: extern struct proc_dir_entry proc_root;
132: extern struct proc_dir_entry *proc_mknod(const char*, unsigned short,
133: struct proc_dir_entry*, unsigned short);
134: extern void remove_proc_entry(const char *, struct proc_dir_entry *);
135:
136: #endif
CVSweb