summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-09-26 00:20:28 +0000
committerEric Andersen <andersen@codepoet.org>2000-09-26 00:20:28 +0000
commit67fdf5e538cef21829ac793053df668e33a5e965 (patch)
treead95f2a30185df16ba3e339f995a4dca95f36e94 /examples
parentff1ed7215c0532912b96ed8a0819cbdd3f04a1e7 (diff)
downloadbusybox-w32-67fdf5e538cef21829ac793053df668e33a5e965.tar.gz
busybox-w32-67fdf5e538cef21829ac793053df668e33a5e965.tar.bz2
busybox-w32-67fdf5e538cef21829ac793053df668e33a5e965.zip
Update my devps patch for the latest 2.2 kernel.
-Erik
Diffstat (limited to 'examples')
-rw-r--r--examples/kernel-patches/devps.patch.9_25_2000 (renamed from examples/kernel-patches/devps.patch.3_7)966
1 files changed, 64 insertions, 902 deletions
diff --git a/examples/kernel-patches/devps.patch.3_7 b/examples/kernel-patches/devps.patch.9_25_2000
index 0f354a025..d74a26a99 100644
--- a/examples/kernel-patches/devps.patch.3_7
+++ b/examples/kernel-patches/devps.patch.9_25_2000
@@ -1,237 +1,24 @@
1diff -ur --new-file linux-2.2.15-pre13.virgin/arch/alpha/defconfig linux/arch/alpha/defconfig 1diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/Config.in linux/drivers/char/Config.in
2--- linux-2.2.15-pre13.virgin/arch/alpha/defconfig Tue Jan 4 11:12:10 2000 2--- linux-2.2.18-9.virgin/drivers/char/Config.in Mon Sep 18 15:02:30 2000
3+++ linux/arch/alpha/defconfig Tue Mar 7 19:57:29 2000 3+++ linux/drivers/char/Config.in Mon Sep 25 16:33:16 2000
4@@ -239,6 +239,9 @@ 4@@ -56,6 +56,8 @@
5 # CONFIG_SERIAL_CONSOLE is not set
6 # CONFIG_SERIAL_EXTENDED is not set
7 # CONFIG_SERIAL_NONSTANDARD is not set
8+# CONFIG_DEVPS is not set
9+# CONFIG_DEVMTAB is not set
10+# CONFIG_DEVMODULES is not set
11 CONFIG_UNIX98_PTYS=y
12 CONFIG_UNIX98_PTY_COUNT=256
13 CONFIG_MOUSE=y
14diff -ur --new-file linux-2.2.15-pre13.virgin/arch/arm/defconfig linux/arch/arm/defconfig
15--- linux-2.2.15-pre13.virgin/arch/arm/defconfig Thu Feb 25 11:46:46 1999
16+++ linux/arch/arm/defconfig Tue Mar 7 20:01:46 2000
17@@ -156,6 +156,10 @@
18 CONFIG_SCSI_PPA=m
19 CONFIG_SCSI_PPA_HAVE_PEDANTIC=2
20
21+# CONFIG_DEVPS is not set
22+# CONFIG_DEVMTAB is not set
23+# CONFIG_DEVMODULES is not set
24+
25 #
26 # Network device support
27 #
28diff -ur --new-file linux-2.2.15-pre13.virgin/arch/i386/defconfig linux/arch/i386/defconfig
29--- linux-2.2.15-pre13.virgin/arch/i386/defconfig Tue Mar 7 19:46:57 2000
30+++ linux/arch/i386/defconfig Tue Mar 7 19:57:40 2000
31@@ -300,6 +300,9 @@
32 # CONFIG_SERIAL_CONSOLE is not set
33 # CONFIG_SERIAL_EXTENDED is not set
34 # CONFIG_SERIAL_NONSTANDARD is not set
35+# CONFIG_DEVPS is not set
36+# CONFIG_DEVMTAB is not set
37+# CONFIG_DEVMODULES is not set
38 CONFIG_UNIX98_PTYS=y
39 CONFIG_UNIX98_PTY_COUNT=256
40 CONFIG_MOUSE=y
41diff -ur --new-file linux-2.2.15-pre13.virgin/arch/i386/kernel/Makefile linux/arch/i386/kernel/Makefile
42--- linux-2.2.15-pre13.virgin/arch/i386/kernel/Makefile Wed Jan 20 11:18:53 1999
43+++ linux/arch/i386/kernel/Makefile Tue Mar 7 19:52:45 2000
44@@ -14,8 +14,8 @@
45
46 O_TARGET := kernel.o
47 O_OBJS := process.o signal.o entry.o traps.o irq.o vm86.o \
48- ptrace.o ioport.o ldt.o setup.o time.o sys_i386.o
49-OX_OBJS := i386_ksyms.o
50+ ptrace.o ioport.o ldt.o time.o sys_i386.o
51+OX_OBJS := i386_ksyms.o setup.o
52 MX_OBJS :=
53
54 ifdef CONFIG_PCI
55diff -ur --new-file linux-2.2.15-pre13.virgin/arch/m68k/defconfig linux/arch/m68k/defconfig
56--- linux-2.2.15-pre13.virgin/arch/m68k/defconfig Thu Feb 25 11:46:46 1999
57+++ linux/arch/m68k/defconfig Tue Mar 7 19:58:10 2000
58@@ -223,6 +223,9 @@
59 CONFIG_AMIGAMOUSE=y
60 CONFIG_ATARIMOUSE=y
61 CONFIG_AMIGA_BUILTIN_SERIAL=y
62+# CONFIG_DEVPS is not set
63+# CONFIG_DEVMTAB is not set
64+# CONFIG_DEVMODULES is not set
65 # CONFIG_GVPIOEXT is not set
66 # CONFIG_GVPIOEXT_LP is not set
67 # CONFIG_GVPIOEXT_PLIP is not set
68diff -ur --new-file linux-2.2.15-pre13.virgin/arch/mips/defconfig linux/arch/mips/defconfig
69--- linux-2.2.15-pre13.virgin/arch/mips/defconfig Mon Aug 9 13:04:38 1999
70+++ linux/arch/mips/defconfig Tue Mar 7 19:58:30 2000
71@@ -252,6 +252,9 @@
72 CONFIG_SERIAL=m
73 # CONFIG_SERIAL_EXTENDED is not set
74 # CONFIG_SERIAL_NONSTANDARD is not set
75+# CONFIG_DEVPS is not set
76+# CONFIG_DEVMTAB is not set
77+# CONFIG_DEVMODULES is not set
78 # CONFIG_UNIX98_PTYS is not set
79 # CONFIG_MOUSE is not set
80 # CONFIG_QIC02_TAPE is not set
81diff -ur --new-file linux-2.2.15-pre13.virgin/arch/ppc/apus_defconfig linux/arch/ppc/apus_defconfig
82--- linux-2.2.15-pre13.virgin/arch/ppc/apus_defconfig Thu Feb 25 11:46:47 1999
83+++ linux/arch/ppc/apus_defconfig Tue Mar 7 19:59:14 2000
84@@ -303,6 +303,9 @@
85 CONFIG_SERIAL=m
86 # CONFIG_SERIAL_EXTENDED is not set
87 # CONFIG_SERIAL_NONSTANDARD is not set
88+# CONFIG_DEVPS is not set
89+# CONFIG_DEVMTAB is not set
90+# CONFIG_DEVMODULES is not set
91 CONFIG_UNIX98_PTYS=y
92 CONFIG_UNIX98_PTY_COUNT=256
93 # CONFIG_MOUSE is not set
94diff -ur --new-file linux-2.2.15-pre13.virgin/arch/ppc/chrp_defconfig linux/arch/ppc/chrp_defconfig
95--- linux-2.2.15-pre13.virgin/arch/ppc/chrp_defconfig Thu Feb 25 11:46:47 1999
96+++ linux/arch/ppc/chrp_defconfig Tue Mar 7 19:58:57 2000
97@@ -261,6 +261,9 @@
98 # CONFIG_SERIAL_CONSOLE is not set
99 # CONFIG_SERIAL_EXTENDED is not set
100 # CONFIG_SERIAL_NONSTANDARD is not set
101+# CONFIG_DEVPS is not set
102+# CONFIG_DEVMTAB is not set
103+# CONFIG_DEVMODULES is not set
104 # CONFIG_UNIX98_PTYS is not set
105 # CONFIG_MOUSE is not set
106 # CONFIG_UMISC is not set
107diff -ur --new-file linux-2.2.15-pre13.virgin/arch/ppc/common_defconfig linux/arch/ppc/common_defconfig
108--- linux-2.2.15-pre13.virgin/arch/ppc/common_defconfig Tue Jan 4 11:12:12 2000
109+++ linux/arch/ppc/common_defconfig Tue Mar 7 19:59:35 2000
110@@ -337,6 +337,9 @@
111 CONFIG_SERIAL=m
112 # CONFIG_SERIAL_EXTENDED is not set
113 # CONFIG_SERIAL_NONSTANDARD is not set
114+# CONFIG_DEVPS is not set
115+# CONFIG_DEVMTAB is not set
116+# CONFIG_DEVMODULES is not set
117 CONFIG_UNIX98_PTYS=y
118 CONFIG_UNIX98_PTY_COUNT=256
119 CONFIG_MOUSE=y
120diff -ur --new-file linux-2.2.15-pre13.virgin/arch/ppc/defconfig linux/arch/ppc/defconfig
121--- linux-2.2.15-pre13.virgin/arch/ppc/defconfig Tue Jan 4 11:12:12 2000
122+++ linux/arch/ppc/defconfig Tue Mar 7 19:58:43 2000
123@@ -337,6 +337,9 @@
124 CONFIG_SERIAL=m
125 # CONFIG_SERIAL_EXTENDED is not set
126 # CONFIG_SERIAL_NONSTANDARD is not set
127+# CONFIG_DEVPS is not set
128+# CONFIG_DEVMTAB is not set
129+# CONFIG_DEVMODULES is not set
130 CONFIG_UNIX98_PTYS=y
131 CONFIG_UNIX98_PTY_COUNT=256
132 CONFIG_MOUSE=y
133diff -ur --new-file linux-2.2.15-pre13.virgin/arch/ppc/gemini_defconfig linux/arch/ppc/gemini_defconfig
134--- linux-2.2.15-pre13.virgin/arch/ppc/gemini_defconfig Tue Jan 4 11:12:12 2000
135+++ linux/arch/ppc/gemini_defconfig Tue Mar 7 19:59:23 2000
136@@ -285,6 +285,9 @@
137 CONFIG_SERIAL_CONSOLE=y
138 # CONFIG_SERIAL_EXTENDED is not set
139 # CONFIG_SERIAL_NONSTANDARD is not set
140+# CONFIG_DEVPS is not set
141+# CONFIG_DEVMTAB is not set
142+# CONFIG_DEVMODULES is not set
143 CONFIG_UNIX98_PTYS=y
144 CONFIG_UNIX98_PTY_COUNT=256
145 # CONFIG_MOUSE is not set
146diff -ur --new-file linux-2.2.15-pre13.virgin/arch/ppc/mbx_defconfig linux/arch/ppc/mbx_defconfig
147--- linux-2.2.15-pre13.virgin/arch/ppc/mbx_defconfig Wed Mar 10 22:30:32 1999
148+++ linux/arch/ppc/mbx_defconfig Tue Mar 7 19:59:49 2000
149@@ -192,6 +192,9 @@
150 CONFIG_SERIAL_CONSOLE=y
151 # CONFIG_SERIAL_EXTENDED is not set
152 # CONFIG_SERIAL_NONSTANDARD is not set
153+# CONFIG_DEVPS is not set
154+# CONFIG_DEVMTAB is not set
155+# CONFIG_DEVMODULES is not set
156 # CONFIG_UNIX98_PTYS is not set
157 # CONFIG_MOUSE is not set
158 # CONFIG_QIC02_TAPE is not set
159diff -ur --new-file linux-2.2.15-pre13.virgin/arch/ppc/pmac_defconfig linux/arch/ppc/pmac_defconfig
160--- linux-2.2.15-pre13.virgin/arch/ppc/pmac_defconfig Tue Oct 26 18:53:39 1999
161+++ linux/arch/ppc/pmac_defconfig Tue Mar 7 19:59:59 2000
162@@ -368,6 +368,9 @@
163 # CONFIG_SERIAL is not set
164 # CONFIG_SERIAL_EXTENDED is not set
165 # CONFIG_SERIAL_NONSTANDARD is not set
166+# CONFIG_DEVPS is not set
167+# CONFIG_DEVMTAB is not set
168+# CONFIG_DEVMODULES is not set
169 CONFIG_UNIX98_PTYS=y
170 CONFIG_UNIX98_PTY_COUNT=256
171 # CONFIG_PRINTER is not set
172diff -ur --new-file linux-2.2.15-pre13.virgin/arch/s390/defconfig linux/arch/s390/defconfig
173--- linux-2.2.15-pre13.virgin/arch/s390/defconfig Tue Mar 7 19:46:57 2000
174+++ linux/arch/s390/defconfig Tue Mar 7 20:02:36 2000
175@@ -64,6 +64,9 @@
176 CONFIG_3215_CONSOLE=y
177 CONFIG_HWC=y
178 CONFIG_HWC_CONSOLE=y
179+# CONFIG_DEVPS is not set
180+# CONFIG_DEVMTAB is not set
181+# CONFIG_DEVMODULES is not set
182
183 #
184 # Networking options
185diff -ur --new-file linux-2.2.15-pre13.virgin/arch/sparc/defconfig linux/arch/sparc/defconfig
186--- linux-2.2.15-pre13.virgin/arch/sparc/defconfig Tue Mar 7 19:46:57 2000
187+++ linux/arch/sparc/defconfig Tue Mar 7 20:01:00 2000
188@@ -219,6 +219,10 @@
189 CONFIG_SUNQE=m
190 CONFIG_MYRI_SBUS=m
191
192+# CONFIG_DEVPS is not set
193+# CONFIG_DEVMTAB is not set
194+# CONFIG_DEVMODULES is not set
195+
196 #
197 # Unix98 PTY support
198 #
199diff -ur --new-file linux-2.2.15-pre13.virgin/arch/sparc64/defconfig linux/arch/sparc64/defconfig
200--- linux-2.2.15-pre13.virgin/arch/sparc64/defconfig Tue Mar 7 19:46:57 2000
201+++ linux/arch/sparc64/defconfig Tue Mar 7 20:01:16 2000
202@@ -262,6 +262,10 @@
203 CONFIG_EEXPRESS_PRO100=m
204 CONFIG_SK98LIN=m
205
206+# CONFIG_DEVPS is not set
207+# CONFIG_DEVMTAB is not set
208+# CONFIG_DEVMODULES is not set
209+
210 #
211 # Unix 98 PTY support
212 #
213diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/Config.in linux/drivers/char/Config.in
214--- linux-2.2.15-pre13.virgin/drivers/char/Config.in Tue Mar 7 19:46:58 2000
215+++ linux/drivers/char/Config.in Tue Mar 7 19:52:45 2000
216@@ -56,6 +56,9 @@
217 dep_tristate 'Microgate SyncLink card support' CONFIG_SYNCLINK m 5 dep_tristate 'Microgate SyncLink card support' CONFIG_SYNCLINK m
218 dep_tristate 'HDLC line discipline support' CONFIG_N_HDLC m 6 dep_tristate 'HDLC line discipline support' CONFIG_N_HDLC m
219 fi 7 fi
220+tristate 'Devps support' CONFIG_DEVPS 8+tristate 'Devps support' CONFIG_DEVPS
221+tristate 'Devmounts support' CONFIG_DEVMTAB 9+tristate 'Devmounts support' CONFIG_DEVMTAB
222+tristate 'Devmodules support' CONFIG_DEVMODULES
223 bool 'Unix98 PTY support' CONFIG_UNIX98_PTYS 10 bool 'Unix98 PTY support' CONFIG_UNIX98_PTYS
224 if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then 11 if [ "$CONFIG_UNIX98_PTYS" = "y" ]; then
225 int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256 12 int 'Maximum number of Unix98 PTYs in use (0-2048)' CONFIG_UNIX98_PTY_COUNT 256
226diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/Makefile linux/drivers/char/Makefile 13diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/Makefile linux/drivers/char/Makefile
227--- linux-2.2.15-pre13.virgin/drivers/char/Makefile Tue Mar 7 19:46:58 2000 14--- linux-2.2.18-9.virgin/drivers/char/Makefile Mon Sep 18 15:02:30 2000
228+++ linux/drivers/char/Makefile Tue Mar 7 19:52:45 2000 15+++ linux/drivers/char/Makefile Mon Sep 25 18:01:12 2000
229@@ -620,6 +620,30 @@ 16@@ -697,6 +697,22 @@
230 L_OBJS += dz.o 17 M_OBJS += $(sort $(filter $(module-list), $(obj-m)))
231 endif 18
232 19
233+ifeq ($(CONFIG_DEVPS),y) 20+ifeq ($(CONFIG_DEVPS),y)
234+L_OBJS += devps.o 21+O_OBJS += devps.o
235+else 22+else
236+ ifeq ($(CONFIG_DEVPS),m) 23+ ifeq ($(CONFIG_DEVPS),m)
237+ M_OBJS += devps.o 24+ M_OBJS += devps.o
@@ -239,302 +26,20 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/Makefile linux/driver
239+endif 26+endif
240+ 27+
241+ifeq ($(CONFIG_DEVMTAB),y) 28+ifeq ($(CONFIG_DEVMTAB),y)
242+L_OBJS += devmtab.o 29+O_OBJS += devmtab.o
243+else 30+else
244+ ifeq ($(CONFIG_DEVMTAB),m) 31+ ifeq ($(CONFIG_DEVMTAB),m)
245+ M_OBJS += devmtab.o 32+ M_OBJS += devmtab.o
246+ endif 33+ endif
247+endif 34+endif
248+ 35+
249+ifeq ($(CONFIG_DEVMODULES),y)
250+L_OBJS += devmodules.o
251+else
252+ ifeq ($(CONFIG_DEVMODULES),m)
253+ M_OBJS += devmodules.o
254+ endif
255+endif
256+
257 include $(TOPDIR)/Rules.make 36 include $(TOPDIR)/Rules.make
258 37
259 fastdep: 38 fastdep:
260diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/devmodules.c linux/drivers/char/devmodules.c 39diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/devmtab.c linux/drivers/char/devmtab.c
261--- linux-2.2.15-pre13.virgin/drivers/char/devmodules.c Wed Dec 31 17:00:00 1969 40--- linux-2.2.18-9.virgin/drivers/char/devmtab.c Wed Dec 31 17:00:00 1969
262+++ linux/drivers/char/devmodules.c Tue Mar 7 22:37:42 2000 41+++ linux/drivers/char/devmtab.c Mon Sep 25 17:00:57 2000
263@@ -0,0 +1,270 @@ 42@@ -0,0 +1,295 @@
264+/* vi: set sw=8 ts=8: */
265+/*
266+ * linux/drivers/char/devmodules.c
267+ *
268+ * Copyright (C) 2000 Erik Andersen <andersee@debian.org>
269+ *
270+ * May be copied or modified under the terms of the GNU General Public License.
271+ * See linux/COPYING for more information.
272+ *
273+ * This driver implements an interface whereby programs such as lsmod(8) may
274+ * obtain all the information they need to do their jobs. Now you may ask,
275+ * "Why not use /proc/modules?". Thanks for asking. Because /proc is big and
276+ * bloated, and because using this driver we can avoid all that bloat and avoid
277+ * having the kernel need to pretty print stuff and avoid having user-space
278+ * then have to parse the stuff the kernel wasted its time formatting.
279+ *
280+ *
281+ * Suggestions are welcome. Patches that work are more welcome though. ;-)
282+ *
283+ * When using this driver, running:
284+ * mknod /dev/modules c 10 23
285+ * could be considered helpful.
286+ *
287+ * ----------------------------------
288+ * 1.00 Mar 07, 2000 -- Initial version.
289+ *
290+ *
291+ *************************************************************************/
292+
293+#define DEVMODULES_VERSION "1.00"
294+
295+#include <linux/config.h>
296+#include <linux/module.h>
297+#include <linux/types.h>
298+#include <linux/sched.h>
299+#include <linux/fs.h>
300+#include <linux/mm.h>
301+#include <linux/pagemap.h>
302+#include <linux/malloc.h>
303+#include <linux/miscdevice.h>
304+#include <linux/devmodules.h>
305+#include <linux/wrapper.h>
306+#include <asm/pgtable.h>
307+#include <asm/uaccess.h>
308+
309+
310+/* Some variables used by this device */
311+static struct wait_queue *devmodules_waitq = NULL;
312+static int devmodules_already_opened = 0;
313+static char *devmodulesfile = NULL;
314+static int devmodules_ptr;
315+static int devmodules_size;
316+
317+
318+
319+/****************************************************************************
320+ * Handle opening and closing of the device
321+ */
322+
323+static long long
324+devmodules_lseek (struct file *file, long long offset, int orig)
325+{
326+ return -ESPIPE;
327+}
328+
329+static ssize_t
330+devmodules_read (struct file *file, char *buf, size_t count, loff_t * ppos)
331+{
332+ int n = devmodules_size - devmodules_ptr;
333+
334+ if (devmodules_size == 0) {
335+ /* Make some space */
336+ if (!(devmodulesfile = (char *) get_free_page (GFP_KERNEL)))
337+ return -ENOMEM;
338+ /* Grab the module list */
339+ get_module_list (devmodulesfile);
340+ devmodules_ptr = 0;
341+ devmodules_size = strlen (devmodulesfile);
342+ n = devmodules_size - devmodules_ptr;
343+ }
344+
345+ if (n > count)
346+ n = count;
347+ if (n <= 0)
348+ return 0;
349+
350+ if (copy_to_user (buf, devmodulesfile, n))
351+ return -EFAULT;
352+ devmodules_ptr += n;
353+ return n;
354+}
355+
356+static int devmodules_open (struct inode *ip, struct file *fp)
357+{
358+ /* Only let one process use us at any time -- putting other
359+ * processes to sleep. Those opening us O_NONBLOCK will
360+ * get an EAGAIN error */
361+ if ((fp->f_flags & O_NONBLOCK) && devmodules_already_opened)
362+ return -EAGAIN;
363+
364+ MOD_INC_USE_COUNT;
365+
366+ while (devmodules_already_opened) {
367+ int i, got_signal=0;
368+
369+ /* Go to sleep until we get woken up
370+ * by devmodules_close or we receive a signal */
371+ module_interruptible_sleep_on(&devmodules_waitq);
372+
373+ for(i=0; i<_NSIG_WORDS && !got_signal; i++)
374+ got_signal = current->signal.sig[i] & ~current->blocked.sig[i];
375+
376+ /* If we got a signal, decrement the use count
377+ * and return to user space */
378+ if (got_signal) {
379+ MOD_DEC_USE_COUNT;
380+ return -EINTR;
381+ }
382+ }
383+
384+ /* Since we got here, then devmodules_already_opened must equal 0 */
385+ devmodules_already_opened=1;
386+ devmodules_ptr = 0;
387+ devmodules_size = 0;
388+
389+ return 0;
390+}
391+
392+static int devmodules_release (struct inode *ip, struct file *fp)
393+{
394+ /* Clean up */
395+ if (devmodulesfile != NULL) {
396+ free_page ((unsigned long) devmodulesfile);
397+ devmodulesfile = NULL;
398+ }
399+
400+ /* Zero out the reference counter */
401+ devmodules_already_opened=0;
402+
403+ /* Wake up anybody that is waiting to access this device */
404+ module_wake_up(&devmodules_waitq);
405+
406+ MOD_DEC_USE_COUNT;
407+
408+ return 0;
409+}
410+
411+static int
412+devmodules_ioctl (struct inode *ip, struct file *fp,
413+ unsigned int cmd, unsigned long arg)
414+{
415+ switch (cmd) {
416+
417+ case DEVMODULES_COUNT_MODULES:{
418+#ifdef CONFIG_MODULES
419+ return(count_kmodules());
420+#else
421+ return -ENOSYS;
422+#endif
423+ }
424+
425+ case DEVMODULES_GET_MODULES_LIST:{
426+#if !defined CONFIG_MODULES
427+ return -ENOSYS;
428+#else
429+
430+ int stat, count;
431+ struct k_module_item* module_list;
432+
433+
434+ /* How many are there? */
435+ count = count_kmodules();
436+
437+ /* Make some space */
438+ module_list = (struct k_module_item *)kmalloc(sizeof(struct k_module_item) * count, GFP_KERNEL);
439+ if (!module_list)
440+ return -ENOMEM;
441+ memset(module_list, 0, sizeof(struct k_module_item) * count);
442+
443+ /* Grab the list of modules */
444+ get_kmodule_list(count, module_list);
445+
446+ /* Make sure there is enough room */
447+ stat = verify_area (VERIFY_WRITE, (struct k_module_item *) arg,
448+ sizeof(struct k_module_item) * count);
449+ if (stat) {
450+ printk (KERN_INFO
451+ "devmodules: Insufficient space was provided.\n");
452+ return stat;
453+ }
454+
455+ /* Send it to user space */
456+ copy_to_user_ret ((struct k_module_item *) arg, module_list,
457+ sizeof(struct k_module_item) * count,
458+ -EFAULT);
459+
460+ /* Clean up */
461+ kfree( module_list);
462+ return 0;
463+#endif
464+ }
465+
466+ default:
467+ return -EINVAL;
468+
469+ }
470+ return 0;
471+}
472+
473+
474+
475+/****************************************************************************
476+ * Set up the file operations devmodules will support
477+ */
478+static struct file_operations devmodules_fops = {
479+ devmodules_lseek,
480+ devmodules_read,
481+ NULL, /* No write */
482+ NULL, /* No readdir */
483+ NULL, /* No poll */
484+ devmodules_ioctl,
485+ NULL, /* No mmap */
486+ devmodules_open,
487+ NULL, /* flush */
488+ devmodules_release,
489+ NULL, /* fsync */
490+ NULL, /* fasync */
491+ NULL, /* check_media_change */
492+ NULL /* revalidate */
493+};
494+
495+static struct miscdevice devmodules_misc_dev = {
496+ DEVMODULES_MINOR,
497+ "devmodules",
498+ &devmodules_fops
499+};
500+
501+/* The real driver initialization function */
502+extern int devmodules_init (void)
503+{
504+ printk (KERN_INFO "devmodules: driver %s loaded\n", DEVMODULES_VERSION);
505+
506+ if (misc_register (&devmodules_misc_dev)) {
507+ printk ("devmodules: can't register misc device %d\n",
508+ DEVMODULES_MINOR);
509+ return -EIO;
510+ }
511+
512+ return 0;
513+}
514+
515+#ifdef MODULE
516+
517+MODULE_AUTHOR ("Erik Andersen <andersee@debian.org>");
518+MODULE_DESCRIPTION
519+ ("devmodules driver -- exports filesystem and mount information to user space");
520+
521+/* Stub driver initialization function */
522+int init_module (void)
523+{
524+ return (devmodules_init ());
525+}
526+
527+void cleanup_module (void)
528+{
529+ printk (KERN_INFO "devmodules: driver unloaded\n");
530+ misc_deregister (&devmodules_misc_dev);
531+}
532+
533+#endif /* MODULE */
534diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/devmtab.c linux/drivers/char/devmtab.c
535--- linux-2.2.15-pre13.virgin/drivers/char/devmtab.c Wed Dec 31 17:00:00 1969
536+++ linux/drivers/char/devmtab.c Tue Mar 7 19:52:45 2000
537@@ -0,0 +1,304 @@
538+/* vi: set sw=8 ts=8: */ 43+/* vi: set sw=8 ts=8: */
539+/* 44+/*
540+ * linux/drivers/char/devmtab.c 45+ * linux/drivers/char/devmtab.c
@@ -762,15 +267,6 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/devmtab.c linux/drive
762+ return 0; 267+ return 0;
763+ } 268+ }
764+ 269+
765+ case DEVMTAB_SET_ROOTFS_DEVNAME:{
766+ char rootdevname[256];
767+
768+ copy_from_user_ret (rootdevname, (char*) arg,
769+ sizeof(rootdevname), -EFAULT);
770+ return( set_root_filesystem_name( rootdevname));
771+ }
772+
773+
774+ default: 270+ default:
775+ return -EINVAL; 271+ return -EINVAL;
776+ 272+
@@ -839,9 +335,9 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/devmtab.c linux/drive
839+} 335+}
840+ 336+
841+#endif /* MODULE */ 337+#endif /* MODULE */
842diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/devps.c linux/drivers/char/devps.c 338diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/devps.c linux/drivers/char/devps.c
843--- linux-2.2.15-pre13.virgin/drivers/char/devps.c Wed Dec 31 17:00:00 1969 339--- linux-2.2.18-9.virgin/drivers/char/devps.c Wed Dec 31 17:00:00 1969
844+++ linux/drivers/char/devps.c Tue Mar 7 19:52:45 2000 340+++ linux/drivers/char/devps.c Mon Sep 25 17:00:57 2000
845@@ -0,0 +1,518 @@ 341@@ -0,0 +1,518 @@
846+/* vi: set sw=8 ts=8: */ 342+/* vi: set sw=8 ts=8: */
847+/* 343+/*
@@ -1361,29 +857,28 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/devps.c linux/drivers
1361+} 857+}
1362+ 858+
1363+#endif /* endif MODULE */ 859+#endif /* endif MODULE */
1364diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/makedevps.sh linux/drivers/char/makedevps.sh 860diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/makedevps.sh linux/drivers/char/makedevps.sh
1365--- linux-2.2.15-pre13.virgin/drivers/char/makedevps.sh Wed Dec 31 17:00:00 1969 861--- linux-2.2.18-9.virgin/drivers/char/makedevps.sh Wed Dec 31 17:00:00 1969
1366+++ linux/drivers/char/makedevps.sh Tue Mar 7 23:31:52 2000 862+++ linux/drivers/char/makedevps.sh Mon Sep 25 17:00:57 2000
1367@@ -0,0 +1,6 @@ 863@@ -0,0 +1,5 @@
1368+#!/bin/sh -x 864+#!/bin/sh -x
1369+ 865+
1370+gcc -Wall -g -I /usr/src/linux/include ps-devps.c -o ps-devps 866+gcc -Wall -g -I /usr/src/linux/include ps-devps.c -o ps-devps
1371+gcc -Wall -g -I /usr/src/linux/include mounts.c -o mounts 867+gcc -Wall -g -I /usr/src/linux/include mounts.c -o mounts
1372+gcc -Wall -g -I /usr/src/linux/include modules.c -o modules 868+
1373+ 869diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/misc.c linux/drivers/char/misc.c
1374diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/misc.c linux/drivers/char/misc.c 870--- linux-2.2.18-9.virgin/drivers/char/misc.c Mon Sep 18 15:02:31 2000
1375--- linux-2.2.15-pre13.virgin/drivers/char/misc.c Tue Mar 7 19:46:58 2000 871+++ linux/drivers/char/misc.c Mon Sep 25 17:00:57 2000
1376+++ linux/drivers/char/misc.c Tue Mar 7 19:52:45 2000 872@@ -85,6 +85,8 @@
1377@@ -84,6 +84,8 @@
1378 extern void hfmodem_init(void);
1379 extern int pc110pad_init(void);
1380 extern int pmu_device_init(void); 873 extern int pmu_device_init(void);
874 extern int tosh_init(void);
875 extern int rng_init(void);
1381+extern int devps_init(void); 876+extern int devps_init(void);
1382+extern int devmtab_init(void); 877+extern int devmtab_init(void);
1383 878
1384 static int misc_read_proc(char *buf, char **start, off_t offset, 879 static int misc_read_proc(char *buf, char **start, off_t offset,
1385 int len, int *eof, void *private) 880 int len, int *eof, void *private)
1386@@ -267,6 +269,12 @@ 881@@ -268,6 +270,12 @@
1387 #endif 882 #endif
1388 #ifdef CONFIG_PMAC_PBOOK 883 #ifdef CONFIG_PMAC_PBOOK
1389 pmu_device_init(); 884 pmu_device_init();
@@ -1396,116 +891,10 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/misc.c linux/drivers/
1396 #endif 891 #endif
1397 #ifdef CONFIG_SGI_NEWPORT_GFX 892 #ifdef CONFIG_SGI_NEWPORT_GFX
1398 gfx_register (); 893 gfx_register ();
1399diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/modules.c linux/drivers/char/modules.c 894diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/mounts.c linux/drivers/char/mounts.c
1400--- linux-2.2.15-pre13.virgin/drivers/char/modules.c Wed Dec 31 17:00:00 1969 895--- linux-2.2.18-9.virgin/drivers/char/mounts.c Wed Dec 31 17:00:00 1969
1401+++ linux/drivers/char/modules.c Tue Mar 7 23:35:26 2000 896+++ linux/drivers/char/mounts.c Mon Sep 25 17:00:57 2000
1402@@ -0,0 +1,102 @@ 897@@ -0,0 +1,116 @@
1403+/* vi: set sw=4 ts=4: */
1404+/*
1405+ * devmodules tester
1406+ *
1407+ *
1408+ * Copyright (C) 2000 by Erik Andersen <andersee@debian.org>
1409+ *
1410+ * This program is free software; you can redistribute it and/or modify
1411+ * it under the terms of the GNU General Public License as published by
1412+ * the Free Software Foundation; either version 2 of the License, or
1413+ * (at your option) any later version.
1414+ *
1415+ * This program is distributed in the hope that it will be useful,
1416+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1417+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1418+ * General Public License for more details.
1419+ *
1420+ * You should have received a copy of the GNU General Public License
1421+ * along with this program; if not, write to the Free Software
1422+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1423+ *
1424+ */
1425+
1426+#include <stdio.h>
1427+#include <stdlib.h>
1428+#include <errno.h>
1429+#include <string.h>
1430+#include <unistd.h>
1431+#include <time.h>
1432+#include <fcntl.h>
1433+#include <sys/ioctl.h>
1434+#include <sys/types.h>
1435+#include <linux/devmodules.h>
1436+
1437+
1438+int main (int argc, char **argv)
1439+{
1440+ char device[80] = "/dev/modules";
1441+ int fd; /* file descriptor for devmodules device */
1442+ int i, num_modules;
1443+ struct k_module_item *modlist;
1444+
1445+ if (argc > 1 && **(argv + 1) == '-') {
1446+ fprintf(stderr, "Usage: modules\n\nLists loaded modules\n\nThis version of modules accepts no options.\n\n");
1447+ exit(1);
1448+ }
1449+
1450+ /* open device */
1451+ fd = open(device, O_RDONLY);
1452+ if (fd < 0) {
1453+ fprintf (stderr, "open failed for `%s': %s\n",
1454+ device, strerror (errno));
1455+ exit (1);
1456+ }
1457+
1458+ /* How many modules? We need to know to allocate
1459+ * enough space for later... */
1460+ num_modules = ioctl (fd, DEVMODULES_COUNT_MODULES);
1461+ if (num_modules<0) {
1462+ fprintf (stderr, "\nDEVMODULES_COUNT_MODULES: %s\n",
1463+ strerror (errno));
1464+ exit (1);
1465+ }
1466+ modlist = (struct k_module_item *) calloc ( num_modules, sizeof(struct k_module_item));
1467+
1468+ /* Grab the list of loaded modules */
1469+ if (ioctl (fd, DEVMODULES_GET_MODULES_LIST, modlist)<0) {
1470+ fprintf (stderr, "\nDEVMODULES_GET_MODULES_LIST: %s\n",
1471+ strerror (errno));
1472+ exit (1);
1473+ }
1474+ fprintf( stdout, "\nEquivalent of /proc/modules:\n");
1475+ for( i = 0 ; i < num_modules ; i++) {
1476+ fprintf( stdout, "%-20s%8lu%4ld", modlist[i].name,
1477+ modlist[i].size, modlist[i].usecount);
1478+ if (modlist[i].flags & MOD_DELETED)
1479+ fprintf( stdout, " (deleted)");
1480+ else if (modlist[i].flags & MOD_RUNNING) {
1481+ if (modlist[i].flags & MOD_AUTOCLEAN)
1482+ fprintf( stdout, " (autoclean)");
1483+ if (!(modlist[i].flags & MOD_USED_ONCE))
1484+ fprintf( stdout, " (unused)");
1485+ }
1486+ else if (modlist[i].flags & MOD_INITIALIZING)
1487+ fprintf( stdout, " (initializing)");
1488+ else
1489+ fprintf( stdout, " (uninitialized)");
1490+ /* TODO: Add in module reference list */
1491+ fprintf( stdout, "\n");
1492+ }
1493+
1494+ /* Clean up */
1495+ free( modlist);
1496+ if (close (fd) != 0) {
1497+ fprintf (stderr, "close failed for `%s': %s\n",
1498+ device, strerror (errno));
1499+ exit (1);
1500+ }
1501+
1502+ exit (0);
1503+}
1504+
1505diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/mounts.c linux/drivers/char/mounts.c
1506--- linux-2.2.15-pre13.virgin/drivers/char/mounts.c Wed Dec 31 17:00:00 1969
1507+++ linux/drivers/char/mounts.c Tue Mar 7 23:29:27 2000
1508@@ -0,0 +1,124 @@
1509+/* vi: set sw=4 ts=4: */ 898+/* vi: set sw=4 ts=4: */
1510+/* 899+/*
1511+ * devmtab tester 900+ * devmtab tester
@@ -1610,14 +999,6 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/mounts.c linux/driver
1610+ } 999+ }
1611+ 1000+
1612+ 1001+
1613+ /* Change the root filesystem's device name */
1614+ if (ioctl (fd, DEVMTAB_SET_ROOTFS_DEVNAME, "/dev/foo")<0) {
1615+ fprintf (stderr, "\nDEVMTAB_SET_ROOTFS_DEVNAME: %s\n",
1616+ strerror (errno));
1617+ exit (1);
1618+ }
1619+
1620+
1621+ /* clean up */ 1002+ /* clean up */
1622+ free( fslist); 1003+ free( fslist);
1623+ free( mntentlist); 1004+ free( mntentlist);
@@ -1630,10 +1011,10 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/mounts.c linux/driver
1630+ exit (0); 1011+ exit (0);
1631+} 1012+}
1632+ 1013+
1633diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/ps-devps.c linux/drivers/char/ps-devps.c 1014diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/drivers/char/ps-devps.c linux/drivers/char/ps-devps.c
1634--- linux-2.2.15-pre13.virgin/drivers/char/ps-devps.c Wed Dec 31 17:00:00 1969 1015--- linux-2.2.18-9.virgin/drivers/char/ps-devps.c Wed Dec 31 17:00:00 1969
1635+++ linux/drivers/char/ps-devps.c Tue Mar 7 19:52:45 2000 1016+++ linux/drivers/char/ps-devps.c Mon Sep 25 17:32:19 2000
1636@@ -0,0 +1,147 @@ 1017@@ -0,0 +1,148 @@
1637+/* vi: set sw=4 ts=4: */ 1018+/* vi: set sw=4 ts=4: */
1638+/* 1019+/*
1639+ * Mini ps implementation for use with the Linux devps driver 1020+ * Mini ps implementation for use with the Linux devps driver
@@ -1694,7 +1075,8 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/ps-devps.c linux/driv
1694+ } 1075+ }
1695+ 1076+
1696+ /* open device */ 1077+ /* open device */
1697+ fd = open(device, O_RDWR); 1078+ //fd = open(device, O_RDWR);
1079+ fd = open(device, O_RDONLY);
1698+ if (fd < 0) { 1080+ if (fd < 0) {
1699+ fprintf (stderr, "open failed for `%s': %s\n", 1081+ fprintf (stderr, "open failed for `%s': %s\n",
1700+ device, strerror (errno)); 1082+ device, strerror (errno));
@@ -1781,9 +1163,9 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/drivers/char/ps-devps.c linux/driv
1781+ exit (1); 1163+ exit (1);
1782+} 1164+}
1783+ 1165+
1784diff -ur --new-file linux-2.2.15-pre13.virgin/fs/Makefile linux/fs/Makefile 1166diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/fs/Makefile linux/fs/Makefile
1785--- linux-2.2.15-pre13.virgin/fs/Makefile Mon Mar 6 10:23:14 2000 1167--- linux-2.2.18-9.virgin/fs/Makefile Wed Aug 25 18:29:49 1999
1786+++ linux/fs/Makefile Tue Mar 7 19:52:45 2000 1168+++ linux/fs/Makefile Mon Sep 25 16:33:16 2000
1787@@ -11,9 +11,10 @@ 1169@@ -11,9 +11,10 @@
1788 L_OBJS = $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o)) 1170 L_OBJS = $(join $(SUB_DIRS),$(SUB_DIRS:%=/%.o))
1789 O_TARGET := fs.o 1171 O_TARGET := fs.o
@@ -1796,31 +1178,9 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/fs/Makefile linux/fs/Makefile
1796 1178
1797 MOD_LIST_NAME := FS_MODULES 1179 MOD_LIST_NAME := FS_MODULES
1798 ALL_SUB_DIRS = coda minix ext2 fat msdos vfat proc isofs nfs umsdos ntfs \ 1180 ALL_SUB_DIRS = coda minix ext2 fat msdos vfat proc isofs nfs umsdos ntfs \
1799diff -ur --new-file linux-2.2.15-pre13.virgin/fs/proc/array.c linux/fs/proc/array.c 1181diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/fs/super.c linux/fs/super.c
1800--- linux-2.2.15-pre13.virgin/fs/proc/array.c Tue Mar 7 19:47:04 2000 1182--- linux-2.2.18-9.virgin/fs/super.c Mon Sep 18 15:02:34 2000
1801+++ linux/fs/proc/array.c Tue Mar 7 19:52:45 2000 1183+++ linux/fs/super.c Mon Sep 25 17:00:57 2000
1802@@ -44,6 +44,7 @@
1803 *
1804 */
1805
1806+#include <linux/module.h>
1807 #include <linux/types.h>
1808 #include <linux/errno.h>
1809 #include <linux/sched.h>
1810@@ -1306,10 +1307,6 @@
1811 }
1812 #endif
1813
1814-#ifdef CONFIG_MODULES
1815-extern int get_module_list(char *);
1816-extern int get_ksyms_list(char *, char **, off_t, int);
1817-#endif
1818 extern int get_device_list(char *);
1819 extern int get_partition_list(char *);
1820 extern int get_filesystem_list(char *);
1821diff -ur --new-file linux-2.2.15-pre13.virgin/fs/super.c linux/fs/super.c
1822--- linux-2.2.15-pre13.virgin/fs/super.c Tue Jan 4 11:12:23 2000
1823+++ linux/fs/super.c Tue Mar 7 19:52:45 2000
1824@@ -18,6 +18,7 @@ 1184@@ -18,6 +18,7 @@
1825 */ 1185 */
1826 1186
@@ -1837,7 +1197,7 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/fs/super.c linux/fs/super.c
1837 1197
1838 #include <asm/uaccess.h> 1198 #include <asm/uaccess.h>
1839 1199
1840@@ -309,7 +311,57 @@ 1200@@ -311,7 +313,57 @@
1841 { 0, NULL } 1201 { 0, NULL }
1842 }; 1202 };
1843 1203
@@ -1896,7 +1256,7 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/fs/super.c linux/fs/super.c
1896 { 1256 {
1897 struct vfsmount *tmp = vfsmntlist; 1257 struct vfsmount *tmp = vfsmntlist;
1898 struct proc_fs_info *fs_infop; 1258 struct proc_fs_info *fs_infop;
1899@@ -379,8 +431,54 @@ 1259@@ -383,8 +435,37 @@
1900 1260
1901 return len; 1261 return len;
1902 } 1262 }
@@ -1916,23 +1276,6 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/fs/super.c linux/fs/super.c
1916+} 1276+}
1917+EXPORT_SYMBOL(count_kfstypes); 1277+EXPORT_SYMBOL(count_kfstypes);
1918+ 1278+
1919+extern int set_root_filesystem_name( char *newname)
1920+{
1921+ struct vfsmount *tmp = vfsmntlist;
1922+ char *name;
1923+
1924+ if (tmp && newname) {
1925+ kfree( tmp->mnt_devname);
1926+ name = (char *) kmalloc(strlen(newname)+1, GFP_KERNEL);
1927+ if (!name)
1928+ return -ENOMEM;
1929+ strcpy(name, newname);
1930+ tmp->mnt_devname = name;
1931+ }
1932+ return 0;
1933+}
1934+EXPORT_SYMBOL(set_root_filesystem_name);
1935+
1936+extern void get_kfstype_list(int count, struct k_fstype* fstypelist) 1279+extern void get_kfstype_list(int count, struct k_fstype* fstypelist)
1937+{ 1280+{
1938+ int i = 0; 1281+ int i = 0;
@@ -1952,7 +1295,7 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/fs/super.c linux/fs/super.c
1952 { 1295 {
1953 int len = 0; 1296 int len = 0;
1954 struct file_system_type * tmp; 1297 struct file_system_type * tmp;
1955@@ -394,6 +492,7 @@ 1298@@ -398,6 +479,7 @@
1956 } 1299 }
1957 return len; 1300 return len;
1958 } 1301 }
@@ -1960,68 +1303,9 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/fs/super.c linux/fs/super.c
1960 1303
1961 struct file_system_type *get_fs_type(const char *name) 1304 struct file_system_type *get_fs_type(const char *name)
1962 { 1305 {
1963diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/devmodules.h linux/include/linux/devmodules.h 1306diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/include/linux/devmtab.h linux/include/linux/devmtab.h
1964--- linux-2.2.15-pre13.virgin/include/linux/devmodules.h Wed Dec 31 17:00:00 1969 1307--- linux-2.2.18-9.virgin/include/linux/devmtab.h Wed Dec 31 17:00:00 1969
1965+++ linux/include/linux/devmodules.h Tue Mar 7 23:37:48 2000 1308+++ linux/include/linux/devmtab.h Mon Sep 25 17:00:57 2000
1966@@ -0,0 +1,55 @@
1967+/* vi: set sw=8 ts=8: */
1968+/*
1969+ * -- <linux/devmodules.h>
1970+ *
1971+ * Copyright (C) 2000 Erik Andersen <andersee@debian.org>
1972+ *
1973+ * May be copied or modified under the terms of the GNU General Public License.
1974+ * See linux/COPYING for more information.
1975+ *
1976+ * This driver implements an interface whereby programs such as lsmod(8) may
1977+ * obtain all the information they need to do their jobs without needing to
1978+ * use /proc.
1979+ *
1980+ */
1981+
1982+#ifndef _LINUX_DEVMODULES_H
1983+#define _LINUX_DEVMODULES_H
1984+
1985+
1986+/*******************************************************
1987+ * The list of all ioctl(2) commands suported by devmodules.
1988+ * For the devmodules ioctls, I have commandeered some of the
1989+ * higher bits of byte 0xeb.
1990+ *******************************************************/
1991+#define DEVMODULES_COUNT_MODULES 0xebba /* How many modules are there? */
1992+#define DEVMODULES_GET_MODULES_LIST 0xebbb /* Get a list of all installed modules */
1993+
1994+/*******************************************************
1995+ * devmodules ioctl(2) structures
1996+ *******************************************************/
1997+
1998+/* An array of these is returned by the DEVMODULES_GET_MODULES_LIST ioctl.
1999+ */
2000+struct k_module_item {
2001+ char name[255];/* Name of the module */
2002+ unsigned long size; /* Size of module in bytes */
2003+ unsigned long flags; /* Flags set by the module */
2004+ long usecount; /* Module use count value */
2005+
2006+ /* TODO: Add in module reference list */
2007+
2008+};
2009+
2010+/* Possible bits for k_module_item's flags. */
2011+#define MOD_UNINITIALIZED 0
2012+#define MOD_RUNNING 1
2013+#define MOD_DELETED 2
2014+#define MOD_AUTOCLEAN 4
2015+#define MOD_VISITED 8
2016+#define MOD_USED_ONCE 16
2017+#define MOD_JUST_FREED 32
2018+#define MOD_INITIALIZING 64
2019+
2020+
2021+#endif /* _LINUX_DEVMODULES_H */
2022diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/devmtab.h linux/include/linux/devmtab.h
2023--- linux-2.2.15-pre13.virgin/include/linux/devmtab.h Wed Dec 31 17:00:00 1969
2024+++ linux/include/linux/devmtab.h Tue Mar 7 19:52:45 2000
2025@@ -0,0 +1,55 @@ 1309@@ -0,0 +1,55 @@
2026+/* vi: set sw=8 ts=8: */ 1310+/* vi: set sw=8 ts=8: */
2027+/* 1311+/*
@@ -2078,9 +1362,9 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/devmtab.h linux/incl
2078+}; 1362+};
2079+ 1363+
2080+#endif /* _LINUX_DEVMTAB_H */ 1364+#endif /* _LINUX_DEVMTAB_H */
2081diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/devps.h linux/include/linux/devps.h 1365diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/include/linux/devps.h linux/include/linux/devps.h
2082--- linux-2.2.15-pre13.virgin/include/linux/devps.h Wed Dec 31 17:00:00 1969 1366--- linux-2.2.18-9.virgin/include/linux/devps.h Wed Dec 31 17:00:00 1969
2083+++ linux/include/linux/devps.h Tue Mar 7 19:52:45 2000 1367+++ linux/include/linux/devps.h Mon Sep 25 17:00:57 2000
2084@@ -0,0 +1,78 @@ 1368@@ -0,0 +1,78 @@
2085+/* 1369+/*
2086+ * -- <linux/devps.h> 1370+ * -- <linux/devps.h>
@@ -2160,10 +1444,10 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/devps.h linux/includ
2160+}; 1444+};
2161+ 1445+
2162+#endif /* _LINUX_DEVPS_H */ 1446+#endif /* _LINUX_DEVPS_H */
2163diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/fs.h linux/include/linux/fs.h 1447diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/include/linux/fs.h linux/include/linux/fs.h
2164--- linux-2.2.15-pre13.virgin/include/linux/fs.h Mon Mar 6 10:23:14 2000 1448--- linux-2.2.18-9.virgin/include/linux/fs.h Mon Sep 18 15:08:47 2000
2165+++ linux/include/linux/fs.h Tue Mar 7 21:14:11 2000 1449+++ linux/include/linux/fs.h Mon Sep 25 17:37:50 2000
2166@@ -566,6 +566,17 @@ 1450@@ -573,6 +573,16 @@
2167 struct semaphore s_vfs_rename_sem; /* Kludge */ 1451 struct semaphore s_vfs_rename_sem; /* Kludge */
2168 }; 1452 };
2169 1453
@@ -2176,141 +1460,19 @@ diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/fs.h linux/include/l
2176+extern int get_filesystem_info(char *buf); 1460+extern int get_filesystem_info(char *buf);
2177+extern int get_filesystem_list(char *buf); 1461+extern int get_filesystem_list(char *buf);
2178+extern void get_mtab_entries( int count, struct k_mntent* mntentlist); 1462+extern void get_mtab_entries( int count, struct k_mntent* mntentlist);
2179+extern int set_root_filesystem_name( char *newname);
2180+ 1463+
2181 /* 1464 /*
2182 * VFS helper functions.. 1465 * VFS helper functions..
2183 */ 1466 */
2184diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/miscdevice.h linux/include/linux/miscdevice.h 1467diff -urN --exclude=.version --exclude=.config* --exclude=.*depend linux-2.2.18-9.virgin/include/linux/miscdevice.h linux/include/linux/miscdevice.h
2185--- linux-2.2.15-pre13.virgin/include/linux/miscdevice.h Mon Aug 9 13:04:41 1999 1468--- linux-2.2.18-9.virgin/include/linux/miscdevice.h Mon Aug 9 13:04:41 1999
2186+++ linux/include/linux/miscdevice.h Tue Mar 7 22:24:50 2000 1469+++ linux/include/linux/miscdevice.h Mon Sep 25 16:33:17 2000
2187@@ -11,6 +11,9 @@ 1470@@ -11,6 +11,8 @@
2188 #define APOLLO_MOUSE_MINOR 7 1471 #define APOLLO_MOUSE_MINOR 7
2189 #define PC110PAD_MINOR 9 1472 #define PC110PAD_MINOR 9
2190 #define MAC_MOUSE_MINOR 10 1473 #define MAC_MOUSE_MINOR 10
2191+#define DEVPS_MINOR 21 1474+#define DEVPS_MINOR 21
2192+#define DEVMTAB_MINOR 22 1475+#define DEVMTAB_MINOR 22
2193+#define DEVMODULES_MINOR 23
2194 #define WATCHDOG_MINOR 130 /* Watchdog timer */ 1476 #define WATCHDOG_MINOR 130 /* Watchdog timer */
2195 #define TEMP_MINOR 131 /* Temperature Sensor */ 1477 #define TEMP_MINOR 131 /* Temperature Sensor */
2196 #define RTC_MINOR 135 1478 #define RTC_MINOR 135
2197diff -ur --new-file linux-2.2.15-pre13.virgin/include/linux/module.h linux/include/linux/module.h
2198--- linux-2.2.15-pre13.virgin/include/linux/module.h Tue Mar 7 19:47:04 2000
2199+++ linux/include/linux/module.h Tue Mar 7 21:26:48 2000
2200@@ -8,6 +8,7 @@
2201 #define _LINUX_MODULE_H
2202
2203 #include <linux/config.h>
2204+#include <linux/types.h>
2205
2206 #ifdef __GENKSYMS__
2207 # define _set_ver(sym) sym
2208@@ -143,6 +144,21 @@
2209
2210 /* Find a symbol exported by the kernel or another module */
2211 extern unsigned long get_module_symbol(char *, char *);
2212+/* Used by /proc and devmodules to export kernel symbols */
2213+extern int get_ksyms_list(char *buf, char **start, off_t offset, int length);
2214+/* Used by /proc and devmodules to export the list of modules
2215+ * in human readable form */
2216+extern int get_module_list(char *);
2217+#if defined CONFIG_DEVMODULES || defined CONFIG_DEVMODULES_MODULE
2218+#include <linux/devmodules.h>
2219+/* Used by devmodules to export the list of modules
2220+ * in machine readable form */
2221+extern void get_kmodule_list( int count, struct k_module_item* modlst);
2222+/* Used by devmodules to export the number of modules */
2223+extern int count_kmodules(void);
2224+#endif
2225+
2226+
2227
2228 #if defined(MODULE) && !defined(__GENKSYMS__)
2229
2230diff -ur --new-file linux-2.2.15-pre13.virgin/kernel/Makefile linux/kernel/Makefile
2231--- linux-2.2.15-pre13.virgin/kernel/Makefile Wed May 6 12:01:46 1998
2232+++ linux/kernel/Makefile Tue Mar 7 22:47:07 2000
2233@@ -11,11 +11,11 @@
2234 $(CPP) -traditional $< -o $*.s
2235
2236 O_TARGET := kernel.o
2237-O_OBJS = sched.o dma.o fork.o exec_domain.o panic.o printk.o sys.o \
2238- module.o exit.o itimer.o info.o time.o softirq.o resource.o \
2239+O_OBJS = sched.o dma.o exec_domain.o panic.o printk.o sys.o \
2240+ exit.o itimer.o info.o time.o softirq.o resource.o \
2241 sysctl.o acct.o capability.o
2242
2243-OX_OBJS += signal.o
2244+OX_OBJS += fork.o module.o signal.o
2245
2246 ifeq ($(CONFIG_KMOD),y)
2247 O_OBJS += kmod.o
2248diff -ur --new-file linux-2.2.15-pre13.virgin/kernel/fork.c linux/kernel/fork.c
2249--- linux-2.2.15-pre13.virgin/kernel/fork.c Tue Oct 26 18:53:42 1999
2250+++ linux/kernel/fork.c Tue Mar 7 19:52:45 2000
2251@@ -36,6 +36,7 @@
2252 kmem_cache_t *files_cachep;
2253
2254 struct task_struct *pidhash[PIDHASH_SZ];
2255+EXPORT_SYMBOL(pidhash);
2256
2257 struct task_struct **tarray_freelist = NULL;
2258 spinlock_t taskslot_lock = SPIN_LOCK_UNLOCKED;
2259diff -ur --new-file linux-2.2.15-pre13.virgin/kernel/module.c linux/kernel/module.c
2260--- linux-2.2.15-pre13.virgin/kernel/module.c Tue Mar 7 19:47:05 2000
2261+++ linux/kernel/module.c Tue Mar 7 22:42:58 2000
2262@@ -816,10 +816,40 @@
2263 module_unmap(mod);
2264 }
2265
2266+/* Used by devmodules to export the number of modules */
2267+extern int
2268+count_kmodules(void)
2269+{
2270+ int i=0;
2271+ struct module *mod;
2272+ for (mod = module_list; mod != &kernel_module; mod = mod->next, i++);
2273+ return i;
2274+}
2275+EXPORT_SYMBOL(count_kmodules);
2276+
2277+extern void
2278+get_kmodule_list( int count, struct k_module_item* modlst)
2279+{
2280+ int i = 0;
2281+ struct module *mod = module_list;
2282+
2283+ while (mod && i < count)
2284+ {
2285+ strncpy(modlst[i].name, mod->name,
2286+ sizeof(modlst[i].name));
2287+ modlst[i].size = mod->size;
2288+ modlst[i].flags = mod->flags;
2289+ modlst[i].usecount = (long)atomic_read(&mod->uc.usecount);
2290+ mod = mod->next;
2291+ i++;
2292+ }
2293+}
2294+EXPORT_SYMBOL(get_kmodule_list);
2295+
2296+
2297 /*
2298 * Called by the /proc file system to return a current list of modules.
2299 */
2300-
2301 int get_module_list(char *p)
2302 {
2303 size_t left = PAGE_SIZE;
2304@@ -897,11 +927,11 @@
2305 fini:
2306 return PAGE_SIZE - left;
2307 }
2308+EXPORT_SYMBOL(get_module_list);
2309
2310 /*
2311 * Called by the /proc file system to return a current list of ksyms.
2312 */
2313-
2314 int
2315 get_ksyms_list(char *buf, char **start, off_t offset, int length)
2316 {