The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/boot/paq.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #include <u.h>
    2 #include <libc.h>
    3 #include <../boot/boot.h>
    4 
    5 char *fparts[] =
    6 {
    7         "add bootldr    0x0000000 0x0040000",
    8         "add params     0x0040000 0x0080000",
    9         "add kernel     0x0080000 0x0140000",
   10         "add user       0x0140000 0x0200000",
   11         "add ramdisk    0x0200000 0x0600000",
   12 };
   13 
   14 void
   15 configpaq(Method*)
   16 {
   17         int fd;
   18         int i;
   19 
   20         if(bind("#F", "/dev", MAFTER) < 0)
   21                 fatal("bind #c");
   22         if(bind("#p", "/proc", MREPL) < 0)
   23                 fatal("bind #p");
   24         fd = open("/dev/flash/flashctl", OWRITE);
   25         if(fd < 0)
   26                 fatal("opening flashctl");
   27         for(i = 0; i < nelem(fparts); i++)
   28                 if(fprint(fd, fparts[i]) < 0)
   29                         fatal(fparts[i]);
   30         close(fd);
   31 }
   32 
   33 int
   34 connectpaq(void)
   35 {
   36         int  p[2];
   37         char **arg, **argp;
   38 
   39         print("paq...");
   40         if(pipe(p)<0)
   41                 fatal("pipe");
   42         switch(fork()){
   43         case -1:
   44                 fatal("fork");
   45         case 0:
   46                 arg = malloc(10*sizeof(char*));
   47                 argp = arg;
   48                 *argp++ = "paqfs";
   49                 *argp++ = "-v";
   50                 *argp++ = "-i";
   51                 *argp++ = "/dev/flash/ramdisk";
   52                 *argp = 0;
   53 
   54                 dup(p[0], 0);
   55                 dup(p[1], 1);
   56                 close(p[0]);
   57                 close(p[1]);
   58                 exec("/boot/paqfs", arg);
   59                 fatal("can't exec paqfs");
   60         default:
   61                 break;
   62         }
   63         waitpid();
   64 
   65         close(p[1]);
   66         return p[0];
   67 }

Cache object: f1f8c671e0e905e1fd4bbab19080bc2c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.