Windows: remove trailing whitespace
[openafs.git] / src / WINNT / client_osi / osiltype.c
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 /* Copyright (C) 1994 Cazamar Systems, Inc. */
11
12
13 #include <afs/param.h>
14 #include <afs/stds.h>
15
16 #include <windows.h>
17 #include "osi.h"
18 #include <assert.h>
19
20 /* table of dynamic lock types.  First entry isn't used, since those are
21  * wired in for performance reasons.
22  */
23 osi_lockOps_t *osi_lockOps[OSI_NLOCKTYPES];
24 char *osi_lockOpNames[OSI_NLOCKTYPES];
25
26 /* first free slot in lock operations; slot 0 is not used */
27 int osi_lockTypeIndex = 1;
28
29 /* type to create generically */
30 int osi_lockTypeDefault = 0;
31
32 int osi_LockTypeFind(char *namep)
33 {
34         int i;
35
36         for(i=1; i<osi_lockTypeIndex; i++) {
37                 if (!strcmp(osi_lockOpNames[i], namep)) return i;
38         }
39         return -1;
40 }
41
42 void osi_LockTypeAdd(osi_lockOps_t *statOps, char *namep, int *indexp)
43 {
44         int i;
45         if ((i = osi_lockTypeIndex) >= OSI_NLOCKTYPES) return;
46         osi_lockOps[i] = statOps;
47         osi_lockOpNames[i] = namep;
48         *indexp = i;
49         osi_lockTypeIndex = i+1;
50 }
51
52 osi_LockTypeSetDefault(char *namep)
53 {
54         int index;
55
56         if (namep == (char *) 0)
57                 osi_lockTypeDefault = 0;
58         else {
59                 index = osi_LockTypeFind(namep);
60                 if (index > 0) osi_lockTypeDefault = index;
61         }
62         return 0;
63 }
64