~kris/9p

9hist

ae76db6206afa100bdbee39669a69dbc77601f5f — David du Colombier 30 years ago 735e3b8
Plan 9 from Bell Labs 1996-03-26
1 files changed, 21 insertions(+), 1 deletions(-)

M port/cache.c
M port/cache.c => port/cache.c +21 -1
@@ 498,7 498,7 @@ cupdate(Chan *c, uchar *buf, int len, ulong offset)
void
cwrite(Chan* c, uchar *buf, int len, ulong offset)
{
	int o;
	int o, n;
	Mntcache *m;
	ulong eblock, ee;
	Extent *p, *f, *e, *tail;


@@ 526,6 526,26 @@ cwrite(Chan* c, uchar *buf, int len, ulong offset)
		p = f;		
	}

	if(f != 0) {
		o = offset - f->start;
		if(o >= 0) {
			n = f->len - o;
			if(n > len)
				n = len;
			if(n > 0) {
				if(cpgmove(f, buf, o, n)) {
					buf += n;
					len -= n;
					offset += n;
				}
				if(len == 0) {
					qunlock(m);
					return;
				}
			}	
		}
	}

	if(p != 0) {
		ee = p->start+p->len;
		if(ee > offset) {