partition.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
d62bc4badc1c1f1549c961cfb8b420e650e1272byz * CDDL HEADER START
a399b7655a1d835aa8606c2b29e4e777baac8635zf *
a399b7655a1d835aa8606c2b29e4e777baac8635zf * The contents of this file are subject to the terms of the
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Common Development and Distribution License, Version 1.0 only
a399b7655a1d835aa8606c2b29e4e777baac8635zf * (the "License"). You may not use this file except in compliance
a399b7655a1d835aa8606c2b29e4e777baac8635zf * with the License.
a399b7655a1d835aa8606c2b29e4e777baac8635zf *
a399b7655a1d835aa8606c2b29e4e777baac8635zf * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a399b7655a1d835aa8606c2b29e4e777baac8635zf * or http://www.opensolaris.org/os/licensing.
a399b7655a1d835aa8606c2b29e4e777baac8635zf * See the License for the specific language governing permissions
a399b7655a1d835aa8606c2b29e4e777baac8635zf * and limitations under the License.
a399b7655a1d835aa8606c2b29e4e777baac8635zf *
a399b7655a1d835aa8606c2b29e4e777baac8635zf * When distributing Covered Code, include this CDDL HEADER in each
a399b7655a1d835aa8606c2b29e4e777baac8635zf * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a399b7655a1d835aa8606c2b29e4e777baac8635zf * If applicable, add the following below this CDDL HEADER, with the
a399b7655a1d835aa8606c2b29e4e777baac8635zf * fields enclosed by brackets "[]" replaced with your own identifying
a399b7655a1d835aa8606c2b29e4e777baac8635zf * information: Portions Copyright [yyyy] [name of copyright owner]
a399b7655a1d835aa8606c2b29e4e777baac8635zf *
a399b7655a1d835aa8606c2b29e4e777baac8635zf * CDDL HEADER END
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Use is subject to license terms.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf#ifndef __PARTITION_H
a399b7655a1d835aa8606c2b29e4e777baac8635zf#define __PARTITION_H
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf#pragma ident "%Z%%M% %I% %E% SMI"
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf#ifdef __cplusplus
fb91fd8a302dfb13e250bbefb6a3970c2edc3ae3zfextern "C" {
a399b7655a1d835aa8606c2b29e4e777baac8635zf#endif
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Partition class interface file.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Local include files
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf#include "medium.h"
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * The partition class stores its attributes as private
a399b7655a1d835aa8606c2b29e4e777baac8635zf * data. Client classes can't access them directly.
a399b7655a1d835aa8606c2b29e4e777baac8635zf * They can only use the services declared in this
a399b7655a1d835aa8606c2b29e4e777baac8635zf * public include file.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zftypedef void * partition_handle_t;
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * IMPORTANT NOTE:
a399b7655a1d835aa8606c2b29e4e777baac8635zf *
a399b7655a1d835aa8606c2b29e4e777baac8635zf * The strings in the partition_result_codes[] string array in
a399b7655a1d835aa8606c2b29e4e777baac8635zf * partition_private.h MUST match the result types in typdef enum
a399b7655a1d835aa8606c2b29e4e777baac8635zf * partition_result_t below. When you add or remove result
a399b7655a1d835aa8606c2b29e4e777baac8635zf * types, keep the result types and the matching strings in
a399b7655a1d835aa8606c2b29e4e777baac8635zf * alphabetical order to make it easier to maintain the match.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zftypedef enum partition_result {
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_BAD_INPUT_PARAMETER = 0,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_CANT_MOUNT,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_CANT_READ_MEDIUM,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_CANT_REMOUNT,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_CANT_UNMOUNT,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_CANT_WRITE_MEDIUM,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_DB_ERROR,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_DUPLICATE_VOLUME,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_LABEL_BLANK,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_NOT_THIS_TYPE,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_OUT_OF_MEMORY,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_SUCCESS,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_TOO_MANY_PARTITIONS,
a399b7655a1d835aa8606c2b29e4e777baac8635zf PARTITION_CANT_CREATE_DEVMAP
a399b7655a1d835aa8606c2b29e4e777baac8635zf} partition_result_t;
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zfextern partition_result_t
a399b7655a1d835aa8606c2b29e4e777baac8635zfcreate_top_partition(medium_handle_t on_mediump,
a399b7655a1d835aa8606c2b29e4e777baac8635zf partition_handle_t *top_partitionpp);
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Creates a partition object that models the top-level
a399b7655a1d835aa8606c2b29e4e777baac8635zf * partition on the medium modeled by the medium object
a399b7655a1d835aa8606c2b29e4e777baac8635zf * whose handle is on_mediump. Writes a handle to the
a399b7655a1d835aa8606c2b29e4e777baac8635zf * object to the partition handle addressed by partitionpp.
a399b7655a1d835aa8606c2b29e4e777baac8635zf * If it can't create the object it returns an error code
a399b7655a1d835aa8606c2b29e4e777baac8635zf * and nulls the partition handle.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zfvoid
a399b7655a1d835aa8606c2b29e4e777baac8635zfdestroy_partition(partition_handle_t *partitionpp);
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Destroys the partition object whose handle is addressed
a399b7655a1d835aa8606c2b29e4e777baac8635zf * by partitionpp. Nulls the handle.
a399b7655a1d835aa8606c2b29e4e777baac8635zf * intact.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zfextern partition_result_t
a399b7655a1d835aa8606c2b29e4e777baac8635zfmount_partition(partition_handle_t partitionp);
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Mounts the partition modeled by the partition object addressed by
a399b7655a1d835aa8606c2b29e4e777baac8635zf * partitionp.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zfextern int
a399b7655a1d835aa8606c2b29e4e777baac8635zfnumber_of_partition_types();
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Returns the number of different partition types currently supported
a399b7655a1d835aa8606c2b29e4e777baac8635zf * by the partition class.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zfextern partition_result_t
a399b7655a1d835aa8606c2b29e4e777baac8635zfpartition_create_vnodes(partition_handle_t partitionp);
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Creates vnodes that link the file system to the partition
a399b7655a1d835aa8606c2b29e4e777baac8635zf * modeled by the partition object addressed by partitionp.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zfextern partition_result_t
a399b7655a1d835aa8606c2b29e4e777baac8635zfremount_partition(partition_handle_t partitionp);
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Remounts the partition modeled by the partition object addressed by
a399b7655a1d835aa8606c2b29e4e777baac8635zf * partitionp.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zfextern partition_result_t
a399b7655a1d835aa8606c2b29e4e777baac8635zfunmount_partition(partition_handle_t partitionp);
a399b7655a1d835aa8606c2b29e4e777baac8635zf/*
a399b7655a1d835aa8606c2b29e4e777baac8635zf * Unmounts the partition modeled by the partition object addressed
a399b7655a1d835aa8606c2b29e4e777baac8635zf * by partitionp.
a399b7655a1d835aa8606c2b29e4e777baac8635zf */
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf#ifdef __cplusplus
a399b7655a1d835aa8606c2b29e4e777baac8635zf}
a399b7655a1d835aa8606c2b29e4e777baac8635zf#endif
a399b7655a1d835aa8606c2b29e4e777baac8635zf
a399b7655a1d835aa8606c2b29e4e777baac8635zf#endif /* __PARTITION_H */
a399b7655a1d835aa8606c2b29e4e777baac8635zf