Deleted Added
full compact
geom_sunlabel.c (105542) geom_sunlabel.c (105551)
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_sunlabel.c 105542 2002-10-20 19:18:07Z phk $
35 * $FreeBSD: head/sys/geom/geom_sunlabel.c 105551 2002-10-20 20:28:24Z phk $
36 */
37
38
39#include <sys/param.h>
40#ifndef _KERNEL
41#include <stdio.h>
42#include <string.h>
43#include <stdlib.h>

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

105 return (NULL);
106 gsp = gp->softc;
107 g_topology_unlock();
108 gp->dumpconf = g_sunlabel_dumpconf;
109 npart = 0;
110 while (1) { /* a trick to allow us to use break */
111 if (gp->rank != 2 && flags == G_TF_NORMAL)
112 break;
36 */
37
38
39#include <sys/param.h>
40#ifndef _KERNEL
41#include <stdio.h>
42#include <string.h>
43#include <stdlib.h>

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

105 return (NULL);
106 gsp = gp->softc;
107 g_topology_unlock();
108 gp->dumpconf = g_sunlabel_dumpconf;
109 npart = 0;
110 while (1) { /* a trick to allow us to use break */
111 if (gp->rank != 2 && flags == G_TF_NORMAL)
112 break;
113 error = g_getattr("GEOM::sectorsize", cp, &sectorsize);
114 if (error) {
115 sectorsize = 512;
116 printf("g_sunlabel_taste: error %d Sectors are %d bytes\n",
117 error, sectorsize);
118 }
113 sectorsize = cp->provider->sectorsize;
114 if (sectorsize < 512)
115 break;
119 gsp->frontstuff = 16 * sectorsize;
116 gsp->frontstuff = 16 * sectorsize;
120 error = g_getattr("GEOM::mediasize", cp, &mediasize);
121 if (error) {
122 mediasize = 0;
123 printf("g_error %d Mediasize is %lld bytes\n",
124 error, (long long)mediasize);
125 }
117 mediasize = cp->provider->mediasize;
126 buf = g_read_data(cp, 0, sectorsize, &error);
127 if (buf == NULL || error != 0)
128 break;
129
130 /* The second last short is a magic number */
131 if (g_dec_be2(buf + 508) != 0xdabe)
132 break;
133 /* The shortword parity of the entire thing must be even */

--- 64 unchanged lines hidden ---
118 buf = g_read_data(cp, 0, sectorsize, &error);
119 if (buf == NULL || error != 0)
120 break;
121
122 /* The second last short is a magic number */
123 if (g_dec_be2(buf + 508) != 0xdabe)
124 break;
125 /* The shortword parity of the entire thing must be even */

--- 64 unchanged lines hidden ---