1 /* $OpenBSD: ukc.h,v 1.13 2015/09/21 14:45:14 guenther 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_NEXTRALOC 10 41 #define I_UEXTRALOC 11 42 #define I_HISTLEN 12 43 #define CA_HISTORY 13 44 #define TZ_TZ 14 45 #define P_PDEVNAMES 15 46 #define I_PDEVSIZE 16 47 #define S_PDEVINIT 17 48 #define I_NMBCLUSTERS 18 49 #define I_BUFCACHEPCT 19 50 #define I_NKMEMPG 20 51 #define NLENTRIES 21 52 53 #ifdef UKC_MAIN 54 struct nlist nl[] = { 55 { "_locnames" }, 56 { "_locnamp" }, 57 { "_cfroots" }, 58 { "_cfroots_size" }, 59 { "_pv_size" }, 60 { "_pv" }, 61 { "_cfdata" }, 62 { "_kernel_text" }, 63 { "_version" }, 64 { "_extraloc" }, 65 { "_nextraloc" }, 66 { "_uextraloc" }, 67 { "_userconf_histlen" }, 68 { "_userconf_history" }, 69 { "_tz" }, 70 { "_pdevnames" }, 71 { "_pdevnames_size" }, 72 { "_pdevinit" }, 73 { "_nmbclust" }, 74 { "_bufcachepercent" }, 75 { "_nkmempages" }, 76 { NULL }, 77 }; 78 struct nlist knl[] = { 79 { "_locnames" }, 80 { "_locnamp" }, 81 { "_cfroots" }, 82 { "_cfroots_size" }, 83 { "_pv_size" }, 84 { "_pv" }, 85 { "_cfdata" }, 86 { "_kernel_text" }, 87 { "_version" }, 88 { "_extraloc" }, 89 { "_nextraloc" }, 90 { "_uextraloc" }, 91 { "_userconf_histlen" }, 92 { "_userconf_history" }, 93 { "_tz" }, 94 { "_pdevnames" }, 95 { "_pdevnames_size" }, 96 { "_pdevinit" }, 97 { "_nmbclust" }, 98 { "_bufcachepercent" }, 99 { "_nkmempages" }, 100 { NULL }, 101 }; 102 int maxdev = 0; 103 int totdev = 0; 104 int maxpseudo = 0; 105 int maxlocnames = 0; 106 int base = 16; 107 int cnt = -1; 108 int lines = 18; 109 int oldkernel = 0; 110 int nopdev = 0; 111 #else 112 extern struct nlist nl[]; 113 extern int maxdev; 114 extern int totdev; 115 extern int maxpseudo; 116 extern int maxlocnames; 117 extern int base; 118 extern int cnt; 119 extern int lines; 120 extern int oldkernel; 121 extern int nopdev; 122 #endif 123 124 struct cfdata *get_cfdata(int); 125 short *get_locnamp(int); 126 127 int more(void); 128 void pdev(short); 129 int number(const char *, int *); 130 int device(char *, int *, short *, short *); 131 int attr(char *, int *); 132 void modify(char *, int *); 133 void change(int); 134 void disable(int); 135 void enable(int); 136 void show(void); 137 void common_attr_val(short, int *, char); 138 void show_attr(char *); 139 void common_dev(char *, int, short, short, char); 140 void common_attr(char *, int, char); 141 void add_read(char *, char, char *, int, int *); 142 void add(char *, int, short, short); 143 144 int config(void); 145 void process_history(int, char *); 146 147 #define UC_CHANGE 'c' 148 #define UC_DISABLE 'd' 149 #define UC_ENABLE 'e' 150 #define UC_FIND 'f' 151 #define UC_SHOW 's' 152 153 #endif /* _UTIL_H */ 154 155 156