Home | History | Annotate | Line # | Download | only in sys
      1 /* $NetBSD: boot_flag.h,v 1.8 2024/05/12 10:34:56 rillig Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  *
     16  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     17  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     26  * POSSIBILITY OF SUCH DAMAGE.
     27  */
     28 
     29 #ifndef _SYS_BOOT_FLAG_H_
     30 #define _SYS_BOOT_FLAG_H_
     31 
     32 #include <sys/reboot.h>
     33 
     34 /*
     35  * Recognize standard boot arguments. If the flag is known, appropriate
     36  * value is or'ed to retval, otherwise retval is left intact.
     37  * Note that not all ports use all flags recognized here. This list is mere
     38  * concatenation of all non-conflicting standard boot flags. Individual ports
     39  * might use also other flags (see e.g. alpha).
     40  */
     41 #define	BOOT_FLAG(arg, retval) do {				\
     42 	switch (arg) {						\
     43 	case '1': /* machine dependent flag */			\
     44 		(retval) |= RB_MD1;				\
     45 		break;						\
     46 	case '2': /* machine dependent flag */			\
     47 		(retval) |= RB_MD2;				\
     48 		break;						\
     49 	case '3': /* machine dependent flag */			\
     50 		(retval) |= RB_MD3;				\
     51 		break;						\
     52 	case '4': /* machine dependent flag */			\
     53 		(retval) |= RB_MD4;				\
     54 		break;						\
     55 	case 'a': /* ask for file name to boot from */		\
     56 		(retval) |= RB_ASKNAME;				\
     57 		break;						\
     58 	case 'b': /* always halt, never reboot */		\
     59 		(retval) |= RB_HALT;				\
     60 		break;						\
     61 	case 'c': /* userconf */				\
     62 		(retval) |= RB_USERCONF;			\
     63 		break;						\
     64 	case 'd': /* break into the kernel debugger ASAP (if compiled in) */ \
     65 		(retval) |= RB_KDB;				\
     66 		break;						\
     67 	case 'm': /* mini root present in memory */		\
     68 		(retval) |= RB_MINIROOT;			\
     69 		break;						\
     70 	case 'q': /* boot quietly */				\
     71 		(retval) |= AB_QUIET;				\
     72 		break;						\
     73 	case 's': /* boot to single user */			\
     74 		(retval) |= RB_SINGLE;				\
     75 		break;						\
     76 	case 'v': /* boot verbosely */				\
     77 		(retval) |= AB_VERBOSE;				\
     78 		break;						\
     79 	case 'x': /* boot with debugging messages */		\
     80 		(retval) |= AB_DEBUG;				\
     81 		break;						\
     82 	case 'z': /* boot silently */				\
     83 		(retval) |= AB_SILENT;				\
     84 		break;						\
     85 	default:  /* something else, do nothing */		\
     86 		break;						\
     87 	} /* switch */						\
     88 								\
     89 	} while (0)
     90 
     91 #endif /* _SYS_BOOT_FLAG_H_ */
     92