/dev/one support ?

Terry Tree terry.tree at gmail.com
Mon May 15 06:57:35 PDT 2006


I have been trying to hack in support for /dev/one.  I'm looking for
some tips on what to try next.
Index: sys/i386/i386/mem.c
===================================================================
RCS file: /home/dcvs/src/sys/i386/i386/mem.c,v
retrieving revision 1.12
diff -u -u -r1.12 mem.c
--- sys/i386/i386/mem.c 2 Nov 2005 22:59:43 -0000       1.12
+++ sys/i386/i386/mem.c 15 May 2006 02:25:55 -0000
@@ -283,6 +283,20 @@
                       error = uiomove(zbuf, (int)c, uio);
                       continue;
+               case 241:
+                       if (uio->uio_rw == UIO_WRITE) {
+                               c = iov->iov_len;
+                               break;
+                       }
+                       if (zbuf == NULL) {
+                               zbuf = (caddr_t)
+                                   malloc(PAGE_SIZE, M_TEMP, M_WAITOK);
+                               bzero(zbuf, PAGE_SIZE);
+                       }
+                       c = min(iov->iov_len, PAGE_SIZE);
+                       error = uiomove(zbuf, (int)c, uio);
+                       continue;
+
               default:
                       return (ENODEV);
               }
@@ -527,6 +541,7 @@
       make_dev(&mem_cdevsw, 3, UID_ROOT, GID_WHEEL, 0644, "random");
       make_dev(&mem_cdevsw, 4, UID_ROOT, GID_WHEEL, 0644, "urandom");
       make_dev(&mem_cdevsw, 12, UID_ROOT, GID_WHEEL, 0666, "zero");
+       make_dev(&mem_cdevsw, 241, UID_ROOT, GID_WHEEL, 0666, "one");
       make_dev(&mem_cdevsw, 14, UID_ROOT, GID_WHEEL, 0600, "io");
}





More information about the Kernel mailing list