- top = elem;
- one_service = ( QueueCount(top) == 1 );
- while (elem != NULL) {
- info = (char **) elem->q_data;
- if (!one_service) { /* If more than one then query through them. */
- sprintf(buf,"Update - %s\tDirectory: %s? (y/n/q)", info[NFS_NAME],
- info[NFS_DIR]);
- switch( YesNoQuitQuestion(buf, FALSE)) {
- case TRUE:
- update = TRUE;
- break;
- case FALSE:
- update = FALSE;
- break;
- default:
- FreeQueue(top);
- Put_message("Aborting update.");
- return(DM_NORMAL);
- }
- }
- else
- update = TRUE;
-
- if (update) { /* actually perform update */
- args = AskNFSInfo(info);
- if ((stat = sms_query("update_nfsphys", CountArgs(args), args,
- Scream, (char *)NULL)) != 0)
- com_err(program_name, stat, (char *) NULL);
+ FreeQueue(elem);
+ return DM_NORMAL;
+}
+
+/* Function Name: FSPartPrint
+ * Description: print filesystem partition usage.
+ * Arguments: info - the filesystem information.
+ * Returns: none.
+ */
+
+static void FSPartPrint(char **info)
+{
+ char buf[BUFSIZ];
+ sprintf(buf, "NFS Filesystem %s uses that partition.", info[FS_NAME]);
+ Put_message(buf);
+}
+
+/* Function Name: RealDeleteNFSService
+ * Description: Actually Deletes the filesystem (some checks are made).
+ * Arguments: info - info about NFS service stored in array of strings.
+ * one_item - if TRUE then only one item on the queue, and
+ * we should confirm.
+ * Returns: none.
+ */
+
+static void RealDeleteNFSService(char **info, Bool one_item)
+{
+ char temp_buf[BUFSIZ], *args[10];
+ struct mqelem *elem = NULL;
+ int stat;
+
+ sprintf(temp_buf,
+ "Are you sure that you want to delete the %s directory on %s",
+ info[NFS_DIR], info[NFS_NAME]);
+
+ /*
+ * Check to be sure that it is not used by any of the nfs packs.
+ */
+
+ if (!one_item || Confirm(temp_buf))
+ {
+ args[0] = info[NFS_NAME];
+ args[1] = info[NFS_DIR];
+ args[2] = NULL;
+ switch ((stat = do_mr_query("get_filesys_by_nfsphys", CountArgs(args),
+ args, StoreInfo, &elem)))
+ {
+ case MR_NO_MATCH: /* it is unused, delete it. */
+ if ((stat = do_mr_query("delete_nfsphys", 2, info, NULL, NULL)))
+ com_err(program_name, stat, " in DeleteNFSService");
+ else
+ Put_message("Physical Filesystem Deleted.");
+ break;
+ case MR_SUCCESS: /* it is used, print filesys's that use it. */
+ elem = QueueTop(elem);
+ Put_message("The following fileystems are using this partition,");
+ Put_message("and must be removed before it can be deleted.");
+ Put_message("");
+ Loop(elem, FSPartPrint);
+
+ FreeQueue(elem);
+ Put_message("");
+ break;
+ default:
+ com_err(program_name, stat, " while checking usage of partition");