+/* Function Name: FSPartPrint
+ * Description: print filesystem partition usage.
+ * Arguments: info - the filesystem information.
+ * Returns: none.
+ */
+
+static void
+FSPartPrint(info)
+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(info, one_item)
+char ** info;
+Bool one_item;
+{
+ char temp_buf[BUFSIZ], *args[10];
+ struct qelem *elem= NULL;
+ register 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_sms_query("get_filesys_by_nfsphys", CountArgs(args),
+ args, StoreInfo, (char *)&elem)) {
+ case SMS_NO_MATCH: /* it is unused, delete it. */
+ if ( (stat = do_sms_query("delete_nfsphys", 2, info, Scream,
+ (char *) NULL )) != SMS_SUCCESS)
+ com_err(program_name, stat, " in DeleteNFSService");
+ else
+ Put_message("Physical Filesystem Deleted.");
+ break;
+ case SMS_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");
+ }
+ }
+ else
+ Put_message("Physical filesystem not deleted.");
+}
+