fix-indent-bug-with-lock-macros-20030729
[openafs.git] / src / viced / viced.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 /*  file.h      - include file for the File Server                      */
11 /*                                                                      */
12 /*  Date: 5/1/85                                                        */
13 /*                                                                      */
14 /************************************************************************/
15 /*
16  * Revision 2.2  90/08/29  15:12:11
17  * Cleanups.
18  * 
19  * Revision 2.1  90/08/07  19:46:16
20  * Start with clean version to sync test and dev trees.
21  * */
22
23 #include <afs/afssyscalls.h>
24 #include <afs/afsutil.h>
25 #include "fs_stats.h"           /*Defs for xstat-based statistics */
26
27 #define AFS_HARDDEADTIME        120
28
29 typedef struct DirHandle {
30     /* device+inode+vid are low level disk addressing + validity check */
31     /* vid+vnode+unique+cacheCheck are to guarantee validity of cached copy */
32     /* ***NOTE*** size of this stucture must not exceed size in buffer
33      * package (dir/buffer.c. Also, dir/buffer uses the first int as a
34      * hash into the page hash table.
35      * ***NOTE*** The volume, device and inode numbers used to compare
36      * fids are copied out of the handle to allow the handle to be reused
37      * while pages for the old fid are still in the buffer cache.
38      */
39     int dirh_vid;
40     int dirh_dev;
41     Inode dirh_ino;
42     VnodeId dirh_vnode;
43     afs_int32 dirh_cacheCheck;
44     Unique dirh_unique;
45     IHandle_t *dirh_handle;
46 } DirHandle;
47
48
49 struct cbcounters {
50     int DeleteFiles;
51     int DeleteCallBacks;
52     int BreakCallBacks;
53     int AddCallBacks;
54     int GotSomeSpaces;
55     int DeleteAllCallBacks;
56     int nFEs, nCBs, nblks;
57     int CBsTimedOut;
58     int nbreakers;
59     int GSS1, GSS2, GSS3, GSS4, GSS5;
60 };
61
62 #define MAXCNTRS (AFS_HIGHEST_OPCODE+1)
63
64 #define MAXCONSOLE 5
65 #define CONSOLENAME "opcons"
66 #define NEWCONNECT "NEWCONNECT"
67 #define TOTAL 0
68 #define FETCHDATAOP 30
69 #define FETCHDATA 31
70 #define FETCHD1 32
71 #define FETCHD2 33
72 #define FETCHD3 34
73 #define FETCHD4 35
74 #define FETCHD5 36
75 #define FETCHTIME 37
76 #define STOREDATAOP 40
77 #define STOREDATA 41
78 #define STORED1 42
79 #define STORED2 43
80 #define STORED3 44
81 #define STORED4 45
82 #define STORED5 46
83 #define STORETIME 47
84 /* N.B.: the biggest "opcode" here must not be as big as VICELOWEST_OPCODE */
85
86
87 #define SIZE1 1024
88 #define SIZE2 SIZE1*8
89 #define SIZE3 SIZE2*8
90 #define SIZE4 SIZE3*8
91
92 #define BIGTIME (0x7FFFFFFF)    /* Should be max u_int, rather than max int */
93
94 struct AFSCallStatistics {
95     /* References to AFS interface calls */
96     afs_uint32 FetchData;
97     afs_uint32 FetchACL;
98     afs_uint32 FetchStatus;
99     afs_uint32 StoreData;
100     afs_uint32 StoreACL;
101     afs_uint32 StoreStatus;
102     afs_uint32 RemoveFile;
103     afs_uint32 CreateFile;
104     afs_uint32 Rename;
105     afs_uint32 Symlink;
106     afs_uint32 Link;
107     afs_uint32 MakeDir;
108     afs_uint32 RemoveDir;
109     afs_uint32 SetLock;
110     afs_uint32 ExtendLock;
111     afs_uint32 ReleaseLock;
112     afs_uint32 GetStatistics;
113     afs_uint32 GiveUpCallBacks;
114     afs_uint32 GetVolumeInfo;
115     afs_uint32 GetVolumeStatus;
116     afs_uint32 SetVolumeStatus;
117     afs_uint32 GetRootVolume;
118     afs_uint32 CheckToken;
119     afs_uint32 GetTime;
120
121     /* General Fetch/Store Stats */
122     afs_uint32 TotalCalls;
123     afs_uint32 TotalFetchedBytes;
124     afs_uint32 AccumFetchTime;
125     afs_uint32 FetchSize1;
126     afs_uint32 FetchSize2;
127     afs_uint32 FetchSize3;
128     afs_uint32 FetchSize4;
129     afs_uint32 FetchSize5;
130     afs_uint32 TotalStoredBytes;
131     afs_uint32 AccumStoreTime;
132     afs_uint32 StoreSize1;
133     afs_uint32 StoreSize2;
134     afs_uint32 StoreSize3;
135     afs_uint32 StoreSize4;
136     afs_uint32 StoreSize5;
137 };
138
139 struct AFSDisk {
140     afs_int32 BlocksAvailable;
141     afs_int32 TotalBlocks;
142     DiskName Name;
143 };
144
145 #define AFS_MSTATSPARES 8
146 #define AFS_MSTATDISKS  10
147 struct AFSStatistics {
148     afs_uint32 CurrentMsgNumber;
149     afs_uint32 OldestMsgNumber;
150     afs_uint32 CurrentTime;
151     afs_uint32 BootTime;
152     afs_uint32 StartTime;
153     afs_int32 CurrentConnections;
154     afs_uint32 TotalAFSCalls;
155     afs_uint32 TotalFetchs;
156     afs_uint32 FetchDatas;
157     afs_uint32 FetchedBytes;
158     afs_int32 FetchDataRate;
159     afs_uint32 TotalStores;
160     afs_uint32 StoreDatas;
161     afs_uint32 StoredBytes;
162     afs_int32 StoreDataRate;
163     afs_uint32 TotalRPCBytesSent;
164     afs_uint32 TotalRPCBytesReceived;
165     afs_uint32 TotalRPCPacketsSent;
166     afs_uint32 TotalRPCPacketsReceived;
167     afs_uint32 TotalRPCPacketsLost;
168     afs_uint32 TotalRPCBogusPackets;
169     afs_int32 SystemCPU;
170     afs_int32 UserCPU;
171     afs_int32 NiceCPU;
172     afs_int32 IdleCPU;
173     afs_int32 TotalIO;
174     afs_int32 ActiveVM;
175     afs_int32 TotalVM;
176     afs_int32 EtherNetTotalErrors;
177     afs_int32 EtherNetTotalWrites;
178     afs_int32 EtherNetTotalInterupts;
179     afs_int32 EtherNetGoodReads;
180     afs_int32 EtherNetTotalBytesWritten;
181     afs_int32 EtherNetTotalBytesRead;
182     afs_int32 ProcessSize;
183     afs_int32 WorkStations;
184     afs_int32 ActiveWorkStations;
185     afs_int32 Spares[AFS_MSTATSPARES];
186     struct AFSDisk Disks[AFS_MSTATDISKS];
187 };
188
189 extern int busyonrst;
190
191 #define RESTART_ORDINARY 1
192 #define RESTART_FAST 2
193 #define RESTART_SAFE 3
194
195 #define DONTPANIC 0
196 #define PANIC 1
197
198 #define MAX_FILESERVER_THREAD   128     /* max number of threads in fileserver, subject to system limits */
199
200 #define FILESERVER_HELPER_THREADS 7     /* Listner, IOMGR, FiveMinute, 
201                                          * HostCheck, Signal, min 2 for RXSTATS */
202 #ifdef AFS_PTHREAD_ENV
203 #include <pthread.h>
204 #include <assert.h>
205 extern pthread_mutex_t fileproc_glock_mutex;
206 #define FS_LOCK \
207     assert(pthread_mutex_lock(&fileproc_glock_mutex) == 0)
208 #define FS_UNLOCK \
209     assert(pthread_mutex_unlock(&fileproc_glock_mutex) == 0)
210 extern pthread_mutex_t fsync_glock_mutex;
211 #define FSYNC_LOCK \
212     assert(pthread_mutex_lock(&fsync_glock_mutex) == 0)
213 #define FSYNC_UNLOCK \
214     assert(pthread_mutex_unlock(&fsync_glock_mutex) == 0)
215 #else /* AFS_PTHREAD_ENV */
216 #define FS_LOCK
217 #define FS_UNLOCK
218 #define FSYNC_LOCK
219 #define FSYNC_UNLOCK
220 #endif /* AFS_PTHREAD_ENV */