diff options
author | sobomax <sobomax@FreeBSD.org> | 2005-11-30 22:54:41 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2005-11-30 22:54:41 +0000 |
commit | 44ba92fd8a305caee99b775a8e041b77ea5ee81d (patch) | |
tree | ec52f3da27b51021030560bd21fc6d78192ff3d4 /sys/geom/geom_bsd.c | |
parent | 16e3e466ccc1974e0b78451d67ba767ee0856d43 (diff) | |
download | FreeBSD-src-44ba92fd8a305caee99b775a8e041b77ea5ee81d.zip FreeBSD-src-44ba92fd8a305caee99b775a8e041b77ea5ee81d.tar.gz |
It is unclear who is wrong and who is right, but when operating on
plain file bsdlabel(8) always writes label at a fixed offset from
its beginning (512 bytes), regardless of the sector size. At the same
time, bsdlabel geom class expects label to be available at the very
beginning of the second sector.
As a result, images prepared in userland for media with sector size
different from 512 bytes (i.e. 2k for cdroms) are not recognized by
the tasting mechanism.
Solve the problem by always looking for the label at 512-byte offset
if we can't find it at the beginning of the second sector and sector
size is not 512 bytes.
Diffstat (limited to 'sys/geom/geom_bsd.c')
-rw-r--r-- | sys/geom/geom_bsd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index dbca175..b7402cf 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #define BSD_CLASS_NAME "BSD" #define ALPHA_LABEL_OFFSET 64 +#define HISTORIC_LABEL_OFFSET 512 #define LABELSIZE (148 + 16 * MAXPARTITIONS) @@ -536,6 +537,15 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) /* First look for a label at the start of the second sector. */ error = g_bsd_try(gp, gsp, cp, secsize, ms, secsize); + /* + * If sector size is not 512 the label still can be at + * offset 512, not at the start of the second sector. At least + * it's true for labels created by the FreeBSD's bsdlabel(8). + */ + if (error && secsize != HISTORIC_LABEL_OFFSET) + error = g_bsd_try(gp, gsp, cp, secsize, ms, + HISTORIC_LABEL_OFFSET); + /* Next, look for alpha labels */ if (error) error = g_bsd_try(gp, gsp, cp, secsize, ms, |