gcc-warnings-cleanup-20030701
[openafs.git] / src / uss / uss_common.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 /*
11  *      Common definitions & global variables for the AFS user
12  *      account facility.
13  *
14  */
15
16 #ifndef _USS_COMMON_H_
17 #define _USS_COMMON_H_ 1
18
19 /*
20  * --------------------- Required definitions ---------------------
21  */
22 #include <sys/param.h>          /*Ditto*/
23 #include <stdio.h>              /*I/O stuff*/
24 #include <afs/afsutil.h>
25 #include <errno.h>
26 #ifdef HAVE_STRING_H
27 #include <string.h>
28 #else
29 #ifdef HAVE_STRINGS_H
30 #include <strings.h>
31 #endif
32 #endif
33
34 /*
35  * --------------------- Exported definitions ---------------------
36  */
37
38 /*
39  * Should we use static declarations or malloc()s?
40  */
41
42 #define uss_QUIET 0
43 #define uss_VERBOSE 1
44
45 #define uss_MAX_ARG               25
46 #define uss_MAX_ARG_SIZE          50
47 #define uss_MAX_ENTRY            400
48 #define uss_PATH_SIZE           AFSDIR_PATH_MAX
49 #define uss_MAX_SIZE            2048
50
51 #define uss_DEFAULT_PASSWORD "changeme"
52
53 /*
54  * Capacities for the exported variables.
55  */
56 #define uss_UserLen               8
57 #define uss_UidLen                8
58 #define uss_ServerLen            64
59 #define uss_PartitionLen         16
60 #define uss_MountPointLen       300
61 #define uss_RealNameLen         100
62 #define uss_PwdLen               16
63 #define uss_PwdPathLen          300
64 #define uss_PwdFormatLen        100
65 #define uss_RestoreDirLen       300
66 #define uss_VolumeLen           300
67 #define uss_DirPoolLen          300
68
69 #if !defined(AFS_LINUX20_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
70 extern char *sys_errlist[];
71 #endif
72
73 /*
74  * We have to chain every directory that we make in order to be
75  * able to come back in the reverse order and remove creator's
76  * access to each directory.
77  */
78 struct uss_subdir {
79     struct uss_subdir *previous;        /*Back ptr*/
80     char *path;                         /*Pathname to dir*/
81     char *finalACL;                     /*Final ACL for dir*/
82 };
83
84 /*
85  * This is extracted from afsint.h, which can't be included because it
86  * redefines some stuff from kauth.h.
87  */
88 struct uss_VolumeStatus {
89     afs_int32 Vid;
90     afs_int32 ParentId;
91     char Online;
92     char InService;
93     char Blessed;
94     char NeedsSalvage;
95     afs_int32 Type;
96     afs_int32 MinQuota;
97     afs_int32 MaxQuota;
98     afs_int32 BlocksInUse;
99     afs_int32 PartBlocksAvail;
100     afs_int32 PartMaxBlocks;
101 };
102
103 typedef struct uss_VolumeStatus uss_VolumeStatus_t;
104
105
106 /*
107  * ---------------------- Exported variables ----------------------
108  */
109 extern char uss_User[];                 /*User's account name*/
110 extern char uss_Uid[];                  /*User's uid*/
111 extern char uss_Server[];               /*FileServer hosting user's volume*/
112 extern char uss_Partition[];            /*FileServer partition for above*/
113 extern char uss_MountPoint[];           /*Mountpoint for user's volume*/
114 extern char uss_RealName[];             /*User's full name*/
115 extern char uss_Pwd[];                  /*User's password*/
116 extern char uss_PwdPath[];              /*Current pathname to password file*/
117 extern char uss_PwdPath_Saved[];        /*Saved pathname to password file*/
118 extern char uss_PwdFormat[];            /*Current password entry format*/
119 extern char uss_PwdFormat_Saved[];      /*Saved password entry format*/
120 extern char uss_RestoreDir[];           /*Current directory for restore info*/
121 extern char uss_RestoreDir_Saved[];     /*Saved directory for restore info*/
122 extern char uss_Auto[];                 /*Current choice of AUTO value*/
123 extern char uss_Var[][uss_MAX_ARG_SIZE]; /*$1, $2, ... command variables*/
124 extern int uss_VarMax;                  /*Largest index in above*/
125 extern char uss_Volume[];               /*Name of user's volume*/
126 extern afs_int32 uss_VolumeID;          /*Numerical volume ID*/
127 extern afs_int32 uss_ServerID;          /*Numerical server ID*/
128 extern afs_int32 uss_PartitionID;               /*Numerical partition ID*/
129 extern char uss_DirPool[][uss_DirPoolLen]; /*List of all acceptable subdirs*/
130
131 extern int uss_NumGroups;               /*Number of $AUTO entries*/
132 extern int uss_SaveVolume;              /*Save current user volume?*/
133 extern int uss_SaveVolume_Saved;        /*Saved value of above*/
134 extern int uss_DryRun;                  /*Is this a dry run?*/
135 extern int uss_Overwrite;               /*Overwrite user files?*/
136 extern int uss_SkipKaserver;            /*Ignore calls to Kaserver*/
137 extern int uss_OverwriteThisOne;        /*Overwrite on this pass?*/
138 extern char uss_Administrator[];        /*Name of admin account*/
139 extern char uss_AccountCreator[];       /*Principal running this program*/
140 extern afs_int32 uss_DesiredUID;                /*UID to assign the user*/
141 extern afs_int32 uss_Expires;                /*Password lifetime*/
142 extern char uss_Cell[];                 /*Cell in which account lives*/
143 extern char uss_ConfDir[];              /*Config directory*/
144 extern int uss_verbose;                 /*Should we be verbose?*/
145 extern int uss_ignoreFlag;              /*Ignore yyparse errors?*/
146 extern char uss_whoami[];               /*Program name used*/
147 extern int uss_syntax_err;              /*YACC syntax error?*/
148 extern struct uss_subdir *uss_currentDir;  /*Current directory*/
149
150
151 /*
152  * ------------------------ Exported functions  -----------------------
153  */
154 extern void uss_common_Init();
155     /*
156      * Summary:
157      *    Set up various common uss variables, especially the saved
158      *    ones.
159      *
160      * Args:
161      *    None.
162      *
163      * Returns:
164      *    Nothing.
165      */
166
167 extern void uss_common_Reset();
168     /*
169      * Summary:
170      *    Reset some common uss variables to their idle or
171      *    saved states.
172      *
173      * Args:
174      *    None.
175      *
176      * Returns:
177      *    Nothing.
178      */
179
180 extern char *uss_common_FieldCp();
181     /*
182      * Summary:
183      *    Copy a ``field'', as terminated by the given separator, or
184      *    up to a certain specified length.  Gripe if there was an
185      *    overflow.
186      *
187      * Args:
188      *    char *a_to       : Destination of the copy.
189      *    char *a_from     : Source of the copy.
190      *    char a_separator : Separator character to look for.
191      *    int a_maxChars   : Max chars to copy.
192      *    int *a_overflowP : Was there an overflow?
193      *
194      * Returns:
195      *    Ptr to the next location to read from.
196      */
197
198 #endif /* _USS_COMMON_H_ */