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
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Utility for cache configuration
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _SD_FNAME /* bring in function names from sd_trace.h */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Since we no longer support nvram cards, the hints wrthru and nowrthru no
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * longer serve any purpose, and the system will always be in wrthru mode.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * WRTHRU_HINTS, if defined still allows the setting and reporting of write
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * hints. This is defined by default on DEBUG builds.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Variables used to set up paramater block passed to kernel */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int forced_wrthru = -1; /* 0 clear, 1 set,-1 as is */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Functions exported for fwcadm.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void buildusage(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int get_cd(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int get_hint(char *, int *, int *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void check_and_set_mirrors(int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern struct tm *localtime_r(const time_t *, struct tm *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("\n%s: desired cache size (%d) "\
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "set to system max (%d)\n"), \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "set to system max (%d)\n"), \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Return the per-cd hints for a cd.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Since the global (no)wrthru and NSC_NOCACHE hints take precedence
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * over the per-cd hints, get them as well and OR the whole lot
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodehint = SDBC_IOCTL(SDBC_GET_NODE_HINT, 0, 0, 0, 0, 0, &ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: get system options failed\n"), progname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdhint = SDBC_IOCTL(SDBC_GET_CD_HINT, cd, 0, 0, 0, 0, &ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: get cd(%d) hint failed\n"), progname, cd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte nodehint &= (NSC_FORCED_WRTHRU | NSC_NO_FORCED_WRTHRU | NSC_NOCACHE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set the top bit to mark it as a system override */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Check for a config.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If no suitable config can be found, install the default config.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calling state:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * libcfg locked (mode describes type of lock)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, "scm.set1", buf, sizeof (buf)) >= 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* config exists, return */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: installing default config entry '%s'\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: upgraded lock, retrying\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_put_cstring(cfg, "scm", default_cfg, strlen(default_cfg)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to write configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to write to configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to relock configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (rc > 0) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki gettext("%s: unable to ascertain environment\n"), progname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* NOTREACHED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to access configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (setnumber = 1; /*CONSTCOND*/ TRUE; setnumber++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "cache_hint.set%d.device",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* error or not found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "cache_hint.set%d.wrthru",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Node hint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "option failed\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NSC_WRTHRU, 1, 0, 0, &ustatus) == SPCS_S_ERROR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "cache_hint.set%d.nordcache",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Node hint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "option failed\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (SDBC_IOCTL(SDBC_SET_CD_HINT, cd, NSC_NOCACHE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: get maxfiles failed\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to access configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* end of list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: error reading configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to access configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* end of list */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "in configuration\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: error reading configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_put_cstring(cfg, key, (char *)NULL, 0) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "from configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "to configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * User visible configuration.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "write_cache", "write_cache_size", "write cache size" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "fill_pattern", "fill_pattern", "debug fill pattern" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "reserved1", "reserved1", "unavailable, do not use" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "tdemons", "ntdeamons", "number of sd_test daemons" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "forced_wrthru", "forced_wrthru", "override wrthru detection" },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "no_forced_wrthru", "no_forced_wrthru", "override wrthru"},
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconfigure_sdbc(int argc, char *argv[], int optind)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *cp, option[CFG_MAX_BUF], value[CFG_MAX_BUF];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, "%s: unable to open configuration: %s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* display current user visible config */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; sdbc_cfg_options[i].tag != NULL; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* not found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(option, argv[optind], sizeof (option));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte option[sizeof (option) - 1] = '\0'; /* terminate */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; sdbc_cfg_options[i].tag != NULL; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "configuration: %s\n"),
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(buf, "<default>", sizeof (buf));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* set to new value */
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "%s: bad value (%s) "
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki "for option %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* make sure cache size is valid */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Overwrite the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cache size with
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the maximum cache
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } /* end command line args */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "to configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "will take effect when the cache is restarted"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s malloc: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_cachesize == 0 || cd >= cs_cur->st_count)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * takes either either a string containing the cd or the device name, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * returns the device name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if the arg has a leading '/', assume it's a valid device name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* treat the "all" keyword as a valid device name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Next, assume it's a cd, and try to convert it to an integer, and
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * subsequently convert that cd to its corresponding device name.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Since strtol returns 0 on failure, we need to make a special case
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * for a cd of "0", which is valid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((cd = strtol(arg, (char **)NULL, 10)) > 0) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* cd_to_device returns NULL or "" on failure--check both */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* it seems to be a valid device name */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to access configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (setnumber = 1; /*CONSTCOND*/ TRUE; setnumber++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "cache_hint.set%d.device",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* error or not found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove config file entry */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "storage: %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "storage: %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " removed from configuration\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to access configuration: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to lock configuration: %s\n"),
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncpy(device, cd_to_device(cd), NSC_MAXPATH);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (setnumber = 1; /*CONSTCOND*/ TRUE; setnumber++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "cache_hint.set%d.device",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, sizeof (buf)) < 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* error or not found */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else /* NSC_NOCACHE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else /* NSC_NOCACHE */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = cfg_put_cstring(cfg, "cache_hint", buf, sizeof (buf));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to update configuration storage: %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to update configuration storage: %s"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte extern char *optarg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "-d, -e, -m, -o, -C, -D, -L, and -v "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "are mutually exclusive\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (c) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " from src/cmd/ns/sdbc in a development"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " workspace\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Set hints saved in persistent configuration */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* bitmapfs control */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "mutually exclusive\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else /* if (Dopt) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: Printing all cd's and options:\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Configure */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (o == 'C') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* enable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (o == 'e') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* disable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (o == 'd') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get version */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (o == 'v') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* node_hint or cd_hint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (o == 'o') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(strcoll(optarg, "system"))) { /* node_hint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "options failed\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else { /* set, clear */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove hint from config */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "option failed\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else { /* cd_hint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else { /* set, clear */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* remove hint from config */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((dev_name = get_device_name(optarg)) == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%s: device for cd %d not found\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: diskname %s; cd %d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (!(strcoll(optarg, gettext("mask")))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (!(strcoll(optarg, gettext("lbolt")))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (!(strcoll(optarg, gettext("good")))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else goto usage;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_ADUMP, (long)cd, &tt, NULL, 0L,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: trace %s processed\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext(" cd %d; size %d; mask 0x%04x; "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "lbolt %d; good %d;\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* a cd of "-1" represents all devices */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_INJ_IOERR, cd, ioj_err, ioj_cnt, 0, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: i/o error injection cd %d errno %d "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* a cd of "-1" represents all devices */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_CLR_IOERR, cd, 0, 0, 0, 0, &ustats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: i/o error clear for cd %d "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: sdbc cache flush now %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* DEBUG */
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strncat(scmadmUsage, f__, sizeof (scmadmUsage));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(fmt, sizeof (fmt), "%s%s", scmadmUsage, f__); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(scmadmUsage, sizeof (scmadmUsage), fmt, a__);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(fmt, sizeof (fmt), "%s%s", scmadmUsage, f__); \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(scmadmUsage, sizeof (scmadmUsage), fmt, a__, b__);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *hints_str = "[nordcache|rdcache|wrthru|nowrthru|forget]\n";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *hints_str = "[nordcache|rdcache|forget]\n";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage1(gettext("\t%s {-L | -D bitmapfs}\n"), p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage1(gettext("\t%s -C [parameter[=[value]] ...]\n"), p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage2(gettext("\t%s -o system %s"), p, hints_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage2(gettext("\t%s -o <cd> %s"), p, hints_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage2(gettext("\t%s -o <diskname> %s"), p, hints_str);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage1(gettext("\t%s -m {<cd>|<diskname>|all}\n"), p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t%s -S [-Mz] [-d delay_time] [-l logfile] [-r range]\n"), p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t%s -t {size|mask|lbolt|good} <cd|diskname> <value>\n"), p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "\t%s -i {cd|diskname|-1 for all} [errno [countdown]]\n"), p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage1(gettext("\t%s -c {cd|diskname|-1 for all}\n"), p);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addusage(gettext("\nt = trace\tg = toggle_flush\ti = inject ioerr\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "c = clear ioerr\tS = stats\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* DEBUG */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "e = enable\td = disable\tv=version\to = get/ set options\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "m = get cd map\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "note: cd is a cache descriptor integer in the range [0-%d]\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " bitmapfs is a block device or filesystem mount point\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(stats_usage, sizeof (stats_usage),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (!(strcoll(str, gettext("nowrthru")))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (!(strcoll(str, gettext("rdcache")))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("Fast Writes Overridden\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* if (type & NSC_NO_FORCED_WRTHRU) */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (type & (NSC_FORCED_WRTHRU|NSC_WRTHRU)) ? "" : "no",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("%srdcache", (type & NSC_NOCACHE) ? "no" : "");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Read the configuration via libcfg
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memset((char *)&user_level_conf, 0, sizeof (_sd_cache_param_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the system ID */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s Unable to obtain subsystem ID: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.thread");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.tdemons");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.write_cache");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.size");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We need to run strtol for backwards compatibility in 3.2.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * A workaround for this bug was put in 3.2 which allowed
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * customers to set the cache size up to 1024 if it was
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * specified in hexadecimal. Decimal still had the limit
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of 128. This change treats them both identically.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte user_level_conf.cache_mem[0] = (int)strtol(buf, NULL, 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (user_level_conf.cache_mem[0] > MAX_CACHE_SIZE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "The cache size of %ld is larger than "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the system maximum of %ld.\nUse \"scmadm -C "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "cache_size=<size>\" to set the size to a proper "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "value.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.iobuf");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.fill_pattern");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.no_forced_wrthru");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.forced_wrthru");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) snprintf(key, sizeof (key), "scm.set1.reserved1");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cfg_get_cstring(cfg, key, buf, CFG_MAX_BUF) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * use the default minidsp configuration if no
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * node/mirror/remote-mirror/cluster line is in the sd.cf file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Check if our sysid was defined */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("This node(%d) is not defined in config.\n"), myid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Save off number of nodes so we can calculate the point-to-point
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * segements. Code in kernel currently supports MAX_SD_NODES
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((user_level_conf.num_nodes = nodes_configured) >
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("Cache can support only %d nodes(%d).\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("Cannot configure odd number of nodes.\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Pass List of Nodes Configured to Cache */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < nodes_configured; i++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Place magic number in user_level_conf. Kernel will test for it */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* function name string */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte static char c[8];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (f & ST_BSUB)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (f & ST_IO)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (f & ST_STATS)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (f & ST_CCIO)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (f & ST_FT)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (f & ST_INFO)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Background daemon to wait for alert (on any device)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Writes the traces to "sd_alert.CD.NUM",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and writes an information message to the alert_file.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* fork and detach daemon */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fd = open(alert_file, O_WRONLY|O_APPEND|O_CREAT, 0644);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte buf = (_sdtr_t *)malloc(size * sizeof (_sdtr_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s malloc: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tm_ptr = (struct tm *)localtime_r(&tloc, &tm_storage);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((count = SDBC_IOCTL(SDBC_ADUMP, cd, &tt, buf, size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: sd_adump\n"), progname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) sprintf(filename, "%s.%d.%d", "sd_alert", cd, alerts++);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((fd = open(filename, O_CREAT | O_RDWR, 0444)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: open: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * write header to identify device, write entries
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: write: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (write(fd, buf, sizeof (_sdtr_t)*count) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: write: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf("sd alert trace dump %s at %s\n", filename, timebuf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * print list of configured cd's, diskname, options and global options
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* No corresponding free because this function exits */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s malloc: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* node hints */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((hint = SDBC_IOCTL(SDBC_GET_NODE_HINT, 0, 0, 0, 0, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* get cds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0, &ustats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: get_cd failed in print_all options\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("No devices are configured\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("\nConfigured cd's, disknames and options: \n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("cd\t%-28s\t%-20s\n"), s1, s2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cache device -- lookup names and cache descriptors of all configured devices
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* No corresponding free because this function exits */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s malloc: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0, &ustats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: get_cd_all"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("No devices are configured\n"));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * cache device -- specified by number or lookup name
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * No corresponding free because the memory is reused
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * every time the function is called.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s malloc: %s\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0, &ustats)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: get_cd\n"), progname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (*s != '/') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Since strtol returns 0 on failure, we need to make a
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * special case for a cd of "0", which is valid.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This case also deals with the difference between
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * scmadm -o system and scmadm -o 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Only return failure at this point, in order to allow
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * checking arg_cd against st_count later on.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* make sure the cd passed as an argument is alloc'd and < st_count */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (cs_cur->st_shared[arg_cd].sh_alloc)) ? arg_cd : -1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strcmp(s, cs_cur->st_shared[cd].sh_filename) == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Cannot define other nodes.\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((!(node % 2) && !(node == mirror - 1)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: Node and Mirror identification values "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "must be consecutive\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "starting at an even number (Node = %d Mirror = %d)\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%-8s Structures use approx. %8d bytes (%5d pages) of memory\n";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: unable to read configuration file\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_ENABLE, &user_level_conf, 0, 0, 0, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) fprintf(stderr, gettext("%s: cache enable failed\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_log("scm", &ustats, gettext("%s cache enable failed"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_log("scm", NULL, gettext("%s cache enable succeeded"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: cache has been configured\n"), progname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Must writethru on a cluster, even if nvram configured */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Have minidsp with forced_wrthru hint. Set / Clear hint */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_SET_NODE_HINT, NSC_FORCED_WRTHRU,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte forced_wrthru, 0, 0, 0, &ustats) == SPCS_S_ERROR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: Node option forced_wrthru "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: Node option forced_wrthru "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_SET_NODE_HINT, NSC_NO_FORCED_WRTHRU,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte no_forced_wrthru, 0, 0, 0, &ustats) == SPCS_S_ERROR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: Node option no_forced_wrthru"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: Node option no_forced_wrthru"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* do scmadm -O to cater for manual cache disable then enable */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_DISABLE, 0, 0, 0, 0, 0, &ustats) != SPCS_S_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If it wasn't already enabled, don't appear to fail
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or users of this program might think the cache is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * configured, when it actually isn't.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("%s: cache has been deconfigured\n"), progname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_log("scm", NULL, gettext("%s cache disable succeeded"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_VERSION, &version, 0, 0, 0, 0, &ustats) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte gettext("%s: get cache version failed\n"), progname);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("Cache version %d.%d.%d.%d\n"),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte version.major, version.minor, version.micro, version.baseline);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) printf(gettext("Cache version %d.%d.%d\n"),