From 6ff92c14b7a65f64dea4e0d4e8d19b2dcf3f57b3 Mon Sep 17 00:00:00 2001 From: msmith Date: Tue, 5 Sep 2000 09:52:50 +0000 Subject: Implement readahead buffering for non-raw files. This drastically improves the efficiency of byte-by-byte read operations on filesystems not already supported by the block cache (especially NFS). This should be a welcome change for users booting via PXE, as the loader now reads its startup files almost instantly, instead of taking tens of seconds. --- lib/libstand/open.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/libstand/open.c') diff --git a/lib/libstand/open.c b/lib/libstand/open.c index 3a9127c..471f937 100644 --- a/lib/libstand/open.c +++ b/lib/libstand/open.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* $NetBSD: open.c,v 1.16 1997/01/28 09:41:03 pk Exp $ */ /*- @@ -79,6 +80,13 @@ o_gethandle(void) return(-1); } +static void +o_rainit(struct open_file *f) +{ + f->f_rabuf = malloc(SOPEN_RASIZE); + f->f_ralen = 0; + f->f_raoffset = 0; +} int open(const char *fname, int mode) @@ -118,6 +126,7 @@ open(const char *fname, int mode) if (error == 0) { f->f_ops = file_system[i]; + o_rainit(f); return (fd); } if (error != EINVAL) -- cgit v1.1