Print this page
4833 Remove volrmmount
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
*** 15,29 ****
* 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_misc.c :
* Miscelleneous routines for rmformat.
--- 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_misc.c :
* Miscelleneous routines for rmformat.
*** 85,95 ****
/*
* Function prototypes.
*/
static int my_umount(char *mountp);
! static int my_volrmmount(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);
--- 86,96 ----
/*
* Function prototypes.
*/
static int my_umount(char *mountp);
! 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,269 ****
*
* 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.
*/
nl = strlen("/vol/dev/");
if (strncmp(real_name, "/vol/dev/", nl) != 0)
--- 260,270 ----
*
* 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 "rmmount -u <dev_name>" if -U flag is set.
*/
nl = strlen("/vol/dev/");
if (strncmp(real_name, "/vol/dev/", nl) != 0)
*** 314,324 ****
}
}
if (ret_val == 1) {
if (flag) {
! if (my_volrmmount(real_name) < 0) {
ret_val = -1;
}
} else {
ret_val = -1;
}
--- 315,325 ----
}
}
if (ret_val == 1) {
if (flag) {
! if (my_rmmount(real_name) < 0) {
ret_val = -1;
}
} else {
ret_val = -1;
}
*** 1066,1076 ****
}
return (-1);
}
static int
! my_volrmmount(char *real_name)
{
int pid, rval;
/* Turn on the privileges. */
(void) __priv_bracket(PRIV_ON);
--- 1067,1077 ----
}
return (-1);
}
static int
! my_rmmount(char *real_name)
{
int pid, rval;
/* Turn on the privileges. */
(void) __priv_bracket(PRIV_ON);
*** 1087,1112 ****
}
if (pid == 0) {
/* the child */
/* get rid of those nasty err messages */
! DPRINTF1("call_unmount_prog: calling %s \n",
! "/usr/bin/volrmmount");
/* Turn on the privileges. */
(void) __priv_bracket(PRIV_ON);
! if (execl("/usr/bin/volrmmount", "/usr/bin/volrmmount", "-e",
real_name, NULL) < 0) {
! PERROR("volrmmount 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");
return (1);
}
}
}
return (-1);
--- 1088,1113 ----
}
if (pid == 0) {
/* the child */
/* get rid of those nasty err messages */
! DPRINTF1("call_unmount_prog: calling %s\n",
! "/usr/bin/rmmount");
/* Turn on the privileges. */
(void) __priv_bracket(PRIV_ON);
! if (execl("/usr/bin/rmmount", "/usr/bin/rmmount", "-u",
real_name, NULL) < 0) {
! 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("rmmount: Success\n");
return (1);
}
}
}
return (-1);
*** 1158,1168 ****
continue;
}
total_devices_found++;
if ((!defer) && !found) {
! char *sn, *tmpbuf;
/*
* dev_name is an optional command line input.
*/
if (dev_name) {
if (strstr(dirent->d_name, tmpstr)) {
--- 1159,1169 ----
continue;
}
total_devices_found++;
if ((!defer) && !found) {
! char *sn, *tmpbuf = NULL;
/*
* dev_name is an optional command line input.
*/
if (dev_name) {
if (strstr(dirent->d_name, tmpstr)) {