Module Name:    src
Committed By:   mlelstv
Date:           Sun Jan 31 16:04:35 UTC 2010

Modified Files:
        src/sbin/fsck_ffs: setup.c
        src/sbin/newfs: mkfs.c

Log Message:
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?


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sbin/fsck_ffs/setup.c
cvs rdiff -u -r1.106 -r1.107 src/sbin/newfs/mkfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/fsck_ffs/setup.c
diff -u src/sbin/fsck_ffs/setup.c:1.89 src/sbin/fsck_ffs/setup.c:1.90
--- src/sbin/fsck_ffs/setup.c:1.89	Sun Sep 27 17:13:37 2009
+++ src/sbin/fsck_ffs/setup.c	Sun Jan 31 16:04:35 2010
@@ -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 @@
 	/* 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;

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.106 src/sbin/newfs/mkfs.c:1.107
--- src/sbin/newfs/mkfs.c:1.106	Thu May  7 06:56:56 2009
+++ src/sbin/newfs/mkfs.c	Sun Jan 31 16:04:34 2010
@@ -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 @@
 			    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,

Reply via email to