Date: Mon, 24 Dec 2007 11:08:10 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 131511 for review Message-ID: <200712241108.lBOB8Afe079207@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=131511 Change 131511 by rwatson@rwatson_cinnamon on 2007/12/24 11:07:18 Integrate zcopybpf. Affected files ... .. //depot/projects/zcopybpf/src/sys/arm/at91/kb920x_machdep.c#7 integrate .. //depot/projects/zcopybpf/src/sys/geom/part/g_part_bsd.c#2 integrate Differences ... ==== //depot/projects/zcopybpf/src/sys/arm/at91/kb920x_machdep.c#7 (text) ==== @@ -48,7 +48,7 @@ #include "opt_at91.h" #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/arm/at91/kb920x_machdep.c,v 1.27 2007/11/05 11:36:10 kib Exp $"); +__FBSDID("$FreeBSD: src/sys/arm/at91/kb920x_machdep.c,v 1.28 2007/12/23 23:31:27 stas Exp $"); #define _ARM32_BUS_DMA_PRIVATE #include <sys/param.h> @@ -213,7 +213,7 @@ board_init(void) { /* - * Since the USART supprots RS-485 multidrop mode, it allows the + * Since the USART supports RS-485 multidrop mode, it allows the * TX pins to float. However, for RS-232 operations, we don't want * these pins to float. Instead, they should be pulled up to avoid * mismatches. Linux does something similar when it configures the ==== //depot/projects/zcopybpf/src/sys/geom/part/g_part_bsd.c#2 (text+ko) ==== @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/geom/part/g_part_bsd.c,v 1.2 2007/12/08 07:01:10 marcel Exp $"); +__FBSDID("$FreeBSD: src/sys/geom/part/g_part_bsd.c,v 1.3 2007/12/24 01:01:59 marcel Exp $"); #include <sys/param.h> #include <sys/bio.h> @@ -48,6 +48,7 @@ struct g_part_bsd_table { struct g_part_table base; u_char *label; + uint32_t offset; }; struct g_part_bsd_entry { @@ -137,35 +138,15 @@ { struct g_part_bsd_entry *entry; struct g_part_bsd_table *table; - uint32_t start, size, sectors; if (gpp->gpp_parms & G_PART_PARM_LABEL) return (EINVAL); - sectors = basetable->gpt_sectors; - entry = (struct g_part_bsd_entry *)baseentry; table = (struct g_part_bsd_table *)basetable; - start = gpp->gpp_start; - size = gpp->gpp_size; - if (size < sectors) - return (EINVAL); - if (start % sectors) { - size = size - sectors + (start % sectors); - start = start - (start % sectors) + sectors; - } - if (size % sectors) - size = size - (size % sectors); - if (size < sectors) - return (EINVAL); - - KASSERT(baseentry->gpe_start <= start, (__func__)); - KASSERT(baseentry->gpe_end >= start + size - 1, (__func__)); - baseentry->gpe_start = start; - baseentry->gpe_end = start + size - 1; - entry->part.p_size = size; - entry->part.p_offset = start + basetable->gpt_offset; + entry->part.p_size = gpp->gpp_size; + entry->part.p_offset = gpp->gpp_start + table->offset; entry->part.p_fsize = 0; entry->part.p_frag = 0; entry->part.p_cpg = 0; @@ -203,14 +184,14 @@ le32enc(ptr + 48, basetable->gpt_heads); /* d_ntracks */ le32enc(ptr + 52, ncyls); /* d_ncylinders */ le32enc(ptr + 56, secpercyl); /* d_secpercyl */ - le32enc(ptr + 60, ncyls * secpercyl); /* d_secperunit */ + le32enc(ptr + 60, msize); /* d_secperunit */ le16enc(ptr + 72, 3600); /* d_rpm */ le32enc(ptr + 132, DISKMAGIC); /* d_magic2 */ le16enc(ptr + 138, basetable->gpt_entries); /* d_npartitions */ le32enc(ptr + 140, BBSIZE); /* d_bbsize */ basetable->gpt_first = 0; - basetable->gpt_last = ncyls * secpercyl - 1; + basetable->gpt_last = msize - 1; basetable->gpt_isleaf = 1; baseentry = g_part_new_entry(basetable, RAW_PART + 1, @@ -218,7 +199,7 @@ baseentry->gpe_internal = 1; entry = (struct g_part_bsd_entry *)baseentry; entry->part.p_size = basetable->gpt_last + 1; - entry->part.p_offset = basetable->gpt_offset; + entry->part.p_offset = table->offset; return (0); } @@ -320,29 +301,31 @@ sectors = le32dec(buf + 44); if (sectors < 1 || sectors > 63) goto invalid_label; - if (sectors != basetable->gpt_sectors) { - if (basetable->gpt_fixgeom) - goto invalid_label; + if (sectors != basetable->gpt_sectors && !basetable->gpt_fixgeom) { g_part_geometry_heads(msize, sectors, &chs, &heads); - if (chs == 0) - goto invalid_label; - basetable->gpt_sectors = sectors; - basetable->gpt_heads = heads; + if (chs != 0) { + basetable->gpt_sectors = sectors; + basetable->gpt_heads = heads; + } } heads = le32dec(buf + 48); if (heads < 1 || heads > 255) goto invalid_label; - if (heads != basetable->gpt_heads) { - if (basetable->gpt_fixgeom) - goto invalid_label; + if (heads != basetable->gpt_heads && !basetable->gpt_fixgeom) basetable->gpt_heads = heads; - } - chs = le32dec(buf + 52) * heads * sectors; + if (sectors != basetable->gpt_sectors || + heads != basetable->gpt_heads) + printf("GEOM: %s: geometry does not match label.\n", pp->name); + + chs = le32dec(buf + 60); if (chs < 1 || chs > msize) goto invalid_label; + if (chs != msize) + printf("GEOM: %s: media size does not match label.\n", + pp->name); basetable->gpt_first = 0; - basetable->gpt_last = chs - 1; + basetable->gpt_last = msize - 1; basetable->gpt_isleaf = 1; basetable->gpt_entries = le16dec(buf + 138); @@ -350,6 +333,7 @@ basetable->gpt_entries > g_part_bsd_scheme.gps_maxent) goto invalid_label; + table->offset = le32dec(buf + 148 + RAW_PART * 16 + 4); for (index = basetable->gpt_entries - 1; index >= 0; index--) { p = buf + 148 + index * 16; part.p_size = le32dec(p + 0); @@ -362,11 +346,11 @@ continue; if (part.p_fstype == FS_UNUSED && index != RAW_PART) continue; - if (part.p_offset < basetable->gpt_offset) + if (part.p_offset < table->offset) continue; baseentry = g_part_new_entry(basetable, index + 1, - part.p_offset - basetable->gpt_offset, - part.p_offset - basetable->gpt_offset + part.p_size - 1); + part.p_offset - table->offset, + part.p_offset - table->offset + part.p_size - 1); entry = (struct g_part_bsd_entry *)baseentry; entry->part = part; if (part.p_fstype == FS_UNUSED)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712241108.lBOB8Afe079207>