ident_hsfs.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 (c) 1996 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <rmmount.h>
#ifdef DEBUG
#include <errno.h>
#endif
#define CDI_ID_STRING "CD-I"
#define CDI_ID_STRLEN 4
static int rdev_is_a_cd(int rdevfd);
/*
* We call it an hsfs file system iff:
* The string "CD001" is present at the second byte of the PVD.
*
* NOTE:
* argument "verbose" not currently used (but required
* for compatibility, of course)
*/
/*ARGSUSED*/
{
char volp_buf[ISO_SECTOR_SIZE];
int rfd;
int off = 0;
if (rfd == -1) {
#ifdef DEBUG
"hsfs ident: can't open rawpath %s: errno = %d\n",
#endif
return (FALSE);
}
#ifdef CDROMREADOFFSET
if (rdev_is_a_cd(rfd))
off = 0;
#endif
#ifdef DEBUG
#endif
/* hsfs is always clean */
return (TRUE);
}
return (TRUE);
}
return (TRUE);
}
/* no match */
return (FALSE);
}
/*ARGSUSED*/
static bool_t
{
int i;
#ifdef DEBUG
#endif
#ifdef DEBUG
#endif
/* if this is the end of volume descriptors then bail */
break;
}
/* do we have a "CD-I" string ?? */
for (i = 0; i < CDI_ID_STRLEN; i++) {
break;
}
}
if (i < CDI_ID_STRLEN) {
break; /* string didn't match */
}
continue; /* not a valid sector? */
}
/* what type of sector is this */
#ifdef DEBUG
"DEBUG: ident_hsfs() CD-I vol id is \"%s\"\n",
volid);
#endif
break;
}
/* look at next sector */
}
#ifdef DEBUG
#endif
return (found);
}
/*ARGSUSED*/
static bool_t
{
int i;
#ifdef DEBUG
#endif
#ifdef DEBUG
#endif
/*
* look through the volume descriptors until we find an HSFS
* primary volume descriptor, or until we find the end of the
* volume descriptors
*/
/* found the end of the vol descriptors */
break; /* not found */
}
for (i = 0; i < HSV_ID_STRLEN; i++) {
break; /* not a match */
}
}
if (i < HSV_ID_STRLEN) {
break; /* not a match */
}
break; /* not a match */
}
#ifdef DEBUG
"DEBUG: ident_hsfs() HS vol id is \"%s\"\n",
volid);
#endif
break;
}
/* go to the next sector */
}
#ifdef DEBUG
#endif
return (found);
}
/*ARGSUSED*/
static bool_t
{
int i;
#ifdef DEBUG
#endif
#ifdef DEBUG
#endif
/*
* look through the volume descriptors until we find an ISO 9660
* primary volume descriptor, or until we find the end of the
* volume descriptors
*/
/* found the end of the vol descriptors */
break; /* not found */
}
for (i = 0; i < ISO_ID_STRLEN; i++) {
break; /* not a match */
}
}
if (i < ISO_ID_STRLEN) {
break; /* string didn't match */
}
break; /* not a match */
}
#ifdef DEBUG
"DEBUG: ident_hsfs() ISO vol id is \"%s\"\n",
volid);
#endif
break;
}
/* no match -- go to the next sector */
}
#ifdef DEBUG
#endif
return (found);
}
static bool_t
{
#ifdef DEBUG
#endif
return (FALSE);
}
#ifdef DEBUG
#endif
return (FALSE);
}
/* all went well */
return (TRUE);
}
/*
* 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);
}