1 /* $OpenBSD: ukc.h,v 1.17 2019/09/06 21:30:31 cheloha Exp $ */ 2 3 /* 4 * Copyright (c) 1999-2001 Mats O Jansson. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27 #ifndef _UKC_H 28 #define _UKC_H 29 30 #define P_LOCNAMES 0 31 #define S_LOCNAMP 1 32 #define SA_CFROOTS 2 33 #define I_CFROOTS_SIZE 3 34 #define I_PV_SIZE 4 35 #define SA_PV 5 36 #define P_CFDATA 6 37 #define P_KERNEL_TEXT 7 38 #define P_VERSION 8 39 #define IA_EXTRALOC 9 40 #define I_REXTRALOC 10 41 #define I_TEXTRALOC 11 42 #define I_HISTLEN 12 43 #define CA_HISTORY 13 44 #define P_PDEVNAMES 14 45 #define I_PDEVSIZE 15 46 #define S_PDEVINIT 16 47 #define I_NKMEMPG 17 48 #define NLENTRIES 18 49 50 #ifdef UKC_MAIN 51 struct nlist nl[] = { 52 { "_locnames" }, 53 { "_locnamp" }, 54 { "_cfroots" }, 55 { "_cfroots_size" }, 56 { "_pv_size" }, 57 { "_pv" }, 58 { "_cfdata" }, 59 { "_kernel_text" }, 60 { "_version" }, 61 { "_extraloc" }, 62 { "_rextraloc" }, 63 { "_textraloc" }, 64 { "_userconf_histlen" }, 65 { "_userconf_history" }, 66 { "_pdevnames" }, 67 { "_pdevnames_size" }, 68 { "_pdevinit" }, 69 { "_nkmempages" }, 70 { NULL }, 71 }; 72 int maxdev = 0; 73 int totdev = 0; 74 int maxpseudo = 0; 75 int maxlocnames = 0; 76 int base = 16; 77 int cnt = -1; 78 int lines = 18; 79 int oldkernel = 0; 80 int nopdev = 0; 81 #else 82 extern struct nlist nl[]; 83 extern int maxdev; 84 extern int totdev; 85 extern int maxpseudo; 86 extern int maxlocnames; 87 extern int base; 88 extern int cnt; 89 extern int lines; 90 extern int oldkernel; 91 extern int nopdev; 92 #endif 93 94 struct cfdata *get_cfdata(int); 95 short *get_locnamp(int); 96 97 int more(void); 98 void pdev(short); 99 int number(const char *, int *); 100 int device(char *, int *, short *, short *); 101 int attr(char *, int *); 102 void modify(char *, int *); 103 void change(int); 104 void disable(int); 105 void enable(int); 106 void show(void); 107 void common_attr_val(short, int *, char); 108 void show_attr(char *); 109 void common_dev(char *, int, short, short, char); 110 void common_attr(char *, int, char); 111 void add_read(char *, char, char *, int, int *); 112 void add(char *, int, short, short); 113 114 int config(void); 115 void process_history(int, char *); 116 117 #define UC_CHANGE 'c' 118 #define UC_DISABLE 'd' 119 #define UC_ENABLE 'e' 120 #define UC_FIND 'f' 121 #define UC_SHOW 's' 122 123 #endif /* _UTIL_H */ 124 125 126