The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/disklabel64.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
    3  * 
    4  * This code is derived from software contributed to The DragonFly Project
    5  * by Matthew Dillon <dillon@backplane.com>
    6  * 
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 
   11  * 1. Redistributions of source code must retain the above copyright
   12  *    notice, this list of conditions and the following disclaimer.
   13  * 2. Redistributions in binary form must reproduce the above copyright
   14  *    notice, this list of conditions and the following disclaimer in
   15  *    the documentation and/or other materials provided with the
   16  *    distribution.
   17  * 3. Neither the name of The DragonFly Project nor the names of its
   18  *    contributors may be used to endorse or promote products derived
   19  *    from this software without specific, prior written permission.
   20  * 
   21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
   22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
   23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
   25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
   26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
   27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
   28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   32  * SUCH DAMAGE.
   33  * 
   34  * $DragonFly: src/sys/sys/disklabel64.h,v 1.4 2007/06/19 06:39:10 dillon Exp $
   35  */
   36 
   37 #ifndef _SYS_DISKLABEL64_H_
   38 #define _SYS_DISKLABEL64_H_
   39 
   40 #ifndef _SYS_TYPES_H_
   41 #include <sys/types.h>
   42 #endif
   43 #if defined(_KERNEL) && !defined(_SYS_SYSTM_H_)
   44 #include <sys/systm.h>
   45 #endif
   46 #ifndef _SYS_IOCCOM_H_
   47 #include <sys/ioccom.h>
   48 #endif
   49 #ifndef _SYS_UUID_H_
   50 #include <sys/uuid.h>
   51 #endif
   52 
   53 /*
   54  * disklabel64's start at offset 0 on the disk or slice they reside.  All
   55  * values are byte offsets, not block numbers, in order to allow portability.
   56  * Unlike the original 32 bit disklabels, the on-disk format for a 64 bit
   57  * disklabel is slice-relative and does not have to be translated.
   58  *
   59  * Currently the number of partitions is limited to 16, but the virgin
   60  * disklabel code will leave enough space for 32.
   61  */
   62 #define DISKMAGIC64     ((u_int32_t)0xc4464c59) /* The disk magic number */
   63 #ifndef MAXPARTITIONS64
   64 #define MAXPARTITIONS64 16
   65 #endif
   66 #ifndef RESPARTITIONS64
   67 #define RESPARTITIONS64 32
   68 #endif
   69 
   70 #ifndef LOCORE
   71 
   72 /*
   73  * A disklabel64 starts at slice relative offset 0, NOT SECTOR 1.  In
   74  * otherwords, d_magic is at byte offset 512 within the slice, regardless
   75  * of the sector size.
   76  *
   77  * The d_reserved0 area is not included in the crc and any kernel writeback
   78  * of the label will not change the d_reserved area on-disk.  It is purely
   79  * a shim to allow us to avoid sector calculations when reading or
   80  * writing the label.  Since byte offsets are used in our 64 bit disklabel,
   81  * the entire disklabel and the I/O required to access it becomes
   82  * sector-agnostic.
   83  */
   84 struct disklabel64 {
   85         char      d_reserved0[512];     /* reserved or unused */
   86         u_int32_t d_magic;              /* the magic number */
   87         u_int32_t d_crc;                /* crc32() d_magic thru last part */
   88         u_int32_t d_align;              /* partition alignment requirement */
   89         u_int32_t d_npartitions;        /* number of partitions */
   90         struct uuid d_stor_uuid;        /* unique uuid for label */
   91 
   92         u_int64_t d_total_size;         /* total size incl everything (bytes) */
   93         u_int64_t d_bbase;              /* boot area base offset (bytes) */
   94                                         /* boot area is pbase - bbase */
   95         u_int64_t d_pbase;              /* first allocatable offset (bytes) */
   96         u_int64_t d_pstop;              /* last allocatable offset+1 (bytes) */
   97         u_int64_t d_abase;              /* location of backup copy if not 0 */
   98 
   99         u_char    d_packname[64];
  100         u_char    d_reserved[64];
  101 
  102         /*
  103          * Note: offsets are relative to the base of the slice, NOT to
  104          * d_pbase.  Unlike 32 bit disklabels the on-disk format for
  105          * a 64 bit disklabel remains slice-relative.
  106          *
  107          * An uninitialized partition has a p_boffset and p_bsize of 0.
  108          *
  109          * If p_fstype is not supported for a live partition it is set
  110          * to FS_OTHER.  This is typically the case when the filesystem
  111          * is identified by its uuid.
  112          */
  113         struct partition64 {            /* the partition table */
  114                 u_int64_t p_boffset;    /* slice relative offset, in bytes */
  115                 u_int64_t p_bsize;      /* size of partition, in bytes */
  116                 u_int8_t  p_fstype;
  117                 u_int8_t  p_unused01;   /* reserved, must be 0 */
  118                 u_int8_t  p_unused02;   /* reserved, must be 0 */
  119                 u_int8_t  p_unused03;   /* reserved, must be 0 */
  120                 u_int32_t p_unused04;   /* reserved, must be 0 */
  121                 u_int32_t p_unused05;   /* reserved, must be 0 */
  122                 u_int32_t p_unused06;   /* reserved, must be 0 */
  123                 struct uuid p_type_uuid;/* mount type as UUID */
  124                 struct uuid p_stor_uuid;/* unique uuid for storage */
  125         } d_partitions[MAXPARTITIONS64];/* actually may be more */
  126 };
  127 
  128 #ifdef _KERNEL
  129 extern struct disklabel_ops disklabel64_ops;
  130 #endif
  131 
  132 /*
  133  * Disk-specific ioctls.
  134  */
  135 #define DIOCGDINFO64    _IOR('d', 101, struct disklabel64)
  136 #define DIOCSDINFO64    _IOW('d', 102, struct disklabel64)
  137 #define DIOCWDINFO64    _IOW('d', 103, struct disklabel64)
  138 #define DIOCGDVIRGIN64  _IOR('d', 105, struct disklabel64)
  139 
  140 #endif /* LOCORE */
  141 
  142 #endif /* !_SYS_DISKLABEL64_H_ */

Cache object: 007bb3ed0b50f045e9eae294033bbde5


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.