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/i386/setroot.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 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1991,1990 Carnegie Mellon University
    4  * All Rights Reserved.
    5  * 
    6  * Permission to use, copy, modify and distribute this software and its
    7  * documentation is hereby granted, provided that both the copyright
    8  * notice and this permission notice appear in all copies of the
    9  * software, derivative works or modified versions, and any portions
   10  * thereof, and that both notices appear in supporting documentation.
   11  * 
   12  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   13  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
   14  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   15  * 
   16  * Carnegie Mellon requests users of this software to return to
   17  * 
   18  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   19  *  School of Computer Science
   20  *  Carnegie Mellon University
   21  *  Pittsburgh PA 15213-3890
   22  * 
   23  * any improvements or extensions that they make and grant Carnegie Mellon
   24  * the rights to redistribute these changes.
   25  */
   26 /*
   27  * HISTORY
   28  * $Log:        setroot.c,v $
   29  * Revision 2.11  92/04/01  19:32:17  rpd
   30  *      Renamed gets to safe_gets.
   31  *      Fixed get_root_device.
   32  *      [92/03/31            rpd]
   33  * 
   34  * Revision 2.10  92/02/19  16:29:33  elf
   35  *      Make atleast a half hearted attempt to use the info provide by
   36  *      the bootstrap to choose the boot device.
   37  *      [92/02/07            rvb]
   38  * 
   39  * Revision 2.9  91/06/19  11:55:36  rvb
   40  *      cputypes.h->platforms.h
   41  *      [91/06/12  13:45:24  rvb]
   42  * 
   43  * Revision 2.8  91/05/14  16:16:26  mrt
   44  *      Correcting copyright
   45  * 
   46  * Revision 2.7  91/05/08  12:42:00  dbg
   47  *      Include platforms.h to get CPU names.
   48  *      [91/03/21            dbg]
   49  * 
   50  * Revision 2.6  91/02/05  17:14:38  mrt
   51  *      Changed to new Mach copyright
   52  *      [91/02/01  17:37:59  mrt]
   53  * 
   54  * Revision 2.5  90/12/04  14:46:35  jsb
   55  *      iPSC2 -> iPSC386.
   56  *      [90/12/04  11:19:36  jsb]
   57  * 
   58  * Revision 2.4  90/11/24  15:14:53  jsb
   59  *      Added missing newline.
   60  *      [90/11/24  11:45:51  jsb]
   61  * 
   62  * Revision 2.3  90/09/23  16:47:18  jsb
   63  *      If iPSC386, root device is sd (scsi), not hd.
   64  * 
   65  * Revision 2.2  90/05/03  15:37:31  dbg
   66  *      Created.
   67  *      [90/02/20            dbg]
   68  * 
   69  */
   70 
   71 #include <platforms.h>
   72 #include <sys/reboot.h>
   73 
   74 extern int boottype;
   75 
   76 
   77 /*
   78  * Get root device.  Temporarily hard-coded.
   79  */
   80 char root_string[5];
   81 
   82 #if     iPSC386
   83 char *root_name = "sd0a";
   84 get_root_device()
   85 {
   86         printf("root on %s\n", root_name);
   87 }
   88 #else   iPSC386
   89 char *root_name = root_string;
   90 
   91 /*
   92  *       (4) (4) (4) (4)  (8)     (8)
   93  *      --------------------------------
   94  *      |MA | AD| CT| UN| PART  | TYPE |
   95  *      --------------------------------
   96  */
   97 
   98 char *maj_devs[4] = { "hd", "fd", 0, "sd"};
   99 
  100 get_root_device()
  101 {
  102         int type = boottype & 0xff;
  103         int part = (boottype >> 8) & 0xff;
  104         int unit = (boottype >> 16) & 0x7;
  105 
  106         if ( (type > sizeof (maj_devs) / sizeof (char *)) ||
  107              maj_devs[type] == 0) {
  108         }
  109 
  110         root_string[0] = maj_devs[type][0];
  111         root_string[1] = maj_devs[type][1];
  112         root_string[2] = '' + unit;
  113         root_string[3] = 'a' + part;
  114         root_string[4] = 0;
  115 
  116         if (boothowto & RB_ASKNAME) {
  117                 char name[5];
  118 
  119                 printf("root device [%s]? ", root_name);
  120                 safe_gets(name, sizeof name);
  121                 if (*name != 0)
  122                         strcpy(root_name, name);
  123         }
  124         printf("root on %s\n", root_name);
  125 }
  126 #endif  iPSC386

Cache object: f52e64bb2104935aa06b534662860b6c


[ 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.