/*
* 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"
/*
* Label a file system volume.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <locale.h>
#include <fcntl.h>
static void usage();
static void label(char *, char *, char *);
static union sbtag {
extern int optind;
extern char *optarg;
int
{
int opt;
switch (opt) {
case 'o': /* specific options (none defined yet) */
break;
case '?':
usage();
}
}
usage();
}
if (argc > 1) {
gettext("fsname can not be longer than 6 characters\n"));
}
}
if (argc > 2) {
gettext("volume can not be longer than 6 characters\n"));
}
}
return (0);
}
void
usage()
{
"ufs usage: labelit [-F ufs] [gen opts] special [fsname volume]\n"));
}
void
{
int f;
int blk;
int i;
char *p;
} else {
}
if (f < 0) {
perror("open");
}
perror("llseek");
}
perror("read");
}
gettext("bad super block magic number\n"));
}
gettext("unrecognized UFS format version: %d\n"),
}
gettext("unrecognized UFS format version: %d\n"),
}
/*
* Is block layout available?
*/
gettext("insufficient superblock space for file system label\n"));
return;
}
/*
* calculate the available blocks for each rotational position
*/
/* void */;
for (i = 0; i < 14; i++)
p[i] = '\0';
for (i = 0; (i < 6) && (fsname[i]); i++, p++)
*p = fsname[i];
p++;
}
for (i = 0; (i < 6) && (volume[i]); i++, p++)
*p = volume[i];
}
perror("llseek");
}
perror("write");
}
/*
* In the case of multi-terabyte ufs file
* systems, only the first ten and last ten
* cylinder groups have copies of the superblock.
*/
continue;
offset =
perror("lseek");
}
perror("read");
}
gettext("bad alternate super block(%i) magic number\n"), i);
}
((altsblock.fs_version !=
gettext("bad alternate super block UFS format version: %d\n"),
}
gettext("bad alternate super block UFS format version: %d\n"),
}
perror("llseek");
}
perror("write");
}
}
}
for (i = 0; (i < 6) && (*p); i++, p++) {
}
p++;
for (i = 0; (i < 6); i++, p++) {
}
}