hsfs_partition.c revision 18c2aff776a775d34a4c9893a4c72e0434d68e36
/*
* 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"
/*
* HSFS partition class implementation file
*/
/*
* System include files
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
/*
* Private attribute and method declarations
*/
#include "partition_private.h"
#include "vtoc.h"
typedef struct hsfs_attributes {
typedef struct table_of_contents {
struct cdrom_tochdr header;
/*
* The maximum number of tracks is 100 -
* 99 audio tracks and one lead-in track
*/
#define CDI_ID_STRING "CD-I"
#define CDI_ID_STRLEN 4
#define AUDIO_CD "audio_cd"
/*
* Volume name used for an unlabeled HSFS partition on a medium
* that contains other file systems
*/
#define UNNAMED_HSFS "unnamed_hsfs"
/*
* Forward declarations of private methods
*/
/*
* Methods that implement abstract methods
* declared in the parent partition class
*/
static partition_methods_t partition_methods =
/*
* Definition of the public read_partition() method that
* identifies the partition type and sets its attributes
*/
{
if (partition_result == PARTITION_SUCCESS) {
}
}
return (partition_result);
}
/*
* Definitions of private methods
*/
static partition_result_t
{
unsigned char track_number;
if (table_of_contentsp == NULL) {
}
if (partition_result == PARTITION_SUCCESS) {
/*
* Read the table of contents header.
*/
&(table_of_contentsp->header)) < 0) {
} else {
(unsigned char) CDROM_LEADOUT;
&(table_of_contentsp->entry[0])) < 0) {
}
}
}
if (partition_result == PARTITION_SUCCESS) {
/*
* Fill in the rest of the table of contents.
*/
while ((partition_result == PARTITION_SUCCESS) &&
(track_number <=
< 0) {
}
track_number++;
}
}
if (partition_result == PARTITION_SUCCESS) {
/*
* Compute the cyclic redundancy checksum from
* the table of contents.
*/
sizeof (table_of_contents_t));
}
if (table_of_contentsp != NULL) {
}
return (partition_result);
}
static partition_result_t
{
if (partition_result == PARTITION_SUCCESS) {
}
if (partition_result == PARTITION_SUCCESS) {
}
if ((partition_result == PARTITION_SUCCESS) &&
/*
* The partition contains more than one slice.
* Convert its vnodes to directory vnodes
* and attach vnodes for the slices to the
* directory vnodes.
*/
while ((partition_result == PARTITION_SUCCESS) &&
}
}
if (partition_result == PARTITION_SUCCESS) {
}
if (partition_result == PARTITION_SUCCESS) {
}
return (partition_result);
}
static partition_result_t
{
int sector_number;
int string_index;
if (sector_bufferp == NULL) {
}
if (partition_result == PARTITION_SUCCESS) {
/*
* Get the first sector that might contain an
* "Interactive CD" volume descriptor.
*/
}
if (partition_result == PARTITION_SUCCESS) {
}
while ((partition_result == PARTITION_NOT_THIS_TYPE) &&
/*
* Search all the volume descriptor sectors for
* an "Interactive CD" volume descriptor.
*/
string_index = 0;
while ((string_index < CDI_ID_STRLEN) &&
string_index++;
}
if (string_index == CDI_ID_STRLEN) {
} else {
break;
}
if ((partition_result == PARTITION_SUCCESS) &&
}
if ((partition_result == PARTITION_SUCCESS) &&
}
if (partition_result == PARTITION_SUCCESS) {
}
}
if (partition_result == PARTITION_NOT_THIS_TYPE) {
if (partition_result == PARTITION_SUCCESS) {
}
}
}
if (sector_bufferp != NULL) {
}
return (partition_result);
}
static partition_result_t
{
int sector_number;
int string_index;
if (sector_bufferp == NULL) {
}
if (partition_result == PARTITION_SUCCESS) {
/*
* Get the first sector that might contain a
* High Sierra File System volume descriptor.
*/
}
if (partition_result == PARTITION_SUCCESS) {
}
while ((partition_result == PARTITION_NOT_THIS_TYPE) &&
/*
* Search all the volume descriptor sectors for
* a High Sierra File System volume descriptor.
*/
string_index = 0;
while ((string_index < HSV_ID_STRLEN) &&
string_index++;
}
if (string_index == HSV_ID_STRLEN) {
} else {
break;
}
if ((partition_result == PARTITION_SUCCESS) &&
break;
}
if ((partition_result == PARTITION_SUCCESS) &&
}
if (partition_result == PARTITION_SUCCESS) {
}
}
if (partition_result == PARTITION_NOT_THIS_TYPE) {
if (partition_result == PARTITION_SUCCESS) {
}
}
}
if (sector_bufferp != NULL) {
}
return (partition_result);
}
static partition_result_t
{
int sector_number;
int string_index;
if (sector_bufferp == NULL) {
}
if (partition_result == PARTITION_SUCCESS) {
/*
* Get the first sector that might contain
* an ISO9660 volume descriptor.
*/
}
if (partition_result == PARTITION_SUCCESS) {
}
while ((partition_result == PARTITION_NOT_THIS_TYPE) &&
/*
* Search all the volume descriptor sectors
* for an ISO9660 volume descriptor.
*/
string_index = 0;
while ((string_index < ISO_ID_STRLEN) &&
string_index++;
}
if (string_index == ISO_ID_STRLEN) {
} else {
break;
}
if ((partition_result == PARTITION_SUCCESS) &&
break;
}
if ((partition_result == PARTITION_SUCCESS) &&
}
if (partition_result == PARTITION_SUCCESS) {
}
}
if (partition_result == PARTITION_NOT_THIS_TYPE) {
if (partition_result == PARTITION_SUCCESS) {
}
}
}
if (sector_bufferp != NULL) {
}
return (partition_result);
}
static partition_result_t
int sector_number,
{
}
if (partition_result == PARTITION_SUCCESS) {
}
}
if ((partition_result == PARTITION_SUCCESS) &&
read_length) != read_length)) {
}
return (partition_result);
}
static boolean_t
{
int ioctl_result;
struct cdrom_tochdr table_of_contents;
unsigned char track_number;
if (ioctl_result >= 0) {
if (table_of_contents.cdth_trk0 <=
while ((has_audio_data == B_FALSE) &&
if ((ioctl_result >= 0) &&
CDROM_DATA_TRACK) == 0)) {
}
track_number++;
}
}
}
return (has_audio_data);
}
static boolean_t
{
int ioctl_result;
struct cdrom_tochdr table_of_contents;
unsigned char track_number;
if (ioctl_result >= 0) {
if (table_of_contents.cdth_trk0 >
} else {
while ((has_digital_data == B_FALSE) &&
if (ioctl_result < 0) {
} else if ((table_of_contents_entry.cdte_ctrl &
CDROM_DATA_TRACK) != 0) {
}
track_number++;
}
if (has_digital_data == B_FALSE) {
(unsigned char) CDROM_LEADOUT;
if (ioctl_result < 0) {
} else if ((table_of_contents_entry.cdte_ctrl &
CDROM_DATA_TRACK) != 0) {
}
}
}
}
return (has_digital_data);
}
static partition_result_t
{
char *key_bufferp;
} else {
}
if (key_bufferp == NULL) {
}
if (partition_result == PARTITION_SUCCESS) {
}
if (partition_result == PARTITION_SUCCESS) {
#ifdef i386
#else
#endif
if (partition_result == PARTITION_NOT_THIS_TYPE) {
}
if (partition_result == PARTITION_NOT_THIS_TYPE) {
}
if (partition_result == PARTITION_SUCCESS) {
}
}
}
if (partition_result == PARTITION_SUCCESS) {
}
} else {
}
}
if (partition_result == PARTITION_SUCCESS) {
(void) sprintf(key_bufferp,
"0x%lx",
}
}
if (partition_result != PARTITION_SUCCESS) {
}
if (key_bufferp != NULL) {
}
}
return (partition_result);
}
static partition_result_t
{
} else {
DKIOCGVTOC, vtocp) >= 0) &&
} else {
#ifdef i386
#else
#endif
}
}
return (partition_result);
}
static partition_result_t
{
char *key_bufferp;
if (key_bufferp == NULL) {
}
if (partition_result == PARTITION_SUCCESS) {
}
if (partition_result == PARTITION_SUCCESS) {
(void) sprintf(key_bufferp,
"0x%lx",
}
}
if (partition_result == PARTITION_SUCCESS) {
}
}
if (key_bufferp != NULL) {
}
return (partition_result);
}