Skip handling of APPLEUFS_LABEL if it is smaller than a device block.

In particular:

- newfs will not try to erase the label
- fsck_ffs will not try to validate the label

This lets newfs and fsck work on 2048-byte-per-sector media.

Does Apple UFS support such media and how?
This commit is contained in:
mlelstv 2010-01-31 16:04:34 +00:00
parent d2fd323d98
commit 0aef69272b
2 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: setup.c,v 1.89 2009/09/27 17:13:37 bouyer Exp $ */
/* $NetBSD: setup.c,v 1.90 2010/01/31 16:04:35 mlelstv Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.10 (Berkeley) 5/9/95";
#else
__RCSID("$NetBSD: setup.c,v 1.89 2009/09/27 17:13:37 bouyer Exp $");
__RCSID("$NetBSD: setup.c,v 1.90 2010/01/31 16:04:35 mlelstv Exp $");
#endif
#endif /* not lint */
@ -554,6 +554,8 @@ readappleufs(void)
/* XXX do we have to deal with APPLEUFS_LABEL_OFFSET not
* being block aligned (CD's?)
*/
if (APPLEUFS_LABEL_SIZE % dev_bsize != 0)
return 0;
if (bread(fsreadfd, (char *)appleufsblk.b_un.b_fs, label,
(long)APPLEUFS_LABEL_SIZE) != 0)
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkfs.c,v 1.106 2009/05/07 06:56:56 lukem Exp $ */
/* $NetBSD: mkfs.c,v 1.107 2010/01/31 16:04:34 mlelstv Exp $ */
/*
* Copyright (c) 1980, 1989, 1993
@ -73,7 +73,7 @@
#if 0
static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95";
#else
__RCSID("$NetBSD: mkfs.c,v 1.106 2009/05/07 06:56:56 lukem Exp $");
__RCSID("$NetBSD: mkfs.c,v 1.107 2010/01/31 16:04:34 mlelstv Exp $");
#endif
#endif /* not lint */
@ -603,7 +603,7 @@ mkfs(const char *fsys, int fi, int fo,
tv.tv_sec, 0);
wtfs(APPLEUFS_LABEL_OFFSET/sectorsize,
APPLEUFS_LABEL_SIZE, &appleufs);
} else {
} else if (APPLEUFS_LABEL_SIZE % sectorsize == 0) {
struct appleufslabel appleufs;
/* Look for & zap any existing valid apple ufs labels */
rdfs(APPLEUFS_LABEL_OFFSET/sectorsize,