5d508a3f6d7d9b4f4fc2c2ea5898f6a1c35e207b
[openafs.git] / src / config / afs_args.h
1 /*
2  * Copyright 2000, International Business Machines Corporation and others.
3  * All Rights Reserved.
4  *
5  * This software has been released under the terms of the IBM Public
6  * License.  For details, see the LICENSE file in the top-level source
7  * directory or online at http://www.openafs.org/dl/license10.html
8  */
9
10 #ifndef _AFS_ARGS_H_
11 #define _AFS_ARGS_H_
12
13 /*
14  * AFS system call opcodes
15  */
16
17 #define AFSOP_START_RXCALLBACK    0     /* no aux parms */
18 #define AFSOP_START_AFS           1     /* no aux parms */
19 #define AFSOP_START_BKG           2     /* no aux parms */
20 #define AFSOP_START_TRUNCDAEMON   3     /* no aux parms */
21 #define AFSOP_START_CS            4     /* no aux parms */
22 #define AFSOP_ADDCELL             5     /* parm 2 = cell str */
23 #define AFSOP_CACHEINIT           6     /* parms 2-4 -> cache sizes */
24 #define AFSOP_CACHEINFO           7     /* the cacheinfo file */
25 #define AFSOP_VOLUMEINFO          8     /* the volumeinfo file */
26 #define AFSOP_CACHEFILE           9     /* a random cache file (V*) */
27 #define AFSOP_CACHEINODE         10     /* random cache file by inode */
28 #define AFSOP_AFSLOG             11     /* output log file */
29 #define AFSOP_ROOTVOLUME         12     /* non-standard root volume name */
30
31 #define AFSOP_STARTLOG           14     /* temporary: Start afs logging */
32 #define AFSOP_ENDLOG             15     /* temporary: End afs logging */
33 #define AFSOP_AFS_VFSMOUNT       16     /* vfsmount cover for hpux */
34 #define AFSOP_ADVISEADDR         17     /* to init rx cid generator */
35 #define AFSOP_CLOSEWAIT          18     /* make all closes synchronous */
36 #define AFSOP_RXEVENT_DAEMON     19     /* rxevent daemon */
37 #define AFSOP_GETMTU             20     /* stand-in for SIOCGIFMTU, for now */
38 #define AFSOP_GETIFADDRS         21     /* get machine's ethernet interfaces */
39
40 #define AFSOP_ADDCELL2           29     /* 2nd add cell protocol interface */
41 #define AFSOP_AFSDB_HANDLER      30     /* userspace AFSDB lookup handler */
42 #define AFSOP_SET_DYNROOT        31     /* enable/disable dynroot support */
43 #define AFSOP_ADDCELLALIAS       32     /* create alias for existing cell */
44 #define AFSOP_SET_FAKESTAT       33     /* enable/disable fakestat support */
45 #define AFSOP_CELLINFO           34     /* set the cellinfo file name */
46 #define AFSOP_SET_THISCELL       35     /* set the primary cell */
47 #define AFSOP_BASIC_INIT         36     /* used to be part of START_AFS */
48 #define AFSOP_SET_BACKUPTREE     37     /* enable backup tree support */
49 #define AFSOP_SET_RXPCK          38     /* set rx_extraPackets*/
50 #define AFSOP_BUCKETPCT          39     /* bucket percentage */
51 #define AFSOP_SET_RXMAXMTU       40     /* set rx_MyMaxSendSize,rx_maxReceiveSizeUser,rx_maxReceiveSize */
52 #define AFSOP_BKG_HANDLER        41     /* userspace-capable Bkg daemon */
53 #define AFSOP_GETMASK            42     /* stand-in for SIOCGIFNETMASK */
54 #define AFSOP_SET_RXMAXFRAGS     43     /* set rxi_nSendFrags, rxi_nRecvFrags */
55 #define AFSOP_SET_RMTSYS_FLAG    44     /* set flag if rmtsys is enabled */
56 #define AFSOP_SEED_ENTROPY       45     /* Give the kernel hcrypto entropy */
57 #define AFSOP_SET_INUMCALC       46     /* set inode number calculation method */
58 #define AFSOP_SET_VOLUME_TTL     47     /* set the vldb cache timeout */
59
60 #define AFSOP_RXLISTENER_DAEMON  48     /* starts kernel RX listener */
61
62 #define AFSOP_CACHEBASEDIR       50     /* cache base dir */
63 #define AFSOP_CACHEDIRS          51     /* number of files per dir */
64 #define AFSOP_CACHEFILES         52     /* number of files */
65
66 #define AFSOP_SETINT             60     /* set key/value pairs for ints */
67
68 #define AFSOP_GO                100     /* whether settime is being done */
69
70 #define AFSOP_CHECKLOCKS        200     /* dump lock state */
71 #define AFSOP_SHUTDOWN          201     /* Totally shutdown afs (deallocate all) */
72
73 #define AFSOP_STOP_RXCALLBACK   210     /* Stop CALLBACK process */
74 #define AFSOP_STOP_AFS          211     /* Stop AFS process */
75 #define AFSOP_STOP_BKG          212     /* Stop BKG process */
76 #define AFSOP_STOP_TRUNCDAEMON  213     /* Stop cache truncate daemon */
77 /* AFSOP_STOP_RXEVENT           214        defined in osi.h */
78 /* AFSOP_STOP_COMPLETE          215        defined in osi.h */
79 #define AFSOP_STOP_CS           216     /* Stop CheckServer daemon */
80 /* AFSOP_STOP_RXK_LISTENER      217        defined in osi.h */
81 #define AFSOP_STOP_AFSDB        218     /* Stop AFSDB handler */
82 #define AFSOP_STOP_NETIF        219     /* Stop Netif poller */
83
84 #define AFSOP_MAX_OPCODE        AFSOP_STOP_NETIF /* Largest defined opcode. */
85
86 /*
87  * AFS system call types and flags.
88  */
89
90 /* The range 20-30 is reserved for AFS system offsets in the afs_syscall */
91 #define AFSCALL_PIOCTL          20
92 #define AFSCALL_SETPAG          21
93 #define AFSCALL_IOPEN           22
94 #define AFSCALL_ICREATE         23
95 #define AFSCALL_IREAD           24
96 #define AFSCALL_IWRITE          25
97 #define AFSCALL_IINC            26
98 #define AFSCALL_IDEC            27
99 #define AFSCALL_CALL            28
100
101 #define AFSCALL_ICL             30
102
103 /* 64 bit versions of inode system calls. */
104 #define AFSCALL_IOPEN64         41
105 #define AFSCALL_ICREATE64       42
106 #define AFSCALL_IINC64          43
107 #define AFSCALL_IDEC64          44
108 #define AFSCALL_ILISTINODE64    45      /* Used by ListViceInodes */
109 #define AFSCALL_ICREATENAME64   46      /* pass in platform specific pointer
110                                          * used to create a name in in a
111                                          * directory.
112                                          */
113 #ifdef AFS_SGI_VNODE_GLUE
114 #define AFSCALL_INIT_KERNEL_CONFIG 47   /* set vnode glue ops. */
115 #endif
116
117 /* these are for initialization flags */
118
119 #define AFSCALL_INIT_MEMCACHE 0x1
120
121 /* flags for rxstats pioctl */
122
123 #define AFSCALL_RXSTATS_MASK    0x7     /* Valid flag bits */
124 #define AFSCALL_RXSTATS_ENABLE  0x1     /* Enable RX stats */
125 #define AFSCALL_RXSTATS_DISABLE 0x2     /* Disable RX stats */
126 #define AFSCALL_RXSTATS_CLEAR   0x4     /* Clear RX stats */
127
128 /* arguments passed by afsd */
129 #define IDTYPE_UID 0
130
131 /* We don't necessarily have VenusFid here */
132 struct afs_umv_param {
133     afs_int32 id;
134     afs_int32 idtype;
135     afs_int32 sCell;
136     afs_int32 sVolume;
137     afs_int32 sVnode;
138     afs_int32 sUnique;
139     afs_int32 dCell;
140     afs_int32 dVolume;
141     afs_int32 dVnode;
142     afs_int32 dUnique;
143 };
144
145 #define AFS_USPC_UMV 1
146
147 struct afs_uspc_param {
148     afs_int32 retval;
149     afs_int32 ts; /* brequest ts - always unique */
150     afs_int32 bufSz;
151     afs_int32 reqtype;
152     union {
153         struct afs_umv_param umv;
154     } req;
155 };
156
157 struct afs_cacheParams {
158     afs_int32 cacheScaches;
159     afs_int32 cacheFiles;
160     afs_int32 cacheBlocks;
161     afs_int32 cacheDcaches;
162     afs_int32 cacheVolumes;
163     afs_int32 chunkSize;
164     afs_int32 setTimeFlag;
165     afs_int32 memCacheFlag;
166     afs_int32 inodes;
167     afs_int32 users;
168     afs_int32 dynamic_vcaches;
169 };
170
171 /* Supported values for AFSOP_SET_INUMCALC. */
172 enum {
173     AFS_INUMCALC_COMPAT = 0,
174     AFS_INUMCALC_MD5 = 1
175 };
176
177
178 /*
179  * Note that the AFS_*ALLOCSIZ values should be multiples of sizeof(void*) to
180  * accomodate pointer alignment.
181  */
182 /* Used in rx.c as well as afs directory. */
183 #if     defined(AFS_AIX32_ENV) || defined(AFS_HPUX_ENV)
184 /* XXX Because of rxkad_cprivate... XXX */
185 #define AFS_SMALLOCSIZ  (38*sizeof(void *))     /* "Small" allocated size */
186 #else
187 #define AFS_SMALLOCSIZ  (64*sizeof(void *))     /*  "Small" allocated size */
188 #endif
189 #define AFS_LRALLOCSIZ  4096    /* "Large" allocated size */
190
191 /* Cache configuration available through the client callback interface */
192 typedef struct cm_initparams_v1 {
193     afs_uint32 nChunkFiles;
194     afs_uint32 nStatCaches;
195     afs_uint32 nDataCaches;
196     afs_uint32 nVolumeCaches;
197     afs_uint32 firstChunkSize;
198     afs_uint32 otherChunkSize;
199     afs_uint32 cacheSize;
200     afs_uint32 setTime;
201     afs_uint32 memCache;
202 } cm_initparams_v1;
203
204 /*
205  * If you need to change afs_cacheParams, you should probably create a brand
206  * new structure.  Keeping the old structure will allow backwards compatibility
207  * with old clients (even if it is only used to calculate allocation size).
208  * If you do change the size or the format, you'll need to bump
209  * AFS_CLIENT_CONFIG_RETRIEVAL_VERSION.  This allows some primitive form
210  * of versioning a la rxdebug.
211  */
212
213 #define AFS_CLIENT_RETRIEVAL_VERSION            1       /* latest version */
214 #define AFS_CLIENT_RETRIEVAL_FIRST_EDITION      1       /* first version */
215
216 /* Defines and structures for the AFS proc replacement layer for the original syscall (AFS_SYSCALL) strategy */
217
218 #ifdef AFS_LINUX20_ENV
219
220 #define PROC_FSDIRNAME "openafs"
221 #define PROC_SYSCALL_NAME "afs_ioctl"
222 #define PROC_SYSCALL_FNAME "/proc/fs/openafs/afs_ioctl"
223 #define PROC_SYSCALL_ARLA_FNAME "/proc/fs/nnpfs/afs_ioctl"
224 #define PROC_CELLSERVDB_NAME "CellServDB"
225 #define PROC_PEER_NAME "rx_peer"
226 #define PROC_CONN_NAME "rx_conn"
227 #define PROC_CALL_NAME "rx_call"
228 #define PROC_RX_NAME "rx"
229 #define PROC_SERVICES_NAME "rx_services"
230 #define PROC_RXSTATS_NAME "rx_stats"
231 #define VIOC_SYSCALL_TYPE 'C'
232 #define VIOC_SYSCALL _IOW(VIOC_SYSCALL_TYPE,1,void *)
233 #define VIOC_SYSCALL32 _IOW(VIOC_SYSCALL_TYPE,1,int)
234
235 struct afsprocdata {
236   long param4;
237   long param3;
238   long param2;
239   long param1;
240   long syscall;
241 };
242
243 struct afsprocdata32 {
244   unsigned int param4;
245   unsigned int param3;
246   unsigned int param2;
247   unsigned int param1;
248   unsigned int syscall;
249 };
250
251 #endif
252
253 #ifdef AFS_DARWIN80_ENV
254 struct afssysargs {
255     unsigned int syscall;
256     unsigned int param1;
257     unsigned int param2;
258     unsigned int param3;
259     unsigned int param4;
260     unsigned int param5;
261     unsigned int param6;
262     unsigned int retval;
263 };
264
265 /* args reordered to avoid alignment issues */
266 struct afssysargs64 {
267     user_addr_t param1;
268     user_addr_t param2;
269     user_addr_t param3;
270     user_addr_t param4;
271     user_addr_t param5;
272     user_addr_t param6;
273     unsigned int syscall;
274     unsigned int retval;
275 };
276 #define VIOC_SYSCALL_TYPE 'C'
277 #define VIOC_SYSCALL _IOWR(VIOC_SYSCALL_TYPE,1,struct afssysargs)
278 #define VIOC_SYSCALL64 _IOWR(VIOC_SYSCALL_TYPE,2,struct afssysargs64)
279 #define SYSCALL_DEV_FNAME "/dev/openafs_ioctl"
280 #endif
281
282 #ifdef AFS_SUN511_ENV
283 # define VIOC_SYSCALL_TYPE 'C'
284 # define VIOC_SYSCALL _IOW(VIOC_SYSCALL_TYPE, 1, struct afssysargs)
285 # define VIOC_SYSCALL32 _IOW(VIOC_SYSCALL_TYPE, 2, struct afssysargs32)
286 # define SYSCALL_DEV_FNAME "/dev/afs"
287
288 struct afssysargs {
289     afs_uint64 param6;
290     afs_uint64 param5;
291     afs_uint64 param4;
292     afs_uint64 param3;
293     afs_uint64 param2;
294     afs_uint64 param1;
295     afs_uint32 syscall;
296 };
297
298 struct afssysargs32 {
299     afs_uint32 param6;
300     afs_uint32 param5;
301     afs_uint32 param4;
302     afs_uint32 param3;
303     afs_uint32 param2;
304     afs_uint32 param1;
305     afs_uint32 syscall;
306 };
307 #endif /* AFS_SUN511_ENV */
308
309 #ifdef AFS_CACHE_VNODE_PATH
310 #define AFS_CACHE_CELLS_INODE -2
311 #define AFS_CACHE_ITEMS_INODE -3
312 #define AFS_CACHE_VOLUME_INODE -4
313 #endif
314
315 #endif /* _AFS_ARGS_H_ */