]>
Commit | Line | Data |
---|---|---|
402461ad | 1 | #if (!defined(lint) && !defined(SABER)) |
08345b74 | 2 | static char rcsid_module_c[] = "$Header$"; |
402461ad | 3 | #endif |
08345b74 | 4 | |
8defc06b | 5 | /* This is the file attach.c for the MOIRA Client, which allows a nieve |
6 | * user to quickly and easily maintain most parts of the MOIRA database. | |
08345b74 | 7 | * It Contains: Functions for maintaining data used by Hesiod |
8 | * to map courses/projects/users to their file systems, | |
9 | * and maintain filesys info. | |
10 | * | |
11 | * Created: 5/4/88 | |
12 | * By: Chris D. Peterson | |
08345b74 | 13 | * |
14 | * $Source$ | |
15 | * $Author$ | |
16 | * $Header$ | |
17 | * | |
0a2c64cb | 18 | * Copyright 1988 by the Massachusetts Institute of Technology. |
08345b74 | 19 | * |
20 | * For further information on copyright and distribution | |
21 | * see the file mit-copyright.h | |
22 | */ | |
23 | ||
08345b74 | 24 | #include <stdio.h> |
f071d8a7 | 25 | #include <string.h> |
8defc06b | 26 | #include <moira.h> |
27 | #include <moira_site.h> | |
08345b74 | 28 | #include <menu.h> |
7cb7d352 | 29 | #include <sys/types.h> |
30 | #include <sys/stat.h> | |
b7e66e09 | 31 | #include <ctype.h> |
08345b74 | 32 | |
461c03b6 | 33 | #include "mit-copyright.h" |
0a2c64cb | 34 | #include "defs.h" |
35 | #include "f_defs.h" | |
461c03b6 | 36 | #include "globals.h" |
461c03b6 | 37 | |
08345b74 | 38 | #define FS_ALIAS_TYPE "FILESYS" |
39 | ||
461c03b6 | 40 | #define LABEL 0 |
41 | #define MACHINE 1 | |
42 | #define GROUP 2 | |
43 | #define ALIAS 3 | |
08345b74 | 44 | |
6966e6fe | 45 | #define NO_MACHINE ("[NONE]") |
b3197763 | 46 | #define NO_MACHINE_BAD ("[NONE]") |
9e2516d6 | 47 | |
1104552d | 48 | #define DEFAULT_TYPE ("AFS") |
85ca828a | 49 | #define DEFAULT_MACHINE DEFAULT_NONE |
50 | #define DEFAULT_PACK DEFAULT_NONE | |
7f6743f7 | 51 | #define DEFAULT_ACCESS ("w") |
85ca828a | 52 | #define DEFAULT_COMMENTS DEFAULT_COMMENT |
53 | #define DEFAULT_OWNER (user) | |
54 | #define DEFAULT_OWNERS (user) | |
55 | #define DEFAULT_CREATE DEFAULT_YES | |
7f6743f7 | 56 | #define DEFAULT_L_TYPE ("PROJECT") |
7cb7d352 | 57 | #define DEFAULT_CELL ("athena.mit.edu") |
85ca828a | 58 | |
59 | /* Function Name: SetDefaults | |
60 | * Description: sets the default values for filesystem additions. | |
61 | * Arguments: info - an array of char pointers to recieve defaults. | |
62 | * Returns: char ** (this array, now filled). | |
63 | */ | |
64 | ||
65 | static char ** | |
66 | SetDefaults(info, name) | |
67 | char ** info; | |
68 | char * name; | |
69 | { | |
7cce48da | 70 | char buf[BUFSIZ]; |
71 | ||
85ca828a | 72 | info[FS_NAME] = Strsave(name); |
73 | info[FS_TYPE] = Strsave(DEFAULT_TYPE); | |
74 | info[FS_MACHINE] = Strsave(DEFAULT_MACHINE); | |
75 | info[FS_PACK] = Strsave(DEFAULT_PACK); | |
7cce48da | 76 | sprintf(buf, "/mit/%s", name); |
77 | info[FS_M_POINT] = Strsave(buf); | |
85ca828a | 78 | info[FS_ACCESS] = Strsave(DEFAULT_ACCESS); |
79 | info[FS_COMMENTS] = Strsave(DEFAULT_COMMENTS); | |
80 | info[FS_OWNER] = Strsave(DEFAULT_OWNER); | |
81 | info[FS_OWNERS] = Strsave(DEFAULT_OWNERS); | |
82 | info[FS_CREATE] = Strsave(DEFAULT_CREATE); | |
83 | info[FS_L_TYPE] = Strsave(DEFAULT_L_TYPE); | |
84 | info[FS_MODTIME] = info[FS_MODBY] = info[FS_MODWITH] = info[FS_END] = NULL; | |
85 | return(info); | |
86 | } | |
87 | ||
08345b74 | 88 | /* Function Name: GetFSInfo |
89 | * Description: Stores the info in a queue. | |
90 | * Arguments: type - type of information to get. | |
91 | * name - name of the item to get information on. | |
92 | * Returns: a pointer to the first element in the queue. | |
93 | */ | |
94 | ||
402461ad | 95 | static struct qelem * |
08345b74 | 96 | GetFSInfo(type, name) |
97 | int type; | |
98 | char *name; | |
99 | { | |
100 | int stat; | |
101 | struct qelem * elem = NULL; | |
85ca828a | 102 | char * args[5]; |
08345b74 | 103 | |
104 | switch (type) { | |
461c03b6 | 105 | case LABEL: |
8defc06b | 106 | if ( (stat = do_mr_query("get_filesys_by_label", 1, &name, |
14f99d7d | 107 | StoreInfo, (char *)&elem)) != 0) { |
9777ade9 | 108 | com_err(program_name, stat, " in GetFSInfo"); |
08345b74 | 109 | return(NULL); |
110 | } | |
111 | break; | |
461c03b6 | 112 | case MACHINE: |
8defc06b | 113 | if ( (stat = do_mr_query("get_filesys_by_machine", 1, &name, |
14f99d7d | 114 | StoreInfo, (char *)&elem)) != 0) { |
9777ade9 | 115 | com_err(program_name, stat, " in GetFSInfo"); |
08345b74 | 116 | return(NULL); |
117 | } | |
118 | break; | |
461c03b6 | 119 | case GROUP: |
8defc06b | 120 | if ( (stat = do_mr_query("get_filesys_by_group", 1, &name, |
14f99d7d | 121 | StoreInfo, (char *)&elem)) != 0) { |
9777ade9 | 122 | com_err(program_name, stat, " in GetFSInfo"); |
08345b74 | 123 | return(NULL); |
124 | } | |
125 | break; | |
461c03b6 | 126 | case ALIAS: |
85ca828a | 127 | args[ALIAS_NAME] = name; |
128 | args[ALIAS_TYPE] = FS_ALIAS_TYPE; | |
129 | args[ALIAS_TRANS] = "*"; | |
8defc06b | 130 | if ( (stat = do_mr_query("get_alias", 3, args, StoreInfo, |
14f99d7d | 131 | (char *) &elem)) != 0) { |
461c03b6 | 132 | com_err(program_name, stat, " in get_alias."); |
08345b74 | 133 | return(NULL); |
134 | } | |
135 | } | |
136 | ||
137 | return(QueueTop(elem)); | |
138 | } | |
139 | ||
85ca828a | 140 | /* Function Name: PrintFSAlias |
141 | * Description: Prints a filesystem alias | |
142 | * Arguments: info - an array contains the strings of info. | |
402461ad | 143 | * Returns: the name of the filesys - used be QueryLoop(). |
85ca828a | 144 | */ |
145 | ||
402461ad | 146 | static char * |
85ca828a | 147 | PrintFSAlias(info) |
148 | char ** info; | |
149 | { | |
150 | char buf[BUFSIZ]; | |
151 | ||
152 | sprintf(buf,"Alias: %-25s Filesystem: %s",info[ALIAS_NAME], | |
153 | info[ALIAS_TRANS]); | |
154 | Put_message(buf); | |
402461ad | 155 | return(info[ALIAS_NAME]); |
85ca828a | 156 | } |
157 | ||
9e2516d6 | 158 | static int fsgCount = 1; |
159 | ||
160 | static char * | |
161 | PrintFSGMembers(info) | |
162 | char ** info; | |
163 | { | |
164 | char print_buf[BUFSIZ]; | |
165 | ||
166 | sprintf(print_buf, " %d. Filesystem: %-32s (sort key: %s)", fsgCount++, info[0], info[1]); | |
167 | Put_message(print_buf); | |
168 | return(info[0]); | |
169 | } | |
170 | ||
171 | ||
08345b74 | 172 | /* Function Name: PrintFSInfo |
173 | * Description: Prints the filesystem information. | |
174 | * Arguments: info - a pointer to the filesystem information. | |
175 | * Returns: none. | |
176 | */ | |
177 | ||
402461ad | 178 | static char * |
461c03b6 | 179 | PrintFSInfo(info) |
08345b74 | 180 | char ** info; |
181 | { | |
182 | char print_buf[BUFSIZ]; | |
9e2516d6 | 183 | |
85ca828a | 184 | FORMFEED; |
9e2516d6 | 185 | |
b4b1f800 | 186 | if (!strcmp(info[FS_TYPE], "FSGROUP") || !strcmp(info[FS_TYPE], "MUL")) { |
9e2516d6 | 187 | int stat; |
188 | struct qelem *elem = NULL; | |
189 | ||
b4b1f800 | 190 | if (!strcmp(info[FS_TYPE], "MUL")) |
191 | sprintf(print_buf,"%20s Multiple Filesystem: %s", " ", info[FS_NAME]); | |
192 | else | |
193 | sprintf(print_buf,"%20s Filesystem Group: %s", " ", info[FS_NAME]); | |
b3197763 | 194 | Put_message(print_buf); |
195 | ||
9777ade9 | 196 | sprintf(print_buf,"Comments: %s",info[FS_COMMENTS]); |
9e2516d6 | 197 | Put_message(print_buf); |
198 | sprintf(print_buf, MOD_FORMAT, info[FS_MODBY], info[FS_MODTIME], | |
199 | info[FS_MODWITH]); | |
200 | Put_message(print_buf); | |
201 | Put_message("Containing the filesystems (in order):"); | |
8defc06b | 202 | if ((stat = do_mr_query("get_fsgroup_members", 1, &info[FS_NAME], |
9e2516d6 | 203 | StoreInfo, (char *)&elem)) != 0) { |
8defc06b | 204 | if (stat == MR_NO_MATCH) |
9e2516d6 | 205 | Put_message(" [no members]"); |
206 | else | |
9777ade9 | 207 | com_err(program_name, stat, " in PrintFSInfo"); |
9e2516d6 | 208 | } else { |
209 | fsgCount = 1; | |
210 | Loop(QueueTop(elem), (void *) PrintFSGMembers); | |
211 | FreeQueue(elem); | |
212 | } | |
213 | } else { | |
b3197763 | 214 | sprintf(print_buf,"%20s Filesystem: %s", " ", info[FS_NAME]); |
215 | Put_message(print_buf); | |
9e2516d6 | 216 | sprintf(print_buf,"Type: %-40s Machine: %-15s", |
217 | info[FS_TYPE], info[FS_MACHINE]); | |
218 | Put_message(print_buf); | |
219 | sprintf(print_buf,"Default Access: %-2s Packname: %-17s Mountpoint %s ", | |
220 | info[FS_ACCESS], info[FS_PACK], info[FS_M_POINT]); | |
221 | Put_message(print_buf); | |
9777ade9 | 222 | sprintf(print_buf,"Comments: %s",info[FS_COMMENTS]); |
9e2516d6 | 223 | Put_message(print_buf); |
224 | sprintf(print_buf, "User Ownership: %-30s Group Ownership: %s", | |
225 | info[FS_OWNER], info[FS_OWNERS]); | |
226 | Put_message(print_buf); | |
03e8157a | 227 | sprintf(print_buf, "Update Fileserver: %-27s Locker Type: %s", |
9e2516d6 | 228 | atoi(info[FS_CREATE]) ? "ON" : "OFF", |
229 | info[FS_L_TYPE]); | |
230 | Put_message(print_buf); | |
231 | sprintf(print_buf, MOD_FORMAT, info[FS_MODBY], info[FS_MODTIME], | |
232 | info[FS_MODWITH]); | |
233 | Put_message(print_buf); | |
234 | } | |
402461ad | 235 | return(info[FS_NAME]); |
08345b74 | 236 | } |
237 | ||
7cb7d352 | 238 | |
239 | char *canonicalize_cell(c) | |
240 | char *c; | |
241 | { | |
242 | struct stat stbuf; | |
243 | char path[512]; | |
244 | int count; | |
245 | ||
246 | sprintf(path, "/afs/%s", c); | |
247 | if (lstat(path, &stbuf) || !stbuf.st_mode&S_IFLNK) | |
248 | return(c); | |
249 | count = readlink(path, path, sizeof(path)); | |
250 | if (count < 1) return(c); | |
251 | path[count] = 0; | |
252 | free(c); | |
253 | return(strsave(path)); | |
254 | } | |
255 | ||
256 | ||
257 | int GetAliasValue(argc, argv, retval) | |
258 | int argc; | |
259 | char **argv; | |
260 | char **retval; | |
261 | { | |
262 | *retval = strsave(argv[2]); | |
263 | return(MR_CONT); | |
264 | } | |
265 | ||
08345b74 | 266 | /* Function Name: AskFSInfo. |
267 | * Description: This function askes the user for information about a | |
268 | * machine and saves it into a structure. | |
269 | * Arguments: info - a pointer the the structure to put the | |
270 | * info into. | |
271 | * name - add a newname field? (T/F) | |
272 | * Returns: none. | |
273 | */ | |
274 | ||
402461ad | 275 | static char ** |
461c03b6 | 276 | AskFSInfo(info, name) |
08345b74 | 277 | char ** info; |
278 | Bool name; | |
279 | { | |
4423dd45 | 280 | char temp_buf[BUFSIZ], *newname, access_type[32]; |
7cb7d352 | 281 | int fsgroup = 0, newdefaults = 0; |
08345b74 | 282 | |
402461ad | 283 | Put_message(""); |
284 | sprintf(temp_buf, "Changing Attributes of filesystem %s.", | |
85ca828a | 285 | info[FS_NAME]); |
08345b74 | 286 | Put_message(temp_buf); |
402461ad | 287 | Put_message(""); |
08345b74 | 288 | |
289 | if (name) { | |
290 | newname = Strsave(info[FS_NAME]); | |
44b10c87 | 291 | if (GetValueFromUser("The new name for this filesystem", |
292 | &newname) == SUB_ERROR) | |
293 | return(NULL); | |
08345b74 | 294 | } |
295 | ||
7cb7d352 | 296 | strcpy(temp_buf, info[FS_TYPE]); |
44b10c87 | 297 | if (GetTypeFromUser("Filesystem's Type", "filesys", &info[FS_TYPE]) == |
298 | SUB_ERROR) | |
299 | return(NULL); | |
b4b1f800 | 300 | if (!strcasecmp(info[FS_TYPE], "FSGROUP") || |
301 | !strcasecmp(info[FS_TYPE], "MUL")) | |
9e2516d6 | 302 | fsgroup++; |
7cb7d352 | 303 | if (strcasecmp(info[FS_TYPE], temp_buf)) |
304 | newdefaults++; | |
305 | if (fsgroup) { | |
9e2516d6 | 306 | free(info[FS_MACHINE]); |
307 | info[FS_MACHINE] = Strsave(NO_MACHINE); | |
308 | } else { | |
7cb7d352 | 309 | if (!strcasecmp(info[FS_TYPE], "AFS")) { |
310 | if (!name || newdefaults) { | |
311 | free(info[FS_MACHINE]); | |
312 | info[FS_MACHINE] = strsave(DEFAULT_CELL); | |
313 | } | |
314 | if (GetValueFromUser("Filesystem's Cell", &info[FS_MACHINE]) == | |
315 | SUB_ERROR) | |
316 | return(NULL); | |
317 | info[FS_MACHINE] = canonicalize_cell(info[FS_MACHINE]); | |
318 | } else { | |
319 | if (GetValueFromUser("Filesystem's Machine", &info[FS_MACHINE]) == | |
320 | SUB_ERROR) | |
321 | return(NULL); | |
322 | info[FS_MACHINE] = canonicalize_hostname(info[FS_MACHINE]); | |
323 | } | |
9e2516d6 | 324 | } |
325 | if (!fsgroup) { | |
7cb7d352 | 326 | if (!strcasecmp(info[FS_TYPE], "AFS")) { |
327 | char *path, *args[3], *p; | |
328 | int status, depth, i; | |
329 | if (GetTypeFromUser("Filesystem's lockertype", "lockertype", | |
330 | &info[FS_L_TYPE]) == SUB_ERROR) | |
331 | return(NULL); | |
332 | if (!name || newdefaults) { | |
333 | free(info[FS_PACK]); | |
334 | lowercase(info[FS_MACHINE]); | |
335 | sprintf(temp_buf, "%s:%s", info[FS_MACHINE], info[FS_L_TYPE]); | |
336 | args[0] = temp_buf; | |
337 | args[1] = "AFSPATH"; | |
338 | args[2] = "*"; | |
339 | path = "???"; | |
340 | status = do_mr_query("get_alias", 3, args, | |
341 | GetAliasValue, &path); | |
342 | if (status == MR_SUCCESS) { | |
f071d8a7 | 343 | p = strchr(path, ':'); |
7cb7d352 | 344 | if (p) { |
345 | *p = 0; | |
346 | depth = atoi(++p); | |
347 | } else | |
348 | depth = 0; | |
349 | sprintf(temp_buf, "/afs/%s/%s", info[FS_MACHINE], path); | |
b7e66e09 | 350 | if (depth >= 0) { |
351 | for (p=info[FS_NAME]; *p&&(p-info[FS_NAME])<depth; p++) { | |
352 | if (islower(*p)) { | |
353 | strcat(temp_buf, "/x"); | |
354 | temp_buf[strlen(temp_buf)-1] = *p; | |
d678d80c | 355 | } else { |
356 | sprintf(temp_buf, "/afs/%s/%s/other", info[FS_MACHINE], path); | |
357 | break; | |
358 | } | |
b7e66e09 | 359 | } |
360 | } else if (depth = -1) { | |
361 | if (isdigit(info[FS_NAME][0])) { | |
362 | strcat(temp_buf, "/"); | |
363 | depth = strlen(temp_buf); | |
364 | for (p = info[FS_NAME]; *p && isdigit(*p); p++) { | |
365 | temp_buf[depth++] = *p; | |
366 | temp_buf[depth] = 0; | |
367 | } | |
368 | } else | |
369 | strcat(temp_buf, "/other"); | |
370 | } else { | |
371 | /* no default */ | |
7cb7d352 | 372 | } |
373 | strcat(temp_buf, "/"); | |
374 | strcat(temp_buf, info[FS_NAME]); | |
375 | free(path); | |
376 | } else { | |
377 | sprintf(temp_buf, "/afs/%s/%s/%s", info[FS_MACHINE], | |
378 | lowercase(info[FS_L_TYPE]), info[FS_NAME]); | |
379 | } | |
380 | info[FS_PACK] = strsave(temp_buf); | |
381 | } | |
382 | } | |
44b10c87 | 383 | if (GetValueFromUser("Filesystem's Pack Name", &info[FS_PACK]) == |
384 | SUB_ERROR) | |
385 | return(NULL); | |
386 | if (GetValueFromUser("Filesystem's Mount Point", &info[FS_M_POINT]) == | |
387 | SUB_ERROR) | |
388 | return(NULL); | |
4423dd45 | 389 | sprintf(access_type, "fs_access_%s", info[FS_TYPE]); |
44b10c87 | 390 | if (GetTypeFromUser("Filesystem's Default Access", access_type, |
391 | &info[FS_ACCESS]) == SUB_ERROR) | |
392 | return(NULL); | |
9e2516d6 | 393 | } |
44b10c87 | 394 | if (GetValueFromUser("Comments about this Filesystem", &info[FS_COMMENTS]) |
395 | == SUB_ERROR) | |
396 | return(NULL); | |
397 | if (GetValueFromUser("Filesystem's owner (user)", &info[FS_OWNER]) == | |
398 | SUB_ERROR) | |
399 | return(NULL); | |
400 | if (GetValueFromUser("Filesystem's owners (group)", &info[FS_OWNERS]) == | |
401 | SUB_ERROR) | |
402 | return(NULL); | |
9e2516d6 | 403 | if (!fsgroup) |
03e8157a | 404 | if (GetYesNoValueFromUser("Propagate changes to fileserver", |
44b10c87 | 405 | &info[FS_CREATE]) == SUB_ERROR) |
406 | return(NULL); | |
7cb7d352 | 407 | if (strcasecmp(info[FS_TYPE], "AFS")) { |
408 | if (GetTypeFromUser("Filesystem's lockertype", "lockertype", | |
409 | &info[FS_L_TYPE]) == SUB_ERROR) | |
410 | return(NULL); | |
411 | } | |
08345b74 | 412 | |
413 | FreeAndClear(&info[FS_MODTIME], TRUE); | |
414 | FreeAndClear(&info[FS_MODBY], TRUE); | |
415 | FreeAndClear(&info[FS_MODWITH], TRUE); | |
416 | ||
417 | if (name) /* slide the newname into the #2 slot. */ | |
418 | SlipInNewName(info, newname); | |
419 | ||
420 | return(info); | |
421 | } | |
422 | ||
7cb7d352 | 423 | |
08345b74 | 424 | /* --------------- Filesystem Menu ------------- */ |
425 | ||
426 | /* Function Name: GetFS | |
427 | * Description: Get Filesystem information by name. | |
428 | * Arguments: argc, argv - name of filsys in argv[1]. | |
429 | * Returns: DM_NORMAL. | |
430 | */ | |
431 | ||
432 | /* ARGSUSED */ | |
433 | int | |
434 | GetFS(argc, argv) | |
435 | int argc; | |
436 | char **argv; | |
437 | { | |
0a2c64cb | 438 | struct qelem *top; |
08345b74 | 439 | |
0a2c64cb | 440 | top = GetFSInfo(LABEL, argv[1]); /* get info. */ |
441 | Loop(top, (void *) PrintFSInfo); | |
85ca828a | 442 | FreeQueue(top); /* clean the queue. */ |
ef1e47d8 | 443 | return (DM_NORMAL); |
444 | } | |
445 | ||
446 | /* Function Name: GetFSM | |
447 | * Description: Get Filesystem information by machine. | |
448 | * Arguments: argc, argv - name of server in argv[1]. | |
449 | * Returns: DM_NORMAL. | |
450 | */ | |
451 | ||
452 | /* ARGSUSED */ | |
453 | int | |
454 | GetFSM(argc, argv) | |
455 | int argc; | |
456 | char **argv; | |
457 | { | |
458 | struct qelem *top; | |
459 | ||
e48f7f39 | 460 | argv[1] = canonicalize_hostname(strsave(argv[1])); |
ef1e47d8 | 461 | top = GetFSInfo(MACHINE, argv[1]); /* get info. */ |
462 | Loop(top, (void *) PrintFSInfo); | |
463 | FreeQueue(top); /* clean the queue. */ | |
08345b74 | 464 | return (DM_NORMAL); |
465 | } | |
466 | ||
402461ad | 467 | /* Function Name: RealDeleteFS |
468 | * Description: Does the real deletion work. | |
469 | * Arguments: info - array of char *'s containing all useful info. | |
470 | * one_item - a Boolean that is true if only one item | |
471 | * in queue that dumped us here. | |
472 | * Returns: none. | |
473 | */ | |
474 | ||
475 | void | |
476 | RealDeleteFS(info, one_item) | |
477 | char ** info; | |
478 | Bool one_item; | |
479 | { | |
480 | int stat; | |
481 | char temp_buf[BUFSIZ]; | |
482 | ||
483 | /* | |
484 | * Deletetions are performed if the user hits 'y' on a list of multiple | |
485 | * filesystem, or if the user confirms on a unique alias. | |
486 | */ | |
487 | sprintf(temp_buf, "Are you sure that you want to delete filesystem %s", | |
488 | info[FS_NAME]); | |
489 | if(!one_item || Confirm(temp_buf)) { | |
8defc06b | 490 | if ( (stat = do_mr_query("delete_filesys", 1, |
14f99d7d | 491 | &info[FS_NAME], Scream, NULL)) != 0) |
402461ad | 492 | com_err(program_name, stat, " filesystem not deleted."); |
493 | else | |
494 | Put_message("Filesystem deleted."); | |
495 | } | |
496 | else | |
497 | Put_message("Filesystem not deleted."); | |
498 | } | |
499 | ||
08345b74 | 500 | /* Function Name: DeleteFS |
501 | * Description: Delete a filesystem give its name. | |
502 | * Arguments: argc, argv - argv[1] is the name of the filesystem. | |
503 | * Returns: none. | |
504 | */ | |
505 | ||
506 | /* ARGSUSED */ | |
507 | ||
508 | int | |
509 | DeleteFS(argc, argv) | |
510 | int argc; | |
511 | char **argv; | |
512 | { | |
402461ad | 513 | struct qelem *elem = GetFSInfo(LABEL, argv[1]); |
514 | QueryLoop(elem, PrintFSInfo, RealDeleteFS, "Delete the Filesystem"); | |
08345b74 | 515 | |
402461ad | 516 | FreeQueue(elem); |
08345b74 | 517 | return (DM_NORMAL); |
518 | } | |
519 | ||
402461ad | 520 | /* Function Name: RealChangeFS |
521 | * Description: performs the actual change to the filesys. | |
522 | * Arguments: info - the information | |
523 | * junk - an unused boolean. | |
524 | * Returns: none. | |
525 | */ | |
526 | ||
527 | /* ARGSUSED. */ | |
528 | static void | |
529 | RealChangeFS(info, junk) | |
530 | char ** info; | |
531 | Bool junk; | |
532 | { | |
533 | int stat; | |
9777ade9 | 534 | char ** args; |
bff71786 | 535 | extern Menu nfsphys_menu; |
536 | ||
9777ade9 | 537 | args = AskFSInfo(info, TRUE); |
538 | if (args == NULL) { | |
539 | Put_message("Aborted."); | |
540 | return; | |
541 | } | |
8defc06b | 542 | stat = do_mr_query("update_filesys", CountArgs(args), args, |
14f99d7d | 543 | NullFunc, NULL); |
bff71786 | 544 | switch (stat) { |
8defc06b | 545 | case MR_NFS: |
bff71786 | 546 | Put_message("That NFS filesystem is not exported."); |
d8997da7 | 547 | if (YesNoQuestion("Fix this now (Y/N)", TRUE) == TRUE) { |
bff71786 | 548 | Do_menu(&nfsphys_menu, 0, NULL); |
d8997da7 | 549 | if (YesNoQuestion("Retry filesystem update now (Y/N)", TRUE) |
550 | == TRUE) { | |
8defc06b | 551 | if (stat = do_mr_query("update_filesys", CountArgs(args), args, |
14f99d7d | 552 | NullFunc, NULL)) |
bff71786 | 553 | com_err(program_name, stat, " filesystem not updated"); |
554 | else | |
555 | Put_message("filesystem sucessfully updated."); | |
556 | } | |
557 | } | |
558 | break; | |
8defc06b | 559 | case MR_SUCCESS: |
98cce88c | 560 | break; |
bff71786 | 561 | default: |
98cce88c | 562 | com_err(program_name, stat, " in UpdateFS"); |
bff71786 | 563 | } |
402461ad | 564 | } |
565 | ||
08345b74 | 566 | /* Function Name: ChangeFS |
567 | * Description: change the information in a filesys record. | |
568 | * Arguments: arc, argv - value of filsys in argv[1]. | |
569 | * Returns: DM_NORMAL. | |
570 | */ | |
571 | ||
572 | /* ARGSUSED */ | |
573 | int | |
574 | ChangeFS(argc, argv) | |
575 | char **argv; | |
576 | int argc; | |
577 | { | |
402461ad | 578 | struct qelem *elem = GetFSInfo(LABEL, argv[1]); |
579 | QueryLoop(elem, NullPrint, RealChangeFS, "Update the Filesystem"); | |
08345b74 | 580 | |
08345b74 | 581 | FreeQueue(elem); |
582 | return (DM_NORMAL); | |
583 | } | |
584 | ||
585 | /* Function Name: AddFS | |
586 | * Description: change the information in a filesys record. | |
587 | * Arguments: arc, argv - name of filsys in argv[1]. | |
588 | * Returns: DM_NORMAL. | |
589 | */ | |
590 | ||
591 | /* ARGSUSED */ | |
592 | int | |
593 | AddFS(argc, argv) | |
594 | char **argv; | |
595 | int argc; | |
596 | { | |
7cce48da | 597 | char *info[MAX_ARGS_SIZE], **args, buf[BUFSIZ]; |
85ca828a | 598 | int stat; |
bff71786 | 599 | extern Menu nfsphys_menu; |
08345b74 | 600 | |
601 | if ( !ValidName(argv[1]) ) | |
602 | return(DM_NORMAL); | |
603 | ||
8defc06b | 604 | if ( (stat = do_mr_query("get_filesys_by_label", 1, argv + 1, |
14f99d7d | 605 | NullFunc, NULL)) == 0) { |
08345b74 | 606 | Put_message ("A Filesystem by that name already exists."); |
607 | return(DM_NORMAL); | |
8defc06b | 608 | } else if (stat != MR_NO_MATCH) { |
461c03b6 | 609 | com_err(program_name, stat, " in AddFS"); |
08345b74 | 610 | return(DM_NORMAL); |
611 | } | |
612 | ||
44b10c87 | 613 | if ((args = AskFSInfo(SetDefaults(info, argv[1]), FALSE )) == NULL) { |
614 | Put_message("Aborted."); | |
615 | return(DM_NORMAL); | |
616 | } | |
461c03b6 | 617 | |
8defc06b | 618 | stat = do_mr_query("add_filesys", CountArgs(args), args, NullFunc, NULL); |
bff71786 | 619 | switch (stat) { |
8defc06b | 620 | case MR_NFS: |
bff71786 | 621 | Put_message("That NFS filesystem is not exported."); |
d8997da7 | 622 | if (YesNoQuestion("Fix this now (Y/N)", TRUE) == TRUE) { |
bff71786 | 623 | Do_menu(&nfsphys_menu, 0, NULL); |
d8997da7 | 624 | if (YesNoQuestion("Retry filesystem creation now (Y/N)", TRUE) |
625 | == TRUE) { | |
8defc06b | 626 | if (stat = do_mr_query("add_filesys", CountArgs(args), args, |
14f99d7d | 627 | NullFunc, NULL)) |
bff71786 | 628 | com_err(program_name, stat, " in AddFS"); |
629 | else | |
630 | Put_message("Created."); | |
631 | } | |
632 | } | |
633 | break; | |
8defc06b | 634 | case MR_SUCCESS: |
98cce88c | 635 | break; |
bff71786 | 636 | default: |
461c03b6 | 637 | com_err(program_name, stat, " in AddFS"); |
bff71786 | 638 | } |
08345b74 | 639 | |
8defc06b | 640 | if (stat == MR_SUCCESS && !strcasecmp(info[FS_L_TYPE], "HOMEDIR")) { |
7cce48da | 641 | static char *val[] = {"def_quota", NULL}; |
642 | static char *def_quota = NULL; | |
314752ee | 643 | char *argv[Q_QUOTA + 1]; |
7cce48da | 644 | struct qelem *top = NULL; |
645 | ||
646 | if (def_quota == NULL) { | |
8defc06b | 647 | stat = do_mr_query("get_value", CountArgs(val), val, |
7cce48da | 648 | StoreInfo, (char *) &top); |
8defc06b | 649 | if (stat != MR_SUCCESS) { |
7cce48da | 650 | com_err(program_name, stat, " getting default quota"); |
651 | } else { | |
652 | top = QueueTop(top); | |
653 | def_quota = Strsave(((char **)top->q_data)[0]); | |
654 | FreeQueue(top); | |
655 | } | |
656 | } | |
657 | if (def_quota != NULL) { | |
658 | sprintf(buf, "Give user %s a quota of %s on filesys %s (Y/N)", | |
659 | info[FS_NAME], def_quota, info[FS_NAME]); | |
44b10c87 | 660 | if (YesNoQuestion(buf, 1) == TRUE) { |
b124ed18 | 661 | argv[Q_NAME] = argv[Q_FILESYS] = info[FS_NAME]; |
d25fad50 | 662 | if (!strcmp(info[FS_TYPE], "NFS")) |
663 | argv[Q_TYPE] = "USER"; | |
664 | else | |
665 | argv[Q_TYPE] = "ANY"; | |
7cce48da | 666 | argv[Q_QUOTA] = def_quota; |
b124ed18 | 667 | if ((stat = do_mr_query("add_quota", Q_QUOTA+1, argv, Scream, |
8defc06b | 668 | (char *) NULL)) != MR_SUCCESS) { |
7cce48da | 669 | com_err(program_name, stat, " while adding quota"); |
670 | } | |
671 | } | |
672 | } | |
d25fad50 | 673 | } else if (stat == MR_SUCCESS) { |
674 | if (YesNoQuestion("Assign a quota on this filesystem (Y/N)", 1) | |
675 | == TRUE) { | |
676 | parsed_argc = 1; | |
677 | parsed_argv[0] = info[FS_NAME]; | |
678 | AddQuota(); | |
679 | } | |
7cce48da | 680 | } |
681 | ||
08345b74 | 682 | FreeInfo(info); |
683 | return (DM_NORMAL); | |
684 | } | |
685 | ||
9e2516d6 | 686 | /* Function Name: SortAfter |
687 | * Description: choose a sortkey to cause an item to be added after | |
688 | * the count element in the queue | |
689 | * Arguments: queue of filesys names & sortkeys, queue count pointer | |
690 | * Returns: sort key to use. | |
691 | */ | |
692 | ||
693 | /* ARGSUSED */ | |
694 | char * | |
695 | SortAfter(elem, count) | |
696 | struct qelem *elem; | |
697 | int count; | |
698 | { | |
699 | char *prev, *next, prevnext, *key, keybuf[9]; | |
700 | ||
701 | /* first find the two keys we need to insert between */ | |
702 | prev = "A"; | |
703 | for (; count > 0; count--) { | |
704 | prev = ((char **)elem->q_data)[1]; | |
705 | if (elem->q_forw) | |
706 | elem = elem->q_forw; | |
707 | else | |
708 | break; | |
709 | } | |
710 | if (count > 0) | |
711 | next = "Z"; | |
712 | else | |
713 | next = ((char **)elem->q_data)[1]; | |
714 | ||
715 | /* now copy the matching characters */ | |
716 | for (key = keybuf; *prev && *prev == *next; next++) { | |
717 | *key++ = *prev++; | |
718 | } | |
719 | ||
720 | /* and set the last character */ | |
721 | if (*prev == 0) | |
722 | *prev = prevnext = 'A'; | |
723 | else | |
724 | prevnext = prev[1]; | |
725 | if (prevnext == 0) | |
726 | prevnext = 'A'; | |
727 | if (*next == 0) | |
728 | *next = 'Z'; | |
729 | if (*next - *prev > 1) { | |
730 | *key++ = (*next + *prev)/2; | |
731 | } else { | |
732 | *key++ = *prev; | |
733 | *key++ = (prevnext + 'Z')/2; | |
734 | } | |
735 | *key = 0; | |
736 | return(Strsave(keybuf)); | |
737 | } | |
738 | ||
739 | /* Function Name: AddFSToGroup | |
740 | * Description: add a filesystem to an FS group | |
741 | * Arguments: arc, argv - name of group in argv[1], filesys in argv[2]. | |
742 | * Returns: DM_NORMAL. | |
743 | */ | |
744 | ||
745 | /* ARGSUSED */ | |
746 | int | |
747 | AddFSToGroup(argc, argv) | |
748 | char **argv; | |
749 | int argc; | |
750 | { | |
751 | int stat, count; | |
752 | struct qelem *elem = NULL; | |
753 | char buf[BUFSIZ], *args[5], *bufp; | |
754 | ||
8defc06b | 755 | if ((stat = do_mr_query("get_fsgroup_members", 1, argv+1, StoreInfo, |
9e2516d6 | 756 | (char *)&elem)) != 0) { |
8defc06b | 757 | if (stat != MR_NO_MATCH) |
9e2516d6 | 758 | com_err(program_name, stat, " in AddFSToGroup"); |
759 | } | |
760 | if (elem == NULL) { | |
761 | args[0] = argv[1]; | |
762 | args[1] = argv[2]; | |
763 | args[2] = "M"; | |
8defc06b | 764 | stat = do_mr_query("add_filesys_to_fsgroup", 3, args, Scream, NULL); |
9e2516d6 | 765 | if (stat) |
766 | com_err(program_name, stat, " in AddFSToGroup"); | |
767 | return(DM_NORMAL); | |
768 | } | |
769 | elem = QueueTop(elem); | |
770 | fsgCount = 1; | |
771 | Loop(elem, (void *) PrintFSGMembers); | |
772 | sprintf(buf, "%d", QueueCount(elem)); | |
773 | bufp = Strsave(buf); | |
44b10c87 | 774 | if (GetValueFromUser("Enter number of filesystem it should follow (0 to make it first):", &bufp) == SUB_ERROR) |
775 | return(DM_NORMAL); | |
9e2516d6 | 776 | count = atoi(bufp); |
777 | free(bufp); | |
778 | args[2] = SortAfter(elem, count); | |
779 | ||
780 | FreeQueue(QueueTop(elem)); | |
781 | args[0] = argv[1]; | |
782 | args[1] = argv[2]; | |
8defc06b | 783 | stat = do_mr_query("add_filesys_to_fsgroup", 3, args, Scream, NULL); |
784 | if (stat == MR_EXISTS) { | |
9e2516d6 | 785 | Put_message("That filesystem is already a member of the group."); |
786 | Put_message("Use the order command if you want to change the sorting order."); | |
787 | } else if (stat) | |
788 | com_err(program_name, stat, " in AddFSToGroup"); | |
789 | return(DM_NORMAL); | |
790 | } | |
791 | ||
792 | ||
793 | /* Function Name: RemoveFSFromGroup | |
794 | * Description: delete a filesystem from an FS group | |
795 | * Arguments: arc, argv - name of group in argv[1]. | |
796 | * Returns: DM_NORMAL. | |
797 | */ | |
798 | ||
799 | /* ARGSUSED */ | |
800 | int | |
801 | RemoveFSFromGroup(argc, argv) | |
802 | char **argv; | |
803 | int argc; | |
804 | { | |
805 | int stat; | |
806 | char buf[BUFSIZ]; | |
807 | ||
808 | sprintf(buf, "Delete filesystem %s from FS group %s", argv[2], argv[1]); | |
809 | if (!Confirm(buf)) | |
810 | return(DM_NORMAL); | |
8defc06b | 811 | if ((stat = do_mr_query("remove_filesys_from_fsgroup", 2, argv+1, |
9e2516d6 | 812 | Scream, NULL)) != 0) { |
813 | com_err(program_name, stat, ", not removed."); | |
814 | } | |
815 | return(DM_NORMAL); | |
816 | } | |
817 | ||
818 | /* Function Name: ChangeFSGroupOrder | |
819 | * Description: change the sortkey on a filesys in an FSgroup | |
820 | * Arguments: arc, argv - name of group in argv[1]. | |
821 | * Returns: DM_NORMAL. | |
822 | */ | |
823 | ||
824 | /* ARGSUSED */ | |
825 | int | |
826 | ChangeFSGroupOrder(argc, argv) | |
827 | char **argv; | |
828 | int argc; | |
829 | { | |
860a8dbe | 830 | int stat, src, dst, i; |
831 | struct qelem *elem = NULL, *top, *tmpelem; | |
9e2516d6 | 832 | char buf[BUFSIZ], *bufp, *args[3]; |
833 | ||
8defc06b | 834 | if ((stat = do_mr_query("get_fsgroup_members", 1, argv+1, StoreInfo, |
9e2516d6 | 835 | (char *)&elem)) != 0) { |
8defc06b | 836 | if (stat == MR_NO_MATCH) { |
44b10c87 | 837 | sprintf(buf, |
838 | "Ether %s is not a filesystem group or it has no members", | |
839 | argv[1]); | |
9e2516d6 | 840 | Put_message(buf); |
841 | } else | |
842 | com_err(program_name, stat, " in ChangeFSGroupOrder"); | |
843 | return(DM_NORMAL); | |
844 | } | |
845 | top = QueueTop(elem); | |
846 | fsgCount = 1; | |
847 | Loop(top, (void *) PrintFSGMembers); | |
848 | while (1) { | |
849 | bufp = Strsave("1"); | |
44b10c87 | 850 | if (GetValueFromUser("Enter number of the filesystem to move:", |
851 | &bufp) == SUB_ERROR) | |
852 | return(DM_NORMAL); | |
9e2516d6 | 853 | src = atoi(bufp); |
854 | free(bufp); | |
855 | if (src < 0) { | |
856 | Put_message("You must enter a positive number (or 0 to abort)."); | |
857 | continue; | |
858 | } else if (src == 0) { | |
859 | Put_message("Aborted."); | |
860 | return(DM_NORMAL); | |
861 | } | |
860a8dbe | 862 | for (elem = top, i = src; i-- > 1 && elem->q_forw; elem = elem->q_forw); |
863 | if (i > 0) { | |
9e2516d6 | 864 | Put_message("You entered a number that is too high"); |
865 | continue; | |
866 | } | |
867 | break; | |
868 | } | |
860a8dbe | 869 | while (1) { |
870 | bufp = Strsave("0"); | |
44b10c87 | 871 | if (GetValueFromUser("Enter number of filesystem it should follow (0 to make it first):", &bufp) == SUB_ERROR) |
872 | return(DM_NORMAL); | |
860a8dbe | 873 | dst = atoi(bufp); |
874 | free(bufp); | |
875 | if (src == dst || src == dst + 1) { | |
876 | Put_message("That has no effect on the sorting order!"); | |
877 | return(DM_NORMAL); | |
878 | } | |
879 | if (dst < 0) { | |
880 | Put_message("You must enter a non-negative number."); | |
881 | continue; | |
882 | } | |
883 | for (tmpelem = top, i = dst; | |
884 | i-- > 1 && tmpelem->q_forw; | |
885 | tmpelem = tmpelem->q_forw); | |
886 | if (i > 0) { | |
887 | Put_message("You entered a number that is too high"); | |
888 | continue; | |
889 | } | |
890 | break; | |
9e2516d6 | 891 | } |
892 | args[2] = SortAfter(top, dst); | |
893 | args[0] = argv[1]; | |
894 | args[1] = ((char **)elem->q_data)[0]; | |
8defc06b | 895 | if ((stat = do_mr_query("remove_filesys_from_fsgroup", 2, args, |
9e2516d6 | 896 | Scream, NULL)) != 0) { |
897 | com_err(program_name, stat, " in ChangeFSGroupOrder"); | |
898 | return(DM_NORMAL); | |
899 | } | |
8defc06b | 900 | if ((stat = do_mr_query("add_filesys_to_fsgroup", 3, args, |
9e2516d6 | 901 | Scream, NULL)) != 0) { |
902 | com_err(program_name, stat, " in ChangeFSGroupOrder"); | |
903 | } | |
904 | return(DM_NORMAL); | |
905 | } | |
906 | ||
907 | ||
08345b74 | 908 | /* -------------- Top Level Menu ---------------- */ |
909 | ||
910 | /* Function Name: GetFSAlias | |
911 | * Description: Gets the value for a Filesystem Alias. | |
912 | * Arguments: argc, argv - name of alias in argv[1]. | |
913 | * Returns: DM_NORMAL. | |
914 | * NOTES: There should only be one filesystem per alias, thus | |
915 | * this will work correctly. | |
916 | */ | |
917 | ||
918 | /* ARGSUSED */ | |
919 | int | |
920 | GetFSAlias(argc, argv) | |
921 | int argc; | |
922 | char **argv; | |
923 | { | |
0a2c64cb | 924 | struct qelem *top; |
08345b74 | 925 | |
0a2c64cb | 926 | top = GetFSInfo(ALIAS, argv[1]); |
85ca828a | 927 | Put_message(" "); /* blank line. */ |
0a2c64cb | 928 | Loop(top, (void *) PrintFSAlias); |
08345b74 | 929 | FreeQueue(top); |
930 | return(DM_NORMAL); | |
931 | } | |
932 | ||
933 | /* Function Name: CreateFSAlias | |
6c7a2fcf | 934 | * Description: Create an alias name for a filesystem |
08345b74 | 935 | * Arguments: argc, argv - name of alias in argv[1]. |
936 | * Returns: DM_NORMAL. | |
937 | * NOTES: This requires (name, type, transl) I get {name, translation} | |
938 | * from the user. I provide type, which is well-known. | |
939 | */ | |
940 | ||
941 | /* ARGSUSED */ | |
942 | int | |
943 | CreateFSAlias(argc, argv) | |
944 | int argc; | |
945 | char **argv; | |
946 | { | |
461c03b6 | 947 | register int stat; |
08345b74 | 948 | struct qelem *elem, *top; |
461c03b6 | 949 | char *args[MAX_ARGS_SIZE], buf[BUFSIZ], **info; |
08345b74 | 950 | |
951 | elem = NULL; | |
952 | ||
953 | if (!ValidName(argv[1])) | |
954 | return(DM_NORMAL); | |
955 | ||
461c03b6 | 956 | args[ALIAS_NAME] = Strsave(argv[1]); |
957 | args[ALIAS_TYPE] = Strsave(FS_ALIAS_TYPE); | |
85ca828a | 958 | args[ALIAS_TRANS] = Strsave("*"); |
08345b74 | 959 | |
960 | /* | |
961 | * Check to see if this alias already exists in the database, if so then | |
962 | * print out values, free memory used and then exit. | |
963 | */ | |
964 | ||
8defc06b | 965 | if ( (stat = do_mr_query("get_alias", 3, args, StoreInfo, |
14f99d7d | 966 | (char *)&elem)) == 0) { |
85ca828a | 967 | top = elem = QueueTop(elem); |
08345b74 | 968 | while (elem != NULL) { |
969 | info = (char **) elem->q_data; | |
85ca828a | 970 | sprintf(buf,"The alias: %s currently describes the filesystem %s", |
461c03b6 | 971 | info[ALIAS_NAME], info[ALIAS_TRANS]); |
08345b74 | 972 | Put_message(buf); |
973 | elem = elem->q_forw; | |
974 | } | |
975 | FreeQueue(top); | |
976 | return(DM_NORMAL); | |
977 | } | |
8defc06b | 978 | else if ( stat != MR_NO_MATCH) { |
461c03b6 | 979 | com_err(program_name, stat, " in CreateFSAlias."); |
08345b74 | 980 | return(DM_NORMAL); |
981 | } | |
982 | ||
a1d1f62b | 983 | args[ALIAS_TRANS]= Strsave(""); |
984 | args[ALIAS_END] = NULL; | |
44b10c87 | 985 | if (GetValueFromUser("Which filesystem will this alias point to?", |
986 | &args[ALIAS_TRANS]) == SUB_ERROR) | |
987 | return(DM_NORMAL); | |
08345b74 | 988 | |
8defc06b | 989 | if ( (stat = do_mr_query("add_alias", 3, args, NullFunc, NULL)) != 0) |
461c03b6 | 990 | com_err(program_name, stat, " in CreateFSAlias."); |
08345b74 | 991 | |
461c03b6 | 992 | FreeInfo(args); |
08345b74 | 993 | return (DM_NORMAL); |
994 | } | |
402461ad | 995 | |
996 | /* Function Name: RealDeleteFSAlias | |
997 | * Description: Does the real deletion work. | |
998 | * Arguments: info - array of char *'s containing all useful info. | |
999 | * one_item - a Boolean that is true if only one item | |
1000 | * in queue that dumped us here. | |
1001 | * Returns: none. | |
1002 | */ | |
1003 | ||
1004 | void | |
1005 | RealDeleteFSAlias(info, one_item) | |
1006 | char ** info; | |
1007 | Bool one_item; | |
1008 | { | |
1009 | int stat; | |
1010 | char temp_buf[BUFSIZ]; | |
1011 | ||
1012 | /* | |
1013 | * Deletetions are performed if the user hits 'y' on a list of multiple | |
1014 | * filesystem, or if the user confirms on a unique alias. | |
1015 | */ | |
1016 | sprintf(temp_buf, | |
1017 | "Are you sure that you want to delete the filesystem alias %s", | |
1018 | info[ALIAS_NAME]); | |
1019 | if(!one_item || Confirm(temp_buf)) { | |
8defc06b | 1020 | if ( (stat = do_mr_query("delete_alias", CountArgs(info), |
14f99d7d | 1021 | info, Scream, NULL)) != 0 ) |
402461ad | 1022 | com_err(program_name, stat, " filesystem alias not deleted."); |
1023 | else | |
1024 | Put_message("Filesystem alias deleted."); | |
1025 | } | |
1026 | else | |
1027 | Put_message("Filesystem alias not deleted."); | |
1028 | } | |
08345b74 | 1029 | |
1030 | /* Function Name: DeleteFSAlias | |
6c7a2fcf | 1031 | * Description: Delete an alias name for a filesystem |
08345b74 | 1032 | * Arguments: argc, argv - name of alias in argv[1]. |
1033 | * Returns: DM_NORMAL. | |
1034 | * NOTES: This requires (name, type, transl) I get {name, translation} | |
1035 | * from the user. I provide type, which is well-known. | |
1036 | */ | |
1037 | ||
1038 | /* ARGSUSED */ | |
1039 | int | |
1040 | DeleteFSAlias(argc, argv) | |
1041 | int argc; | |
1042 | char **argv; | |
1043 | { | |
402461ad | 1044 | struct qelem *elem = GetFSInfo(ALIAS, argv[1]); |
1045 | QueryLoop(elem, PrintFSAlias, RealDeleteFSAlias, | |
1046 | "Delete the Filesystem Alias"); | |
1047 | FreeQueue(elem); | |
08345b74 | 1048 | return (DM_NORMAL); |
1049 | } | |
1050 | ||
1051 | /* Function Name: AttachHelp | |
1052 | * Description: Print help info on attachmaint. | |
1053 | * Arguments: none | |
1054 | * Returns: DM_NORMAL. | |
1055 | */ | |
1056 | ||
1057 | int | |
1058 | AttachHelp() | |
1059 | { | |
1060 | static char *message[] = { | |
9e2516d6 | 1061 | "These are the options:", |
1062 | "", | |
1063 | "get - get information about a filesystem.", | |
1064 | "add - add a new filesystem to the data base.", | |
1065 | "update - update the information in the database on a filesystem.", | |
1066 | "delete - delete a filesystem from the database.", | |
1067 | "check - check information about association of a name and a filesys.", | |
1068 | "alias - associate a name with a filesystem.", | |
1069 | "unalias - disassociate a name with a filesystem.", | |
1070 | "verbose - toggle the request for delete confirmation.", | |
08345b74 | 1071 | NULL, |
1072 | }; | |
1073 | ||
1074 | return(PrintHelp(message)); | |
1075 | } | |
9e2516d6 | 1076 | |
1077 | /* Function Name: FSGroupHelp | |
1078 | * Description: Print help info on fsgroups. | |
1079 | * Arguments: none | |
1080 | * Returns: DM_NORMAL. | |
1081 | */ | |
1082 | ||
1083 | int | |
1084 | FSGroupHelp() | |
1085 | { | |
1086 | static char *message[] = { | |
1087 | "A filesystem group is a named sorted list of filesystems.", | |
1088 | "", | |
1089 | "To create, modify, or delete a group itself, use the menu above", | |
1090 | " this one, and manipulate a filesystem of type FSGROUP.", | |
1091 | "Options here are:", | |
1092 | " get - get info about a group and show its members", | |
1093 | " add - add a new member to a group.", | |
1094 | " remove - remove a member from a group.", | |
1095 | " order - change the sorting order of a group.", | |
1096 | NULL | |
1097 | }; | |
1098 | ||
1099 | return(PrintHelp(message)); | |
1100 | } |