Deleted Added
full compact
geom_bsd.c (119660) geom_bsd.c (125755)
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

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

33 * SUCH DAMAGE.
34 *
35 * This is the method for dealing with BSD disklabels. It has been
36 * extensively (by my standards at least) commented, in the vain hope that
37 * it will serve as the source in future copy&paste operations.
38 */
39
40#include <sys/cdefs.h>
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

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

33 * SUCH DAMAGE.
34 *
35 * This is the method for dealing with BSD disklabels. It has been
36 * extensively (by my standards at least) commented, in the vain hope that
37 * it will serve as the source in future copy&paste operations.
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/geom/geom_bsd.c 119660 2003-09-01 20:45:32Z phk $");
41__FBSDID("$FreeBSD: head/sys/geom/geom_bsd.c 125755 2004-02-12 22:42:11Z phk $");
42
43#include <sys/param.h>
44#include <sys/endian.h>
45#include <sys/systm.h>
46#include <sys/kernel.h>
47#include <sys/conf.h>
48#include <sys/bio.h>
49#include <sys/malloc.h>

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

564 /*
565 * Process the found disklabel, and modify our "slice"
566 * instance to match it, if possible.
567 */
568 error = g_bsd_modify(gp, ms->label);
569 } while (0);
570
571 /* Success or failure, we can close our provider now. */
42
43#include <sys/param.h>
44#include <sys/endian.h>
45#include <sys/systm.h>
46#include <sys/kernel.h>
47#include <sys/conf.h>
48#include <sys/bio.h>
49#include <sys/malloc.h>

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

564 /*
565 * Process the found disklabel, and modify our "slice"
566 * instance to match it, if possible.
567 */
568 error = g_bsd_modify(gp, ms->label);
569 } while (0);
570
571 /* Success or failure, we can close our provider now. */
572 error = g_access_rel(cp, -1, 0, 0);
572 error = g_access(cp, -1, 0, 0);
573
574 /* If we have configured any providers, return the new geom. */
575 if (gsp->nprovider > 0) {
576 g_slice_conf_hot(gp, 0, ms->labeloffset, LABELSIZE,
577 G_SLICE_HOT_ALLOW, G_SLICE_HOT_DENY, G_SLICE_HOT_CALL);
578 gsp->hot = g_bsd_hotwrite;
579 return (gp);
580 }

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

634 label = gctl_get_paraml(req, "label", LABELSIZE);
635 if (label == NULL)
636 return;
637 h0h0.gp = gp;
638 h0h0.ms = gsp->softc;
639 h0h0.label = label;
640 h0h0.error = -1;
641 /* XXX: Does this reference register with our selfdestruct code ? */
573
574 /* If we have configured any providers, return the new geom. */
575 if (gsp->nprovider > 0) {
576 g_slice_conf_hot(gp, 0, ms->labeloffset, LABELSIZE,
577 G_SLICE_HOT_ALLOW, G_SLICE_HOT_DENY, G_SLICE_HOT_CALL);
578 gsp->hot = g_bsd_hotwrite;
579 return (gp);
580 }

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

634 label = gctl_get_paraml(req, "label", LABELSIZE);
635 if (label == NULL)
636 return;
637 h0h0.gp = gp;
638 h0h0.ms = gsp->softc;
639 h0h0.label = label;
640 h0h0.error = -1;
641 /* XXX: Does this reference register with our selfdestruct code ? */
642 error = g_access_rel(cp, 1, 1, 1);
642 error = g_access(cp, 1, 1, 1);
643 if (error) {
644 gctl_error(req, "could not access consumer");
645 return;
646 }
647 g_bsd_callconfig(&h0h0, 0);
648 error = h0h0.error;
643 if (error) {
644 gctl_error(req, "could not access consumer");
645 return;
646 }
647 g_bsd_callconfig(&h0h0, 0);
648 error = h0h0.error;
649 g_access_rel(cp, -1, -1, -1);
649 g_access(cp, -1, -1, -1);
650 } else if (!strcmp(verb, "write bootcode")) {
651 label = gctl_get_paraml(req, "bootcode", BBSIZE);
652 if (label == NULL)
653 return;
654 /* XXX: Does this reference register with our selfdestruct code ? */
650 } else if (!strcmp(verb, "write bootcode")) {
651 label = gctl_get_paraml(req, "bootcode", BBSIZE);
652 if (label == NULL)
653 return;
654 /* XXX: Does this reference register with our selfdestruct code ? */
655 error = g_access_rel(cp, 1, 1, 1);
655 error = g_access(cp, 1, 1, 1);
656 if (error) {
657 gctl_error(req, "could not access consumer");
658 return;
659 }
660 error = g_bsd_writelabel(gp, label);
656 if (error) {
657 gctl_error(req, "could not access consumer");
658 return;
659 }
660 error = g_bsd_writelabel(gp, label);
661 g_access_rel(cp, -1, -1, -1);
661 g_access(cp, -1, -1, -1);
662 } else {
663 gctl_error(req, "Unknown verb parameter");
664 }
665
666 return;
667}
668
669/* Finally, register with GEOM infrastructure. */
670static struct g_class g_bsd_class = {
671 .name = BSD_CLASS_NAME,
672 .taste = g_bsd_taste,
673 .ctlreq = g_bsd_config,
674};
675
676DECLARE_GEOM_CLASS(g_bsd_class, g_bsd);
662 } else {
663 gctl_error(req, "Unknown verb parameter");
664 }
665
666 return;
667}
668
669/* Finally, register with GEOM infrastructure. */
670static struct g_class g_bsd_class = {
671 .name = BSD_CLASS_NAME,
672 .taste = g_bsd_taste,
673 .ctlreq = g_bsd_config,
674};
675
676DECLARE_GEOM_CLASS(g_bsd_class, g_bsd);