fstyp.c revision c719c59a5efa45b0a47db940384816b4ed77db7d
/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <fcntl.h>
#include <stdio.h>
#include "hsfs_spec.h"
#include "iso_spec.h"
#include "iso_impl.h"
(nosec)*ISO_SECTOR_SIZE))
char hs_buf[ISO_SECTOR_SIZE];
int hs_pvd_sec_no;
char iso_buf[ISO_SECTOR_SIZE];
int iso_pvd_sec_no;
char unix_buf[ISO_SECTOR_SIZE];
int unix_pvd_sec_no;
int vflag;
int cdfd;
int cdroff = 0;
static int rdev_is_a_cd(int rdevfd);
static void usage(void);
int
{
int c;
char *special;
int errflag = 0;
switch (c) {
case 'v':
vflag++;
break;
default:
errflag++;
break;
}
}
usage();
exit(1);
}
return (0);
}
static void
usage(void)
{
}
/*
* findhsvol: check if the disk is in high sierra format
* return(1) if found, (0) otherwise
* if found, volp will point to the descriptor
*
*/
int
char *volp;
{
int secno;
int i;
for (i = 0; i < HSV_ID_STRLEN; i++)
goto cantfind;
goto cantfind;
switch (HSV_DESC_TYPE(volp)) {
case VD_SFS:
return (1);
case VD_EOV:
goto cantfind;
}
}
return (0);
}
/*
* findisovol: check if the disk is in ISO 9660 format
* return(1) if found, (0) otherwise
* if found, volp will point to the descriptor
*
*/
int
char *volp;
{
int secno;
int i;
for (i = 0; i < ISO_ID_STRLEN; i++)
goto cantfind;
goto cantfind;
switch (ISO_DESC_TYPE(volp)) {
case ISO_VD_PVD:
return (1);
case ISO_VD_EOV:
goto cantfind;
}
}
return (0);
}
/*
* findunixvol: check if the disk is in UNIX extension format
* return(1) if found, (0) otherwise
* if found, volp will point to the descriptor
*
*/
int
findunixvol(char *volp)
{
int secno;
int i;
for (i = 0; i < ISO_ID_STRLEN; i++)
goto cantfind;
goto cantfind;
switch (ISO_DESC_TYPE(volp)) {
case ISO_VD_UNIX:
return (1);
case ISO_VD_EOV:
goto cantfind;
}
}
return (0);
}
int
ckvoldesc(void)
{
int cd_type;
cd_type = 0;
else if (findisovol(iso_buf)) {
if (findunixvol(unix_buf))
cd_type = 2;
else cd_type = 1;
} else {
cd_type = -1;
}
return (cd_type);
}
static void
{
int err;
int cd_type;
exit(1);
}
#ifdef CDROMREADOFFSET
if (rdev_is_a_cd(cdfd)) {
if (err == -1)
/*
* This device doesn't support this ioctl.
* That's OK.
*/
cdroff = 0;
}
#endif
/* check volume descriptor */
if (cd_type < 0)
exit(1);
else
if (vflag)
exit(0);
}
static void
{
char *vdp;
char *sysid;
char *volid;
char *volsetid;
char *pubid;
char *prepid;
char *applid;
char *copyfile;
char *absfile;
char *bibfile;
int volsetsize;
int volsetseq;
int blksize;
int volsize;
int i;
switch (cd_type) {
case 0:
break;
case 1:
break;
case 2:
" UNIX extension\n");
break;
default:
return;
}
/* system id */
/* read volume id */
/* read volume set id */
/* publisher id */
/* data preparer id */
/* application id */
/* copyright file identifier */
/* Abstract file identifier */
/* Bibliographic file identifier */
/* print volume set size */
/* print volume set sequnce number */
/* print logical block size */
/* print volume size */
}
static void
{
int i;
if (maxlen < 1)
return;
return;
/* print heading */
/* strip off trailing zeros */
for (i = maxlen-1; i >= 0; i--)
if (s[i] != ' ') break;
maxlen = i+1;
for (i = 0; i < maxlen; i++)
}
/* readdisk - read from cdrom image file */
static void
{
exit(1);
}
exit(1);
}
}
/*
* rdev_is_a_cd - return TRUE if the raw device identified by
* a file descriptor is a CDROM device.
*
* return FALSE if the device can't be accessed
* or is not a CDROM.
*/
static int
rdev_is_a_cd(int rdevfd)
{
return (0);
return (1);
else
return (0);
}