Print this page
4833 Remove volrmmount
4845 rm(u)mount don't always print mount/unmount errors
4846 HAL partition names don't match real parition names
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>

@@ -15,14 +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_menu.c :
  *      Command line options to rmformat are processed in this file.

@@ -86,13 +88,12 @@
 void overwrite_metadata(int32_t fd, smedia_handle_t handle);
 
 int32_t write_sunos_label(int32_t fd, int32_t media_type);
 
 int32_t my_open(char *device_name, int32_t flags);
-int32_t check_and_unmount_vold(char *device_name, int32_t flag);
-int32_t check_and_unmount_scsi(char *device_name, int32_t flag);
 
+int32_t check_and_unmount_scsi(char *device_name, int32_t flag);
 int32_t check_and_unmount_floppy(int32_t fd, int32_t flag);
 int32_t get_confirmation(void);
 
 
 static void     process_F_flag(smedia_handle_t handle, int32_t fd);

@@ -112,11 +113,10 @@
 void
 process_options()
 {
         int32_t fd;
         smedia_handle_t handle;
-        int32_t m_scsi_umount = 0;
         int32_t m_flp_umount = 0;
         int32_t v_device_umount = 0;
         int32_t umount_required = 0;
         int32_t removable;
         int32_t umount_failed = 0;

@@ -167,23 +167,18 @@
                 exit(1);
         }
 
         /* Check if volume manager has mounted this */
         if (umount_required) {
-                v_device_umount = check_and_unmount_vold(dev_name, U_flag);
+                v_device_umount = check_and_unmount_scsi(dev_name, U_flag);
                 if (v_device_umount != 1) {
-                        m_scsi_umount = check_and_unmount_scsi(dev_name,
-                            U_flag);
-                        if (m_scsi_umount != 1) {
-                                m_flp_umount = check_and_unmount_floppy(fd,
-                                    U_flag);
+                        m_flp_umount = check_and_unmount_floppy(fd, U_flag);
                                 if (m_flp_umount != 1) {
                                         umount_failed = 1;
                                 }
                         }
                 }
-        }
 
         if (umount_required && U_flag && umount_failed) {
                 if (v_device_umount || m_scsi_umount || m_flp_umount) {
                         (void) fprintf(stderr,
                             gettext("Could not unmount device.\n"));

@@ -306,11 +301,11 @@
  */
 
 static void
 process_F_flag(smedia_handle_t handle, int32_t fd)
 {
-        uint32_t format_flag;
+        uint32_t format_flag = 0;
         int32_t old_per = 0;
         int32_t new_per, ret_val;
 
         if (force_format) {
                 (void) fprintf(stderr,

@@ -413,11 +408,11 @@
 {
         int retry;
         int removable;
         int total_devices_found_last_time;
         int defer = 0;
-        char *tmpstr;
+        char *tmpstr = NULL;
 
 #define MAX_RETRIES_FOR_SCANNING 3
 
         vol_running = volmgt_running();
         if (vol_running)