Deleted Added
full compact
geom_bsd.c (93097) geom_bsd.c (93248)
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 *
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_bsd.c 93097 2002-03-24 14:27:31Z phk $
35 * $FreeBSD: head/sys/geom/geom_bsd.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 <sys/disklabel.h>
57#include <geom/geom.h>
58#include <geom/geom_slice.h>
59
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 <sys/disklabel.h>
57#include <geom/geom.h>
58#include <geom/geom_slice.h>
59
60#define BSD_METHOD_NAME "BSD-method"
60#define BSD_CLASS_NAME "BSD-class"
61
62struct g_bsd_softc {
63 struct disklabel ondisk;
64 struct disklabel inram;
65};
66
67static void
68g_bsd_ledec_partition(u_char *ptr, struct partition *d)

--- 245 unchanged lines hidden (view full) ---

314 sbuf_printf(sb, "%s<type>%d</type>\n",
315 indent, ms->type[pp->index]);
316 }
317#endif
318 g_slice_dumpconf(sb, indent, gp, cp, pp);
319}
320
321static struct g_geom *
61
62struct g_bsd_softc {
63 struct disklabel ondisk;
64 struct disklabel inram;
65};
66
67static void
68g_bsd_ledec_partition(u_char *ptr, struct partition *d)

--- 245 unchanged lines hidden (view full) ---

314 sbuf_printf(sb, "%s<type>%d</type>\n",
315 indent, ms->type[pp->index]);
316 }
317#endif
318 g_slice_dumpconf(sb, indent, gp, cp, pp);
319}
320
321static struct g_geom *
322g_bsd_taste(struct g_method *mp, struct g_provider *pp, struct thread *tp, int flags)
322g_bsd_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int flags)
323{
324 struct g_geom *gp;
325 struct g_consumer *cp;
326 struct g_provider *pp2;
327 int error, i, j, npart;
328 struct g_bsd_softc *ms;
329 struct disklabel *dl;
330 u_int secsize;
331 u_int fwsectors, fwheads;
332 off_t mediasize;
333 struct partition *ppp, *ppr;
334
335 g_trace(G_T_TOPOLOGY, "bsd_taste(%s,%s)", mp->name, pp->name);
336 g_topology_assert();
337 if (flags == G_TF_NORMAL &&
323{
324 struct g_geom *gp;
325 struct g_consumer *cp;
326 struct g_provider *pp2;
327 int error, i, j, npart;
328 struct g_bsd_softc *ms;
329 struct disklabel *dl;
330 u_int secsize;
331 u_int fwsectors, fwheads;
332 off_t mediasize;
333 struct partition *ppp, *ppr;
334
335 g_trace(G_T_TOPOLOGY, "bsd_taste(%s,%s)", mp->name, pp->name);
336 g_topology_assert();
337 if (flags == G_TF_NORMAL &&
338 !strcmp(pp->geom->method->name, BSD_METHOD_NAME))
338 !strcmp(pp->geom->class->name, BSD_CLASS_NAME))
339 return (NULL);
340 gp = g_slice_new(mp, 8, pp, &cp, &ms, sizeof *ms, g_bsd_start);
341 if (gp == NULL)
342 return (NULL);
343 g_topology_unlock();
344 gp->dumpconf = g_bsd_dumpconf;
345 npart = 0;
346 while (1) { /* a trick to allow us to use break */

--- 81 unchanged lines hidden (view full) ---

428 g_topology_lock();
429 error = g_access_rel(cp, -1, 0, 0);
430 if (npart > 0)
431 return (gp);
432 g_std_spoiled(cp);
433 return (NULL);
434}
435
339 return (NULL);
340 gp = g_slice_new(mp, 8, pp, &cp, &ms, sizeof *ms, g_bsd_start);
341 if (gp == NULL)
342 return (NULL);
343 g_topology_unlock();
344 gp->dumpconf = g_bsd_dumpconf;
345 npart = 0;
346 while (1) { /* a trick to allow us to use break */

--- 81 unchanged lines hidden (view full) ---

428 g_topology_lock();
429 error = g_access_rel(cp, -1, 0, 0);
430 if (npart > 0)
431 return (gp);
432 g_std_spoiled(cp);
433 return (NULL);
434}
435
436static struct g_method g_bsd_method = {
437 BSD_METHOD_NAME,
436static struct g_class g_bsd_class = {
437 BSD_CLASS_NAME,
438 g_bsd_taste,
439 g_slice_access,
440 g_slice_orphan,
441 NULL,
438 g_bsd_taste,
439 g_slice_access,
440 g_slice_orphan,
441 NULL,
442 G_METHOD_INITSTUFF
442 G_CLASS_INITSTUFF
443};
444
443};
444
445DECLARE_GEOM_METHOD(g_bsd_method, g_bsd);
445DECLARE_GEOM_CLASS(g_bsd_class, g_bsd);