Import Upstream version 1.8.5
[hcoop/debian/openafs.git] / src / uss / uss_procs.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 * Interface to the basic procedures for the AFS user account
12 * facility.
13 *
14 */
15
16 #ifndef _USS_PROCS_H_
17 #define _USS_PROCS_H_ 1
18
19 /*
20 * --------------------- Required definitions ---------------------
21 */
22 #include "uss_common.h" /*Commons uss definitions */
23
24
25 /*
26 * --------------------- Exported definitions ---------------------
27 */
28 #define uss_procs_YOUNG 1
29 #define uss_procs_ANCIENT 2
30
31
32 /*
33 * ------------------------ Exported functions -----------------------
34 */
35 extern afs_int32 uss_procs_BuildDir(char *a_path, char *a_mode,
36 char *a_owner, char *a_access);
37 /*
38 * Summary:
39 * Create and fully set up a directory for the user.
40 *
41 * Args:
42 * char *a_path : Pathname of directory to create.
43 * char *a_mode : Unix mode to set for directory.
44 * char *a_owner : Directory's owner.
45 * char *a_access : ACL to set on the directory.
46 *
47 * Returns:
48 * 0 if everything went well,
49 * 1 if there was a problem in the routine itself, or
50 * Other error code if problem occurred in lower-level call.
51 */
52
53 extern afs_int32 uss_procs_CpFile(char *a_path, char *a_mode,
54 char *a_owner, char *a_proto);
55 /*
56 * Summary:
57 * Copy the given file to the user's directory.
58 *
59 * Args:
60 * char *a_path : Pathname of file to create.
61 * char *a_mode : Unix mode to set for file.
62 * char *a_owner : File's owner.
63 * char *a_proto : Prototype to copy from.
64 *
65 * Returns:
66 * 0 if everything went well,
67 * 1 if there was a problem in the routine itself, or
68 * Other error code if problem occurred in lower-level call.
69 */
70
71 extern afs_int32 uss_procs_EchoToFile(char *a_path, char *a_mode,
72 char *a_owner, char *a_content);
73 /*
74 * Summary:
75 * Put the specified contents into the given file.
76 *
77 * Args:
78 * a_path : Pathname of file to fill in.
79 * a_mode : Unix mode to set for file.
80 * a_owner : File's owner.
81 * a_content : Value to insert into file.
82 *
83 * Returns:
84 * 0 if everything went well,
85 * 1 if there was a problem in the routine itself, or
86 * Other error code if problem occurred in lower-level call.
87 */
88
89 extern afs_int32 uss_procs_Exec(char *a_command);
90 /*
91 * Summary:
92 * Execute the given Unix command.
93 *
94 * Args:
95 * char *a_command : Unix command to execute.
96 *
97 * Returns:
98 * 0 if everything went well,
99 * 1 if there was a problem in the routine itself, or
100 * Other error code if problem occurred in lower-level call.
101 */
102
103 extern afs_int32 uss_procs_SetLink(char *a_path1, char *a_path2,
104 char a_type);
105 /*
106 * Summary:
107 * Create either the given symbolic or hard link.
108 *
109 * Args:
110 * char *a_path1 : Name of the link itself.
111 * char *a_path2 : Name of what the link points to.
112 * char a_type : Specifies either a symbolic or hard link.
113 *
114 * Returns:
115 * 0 if everything went well,
116 * 1 if there was a problem in the routine itself, or
117 * Other error code if problem occurred in lower-level call.
118 */
119
120 extern int uss_procs_AddToDirPool(char *a_dirToAdd);
121 /*
122 * Summary:
123 * Add the given pathname to the $AUTH directory pool
124 *
125 * Args:
126 * char *a_dirToAdd : Name of directory to add.
127 *
128 * Returns:
129 * Result of addition.
130 */
131
132 extern FILE *uss_procs_FindAndOpen(char *a_fileToOpen);
133 /*
134 * Summary:
135 * Given a template filename, get that file open and return the
136 * file descriptor. If a full pathname is given, try to open it
137 * directly. Otherwise, use the default pathname prefixes.
138 *
139 * Args:
140 * char *a_fileToOpen : Name of file to open.
141 *
142 * Returns:
143 * The file descriptor for the open file (if it could be done),
144 * NULL otherwise.
145 */
146
147 extern void uss_procs_PrintErr(int a_lineNum, char *a_fmt, ... );
148 /*
149 * Summary:
150 * Print out an error connected with template file parsing.
151 *
152 * Args:
153 * int a_lineNum : Template file line number having the error.
154 * char *a_fmt : Format string to use.
155 *
156 * Returns:
157 * Nothing.
158 */
159
160 extern int uss_procs_GetOwner(char *a_ownerStr);
161 /*
162 * Summary:
163 * Translate the owner string to the owner uid.
164 *
165 * Args:
166 * char *a_ownerStr : Name of the owner.
167 *
168 * Returns:
169 * Owner's uid.
170 */
171
172 extern afs_int32 uss_procs_PickADir(char *path, char *cp);
173 /*
174 * Summary:
175 * Tries to replace $AUTO by a subdir. Subdirs are given by means
176 * of "G" in the configuration file. Each of the directories is
177 * examined, and the one with the inimum number of entries is
178 * picked.
179 *
180 * Args:
181 * a_path : ???
182 * a_cp : ???
183 *
184 * Returns:
185 * 0 if everything went well,
186 * -1 if there was a problem.
187 */
188
189 #endif /* _USS_PROCS_H_ */