cachefslog.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <libintl.h>
#include <kstat.h>
#include <locale.h>
#include "stats.h"
void usage(char *);
void pr_err(char *, ...);
static int hflag = 0;
static int vflag = 0;
char *prog;
static void log_show(char *, char *);
int
{
int rc = 0, c;
int errflg = 0;
char *logfile;
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif /* TEXT_DOMAIN */
(void) textdomain(TEXT_DOMAIN);
++prog;
else
switch (c) {
case 'h':
++errflg;
else
++hflag;
break;
case 'f':
if (hflag)
++errflg;
else
break;
case 'v':
++vflag;
break;
case '?':
default:
++errflg;
break;
}
rc = -1;
goto out;
}
rc = 1;
goto out;
}
if (! stats_good(fs)) {
goto out;
}
goto out;
}
goto out;
}
goto out;
}
} else if (hflag) {
goto out;
}
}
goto out;
}
/*
* if they're changing state, inform them of other filesystems
* that they're changing state for by way of sharing the
* cache.
*
* or, if they're verbose (-v flag), tell them about the
* others.
*/
cachefs_kstat_key_t *k, *origk;
int before = 0;
rc = 1;
goto out;
}
if (! k->ks_mounted) {
free(k);
continue;
}
(char *)k->ks_cachedir) != 0) {
free(k);
continue;
}
free(k);
continue;
}
if (! before)
printf("\n");
before = 1;
free(k);
}
}
if (stats_inerror(fs)) {
}
out:
return (rc);
}
static void
{
if (logfile[0] == '\0')
}
/*
*
* usage
*
* Description:
* Prints a short usage message.
* Arguments:
* msgp message to include with the usage message
* Returns:
* Preconditions:
*/
void
{
if (msgp) {
}
gettext("Usage: "
"cachefslog [ -v ] [-h | -f <logfile>] mountpoint\n"));
}
/*
*
* pr_err
*
* Description:
* Prints an error message to stderr.
* Arguments:
* fmt printf style format
* ... arguments for fmt
* Returns:
* Preconditions:
* precond(fmt)
*/
void
{
}