Deleted Added
full compact
geom_pc98.c (107562) geom_pc98.c (107953)
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

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

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
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

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

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $FreeBSD: head/sys/geom/geom_pc98.c 107562 2002-12-03 20:20:44Z sos $
32 * $FreeBSD: head/sys/geom/geom_pc98.c 107953 2002-12-16 22:33:27Z phk $
33 */
34
35#include <sys/param.h>
36#ifndef _KERNEL
37#include <signal.h>
38#include <stdio.h>
39#include <stdlib.h>
40#include <string.h>

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

52#include <geom/geom.h>
53#include <geom/geom_slice.h>
54
55#define PC98_CLASS_NAME "PC98"
56
57static void
58g_dec_dos_partition(u_char *ptr, struct dos_partition *d)
59{
33 */
34
35#include <sys/param.h>
36#ifndef _KERNEL
37#include <signal.h>
38#include <stdio.h>
39#include <stdlib.h>
40#include <string.h>

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

52#include <geom/geom.h>
53#include <geom/geom_slice.h>
54
55#define PC98_CLASS_NAME "PC98"
56
57static void
58g_dec_dos_partition(u_char *ptr, struct dos_partition *d)
59{
60 int i;
60 u_int u;
61
62 d->dp_mid = ptr[0];
63 d->dp_sid = ptr[1];
64 d->dp_dum1 = ptr[2];
65 d->dp_dum2 = ptr[3];
66 d->dp_ipl_sct = ptr[4];
67 d->dp_ipl_head = ptr[5];
68 d->dp_ipl_cyl = g_dec_le2(ptr + 6);
69 d->dp_ssect = ptr[8];
70 d->dp_shd = ptr[9];
71 d->dp_scyl = g_dec_le2(ptr + 10);
72 d->dp_esect = ptr[12];
73 d->dp_ehd = ptr[13];
74 d->dp_ecyl = g_dec_le2(ptr + 14);
61
62 d->dp_mid = ptr[0];
63 d->dp_sid = ptr[1];
64 d->dp_dum1 = ptr[2];
65 d->dp_dum2 = ptr[3];
66 d->dp_ipl_sct = ptr[4];
67 d->dp_ipl_head = ptr[5];
68 d->dp_ipl_cyl = g_dec_le2(ptr + 6);
69 d->dp_ssect = ptr[8];
70 d->dp_shd = ptr[9];
71 d->dp_scyl = g_dec_le2(ptr + 10);
72 d->dp_esect = ptr[12];
73 d->dp_ehd = ptr[13];
74 d->dp_ecyl = g_dec_le2(ptr + 14);
75 for (i = 0; i < sizeof(d->dp_name); i++)
76 d->dp_name[i] = ptr[16 + i];
75 for (u = 0; u < sizeof(d->dp_name); u++)
76 d->dp_name[u] = ptr[16 + u];
77}
78
79struct g_pc98_softc {
80 int type [NDOSPART];
81 struct dos_partition dp[NDOSPART];
82};
83
84static int
85g_pc98_start(struct bio *bp)
86{
87 struct g_provider *pp;
88 struct g_geom *gp;
89 struct g_pc98_softc *mp;
90 struct g_slicer *gsp;
77}
78
79struct g_pc98_softc {
80 int type [NDOSPART];
81 struct dos_partition dp[NDOSPART];
82};
83
84static int
85g_pc98_start(struct bio *bp)
86{
87 struct g_provider *pp;
88 struct g_geom *gp;
89 struct g_pc98_softc *mp;
90 struct g_slicer *gsp;
91 int index;
91 int idx;
92
93 pp = bp->bio_to;
92
93 pp = bp->bio_to;
94 index = pp->index;
94 idx = pp->index;
95 gp = pp->geom;
96 gsp = gp->softc;
97 mp = gsp->softc;
98 if (bp->bio_cmd == BIO_GETATTR) {
95 gp = pp->geom;
96 gsp = gp->softc;
97 mp = gsp->softc;
98 if (bp->bio_cmd == BIO_GETATTR) {
99 if (g_handleattr_int(bp, "PC98::type", mp->type[index]))
99 if (g_handleattr_int(bp, "PC98::type", mp->type[idx]))
100 return (1);
101 if (g_handleattr_off_t(bp, "PC98::offset",
100 return (1);
101 if (g_handleattr_off_t(bp, "PC98::offset",
102 gsp->slices[index].offset))
102 gsp->slices[idx].offset))
103 return (1);
104 }
105 return (0);
106}
107
108static void
103 return (1);
104 }
105 return (0);
106}
107
108static void
109g_pc98_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp,
109g_pc98_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp,
110 struct g_consumer *cp __unused, struct g_provider *pp)
111{
112 struct g_pc98_softc *mp;
113 struct g_slicer *gsp;
114 char sname[17];
115
116 gsp = gp->softc;
117 mp = gsp->softc;

--- 151 unchanged lines hidden ---
110 struct g_consumer *cp __unused, struct g_provider *pp)
111{
112 struct g_pc98_softc *mp;
113 struct g_slicer *gsp;
114 char sname[17];
115
116 gsp = gp->softc;
117 mp = gsp->softc;

--- 151 unchanged lines hidden ---