#include <stdio.h>
#include <strings.h>
#include <sms.h>
+#include <sms_app.h>
#include <menu.h>
#include "mit-copyright.h"
#include "defs.h"
#include "f_defs.h"
#include "globals.h"
-#include "infodefs.h"
#define FS_ALIAS_TYPE "FILESYS"
#define DEFAULT_MACHINE DEFAULT_NONE
#define DEFAULT_PACK DEFAULT_NONE
#define DEFAULT_M_POINT DEFAULT_NONE
-#define DEFAULT_ACCESS ("r")
+#define DEFAULT_ACCESS ("w")
#define DEFAULT_COMMENTS DEFAULT_COMMENT
#define DEFAULT_OWNER (user)
#define DEFAULT_OWNERS (user)
#define DEFAULT_CREATE DEFAULT_YES
-#define DEFAULT_L_TYPE ("HOMEDIR")
+#define DEFAULT_L_TYPE ("PROJECT")
/* Function Name: SetDefaults
* Description: sets the default values for filesystem additions.
switch (type) {
case LABEL:
- if ( (stat = sms_query("get_filesys_by_label", 1, &name,
- StoreInfo, (char *)&elem)) != 0) {
+ if ( (stat = do_sms_query("get_filesys_by_label", 1, &name,
+ StoreInfo, (char *)&elem)) != 0) {
com_err(program_name, stat, NULL);
return(NULL);
}
break;
case MACHINE:
- if ( (stat = sms_query("get_filesys_by_machine", 1, &name,
- StoreInfo, (char *)&elem)) != 0) {
+ if ( (stat = do_sms_query("get_filesys_by_machine", 1, &name,
+ StoreInfo, (char *)&elem)) != 0) {
com_err(program_name, stat, NULL);
return(NULL);
}
break;
case GROUP:
- if ( (stat = sms_query("get_filesys_by_group", 1, &name,
- StoreInfo, (char *)&elem)) != 0) {
+ if ( (stat = do_sms_query("get_filesys_by_group", 1, &name,
+ StoreInfo, (char *)&elem)) != 0) {
com_err(program_name, stat, NULL);
return(NULL);
}
args[ALIAS_NAME] = name;
args[ALIAS_TYPE] = FS_ALIAS_TYPE;
args[ALIAS_TRANS] = "*";
- if ( (stat = sms_query("get_alias", 3, args, StoreInfo,
- (char *) &elem)) != 0) {
+ if ( (stat = do_sms_query("get_alias", 3, args, StoreInfo,
+ (char *) &elem)) != 0) {
com_err(program_name, stat, " in get_alias.");
return(NULL);
}
&newname);
}
- GetValueFromUser("Filesystem's Type", &info[FS_TYPE]);
+ GetTypeFromUser("Filesystem's Type", "filesys", &info[FS_TYPE]);
GetValueFromUser("Filesystem's Machine", &info[FS_MACHINE]);
strcpy(temp_buf, CanonicalizeHostname(info[FS_MACHINE]));
free(info[FS_MACHINE]);
GetValueFromUser("Filesystem's owners (group)", &info[FS_OWNERS]);
GetYesNoValueFromUser("Automatically create this filesystem",
&info[FS_CREATE]);
- GetValueFromUser("Filesystem's lockertype", &info[FS_L_TYPE]);
+ GetTypeFromUser("Filesystem's lockertype", "lockertype", &info[FS_L_TYPE]);
FreeAndClear(&info[FS_MODTIME], TRUE);
FreeAndClear(&info[FS_MODBY], TRUE);
sprintf(temp_buf, "Are you sure that you want to delete filesystem %s",
info[FS_NAME]);
if(!one_item || Confirm(temp_buf)) {
- if ( (stat = sms_query("delete_filesys", 1,
- &info[FS_NAME], Scream, NULL)) != 0)
+ if ( (stat = do_sms_query("delete_filesys", 1,
+ &info[FS_NAME], Scream, NULL)) != 0)
com_err(program_name, stat, " filesystem not deleted.");
else
Put_message("Filesystem deleted.");
{
int stat;
char ** args = AskFSInfo(info, TRUE);
-
- if ( (stat = sms_query("update_filesys", CountArgs(args),
- args, NullFunc, NULL)) != 0)
- com_err(program_name, stat, ", filesystem not updated");
- else
- Put_message("filesystem sucessfully updated.");
+ extern Menu nfsphys_menu;
+
+ stat = do_sms_query("update_filesys", CountArgs(args), args,
+ NullFunc, NULL);
+ switch (stat) {
+ case SMS_NFS:
+ Put_message("That NFS filesystem is not exported.");
+ if (YesNoQuestion("Fix this now (Y/N)")) {
+ Do_menu(&nfsphys_menu, 0, NULL);
+ if (YesNoQuestion("Retry filesystem update now (Y/N)")) {
+ if (stat = do_sms_query("update_filesys", CountArgs(args), args,
+ NullFunc, NULL))
+ com_err(program_name, stat, " filesystem not updated");
+ else
+ Put_message("filesystem sucessfully updated.");
+ }
+ }
+ break;
+ case SMS_SUCCESS:
+ break;
+ default:
+ com_err(program_name, stat, " in UpdateFS");
+ }
}
/* Function Name: ChangeFS
{
char *info[MAX_ARGS_SIZE], **args;
int stat;
+ extern Menu nfsphys_menu;
if ( !ValidName(argv[1]) )
return(DM_NORMAL);
- if ( (stat = sms_query("get_filesys_by_label", 1, argv + 1,
- NullFunc, NULL)) == 0) {
+ if ( (stat = do_sms_query("get_filesys_by_label", 1, argv + 1,
+ NullFunc, NULL)) == 0) {
Put_message ("A Filesystem by that name already exists.");
return(DM_NORMAL);
} else if (stat != SMS_NO_MATCH) {
args = AskFSInfo(SetDefaults(info, argv[1]), FALSE );
- if ( (stat = sms_query("add_filesys", CountArgs(args), args,
- NullFunc, NULL)) != 0)
+ stat = do_sms_query("add_filesys", CountArgs(args), args, NullFunc, NULL);
+ switch (stat) {
+ case SMS_NFS:
+ Put_message("That NFS filesystem is not exported.");
+ if (YesNoQuestion("Fix this now (Y/N)")) {
+ Do_menu(&nfsphys_menu, 0, NULL);
+ if (YesNoQuestion("Retry filesystem creation now (Y/N)")) {
+ if (stat = do_sms_query("add_filesys", CountArgs(args), args,
+ NullFunc, NULL))
+ com_err(program_name, stat, " in AddFS");
+ else
+ Put_message("Created.");
+ }
+ }
+ break;
+ case SMS_SUCCESS:
+ break;
+ default:
com_err(program_name, stat, " in AddFS");
+ }
FreeInfo(info);
return (DM_NORMAL);
* print out values, free memory used and then exit.
*/
- if ( (stat = sms_query("get_alias", 3, args, StoreInfo,
- (char *)&elem)) == 0) {
+ if ( (stat = do_sms_query("get_alias", 3, args, StoreInfo,
+ (char *)&elem)) == 0) {
top = elem = QueueTop(elem);
while (elem != NULL) {
info = (char **) elem->q_data;
GetValueFromUser("Which filesystem will this alias point to?",
&args[ALIAS_TRANS]);
- if ( (stat = sms_query("add_alias", 3, args, NullFunc, NULL)) != 0)
+ if ( (stat = do_sms_query("add_alias", 3, args, NullFunc, NULL)) != 0)
com_err(program_name, stat, " in CreateFSAlias.");
FreeInfo(args);
"Are you sure that you want to delete the filesystem alias %s",
info[ALIAS_NAME]);
if(!one_item || Confirm(temp_buf)) {
- if ( (stat = sms_query("delete_alias", CountArgs(info),
- info, Scream, NULL)) != 0 )
+ if ( (stat = do_sms_query("delete_alias", CountArgs(info),
+ info, Scream, NULL)) != 0 )
com_err(program_name, stat, " filesystem alias not deleted.");
else
Put_message("Filesystem alias deleted.");
return(PrintHelp(message));
}
-
-/*
- * Local Variables:
- * mode: c
- * c-indent-level: 4
- * c-continued-statement-offset: 4
- * c-brace-offset: -4
- * c-argdecl-indent: 4
- * c-label-offset: -4
- * End:
- */