/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <libintl.h>
#include <string.h>
#include <fcntl.h>
#include <limits.h>
#include <malloc.h>
#include <locale.h>
#include <ftw.h>
#include <sys/instance.h>
#include <libdevinfo.h>
#include <zone.h>
#include "addrem.h"
#include "errmsg.h"
static void usage(void);
static void cleanup_devfs_attributes(char *, char *);
int
{
int opt;
int cleanup = 0;
int err;
int n_flag = 0;
#if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */
#endif
(void) textdomain(TEXT_DOMAIN);
/* must be run by root */
if (getuid() != 0) {
exit(1);
}
switch (opt) {
case 'b' :
server = 1;
exit(1);
}
break;
case 'C':
cleanup = 1;
break;
case 'n':
n_flag = 1;
break;
case '?' :
usage();
exit(1);
}
}
if (driver_name == NULL) {
exit(1);
}
/*
* check for extra args
*/
usage();
exit(1);
}
} else {
usage();
exit(1);
}
if (getzoneid() != GLOBAL_ZONEID) {
exit(1);
}
/* set up add_drv filenames */
exit(1);
}
enter_lock();
err_exit();
err_exit();
/* look up the major number of the driver being removed. */
err_exit();
}
err_exit();
}
mod_unloaded = 1;
/* get the module id for this driver */
/* module is installed */
if (modid != -1) {
mod_unloaded = 0;
}
}
/* unload driver.conf file */
}
}
}
/*
* add driver to rem_name_to_major; if this fails, don`t
* delete from name_to_major
*/
err_exit();
}
/*
* If removing the driver from the running system, notify
* kernel dynamically to remove minor perm entries.
*/
if ((n_flag == 0) &&
if (err != 0) {
driver_name, err);
}
}
/*
*/
/*
* Optionally clean up any dangling devfs shadow nodes for
* this driver so that, in the event the driver is re-added
* to the system, newly created nodes won't incorrectly
* pick up these stale shadow node permissions.
*/
if (err != 0) {
driver_name, err);
}
}
}
exit_unlock();
return (NOERR);
}
/*
* Optionally remove attribute nodes for a driver when
* removing drivers on a mounted root image. Useful
* when reprovisioning a machine to return to default
* permission/ownership settings if the driver is
* re-installed.
*/
typedef struct cleanup_arg {
char *ca_basedir;
char *ca_drvname;
/*
* Callback to remove a minor node for a device
*/
/*ARGSUSED*/
static int
{
}
return (DI_WALK_CONTINUE);
}
/*
* Callback for each device registered in the binding file (path_to_inst)
*/
/*ARGSUSED*/
static int
int inst_number, const char *inst_driver)
{
}
}
return (rv);
}
static void
{
(void) devfs_parse_binding_file(binding_path,
cleanup_device_walker, (void *)&arg);
}
static void
usage()
{
}