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 --- 17 unchanged lines hidden (view full) --- 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 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/geom/geom_mbr.c 133314 2004-08-08 06:49:07Z phk $"); |
35 36#include <sys/param.h> 37#include <sys/errno.h> 38#include <sys/endian.h> 39#include <sys/systm.h> 40#include <sys/kernel.h> 41#include <sys/malloc.h> 42#include <sys/bio.h> --- 193 unchanged lines hidden (view full) --- 236 u_char *buf; 237 238 g_trace(G_T_TOPOLOGY, "mbr_taste(%s,%s)", mp->name, pp->name); 239 g_topology_assert(); 240 gp = g_slice_new(mp, NDOSPART, pp, &cp, &ms, sizeof *ms, g_mbr_start); 241 if (gp == NULL) 242 return (NULL); 243 g_topology_unlock(); |
244 do { 245 /* XXX: phk think about this! */ 246 if (gp->rank != 2 && 247 strcmp(pp->geom->class->name, "LABEL") != 0 && 248 strcmp(pp->geom->class->name, "MIRROR") != 0 && 249 strcmp(pp->geom->class->name, "NOP") != 0) { 250 break; 251 } --- 20 unchanged lines hidden (view full) --- 272 return (NULL); 273 } 274 return (gp); 275} 276 277static struct g_class g_mbr_class = { 278 .name = MBR_CLASS_NAME, 279 .taste = g_mbr_taste, |
280 .dumpconf = g_mbr_dumpconf, 281 .ioctl = g_mbr_ioctl, |
282}; 283 284DECLARE_GEOM_CLASS(g_mbr_class, g_mbr); 285 286#define NDOSEXTPART 32 287struct g_mbrext_softc { 288 int type [NDOSEXTPART]; 289}; --- 53 unchanged lines hidden (view full) --- 343 g_topology_assert(); 344 if (strcmp(pp->geom->class->name, MBR_CLASS_NAME)) 345 return (NULL); 346 gp = g_slice_new(mp, NDOSEXTPART, pp, &cp, &ms, sizeof *ms, 347 g_mbrext_start); 348 if (gp == NULL) 349 return (NULL); 350 g_topology_unlock(); |
351 off = 0; 352 slice = 0; 353 do { 354 error = g_getattr("MBR::type", cp, &i); 355 if (error || (i != DOSPTYP_EXT && i != DOSPTYP_EXTLBA)) 356 break; 357 error = g_getattr("GEOM::fwsectors", cp, &fwsectors); 358 if (error) --- 55 unchanged lines hidden (view full) --- 414 } 415 return (gp); 416} 417 418 419static struct g_class g_mbrext_class = { 420 .name = MBREXT_CLASS_NAME, 421 .taste = g_mbrext_taste, |
422 .dumpconf = g_mbrext_dumpconf, |
423}; 424 425DECLARE_GEOM_CLASS(g_mbrext_class, g_mbrext); |