volcancel.c revision 18c2aff776a775d34a4c9893a4c72e0434d68e36
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Program to cancel pending i/o
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <locale.h>
#include <libintl.h>
#include <volmgt.h>
/*
* ON-private libvolmgt routine(s)
*/
extern void _media_printaliases(void);
/*
* volcancel return codes:
*/
#define SUCCESS 0
#define USAGE_ERROR 1
#define VOLMGT_NOT_RUNNING 2
#define OPEN_ERROR 3
#define IOCTL_ERROR 4
static char *prog_name;
static void usage(void);
static int cancel(char *);
int
{
extern int optind;
int c;
char *name;
#ifdef DEBUG
#endif
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
/* process arguments */
switch (c) {
case 'n':
default:
usage();
}
}
if (!volmgt_running()) {
gettext("%s: volume management is not running\n"),
#ifdef DEBUG
#endif
}
#ifdef DEBUG
name);
#endif
break;
}
}
#ifdef DEBUG
#endif
return (excode);
}
static void
usage(void)
{
}
static int
{
int fd;
#ifdef DEBUG
#endif
#ifdef DEBUG
#endif
return (OPEN_ERROR);
}
#ifdef DEBUG
#endif
#ifdef DEBUG
"volcancel error: ioctl(VOLIOCCANCEL) failed (errno %d; %s)\n",
#endif
return (IOCTL_ERROR);
}
#ifdef DEBUG
#endif
return (SUCCESS);
}
static char *
{
/*
* (oor alternate root if not "/vol")
*/
static uint_t vold_root_len;
static char path_buf[MAXPATHLEN];
if (*vold_root == '\0') {
}
/* path doesn't already exist */
/* found it in rdsk under vol root */
>= sizeof (path_buf))
return (NULL);
}
}
return (path_ptr);
}