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/disk.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 /*      $NetBSD: disk.h,v 1.77 2021/07/24 21:31:39 andvar Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
    9  * NASA Ames Research Center.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   23  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   30  * POSSIBILITY OF SUCH DAMAGE.
   31  */
   32 
   33 /*
   34  * Copyright (c) 1992, 1993
   35  *      The Regents of the University of California.  All rights reserved.
   36  *
   37  * This software was developed by the Computer Systems Engineering group
   38  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
   39  * contributed to Berkeley.
   40  *
   41  * All advertising materials mentioning features or use of this software
   42  * must display the following acknowledgement:
   43  *      This product includes software developed by the University of
   44  *      California, Lawrence Berkeley Laboratories.
   45  *
   46  * Redistribution and use in source and binary forms, with or without
   47  * modification, are permitted provided that the following conditions
   48  * are met:
   49  * 1. Redistributions of source code must retain the above copyright
   50  *    notice, this list of conditions and the following disclaimer.
   51  * 2. Redistributions in binary form must reproduce the above copyright
   52  *    notice, this list of conditions and the following disclaimer in the
   53  *    documentation and/or other materials provided with the distribution.
   54  * 3. Neither the name of the University nor the names of its contributors
   55  *    may be used to endorse or promote products derived from this software
   56  *    without specific prior written permission.
   57  *
   58  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   59  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   60  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   61  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   62  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   63  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   64  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   65  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   66  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   67  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   68  * SUCH DAMAGE.
   69  *
   70  * from: Header: disk.h,v 1.5 92/11/19 04:33:03 torek Exp  (LBL)
   71  *
   72  *      @(#)disk.h      8.2 (Berkeley) 1/9/95
   73  */
   74 
   75 #ifndef _SYS_DISK_H_
   76 #define _SYS_DISK_H_
   77 
   78 /*
   79  * Disk device structures.
   80  */
   81 
   82 #include <sys/dkio.h>
   83 #include <sys/time.h>
   84 #include <sys/queue.h>
   85 #include <sys/iostat.h>
   86 
   87 /*
   88  * Disk information dictionary.
   89  *
   90  * This contains general information for disk devices.
   91  *
   92  *      <dict>
   93  *              <key>type</key>
   94  *              <string>...</string>
   95  *              <key>geometry</key>
   96  *              <dict>
   97  *                      <!-- See below for disk geometry dictionary
   98  *                           contents. -->
   99  *              </dict>
  100  *
  101  *              <!-- optional information -->
  102  *              <key>rpm</key>
  103  *              <integer>...</integer>
  104  *              <key>sector-interleave</key>
  105  *              <integer>...</integer>
  106  *              <key>track-skew</key>
  107  *              <integer>...</integer>
  108  *              <key>cylinder-skew</key>
  109  *              <integer>...</integer>
  110  *              <key>head-switch-usecs</key>
  111  *              <integer>...</integer>
  112  *              <key>track-seek-usecs</key>
  113  *              <integer>...</integer>
  114  *              <key>removable</key>
  115  *              <false/>
  116  *              <key>ecc</key>
  117  *              <false/>
  118  *              <key>bad-sector-forwarding</key>
  119  *              <true/>
  120  *              <key>ramdisk</key>
  121  *              <false/>
  122  *              <key>back-to-back-transfers</key>
  123  *              <true/>
  124  *
  125  *              <!-- additional information for SMD drives -->
  126  *              <key>smd-skip-sectoring</key>
  127  *              <false/>
  128  *              <!-- XXX better names for these properties -->
  129  *              <key>smd-mindist</key>
  130  *              <integer>...</integer>
  131  *              <key>smd-maxdist</key>
  132  *              <integer>...</integer>
  133  *              <key>smd-sdist</key>
  134  *              <integer>...</integer>
  135  *
  136  *              <!-- additional information for ST506 drives -->
  137  *              <!-- XXX better names for these properties -->
  138  *              <key>st506-precompcyl</key>
  139  *              <integer>...</integer>
  140  *              <key>st506-gap3</key>
  141  *              <integer>...</integer>
  142  *
  143  *              <!-- additional information for ATA drives -->
  144  *              <!-- XXX -->
  145  *
  146  *              <!-- additional information for SCSI drives -->
  147  *              <!-- XXX -->
  148  *      </dict>
  149  */
  150 
  151 /*
  152  * dkwedge_info:
  153  *
  154  *      Information needed to configure (or query configuration of) a
  155  *      disk wedge.
  156  */
  157 struct dkwedge_info {
  158         char            dkw_devname[16];/* device-style name (e.g. "dk0") */
  159         uint8_t         dkw_wname[128]; /* wedge name (Unicode, UTF-8) */
  160         char            dkw_parent[16]; /* parent disk device name */
  161         daddr_t         dkw_offset;     /* LBA offset of wedge in parent */
  162         uint64_t        dkw_size;       /* size of wedge in blocks */
  163         char            dkw_ptype[32];  /* partition type string */
  164 };
  165 
  166 /*
  167  * dkwedge_list:
  168  *
  169  *      Structure used to query a list of wedges.
  170  */
  171 struct dkwedge_list {
  172         void            *dkwl_buf;      /* storage for dkwedge_info array */
  173         size_t          dkwl_bufsize;   /* size of that buffer */
  174         u_int           dkwl_nwedges;   /* total number of wedges */
  175         u_int           dkwl_ncopied;   /* number actually copied */
  176 };
  177 
  178 /* Some common partition types */
  179 #define DKW_PTYPE_UNKNOWN       ""
  180 #define DKW_PTYPE_UNUSED        "unused"
  181 #define DKW_PTYPE_SWAP          "swap"
  182 #define DKW_PTYPE_V6            "v6"
  183 #define DKW_PTYPE_V7            "v7"
  184 #define DKW_PTYPE_SYSV          "sysv"
  185 #define DKW_PTYPE_V71K          "v71k"
  186 #define DKW_PTYPE_V8            "v8"
  187 #define DKW_PTYPE_FFS           "ffs"
  188 #define DKW_PTYPE_FAT           "msdos"
  189 #define DKW_PTYPE_LFS           "lfs"
  190 #define DKW_PTYPE_OTHER         "other"
  191 #define DKW_PTYPE_HPFS          "hpfs"
  192 #define DKW_PTYPE_ISO9660       "cd9660"
  193 #define DKW_PTYPE_BOOT          "boot"
  194 #define DKW_PTYPE_AMIGADOS      "ados"
  195 #define DKW_PTYPE_HFS           "hfs"
  196 #define DKW_PTYPE_FILECORE      "filecore"
  197 #define DKW_PTYPE_EXT2FS        "ext2fs"
  198 #define DKW_PTYPE_NTFS          "ntfs"
  199 #define DKW_PTYPE_RAIDFRAME     "raidframe"
  200 #define DKW_PTYPE_CCD           "ccd"
  201 #define DKW_PTYPE_JFS2          "jfs2"
  202 #define DKW_PTYPE_APPLEUFS      "appleufs"
  203 #define DKW_PTYPE_VINUM         "vinum"
  204 #define DKW_PTYPE_UDF           "udf"
  205 #define DKW_PTYPE_APPLEHFS      "hfs"
  206 #define DKW_PTYPE_SYSVBFS       "sysvbfs"
  207 #define DKW_PTYPE_EFS           "efs"
  208 #define DKW_PTYPE_NILFS         "nilfs"
  209 #define DKW_PTYPE_CGD           "cgd"
  210 #define DKW_PTYPE_MINIXFS3      "minixfs3"
  211 #define DKW_PTYPE_VMKCORE       "vmkcore"
  212 #define DKW_PTYPE_VMFS          "vmfs"
  213 #define DKW_PTYPE_VMWRESV       "vmwresv"
  214 #define DKW_PTYPE_ZFS           "zfs"
  215 
  216 /*
  217  * Ensure each symbol used in FSTYPE_DEFN in <sys/disklabel.h>
  218  * has a corresponding DKW_PTYPE_* definition.
  219  */
  220 #define DKW_PTYPE_MSDOS         DKW_PTYPE_FAT
  221 #define DKW_PTYPE_BSDFFS        DKW_PTYPE_FFS
  222 #define DKW_PTYPE_BSDLFS        DKW_PTYPE_LFS
  223 #define DKW_PTYPE_ADOS          DKW_PTYPE_AMIGADOS
  224 #define DKW_PTYPE_EX2FS         DKW_PTYPE_EXT2FS
  225 #define DKW_PTYPE_RAID          DKW_PTYPE_RAIDFRAME
  226 
  227 /*
  228  * Disk geometry dictionary.
  229  *
  230  * NOTE: Not all geometry information is relevant for every kind of disk.
  231  *
  232  *      <dict>
  233  *              <key>sectors-per-unit</key>
  234  *              <integer>...</integer>
  235  *              <key>sector-size</key>
  236  *              <integer>...</integer>
  237  *              <key>sectors-per-track</key>
  238  *              <integer>...</integer>
  239  *              <key>tracks-per-cylinder</key>
  240  *              <integer>...</integer>
  241  *              <key>cylinders-per-unit</key>
  242  *              <integer>...</integer>
  243  *              <key>physical-cylinders-per-unit</key>
  244  *              <integer>...</integer>
  245  *              <key>spare-sectors-per-track</key>
  246  *              <integer>...</integer>
  247  *              <key>spare-sectors-per-cylinder</key>
  248  *              <integer>...</integer>
  249  *              <key>alternative-cylinders</key>
  250  *              <integer>...</integer>
  251  *      </dict>
  252  * NOTE: Not all geometry information is relevant for every kind of disk.
  253  */
  254 
  255 struct disk_geom {
  256         int64_t         dg_secperunit;  /* # of data sectors per unit */
  257         uint32_t        dg_secsize;     /* # of bytes per sector */
  258         uint32_t        dg_nsectors;    /* # of data sectors per track */
  259         uint32_t        dg_ntracks;     /* # of tracks per cylinder */
  260         uint32_t        dg_ncylinders;  /* # of data cylinders per unit */
  261         uint32_t        dg_secpercyl;   /* # of data sectors per cylinder */
  262         uint32_t        dg_pcylinders;  /* # of physical cylinders per unit */
  263 
  264         /*
  265          * Spares (bad sector replacements) below are not counted in
  266          * dg_nsectors or dg_secpercyl.  Spare sectors are assumed to
  267          * be physical sectors which occupy space at the end of each
  268          * track and/or cylinder.
  269          */
  270         uint32_t        dg_sparespertrack;
  271         uint32_t        dg_sparespercyl;
  272         /*
  273          * Alternative cylinders include maintenance, replacement,
  274          * configuration description areas, etc.
  275          */
  276         uint32_t        dg_acylinders;
  277 };
  278 
  279 /*
  280  * Bad sector lists per fixed disk
  281  */
  282 struct disk_badsectors {
  283         SLIST_ENTRY(disk_badsectors)    dbs_next;
  284         daddr_t         dbs_min;        /* min. sector number */
  285         daddr_t         dbs_max;        /* max. sector number */
  286         struct timeval  dbs_failedat;   /* first failure at */
  287 };
  288 
  289 struct disk_badsecinfo {
  290         uint32_t        dbsi_bufsize;   /* size of region pointed to */
  291         uint32_t        dbsi_skip;      /* how many to skip past */
  292         uint32_t        dbsi_copied;    /* how many got copied back */
  293         uint32_t        dbsi_left;      /* remaining to copy */
  294         void *          dbsi_buffer;    /* region to copy disk_badsectors to */
  295 };
  296 
  297 #define DK_STRATEGYNAMELEN      32
  298 struct disk_strategy {
  299         char dks_name[DK_STRATEGYNAMELEN]; /* name of strategy */
  300         char *dks_param;                /* notyet; should be NULL */
  301         size_t dks_paramlen;            /* notyet; should be 0 */
  302 };
  303 
  304 /* Sector alignment */
  305 struct disk_sectoralign {
  306         uint32_t        dsa_firstaligned; /* first aligned sector # */
  307         uint32_t        dsa_alignment;    /* sectors per aligned sector */
  308 };
  309 
  310 #ifdef _KERNEL
  311 #include <sys/device.h>
  312 #include <sys/mutex.h>
  313 
  314 #include <prop/proplib.h>
  315 
  316 struct buf;
  317 struct disk;
  318 struct disklabel;
  319 struct cpu_disklabel;
  320 struct lwp;
  321 struct vnode;
  322 
  323 /*
  324  * dkwedge_discovery_method:
  325  *
  326  *      Structure used to describe partition map parsing schemes
  327  *      used for wedge autodiscovery.
  328  */
  329 struct dkwedge_discovery_method {
  330                                         /* link in wedge driver's list */
  331         LIST_ENTRY(dkwedge_discovery_method) ddm_list;
  332         const char      *ddm_name;      /* name of this method */
  333         int             ddm_priority;   /* search priority */
  334         int             (*ddm_discover)(struct disk *, struct vnode *);
  335 };
  336 
  337 #define DKWEDGE_DISCOVERY_METHOD_DECL(name, prio, discover)             \
  338 static struct dkwedge_discovery_method name ## _ddm = {                 \
  339         { NULL, NULL },                                                 \
  340         #name,                                                          \
  341         prio,                                                           \
  342         discover                                                        \
  343 };                                                                      \
  344 __link_set_add_data(dkwedge_methods, name ## _ddm)
  345 
  346 /*
  347  * Disk partition dictionary.
  348  *
  349  * A partition is represented as a dictionary containing generic partition
  350  * properties (such as starting block and block count), as well as information
  351  * that is specific to individual partition map formats.
  352  *
  353  *      <dict>
  354  *              <key>start-block</key>
  355  *              <integer>...</integer>
  356  *              <key>block-count</key>
  357  *              <integer>...</integer>
  358  *              <!-- DKW_PTYPE strings ("" or missing if unknown) -->
  359  *              <key>type</type>
  360  *              <string>...</string>
  361  *              <!-- optional -->
  362  *              <key>name</key>
  363  *              <string>...</string>
  364  *
  365  *              <!-- these are valid for GPT partition maps -->
  366  *              <key>gpt-type-guid</key>
  367  *              <string>...</string>
  368  *              <key>gpt-partition-guid</key>
  369  *              <string>...</string>
  370  *              <key>gpt-platform-required</key>
  371  *              <false/>
  372  *
  373  *              <!-- these are valid for 4.4BSD partition maps -->
  374  *              <key>bsd44-partition-type</key>
  375  *              <integer>...</integer>
  376  *              <key>bsd44-fs-fragment-size</key>
  377  *              <integer>...</integer>
  378  *              <key>bsd44-iso9660-session-offset</key>
  379  *              <integer>...</integer>
  380  *              <key>bsd44-ffs-cylinders-per-group</key>
  381  *              <integer>...</integer>
  382  *              <key>bsd44-lfs-segment-shift</key>
  383  *              <integer>...</integer>
  384  *
  385  *              <!-- these are valid for NeXT partition maps -->
  386  *              <key>next-block-size</key>
  387  *              <integer>...</integer>
  388  *              <key>next-fs-fragment-size</key>
  389  *              <integer>...</integer>
  390  *              <key>next-fs-optimization</key>
  391  *              <string>...</string>    <!-- "space" or "time" -->
  392  *              <key>next-fs-cylinders-per-group</key>
  393  *              <integer>...</integer>
  394  *              <key>next-bytes-per-inode-density</key>
  395  *              <integer>...</integer>
  396  *              <key>next-minfree-percentage</key>
  397  *              <integer>...</integer>
  398  *              <key>next-run-newfs-during-init</key>
  399  *              <false/>
  400  *              <key>next-mount-point</key>
  401  *              <string>...</string>
  402  *              <key>next-automount</key>
  403  *              <true/>
  404  *              <key>next-partition-type</key>
  405  *              <string>...</string>
  406  *
  407  *              <!-- these are valid for MBR partition maps -->
  408  *              <key>mbr-start-head</key>
  409  *              <integer>...</integer>
  410  *              <key>mbr-start-sector</key>
  411  *              <integer>...</integer>
  412  *              <key>mbr-start-cylinder</key>
  413  *              <integer>...</integer>
  414  *              <key>mbr-partition-type</key>
  415  *              <integer>...</integer>
  416  *              <key>mbr-end-head</key>
  417  *              <integer>...</integer>
  418  *              <key>mbr-end-sector</key>
  419  *              <integer>...</integer>
  420  *              <key>mbr-end-cylinder</key>
  421  *              <integer>...</integer>
  422  *              <key>mbr-active-partition</key>
  423  *              <false/>
  424  *
  425  *              <!-- these are valid for Apple partition maps -->
  426  *              <key>apple-partition-type</key>
  427  *              <string>...</string>
  428  *              <!-- XXX What else do we need?  wrstuden? -->
  429  *
  430  *              <!-- these are valid for RISCiX partition maps -->
  431  *              <key>riscix-partition-type</key>
  432  *              <integer>...</integer>
  433  *
  434  *              <!-- these are valid for MIPS/SGI partition maps -->
  435  *              <key>mips-partition-type</key>
  436  *              <integer>...</integer>
  437  *
  438  *              <!-- SunOS 4 partition maps have no specific
  439  *                   additional information.  Note, however,
  440  *                   that SunOS 4 partitions must begin on
  441  *                   cylinder boundaries. -->
  442  *
  443  *              <!-- XXX Need Amiga partition map info -->
  444  *
  445  *              <!-- these are valid for VTOC partition maps -->
  446  *              <key>vtoc-tag</key>
  447  *              <integer>...</integer>
  448  *              <key>vtoc-unmount</key>
  449  *              <false/>
  450  *              <key>vtoc-read-only</key>
  451  *              <false/>
  452  *              <!-- XXX is this really part of the partition info? -->
  453  *              <key>vtoc-timestamp</key>
  454  *              <integer>...</integer>
  455  *
  456  *              <!-- mvme68k partition maps use 4.4BSD partition
  457  *                   info stuffed into two different areas of the
  458  *                   disk information label recognized by BUG. -->
  459  *
  460  *              <!-- XXX What else? -->
  461  *      </dict>
  462  */
  463 
  464 struct disk {
  465         TAILQ_ENTRY(disk) dk_link;      /* link in global disklist */
  466         const char      *dk_name;       /* disk name */
  467         prop_dictionary_t dk_info;      /* reference to disk-info dictionary */
  468         struct disk_geom dk_geom;       /* cooked version of dk_info */
  469         int             dk_bopenmask;   /* block devices open */
  470         int             dk_copenmask;   /* character devices open */
  471         int             dk_openmask;    /* composite (bopen|copen) */
  472         int             dk_state;       /* label state   ### */
  473         int             dk_blkshift;    /* shift to convert DEV_BSIZE to blks */
  474         int             dk_byteshift;   /* shift to convert bytes to blks */
  475 
  476         /*
  477          * Metrics data; note that some metrics may have no meaning
  478          * on certain types of disks.
  479          */
  480         struct io_stats *dk_stats;
  481 
  482         const struct dkdriver *dk_driver;       /* pointer to driver */
  483 
  484         /*
  485          * Information required to be the parent of a disk wedge.
  486          */
  487         kmutex_t        dk_rawlock;     /* lock on these fields */
  488         u_int           dk_rawopens;    /* # of openes of rawvp */
  489         struct vnode    *dk_rawvp;      /* vnode for the RAW_PART bdev */
  490 
  491         kmutex_t        dk_openlock;    /* lock on these and openmask */
  492         u_int           dk_nwedges;     /* # of configured wedges */
  493                                         /* all wedges on this disk */
  494         LIST_HEAD(, dkwedge_softc) dk_wedges;
  495 
  496         /*
  497          * Disk label information.  Storage for the in-core disk label
  498          * must be dynamically allocated, otherwise the size of this
  499          * structure becomes machine-dependent.
  500          */
  501         daddr_t         dk_labelsector;         /* sector containing label */
  502         struct disklabel *dk_label;     /* label */
  503         struct cpu_disklabel *dk_cpulabel;
  504 };
  505 
  506 struct dkdriver {
  507         void    (*d_strategy)(struct buf *);
  508         void    (*d_minphys)(struct buf *);
  509         int     (*d_open)(dev_t, int, int, struct lwp *);
  510         int     (*d_close)(dev_t, int, int, struct lwp *);
  511         int     (*d_diskstart)(device_t, struct buf *);
  512         void    (*d_iosize)(device_t, int *);
  513         int     (*d_dumpblocks)(device_t, void *, daddr_t, int);
  514         int     (*d_lastclose)(device_t);
  515         int     (*d_discard)(device_t, off_t, off_t);
  516         int     (*d_firstopen)(device_t, dev_t, int, int);
  517         void    (*d_label)(device_t, struct disklabel *lp);
  518 };
  519 
  520 /* states */
  521 #define DK_CLOSED       0               /* drive is closed */
  522 #define DK_WANTOPEN     1               /* drive being opened */
  523 #define DK_WANTOPENRAW  2               /* drive being opened */
  524 #define DK_RDLABEL      3               /* label being read */
  525 #define DK_OPEN         4               /* label read, drive open */
  526 #define DK_OPENRAW      5               /* open without label */
  527 
  528 #define DK_BSIZE2BLKSHIFT(b)    ((ffs((b) / DEV_BSIZE)) - 1)
  529 #define DK_BSIZE2BYTESHIFT(b)   (ffs((b)) - 1)
  530 #define DK_DEV_BSIZE_OK(b) \
  531     ((b) >= DEV_BSIZE && ((b) & ((b) - 1)) == 0 && (b) <= MAXPHYS)
  532 
  533 extern  int disk_count;                 /* number of disks in global disklist */
  534 
  535 struct proc;
  536 
  537 void    disk_rename(struct disk *, const char *);
  538 void    disk_attach(struct disk *);
  539 int     disk_begindetach(struct disk *, int (*)(device_t), device_t, int);
  540 void    disk_detach(struct disk *);
  541 void    disk_init(struct disk *, const char *, const struct dkdriver *);
  542 void    disk_destroy(struct disk *);
  543 void    disk_wait(struct disk *);
  544 void    disk_busy(struct disk *);
  545 void    disk_unbusy(struct disk *, long, int);
  546 bool    disk_isbusy(struct disk *);
  547 struct disk *disk_find(const char *);
  548 int     disk_ioctl(struct disk *, dev_t, u_long, void *, int, struct lwp *);
  549 void    disk_set_info(device_t, struct disk *, const char *);
  550 
  551 void    dkwedge_init(void);
  552 int     dkwedge_add(struct dkwedge_info *);
  553 int     dkwedge_del(struct dkwedge_info *);
  554 void    dkwedge_delall(struct disk *);
  555 int     dkwedge_list(struct disk *, struct dkwedge_list *, struct lwp *);
  556 void    dkwedge_discover(struct disk *);
  557 int     dkwedge_read(struct disk *, struct vnode *, daddr_t, void *, size_t);
  558 device_t dkwedge_find_by_wname(const char *);
  559 device_t dkwedge_find_by_parent(const char *, size_t *);
  560 const char *dkwedge_get_parent_name(dev_t);
  561 void    dkwedge_print_wnames(void);
  562 device_t dkwedge_find_partition(device_t, daddr_t, uint64_t);
  563 
  564 #endif /* _KERNEL */
  565 
  566 #endif /* _SYS_DISK_H_ */

Cache object: a3dba0bd624df425bc87115aef7916f6


[ 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.