summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-06-05 12:00:53 +0000
committerphk <phk@FreeBSD.org>2002-06-05 12:00:53 +0000
commit353a43a7682d103c330ddb06d13af5313dde0ed8 (patch)
treea8fbd3592eec0312b18655b426525dc8e09ee0bf /sys/boot/common
parentf256ed9075894a52ada09e2947e30d7ec937cf0f (diff)
downloadFreeBSD-src-353a43a7682d103c330ddb06d13af5313dde0ed8.zip
FreeBSD-src-353a43a7682d103c330ddb06d13af5313dde0ed8.tar.gz
Make sparc64 share ufsread.c with i386.
Sponsored by: DARPA & NAI Labs.
Diffstat (limited to 'sys/boot/common')
-rw-r--r--sys/boot/common/ufsread.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/boot/common/ufsread.c b/sys/boot/common/ufsread.c
index b478c25..053dbe0 100644
--- a/sys/boot/common/ufsread.c
+++ b/sys/boot/common/ufsread.c
@@ -37,12 +37,13 @@
#define FS_TO_VBO(fs, fsb, off) ((off) & VBLKMASK)
/* Buffers that must not span a 64k boundary. */
-static struct dmadat {
+struct dmadat {
char blkbuf[VBLKSIZE]; /* filesystem blocks */
ufs_daddr_t indbuf[VBLKSIZE / sizeof(ufs_daddr_t)]; /* indir blocks */
char sbbuf[SBSIZE]; /* superblock */
char secbuf[DEV_BSIZE]; /* for MBR/disklabel */
-} *dmadat;
+};
+static struct dmadat *dmadat;
static ino_t lookup(const char *);
static ssize_t fsread(ino_t, void *, size_t);
@@ -71,7 +72,7 @@ fsfind(const char *name, ino_t * ino)
s += d->d_reclen;
}
if (n != -1 && ls)
- putchar('\n');
+ printf("\n");
return 0;
}
@@ -86,6 +87,8 @@ lookup(const char *path)
ino = ROOTINO;
dt = DT_DIR;
+ name[0] = '/';
+ name[1] = '\0';
for (;;) {
if (*path == '/')
path++;
@@ -97,6 +100,10 @@ lookup(const char *path)
ls = *path == '?' && n == 1 && !*s;
memcpy(name, path, n);
name[n] = 0;
+ if (dt != DT_DIR) {
+ printf("%s: not a directory.\n", name);
+ return (0);
+ }
if ((dt = fsfind(name, &ino)) <= 0)
break;
path = s;
@@ -180,4 +187,3 @@ fsread(ino_t inode, void *buf, size_t nbyte)
}
return nbyte;
}
-
OpenPOWER on IntegriCloud