solaris_partition.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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Solaris partition class implementation file
*/
/*
* System include files
*/
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/*
* Local include files
*/
#include "vold.h"
#include "medium.h"
#include "partition.h"
#include "vtoc.h"
/*
* Private data and procedure declarations
*/
#include "partition_private.h"
#define KEY_BUFFER_LENGTH 512
#define UNNAMED_SOLARIS "unnamed_solaris"
/*
* Forward declarations of private methods
*/
static daddr_t dk_label_offset(char *);
/*
* 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
*/
{
/*
* Try to read the label and VTOC from the medium and verify
* that the partition is a Solaris partition. If it is,
* set the partition's attributes accordingly, and if the
* partition has more than one nonempty slice, create child
* partitions for the slices and read the slice data into
* them.
*/
goto dun;
}
if (partition_result == PARTITION_SUCCESS) {
}
}
dun:
return (partition_result);
}
/*
* Definitions of private methods
*/
static partition_result_t
{
/*
* XORs dkl_checksum with the rest of the 16-bit words in the
* label; Since dkl_checksum is computed by XORing the rest
* of the 16-bit words in the label, the net result should
* be the XOR of dkl_checksum with itself, which is zero.
*/
int word_count;
checksum = 0;
while (word_count > 0) {
checksum ^= *next_wordp;
next_wordp++;
word_count--;
}
if (checksum == 0) {
} else {
}
return (partition_result);
}
static partition_result_t
{
}
if (partition_result == PARTITION_SUCCESS) {
}
return (partition_result);
}
static partition_result_t
{
/*
* NOTE: The file system structure created by this
* function is a legacy public interface
* between the volume manager and user-level
* applications. Changing it will cause
* those applications to fail.
*/
/*
* The medium contains more than one file system.
* If the partition's label is blank, rename the
* partition's volume in a way that distinguishes
* the partition from the other partitions on the
* medium that contain file systems.
*/
}
}
if (partition_result == PARTITION_SUCCESS) {
}
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 daddr_t
dk_label_offset(char *medium_typep)
{
} else {
}
return (offset);
}
static partition_result_t
{
struct dk_label solaris_label;
}
if (partition_result == PARTITION_SUCCESS &&
}
if (partition_result == PARTITION_SUCCESS &&
}
if (partition_result == PARTITION_SUCCESS) {
}
if (partition_result == PARTITION_SUCCESS) {
}
if (partition_result == PARTITION_SUCCESS) {
}
return (partition_result);
}
static partition_result_t
{
char *key_bufferp;
char *name_bufferp;
}
if (partition_result == PARTITION_SUCCESS) {
}
if (partition_result == PARTITION_SUCCESS) {
sizeof (struct dk_label));
}
}
if (partition_result == PARTITION_SUCCESS) {
(void) strncpy(name_bufferp,
/*
* NOTE: The makename() method comes from
* vold_util.c. Clean it up and move
* it to partition.c as soon as time
* and resources permit.
*/
} else {
}
}
}
if (partition_result != PARTITION_SUCCESS) {
}
if (key_bufferp != NULL) {
}
if (name_bufferp != NULL) {
}
return (partition_result);
}
static partition_result_t
{
int ioctl_result;
}
if (partition_result == PARTITION_SUCCESS) {
vtocp);
}
}
if (partition_result == PARTITION_SUCCESS) {
0) {
} else {
}
}
}
return (partition_result);
}