xref: /freebsd/sys/geom/part/g_part_if.m (revision 2be1a816b9ff69588e55be0a84cbe2a31efc0f2f)
1#-
2# Copyright (c) 2006, 2007 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$
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
41INTERFACE g_part;
42
43# add() - scheme specific processing for the add verb.
44METHOD int add {
45	struct g_part_table *table;
46	struct g_part_entry *entry;
47	struct g_part_parms *gpp;
48};
49
50# bootcode() - scheme specific processing for the bootcode verb.
51METHOD int bootcode {
52	struct g_part_table *table;
53	struct g_part_parms *gpp;
54};
55
56# create() - scheme specific processing for the create verb.
57METHOD int create {
58	struct g_part_table *table;
59	struct g_part_parms *gpp;
60};
61
62# destroy() - scheme specific processing for the destroy verb.
63METHOD int destroy {
64	struct g_part_table *table;
65	struct g_part_parms *gpp;
66};
67
68# dumpconf()
69METHOD void dumpconf {
70	struct g_part_table *table;
71	struct g_part_entry *entry;
72	struct sbuf *sb;
73	const char *indent;
74};
75
76# dumpto() - return whether the partiton can be used for kernel dumps.
77METHOD int dumpto {
78	struct g_part_table *table;
79	struct g_part_entry *entry;
80};
81
82# modify() - scheme specific processing for the modify verb.
83METHOD int modify {
84	struct g_part_table *table;
85	struct g_part_entry *entry;
86	struct g_part_parms *gpp;
87};
88
89# name() - return the name of the given partition entry.
90# Typical names are "p1", "s0" or "c".
91METHOD const char * name {
92	struct g_part_table *table;
93	struct g_part_entry *entry;
94	char *buf;
95	size_t bufsz;
96};
97
98# probe() - probe the provider attached to the given consumer for the
99# existence of the scheme implemented by the G_PART interface handler.
100METHOD int probe {
101	struct g_part_table *table;
102	struct g_consumer *cp;
103};
104
105# read() - read the on-disk partition table into memory.
106METHOD int read {
107	struct g_part_table *table;
108	struct g_consumer *cp;
109};
110
111# type() - return a string representation of the partition type.
112# Preferrably, the alias names.
113METHOD const char * type {
114        struct g_part_table *table;
115        struct g_part_entry *entry;
116        char *buf;
117        size_t bufsz;
118};
119
120# write() - write the in-memory partition table to disk.
121METHOD int write {
122	struct g_part_table *table;
123	struct g_consumer *cp;
124};
125