Add suppport for FSEntry_file 255, loading whole files. Now I can open
/etc/passwd in Zap.
This commit is contained in:
parent
300e182521
commit
b314f251e2
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: nbfs.c,v 1.4 2006/07/02 22:06:16 bjh21 Exp $ */
|
/* $NetBSD: nbfs.c,v 1.5 2006/07/04 22:34:54 bjh21 Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2006 Ben Harris
|
* Copyright (c) 2006 Ben Harris
|
||||||
|
@ -255,6 +255,7 @@ nbfs_file(struct nbfs_reg *r)
|
||||||
static os_error error = {0, "nbfs_file"};
|
static os_error error = {0, "nbfs_file"};
|
||||||
int reason = r->r0;
|
int reason = r->r0;
|
||||||
char const *fname = (char const *)r->r1;
|
char const *fname = (char const *)r->r1;
|
||||||
|
void *buf = (void *)r->r2;
|
||||||
char const *special = (char const *)r->r6;
|
char const *special = (char const *)r->r6;
|
||||||
struct open_file f;
|
struct open_file f;
|
||||||
int err;
|
int err;
|
||||||
|
@ -266,6 +267,7 @@ nbfs_file(struct nbfs_reg *r)
|
||||||
return &error;
|
return &error;
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case 5:
|
case 5:
|
||||||
|
case 255:
|
||||||
if (err == ENOENT)
|
if (err == ENOENT)
|
||||||
r->r0 = r->r2 = r->r3 = r->r4 = r->r5 = 0;
|
r->r0 = r->r2 = r->r3 = r->r4 = r->r5 = 0;
|
||||||
else {
|
else {
|
||||||
|
@ -277,6 +279,13 @@ nbfs_file(struct nbfs_reg *r)
|
||||||
r->r4 = st.st_size;
|
r->r4 = st.st_size;
|
||||||
r->r5 = fileswitch_ATTR_OWNER_READ |
|
r->r5 = fileswitch_ATTR_OWNER_READ |
|
||||||
fileswitch_ATTR_WORLD_READ;
|
fileswitch_ATTR_WORLD_READ;
|
||||||
|
if (reason == 255) {
|
||||||
|
err = FS_READ(f.f_ops)
|
||||||
|
(&f, buf, st.st_size, NULL);
|
||||||
|
if (err != 0) goto fail;
|
||||||
|
/* R6 should really be the leaf name */
|
||||||
|
r->r6 = r->r1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
$NetBSD: version,v 1.1 2006/04/05 21:33:26 bjh21 Exp $
|
$NetBSD: version,v 1.2 2006/07/04 22:34:54 bjh21 Exp $
|
||||||
|
|
||||||
0.01: Just about enough code to launch a kernel from it.
|
0.01: Just about enough code to launch a kernel from it.
|
||||||
|
0.02: Reading directory entries and loading whole files.
|
Loading…
Reference in New Issue