fstyp.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 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* fstyp
*
*/
#include <errno.h>
#include <stdio.h>
#include <locale.h>
/*
* Parse out all the following forms as unsigned quantities. It would
* not be unusual for them to be large enough that the high bit would be
* set and they would then be misinterpreted as negative quantities.
*
* The values are:
* number of sectors
* big number of sectors (MSDOS4.0 and later)
*/
/*
* Boolean macros
*/
int vflag = 0; /* verbose output */
int errflag = 0;
extern int optind;
char *cbasename;
char *special;
char *fstype;
int
int argc;
char *argv[];
{
int c;
#if !defined(TEXT_DOMAIN)
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
switch (c) {
case 'v': /* dump super block */
vflag++;
break;
case '?':
errflag++;
}
}
usage();
}
/* NOTREACHED */
}
usage()
{
}
char *name;
{
unsigned char media;
close(0);
exit(1);
}
/*
* As an fstyp command, this can get called for a device from
* any filesystem (or for that matter, a bogus device). The
* read() returns EINVAL when it's not a pcfs. In this case,
* don't print an error message.
*/
}
exit(1);
}
if (!valid_media(media))
if (!well_formed(buf))
if (!vflag)
exit(0);
printf("Bytes Per Sector %d\t\tSectors Per Cluster %d\n",
printf("Reserved Sectors %d\t\tNumber of FATs %d\n",
printf("Root Dir Entries %d\t\tNumber of Sectors %d\n",
printf("Sectors Per FAT %d\t\tSectors Per Track %d\n",
printf("Number of Heads %d\t\tNumber Hidden Sectors %d\n",
switch (media) {
case MD_FIXED:
printf("\"Fixed\" Disk\n");
break;
case SS8SPT:
printf("Single Sided, 8 Sectors Per Track\n");
break;
case DS8SPT:
printf("Double Sided, 8 Sectors Per Track\n");
break;
case SS9SPT:
printf("Single Sided, 9 Sectors Per Track\n");
break;
case DS9SPT:
printf("Double Sided, 9 Sectors Per Track\n");
break;
case DS18SPT:
printf("Double Sided, 18 Sectors Per Track\n");
break;
case DS9_15SPT:
printf("Double Sided, 9-15 Sectors Per Track\n");
break;
default:
printf("Unknown Media Type\n");
}
close(0);
exit(0);
}
unsigned char media_type;
{
switch (media_type) {
case MD_FIXED:
case SS8SPT:
case DS8SPT:
case SS9SPT:
case DS9SPT:
case DS18SPT:
case DS9_15SPT:
return (1);
default:
return (0);
}
}
well_formed(char bs[])
{
int fatmatch;
} else if (PC_EXTSIG32(bs)) {
} else {
}
}