Print this page
4833 Remove volrmmount
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

@@ -15,15 +15,16 @@
  * If applicable, add the following below this CDDL HEADER, with the
  * fields enclosed by brackets "[]" replaced with your own identifying
  * information: Portions Copyright [yyyy] [name of copyright owner]
  *
  * CDDL HEADER END
- */
-
-/*
+ *
+ *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright 2014 Andrew Stormont.
  */
 
 /*
  * rmf_misc.c :
  *      Miscelleneous routines for rmformat.

@@ -85,11 +86,11 @@
 
 /*
  * Function prototypes.
  */
 static int              my_umount(char *mountp);
-static int              my_volrmmount(char *real_name);
+static int              my_rmmount(char *real_name);
 static int              vol_name_to_dev_node(char *vname, char *found);
 static int              vol_lookup(char *supplied, char *found);
 static device_t         *get_device(char *user_supplied, char *node);
 static char             *get_physical_name(char *path);
 static int              lookup_device(char *supplied, char *found);

@@ -259,11 +260,11 @@
          *
          * Convert the real name to a block device address.
          * Do a partial match with the mnttab entries.
          * Make sure the match is in the beginning to avoid if
          * anybody puts a label similiar to volume manager path names.
-         * Then use "volrmmount -e <dev_name>" if -U flag is set.
+         * Then use "rmmount -u <dev_name>" if -U flag is set.
          */
 
         nl = strlen("/vol/dev/");
 
         if (strncmp(real_name, "/vol/dev/", nl) != 0)

@@ -314,11 +315,11 @@
                 }
         }
 
         if (ret_val == 1) {
                 if (flag) {
-                        if (my_volrmmount(real_name) < 0) {
+                        if (my_rmmount(real_name) < 0) {
                                 ret_val = -1;
                         }
                 } else {
                         ret_val = -1;
                 }

@@ -1066,11 +1067,11 @@
         }
         return (-1);
 }
 
 static int
-my_volrmmount(char *real_name)
+my_rmmount(char *real_name)
 {
         int pid, rval;
 
         /* Turn on the privileges. */
         (void) __priv_bracket(PRIV_ON);

@@ -1087,26 +1088,26 @@
         }
 
         if (pid == 0) {
                 /* the child */
                 /* get rid of those nasty err messages */
-                DPRINTF1("call_unmount_prog: calling %s \n",
-                    "/usr/bin/volrmmount");
+                DPRINTF1("call_unmount_prog: calling %s\n",
+                    "/usr/bin/rmmount");
 
                 /* Turn on the privileges. */
                 (void) __priv_bracket(PRIV_ON);
-                if (execl("/usr/bin/volrmmount", "/usr/bin/volrmmount", "-e",
+                if (execl("/usr/bin/rmmount", "/usr/bin/rmmount", "-u",
                     real_name, NULL) < 0) {
-                        PERROR("volrmmount exec failed");
+                        PERROR("rmmount exec failed");
                         /* Turn off the privileges */
                         (void) __priv_bracket(PRIV_OFF);
                         exit(-1);
                 }
         } else if (waitpid(pid, &rval, 0) == pid) {
                 if (WIFEXITED(rval)) {
                         if (WEXITSTATUS(rval) == 0) {
-                                DPRINTF("volrmmount: Success\n");
+                                DPRINTF("rmmount: Success\n");
                                 return (1);
                         }
                 }
         }
         return (-1);

@@ -1158,11 +1159,11 @@
                         continue;
                 }
                 total_devices_found++;
 
                 if ((!defer) && !found) {
-                        char *sn, *tmpbuf;
+                        char *sn, *tmpbuf = NULL;
                         /*
                          * dev_name is an optional command line input.
                          */
                         if (dev_name) {
                                 if (strstr(dirent->d_name, tmpstr)) {