fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Pathnames.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Functions.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void resume_sv();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void suspend_sv();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * support for the special cluster tag "local" to be used with -C in a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cluster for local volumes.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t%s [-C tag] -r resume all sv devices\n"), program);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t%s [-C tag] -s suspend all sv devices\n"), program);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortemessage(caddr_t prefix, spcs_s_info_t *status, caddr_t string, va_list ap)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: %s: ", program, prefix);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error(&svl.svl_error, gettext("unable to get max devs"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error(NULL, "unable to allocate %ld bytes of memory",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte extern char *optarg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((opt = getopt(argc, argv, "C:hrsu")) != EOF) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* NOTREACHED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* NOTREACHED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Usage checks
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte warn(NULL, gettext("-r , -s and -u are mutually exclusive"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for the special (local) cluster tag
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Process commands
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for more data.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This was set when reading sv.conf. After the last
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * line svn_path was set to \0, so we are finished.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We shouldn't get here, but put this in just in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) strncpy(svc.svc_path, svn->svn_path, sizeof (svc.svc_path));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte warn(&svc.svc_error, gettext("unable to resume %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This routine parses the config file and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * stores the data in the svn array. The return value is the number
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of entries read from conf_file. If an error occurs the error()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * routine is called (which exits the program).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int index = 0; /* Current location in svn array */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; /*CSTYLED*/; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "sv.set%d.vol", setnumber);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, rdev, sizeof (rdev)) < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check to see if the raw device is present */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte warn(NULL, gettext("%s is not a character device"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur_svn = &svn[index]; /* For easier reading below */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (strlen(rdev) >= sizeof (cur_svn->svn_path)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "raw device name (%s) longer than %d characters"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set the last path to NULL */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_log("sv", NULL, gettext("%s: suspend %s"), program, path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sv_name_t *svn, *svn_system; /* Devices in system */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check kernel's sv_ndevices and thread sets,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * if empty then change kernel state to allow unload,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and sleep SV_WAIT_UNLAOD (10 seconds).
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Only called in pkgrm time.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte error(NULL, gettext("still has active devices or threads"));