1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom_sunlabel.c 93248 2002-03-26 21:40:06Z phk $ |
36 */ 37 38 39#include <sys/param.h> 40#ifndef _KERNEL 41#include <stdio.h> 42#include <string.h> 43#include <stdlib.h> --- 8 unchanged lines hidden (view full) --- 52#include <sys/lock.h> 53#include <sys/mutex.h> 54#endif 55#include <sys/errno.h> 56#include <geom/geom.h> 57#include <geom/geom_slice.h> 58#include <machine/endian.h> 59 |
60#define BSD_CLASS_NAME "SUNLABEL-class" |
61 62struct g_sunlabel_softc { 63 int foo; 64}; 65 66static int 67g_sunlabel_start(struct bio *bp) 68{ --- 10 unchanged lines hidden (view full) --- 79static void 80g_sunlabel_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_consumer *cp __unused, struct g_provider *pp) 81{ 82 83 g_slice_dumpconf(sb, indent, gp, cp, pp); 84} 85 86static struct g_geom * |
87g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int flags) |
88{ 89 struct g_geom *gp; 90 struct g_consumer *cp; 91 struct g_provider *pp2; 92 int error, i, j, npart; 93 u_char *buf; 94 struct g_sunlabel_softc *ms; 95 u_int secsize, u, v, csize; 96 off_t mediasize; 97 98 g_trace(G_T_TOPOLOGY, "g_sunlabel_taste(%s,%s)", mp->name, pp->name); 99 g_topology_assert(); 100 if (flags == G_TF_NORMAL && |
101 !strcmp(pp->geom->class->name, BSD_CLASS_NAME)) |
102 return (NULL); 103 gp = g_slice_new(mp, 8, pp, &cp, &ms, sizeof *ms, g_sunlabel_start); 104 if (gp == NULL) 105 return (NULL); 106 g_topology_unlock(); 107 gp->dumpconf = g_sunlabel_dumpconf; 108 npart = 0; 109 while (1) { /* a trick to allow us to use break */ --- 69 unchanged lines hidden (view full) --- 179 g_topology_lock(); 180 error = g_access_rel(cp, -1, 0, 0); 181 if (npart > 0) 182 return (gp); 183 g_std_spoiled(cp); 184 return (NULL); 185} 186 |
187static struct g_class g_sunlabel_class = { 188 BSD_CLASS_NAME, |
189 g_sunlabel_taste, 190 g_slice_access, 191 g_slice_orphan, 192 NULL, |
193 G_CLASS_INITSTUFF |
194}; 195 |
196DECLARE_GEOM_CLASS(g_sunlabel_class, g_sunlabel); |