/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* tunefs: change layout parameters to an existing file system.
*/
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <ustat.h>
#include <time.h>
#include <sys/sysmacros.h>
#include <fcntl.h>
#include <stdio.h>
union {
} sbun;
int fi;
extern int optind;
extern char *optarg;
static void usage();
static void bwrite(diskaddr_t, char *, int);
static void fatal();
static int bread(diskaddr_t, char *, int);
static int isnumber(char *);
extern char *getfullrawname(), *getfullblkname();
static void
{
char *blockspecial;
if (blockspecial == NULL)
blockspecial = *specialp;
perror("open");
}
return;
}
}
static void
{
char *blockspecial;
if (blockspecial == NULL)
blockspecial = *specialp;
return;
return;
}
}
int
{
int i, mountfd;
int Aflag = 0;
int opt;
if (argc < 3)
usage();
/*
* For performance, don't search mnttab unless necessary
*/
/*
* If mounted directory, search mnttab for special
*/
/*
* If mounted device, search mnttab for mountpoint
*/
}
}
/*
* Doesn't appear to be mounted; take ``unmounted'' path
*/
if (mountpoint == NULL)
exit(32);
}
if (*special == '\0') {
exit(32);
}
}
/*
* If a mountpoint has been found then we will ioctl() the file
* system instead of writing to the file system's device
*/
/* ustat() ok because max number of UFS inodes can fit in ino_t */
if (mountpoint == NULL) {
exit(32);
}
} else
mountpoint = NULL;
switch (opt) {
case 'A':
Aflag++;
continue;
case 'a':
name = "maximum contiguous block count";
if (i < 1)
sblock.fs_maxcontig = i;
continue;
case 'd':
sblock.fs_rotdelay = 0;
continue;
case 'e':
name =
"maximum blocks per file in a cylinder group";
if (i < 1)
continue;
case 'm':
name = "minimum percentage of free space";
if (i < 0 || i > 99)
"%s changes from %d%% to %d%%\n",
sblock.fs_minfree = i;
continue;
case 'o':
name = "optimization preference";
i = FS_OPTSPACE;
i = FS_OPTTIME;
else
fatal("%s: bad %s (options are `space' or `time')",
"%s remains unchanged as %s\n",
continue;
}
"%s changes from %s to %s\n",
continue;
case 'V':
{
char *opt_text;
int opt_count;
opt_count++) {
if (opt_text)
opt_text);
}
}
break;
default:
usage();
}
}
usage();
if (mountpoint) {
if (mountfd == -1) {
"tunefs: can't tune %s\n", mountpoint);
exit(32);
}
"tunefs: can't tune %s\n", mountpoint);
exit(32);
}
} else {
if (Aflag)
}
return (0);
}
void
usage()
{
}
void
{
if (fi < 0) {
}
}
}
fs->fs_version);
}
fs->fs_version);
}
}
void
{
perror("FS SEEK");
}
perror("FS WRITE");
}
}
int
{
int i;
perror("llseek");
return (1);
}
perror("read");
buf[i] = 0;
return (1);
}
return (0);
}
/* VARARGS1 */
void
{
}
int
isnumber(char *s)
{
int c;
while (c = *s++)
if (c < '0' || c > '9')
return (0);
return (1);
}