vtoc.h revision 406fc5100dac8d225a315a6def6be8d628f34e24
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2014 Garrett D'Amore <garrett@damore.org>
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright 2016 Toomas Soome <tsoome@me.com>
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#ifndef _SYS_VTOC_H
#define _SYS_VTOC_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Note: the VTOC is not implemented fully, nor in the manner
* that AT&T implements it. AT&T puts the vtoc structure
* into a sector, usually the second sector (pdsector is first).
*
* Sun incorporates the tag, flag, version, and volume vtoc fields into
* its Disk Label, which already has some vtoc-equivalent fields.
* Upon reading the vtoc with read_vtoc(), the following exceptions
* occur:
* v_bootinfo [all] returned as zero
* v_sanity returned as VTOC_SANE
* if Disk Label was sane
* v_sectorsz returned as 512
* v_reserved [all] retunred as zero
* timestamp [all] returned as zero
*
* See dklabel.h, read_vtoc(), and write_vtoc().
*/
/* (from dkio.h) */
/*
* Partition identification tags
*/
/*
* Partition permission flags
*/
/*
* error codes for reading & writing vtoc
*/
struct partition {
long p_size; /* # of blocks in partition */
};
struct vtoc {
unsigned long v_sanity; /* to verify vtoc sanity */
unsigned long v_version; /* layout version */
};
struct extpartition {
};
struct extvtoc {
};
#ifdef _KERNEL
#define extvtoctovtoc(extv, v) \
{ \
int i; \
for (i = 0; i < 10; i++) \
for (i = 0; i < V_NUMPAR; i++) { \
} \
}
#define vtoctoextvtoc(v, extv) \
{ \
int i; \
for (i = 0; i < 10; i++) \
for (i = 0; i < V_NUMPAR; i++) { \
} \
}
#endif /* _KERNEL */
#if defined(_SYSCALL32)
struct partition32 {
};
struct vtoc32 {
};
#define vtoc32tovtoc(v32, v) \
{ \
int i; \
for (i = 0; i < 10; i++) \
for (i = 0; i < V_NUMPAR; i++) { \
} \
for (i = 0; i < V_NUMPAR; i++) \
}
{ \
int i; \
for (i = 0; i < 10; i++) \
for (i = 0; i < V_NUMPAR; i++) { \
} \
}
#define vtoctovtoc32(v, v32) \
{ \
int i; \
for (i = 0; i < 10; i++) \
for (i = 0; i < V_NUMPAR; i++) { \
} \
for (i = 0; i < V_NUMPAR; i++) { \
if (v.timestamp[i] > TIME32_MAX) \
else \
} \
}
{ \
int i; \
for (i = 0; i < 10; i++) \
for (i = 0; i < V_NUMPAR; i++) { \
} \
for (i = 0; i < V_NUMPAR; i++) { \
else \
} \
}
#endif /* _SYSCALL32 */
/*
* These defines are the mode parameter for the checksum routines.
*/
#define CK_CHECKSUM 0 /* check checksum */
extern int write_vtoc(int, struct vtoc *);
extern int read_extvtoc(int, struct extvtoc *);
extern int write_extvtoc(int, struct extvtoc *);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_VTOC_H */