Print this page
4833 Remove volrmmount
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
*** 15,28 ****
* 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.
*/
/*
* rmf_menu.c :
* Command line options to rmformat are processed in this file.
--- 15,30 ----
* 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,98 ****
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_floppy(int32_t fd, int32_t flag);
int32_t get_confirmation(void);
static void process_F_flag(smedia_handle_t handle, int32_t fd);
--- 88,99 ----
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_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);
*** 114,124 ****
{
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;
struct dk_minfo media;
--- 115,124 ----
*** 167,201 ****
exit(1);
}
/* Check if volume manager has mounted this */
if (umount_required) {
! v_device_umount = check_and_unmount_vold(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);
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"));
(void) close(fd);
exit(1);
}
}
if (umount_required && !U_flag) {
! if (v_device_umount || m_scsi_umount || m_flp_umount) {
(void) fprintf(stderr, gettext("Device mounted.\n"));
(void) fprintf(stderr,
gettext("Requested operation can not be \
performed on a mounted device.\n"));
(void) close(fd);
--- 167,196 ----
exit(1);
}
/* Check if volume manager has mounted this */
if (umount_required) {
! 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);
if (m_flp_umount != 1) {
umount_failed = 1;
}
}
}
if (umount_required && U_flag && umount_failed) {
! if (m_scsi_umount || m_flp_umount) {
(void) fprintf(stderr,
gettext("Could not unmount device.\n"));
(void) close(fd);
exit(1);
}
}
if (umount_required && !U_flag) {
! if (m_scsi_umount || m_flp_umount) {
(void) fprintf(stderr, gettext("Device mounted.\n"));
(void) fprintf(stderr,
gettext("Requested operation can not be \
performed on a mounted device.\n"));
(void) close(fd);
*** 306,316 ****
*/
static void
process_F_flag(smedia_handle_t handle, int32_t fd)
{
! uint32_t format_flag;
int32_t old_per = 0;
int32_t new_per, ret_val;
if (force_format) {
(void) fprintf(stderr,
--- 301,311 ----
*/
static void
process_F_flag(smedia_handle_t handle, int32_t fd)
{
! uint32_t format_flag = 0;
int32_t old_per = 0;
int32_t new_per, ret_val;
if (force_format) {
(void) fprintf(stderr,
*** 413,423 ****
{
int retry;
int removable;
int total_devices_found_last_time;
int defer = 0;
! char *tmpstr;
#define MAX_RETRIES_FOR_SCANNING 3
vol_running = volmgt_running();
if (vol_running)
--- 408,418 ----
{
int retry;
int removable;
int total_devices_found_last_time;
int defer = 0;
! char *tmpstr = NULL;
#define MAX_RETRIES_FOR_SCANNING 3
vol_running = volmgt_running();
if (vol_running)