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/geom/part/g_part_if.m

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) 2006-2009 Marcel Moolenaar
    3 # All rights reserved.
    4 #
    5 # Redistribution and use in source and binary forms, with or without
    6 # modification, are permitted provided that the following conditions
    7 # are met:
    8 #
    9 # 1. Redistributions of source code must retain the above copyright
   10 #    notice, this list of conditions and the following disclaimer.
   11 # 2. Redistributions in binary form must reproduce the above copyright
   12 #    notice, this list of conditions and the following disclaimer in the
   13 #    documentation and/or other materials provided with the distribution.
   14 #
   15 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25 #
   26 # $FreeBSD: releng/8.3/sys/geom/part/g_part_if.m 214975 2010-11-08 10:08:30Z ae $
   27 
   28 #include <sys/param.h>
   29 #include <sys/lock.h>
   30 #include <sys/malloc.h>
   31 #include <sys/mutex.h>
   32 #include <sys/sbuf.h>
   33 #include <sys/bus.h>
   34 #include <machine/bus.h>
   35 #include <sys/systm.h>
   36 #include <geom/geom.h>
   37 #include <geom/part/g_part.h>
   38 
   39 # The G_PART scheme interface.
   40 
   41 INTERFACE g_part;
   42 
   43 # Default implementations of methods.
   44 CODE {
   45         static void
   46         default_fullname(struct g_part_table *table,
   47             struct g_part_entry *entry, struct sbuf *sb, const char *pfx)
   48         {
   49                 char buf[32];
   50 
   51                 sbuf_printf(sb, "%s%s", pfx,
   52                     G_PART_NAME(table, entry, buf, sizeof(buf)));
   53         }
   54 
   55         static int
   56         default_precheck(struct g_part_table *t __unused,
   57             enum g_part_ctl r __unused, struct g_part_parms *p __unused)
   58         {
   59                 return (0);
   60         }
   61 
   62         static int
   63         default_resize(struct g_part_table *t __unused,
   64             struct g_part_entry *e __unused, struct g_part_parms *p __unused)
   65         {
   66                 return (ENOSYS);
   67         }
   68 
   69         static int
   70         default_recover(struct g_part_table *t __unused)
   71         {
   72                 return (ENOSYS);
   73         }
   74 };
   75 
   76 # add() - scheme specific processing for the add verb.
   77 METHOD int add {
   78         struct g_part_table *table;
   79         struct g_part_entry *entry;
   80         struct g_part_parms *gpp;
   81 };
   82 
   83 # bootcode() - scheme specific processing for the bootcode verb.
   84 METHOD int bootcode {
   85         struct g_part_table *table;
   86         struct g_part_parms *gpp;
   87 };
   88 
   89 # create() - scheme specific processing for the create verb.
   90 METHOD int create {
   91         struct g_part_table *table;
   92         struct g_part_parms *gpp;
   93 };
   94 
   95 # destroy() - scheme specific processing for the destroy verb.
   96 METHOD int destroy {
   97         struct g_part_table *table;
   98         struct g_part_parms *gpp;
   99 };
  100 
  101 # dumpconf()
  102 METHOD void dumpconf {
  103         struct g_part_table *table;
  104         struct g_part_entry *entry;
  105         struct sbuf *sb;
  106         const char *indent;
  107 };
  108 
  109 # dumpto() - return whether the partiton can be used for kernel dumps.
  110 METHOD int dumpto {
  111         struct g_part_table *table;
  112         struct g_part_entry *entry;
  113 };
  114 
  115 # fullname() - write the name of the given partition entry to the sbuf.
  116 METHOD void fullname {
  117         struct g_part_table *table;
  118         struct g_part_entry *entry;
  119         struct sbuf *sb;
  120         const char *pfx;
  121 } DEFAULT default_fullname;
  122 
  123 # modify() - scheme specific processing for the modify verb.
  124 METHOD int modify {
  125         struct g_part_table *table;
  126         struct g_part_entry *entry;
  127         struct g_part_parms *gpp;
  128 };
  129 
  130 # resize() - scheme specific processing for the resize verb.
  131 METHOD int resize {
  132         struct g_part_table *table;
  133         struct g_part_entry *entry;
  134         struct g_part_parms *gpp;
  135 } DEFAULT default_resize;
  136 
  137 # name() - return the name of the given partition entry.
  138 # Typical names are "p1", "s0" or "c".
  139 METHOD const char * name {
  140         struct g_part_table *table;
  141         struct g_part_entry *entry;
  142         char *buf;
  143         size_t bufsz;
  144 };
  145 
  146 # precheck() - method to allow schemes to check the parameters given
  147 # to the mentioned ctl request. This only applies to the requests that
  148 # operate on a GEOM. In other words, it does not apply to the create
  149 # request.
  150 # It is allowed (intended actually) to change the parameters according
  151 # to the schemes needs before they are used. Returning an error will
  152 # terminate the request immediately.
  153 METHOD int precheck {
  154         struct g_part_table *table;
  155         enum g_part_ctl req;
  156         struct g_part_parms *gpp;
  157 } DEFAULT default_precheck;
  158 
  159 # probe() - probe the provider attached to the given consumer for the
  160 # existence of the scheme implemented by the G_PART interface handler.
  161 METHOD int probe {
  162         struct g_part_table *table;
  163         struct g_consumer *cp;
  164 };
  165 
  166 # read() - read the on-disk partition table into memory.
  167 METHOD int read {
  168         struct g_part_table *table;
  169         struct g_consumer *cp;
  170 };
  171 
  172 # recover() - scheme specific processing for the recover verb.
  173 METHOD int recover {
  174         struct g_part_table *table;
  175 } DEFAULT default_recover;
  176 
  177 # setunset() - set or unset partition entry attributes.
  178 METHOD int setunset {
  179         struct g_part_table *table;
  180         struct g_part_entry *entry;
  181         const char *attrib;
  182         unsigned int set;
  183 };
  184 
  185 # type() - return a string representation of the partition type.
  186 # Preferrably, the alias names.
  187 METHOD const char * type {
  188         struct g_part_table *table;
  189         struct g_part_entry *entry;
  190         char *buf;
  191         size_t bufsz;
  192 };
  193 
  194 # write() - write the in-memory partition table to disk.
  195 METHOD int write {
  196         struct g_part_table *table;
  197         struct g_consumer *cp;
  198 };

Cache object: 529b071dd50bf44507cd9e8059ecca54


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