Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2009 08:22:36 +0000 (UTC)
From:      Doug Rabson <dfr@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192972 - in head/sys/boot: common pc98/boot2
Message-ID:  <200905280822.n4S8MaKf028523@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dfr
Date: Thu May 28 08:22:36 2009
New Revision: 192972
URL: http://svn.freebsd.org/changeset/base/192972

Log:
  Some of the boot loader code only works on a ufs file system, but it
  uses the generic struct dirent, which happens to look identical to UFS's
  struct direct.  If BSD ever changes dirent then this will be a problem.
  
  Submitted by:	matthew dot fleming at isilon dot com

Modified:
  head/sys/boot/common/ufsread.c
  head/sys/boot/pc98/boot2/sys.c

Modified: head/sys/boot/common/ufsread.c
==============================================================================
--- head/sys/boot/common/ufsread.c	Thu May 28 08:18:12 2009	(r192971)
+++ head/sys/boot/common/ufsread.c	Thu May 28 08:22:36 2009	(r192972)
@@ -47,6 +47,7 @@
 __FBSDID("$FreeBSD$");
 
 #include <ufs/ufs/dinode.h>
+#include <ufs/ufs/dir.h>
 #include <ufs/ffs/fs.h>
 #ifdef UFS_SMALL_CGBASE
 /* XXX: Revert to old (broken for over 1.5Tb filesystems) version of cgbase
@@ -93,7 +94,7 @@ static __inline int
 fsfind(const char *name, ino_t * ino)
 {
 	char buf[DEV_BSIZE];
-	struct dirent *d;
+	struct direct *d;
 	char *s;
 	ssize_t n;
 
@@ -104,7 +105,7 @@ fsfind(const char *name, ino_t * ino)
 			if (ls)
 				printf("%s ", d->d_name);
 			else if (!strcmp(name, d->d_name)) {
-				*ino = d->d_fileno;
+				*ino = d->d_ino;
 				return d->d_type;
 			}
 			s += d->d_reclen;

Modified: head/sys/boot/pc98/boot2/sys.c
==============================================================================
--- head/sys/boot/pc98/boot2/sys.c	Thu May 28 08:18:12 2009	(r192971)
+++ head/sys/boot/pc98/boot2/sys.c	Thu May 28 08:22:36 2009	(r192972)
@@ -34,7 +34,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include "boot.h"
-#include <sys/dirent.h>
+#include <ufs/ufs/dir.h>
 
 #if 0
 /* #define BUFSIZE 4096 */
@@ -142,7 +142,7 @@ find(char *path)
 {
 	char *rest, ch;
 	int block, off, loc, ino = ROOTINO;
-	struct dirent *dp;
+	struct direct *dp;
 	char list_only;
 
 	list_only = (path[0] == '?' && path[1] == '\0');
@@ -174,12 +174,12 @@ loop:
 			devread(iobuf, fsbtodb(fs, block_map(block)) + boff,
 				blksize(fs, &inode, block));
 		}
-		dp = (struct dirent *)(iobuf + off);
+		dp = (struct direct *)(iobuf + off);
 		loc += dp->d_reclen;
-		if (dp->d_fileno && list_only)
+		if (dp->d_ino && list_only)
 			printf("%s ", dp->d_name);
-	} while (!dp->d_fileno || strcmp(path, dp->d_name));
-	ino = dp->d_fileno;
+	} while (!dp->d_ino || strcmp(path, dp->d_name));
+	ino = dp->d_ino;
 	*(path = rest) = ch;
 	goto loop;
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905280822.n4S8MaKf028523>