9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@cse.psu.edu, cej@gli.cas.cz,
	erik quanstrom <quanstro@quanstro.net>
Subject: [9fans] tarfs & 2GB limit
Date: Sat, 14 Jan 2006 06:15:50 -0600	[thread overview]
Message-ID: <20060114121550.4FD0134FFB@dexter-peak.quanstro.net> (raw)
In-Reply-To: <20060113164151.ED27C35076@dexter-peak.quanstro.net>

[-- Attachment #1: Type: text/plain, Size: 5820 bytes --]

i've been able to read tarballs >2G and read individual files >2G in tarballs
with these changes. i've also incorporated the suggested cleanup.

one question, with tpfs, there's a cast to vlong:
	seek(tapefile, 512*(vlong)r->data+off, 0);
i cast to (int) because the size is only 3 bytes.
is there anything drasticlly wrong with this?

- erik

./fs.c
108c108
< 	r->blockno = 0;
---
> 	r->data = 0;
406,407c406,407
< //	if(off > 100*1024*1024)		/* sanity check */
< //		return "write too big";
---
> 	if(off > 100*1024*1024)		/* sanity check */
> 		return "write too big";
=====================================================
./32vfs.c
106c106
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
109,117c109,112
< 	uvlong _bno;
< 	ulong bno;
< 	int i;
< 
< 	_bno = off/BLSIZE;
< 	off -= _bno*BLSIZE;
< 	bno = (ulong)bno;
< 	if (bno!=_bno)
< 		error("offset to large");
---
> 	int bno, i;
> 
> 	bno = off/BLSIZE;
> 	off -= bno*BLSIZE;
133c128
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./zipfs.c
33a34,41
> extern void populate(char *);
> extern void dotrunc(Ram *);
> extern void docreate(Ram *);
> extern char *doread(Ram *, long, long);
> extern void popdir(Ram *);
> extern void dowrite(Ram *, char *, long, long);
> extern int dopermw(Ram *);
> 
101c109
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
113c121
< 	if (Bseek(bin, r->blockno, 0) < 0)
---
> 	if (Bseek(bin, (uvlong)r->data & 0x7fffffff, 0) < 0)
142c150
< 			if (r->blockno & 0x80000000 && MUNGE_CR){
---
> 			if ((uvlong)r->data & 0x80000000 && MUNGE_CR){
165c173
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./tapfs.c
95c95
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
99c99
< 	seek(tapefile, 512*(int)r->blockno+off, 0);
---
> 	seek(tapefile, 512*(vlong)r->data+off, 0);
105c105
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./tarfs.c
38,39c38
< 	vlong blkno;
< 	long isabs, chksum, linkflg;
---
> 	long blkno, isabs, chksum, linkflg;
52c51
< 		f.blockno = blkno+1;
---
> 		f.addr = (void*)(blkno+1);
56c55
< 		f.size = strtoull(dblock.dbuf.size, 0, 8);
---
> 		f.size = strtoul(dblock.dbuf.size, 0, 8);
62c61
< 		||  strrchr(dblock.dbuf.name, '\0')[-1] == '/')
---
> 		||  strrchr(dblock.dbuf.name, '\0')[-1] == '/'){
63a63,64
> 			f.size = 0;
> 		}
69c70
< 			abort();
---
> 			exits("checksum");
100c101
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
103c104
< 	seek(tapefile, (TBLOCK * r->blockno)+off, 0);
---
> 	seek(tapefile, (TBLOCK * (vlong)r->data)+off, 0);
117c118
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)
132,133c133,134
< 	int i;
< 	char *cp;
---
> 	register i;
> 	register char *cp;

=====================================================
./cpiofs.c
39c39
< uvlong	getoct(char*, int);
---
> int	getoct(char*, int);
79c79
< 		f.blockno = (offset+sizeof(struct header)+namesize);
---
> 		f.addr = (void*)(offset+sizeof(struct header)+namesize);
87c87
< uvlong
---
> int
90c90
< 	uvlong r;
---
> 	int r;
112c112
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
115c115
< 	seek(tapefile, r->blockno+off, 0);
---
> 	seek(tapefile, (vlong)r->data+off, 0);
129c129
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./v6fs.c
107c107
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
129c129
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./tpfs.c
20c20
< 	unsigned char	unused2[16];
---
> 	unsigned char	unused[16];
88c88
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
92c92
< 	seek(tapefile, 512*(int)r->blockno+off, 0);
---
> 	seek(tapefile, 512*(vlong)r->data+off, 0);
98c98
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./util.c
96c96
< 			ent->blockno = fi.blockno;
---
> 			ent->data = fi.addr;
133c133
< 	ent->blockno = fi.blockno;
---
> 	ent->data = fi.addr;

=====================================================
./tapefs.h
41,45c41,42
< 	union {
< 		void	*data;
< 		uvlong	blockno;
< 	};
< 	uvlong	ndata;
---
> 	void	*data;
> 	long	ndata;
65,69c62,63
< 	union {
< 		void	*addr;
< 		uvlong	blockno;
< 	};
< 	uvlong	size;
---
> 	void	*addr;
> 	long	size;
89,90c83,84
< char	*doread(Ram*, uvlong, long);
< void	dowrite(Ram*, char*, uvlong, long);
---
> char	*doread(Ram*, long, long);
> void	dowrite(Ram*, char*, long, long);
92c86
< Idmap	*_getpass(char*);
---
> Idmap	*getpass(char*);

=====================================================
./v10fs.c
106c106
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
109,113c109
< 	ulong bno;
< 	int i;
< 
< 	if (off>0xffffffff)
< 		error("offset too large");
---
> 	int bno, i;
132c128
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================

[-- Attachment #2: tapefs.diff --]
[-- Type: text/plain, Size: 5464 bytes --]

./fs.c
108c108
< 	r->blockno = 0;
---
> 	r->data = 0;
406,407c406,407
< //	if(off > 100*1024*1024)		/* sanity check */
< //		return "write too big";
---
> 	if(off > 100*1024*1024)		/* sanity check */
> 		return "write too big";
=====================================================
./32vfs.c
106c106
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
109,117c109,112
< 	uvlong _bno;
< 	ulong bno;
< 	int i;
< 
< 	_bno = off/BLSIZE;
< 	off -= _bno*BLSIZE;
< 	bno = (ulong)bno;
< 	if (bno!=_bno)
< 		error("offset to large");
---
> 	int bno, i;
> 
> 	bno = off/BLSIZE;
> 	off -= bno*BLSIZE;
133c128
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./zipfs.c
33a34,41
> extern void populate(char *);
> extern void dotrunc(Ram *);
> extern void docreate(Ram *);
> extern char *doread(Ram *, long, long);
> extern void popdir(Ram *);
> extern void dowrite(Ram *, char *, long, long);
> extern int dopermw(Ram *);
> 
101c109
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
113c121
< 	if (Bseek(bin, r->blockno, 0) < 0)
---
> 	if (Bseek(bin, (uvlong)r->data & 0x7fffffff, 0) < 0)
142c150
< 			if (r->blockno & 0x80000000 && MUNGE_CR){
---
> 			if ((uvlong)r->data & 0x80000000 && MUNGE_CR){
165c173
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./tapfs.c
95c95
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
99c99
< 	seek(tapefile, 512*(int)r->blockno+off, 0);
---
> 	seek(tapefile, 512*(vlong)r->data+off, 0);
105c105
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./tarfs.c
38,39c38
< 	vlong blkno;
< 	long isabs, chksum, linkflg;
---
> 	long blkno, isabs, chksum, linkflg;
52c51
< 		f.blockno = blkno+1;
---
> 		f.addr = (void*)(blkno+1);
56c55
< 		f.size = strtoull(dblock.dbuf.size, 0, 8);
---
> 		f.size = strtoul(dblock.dbuf.size, 0, 8);
62c61
< 		||  strrchr(dblock.dbuf.name, '\0')[-1] == '/')
---
> 		||  strrchr(dblock.dbuf.name, '\0')[-1] == '/'){
63a63,64
> 			f.size = 0;
> 		}
69c70
< 			abort();
---
> 			exits("checksum");
100c101
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
103c104
< 	seek(tapefile, (TBLOCK * r->blockno)+off, 0);
---
> 	seek(tapefile, (TBLOCK * (vlong)r->data)+off, 0);
117c118
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)
132,133c133,134
< 	int i;
< 	char *cp;
---
> 	register i;
> 	register char *cp;

=====================================================
./cpiofs.c
39c39
< uvlong	getoct(char*, int);
---
> int	getoct(char*, int);
79c79
< 		f.blockno = (offset+sizeof(struct header)+namesize);
---
> 		f.addr = (void*)(offset+sizeof(struct header)+namesize);
87c87
< uvlong
---
> int
90c90
< 	uvlong r;
---
> 	int r;
112c112
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
115c115
< 	seek(tapefile, r->blockno+off, 0);
---
> 	seek(tapefile, (vlong)r->data+off, 0);
129c129
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./v6fs.c
107c107
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
129c129
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./tpfs.c
20c20
< 	unsigned char	unused2[16];
---
> 	unsigned char	unused[16];
88c88
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
92c92
< 	seek(tapefile, 512*(int)r->blockno+off, 0);
---
> 	seek(tapefile, 512*(vlong)r->data+off, 0);
98c98
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================
./util.c
96c96
< 			ent->blockno = fi.blockno;
---
> 			ent->data = fi.addr;
133c133
< 	ent->blockno = fi.blockno;
---
> 	ent->data = fi.addr;

=====================================================
./tapefs.h
41,45c41,42
< 	union {
< 		void	*data;
< 		uvlong	blockno;
< 	};
< 	uvlong	ndata;
---
> 	void	*data;
> 	long	ndata;
65,69c62,63
< 	union {
< 		void	*addr;
< 		uvlong	blockno;
< 	};
< 	uvlong	size;
---
> 	void	*addr;
> 	long	size;
89,90c83,84
< char	*doread(Ram*, uvlong, long);
< void	dowrite(Ram*, char*, uvlong, long);
---
> char	*doread(Ram*, long, long);
> void	dowrite(Ram*, char*, long, long);
92c86
< Idmap	*_getpass(char*);
---
> Idmap	*getpass(char*);

=====================================================
./v10fs.c
106c106
< doread(Ram *r, uvlong off, long cnt)
---
> doread(Ram *r, long off, long cnt)
109,113c109
< 	ulong bno;
< 	int i;
< 
< 	if (off>0xffffffff)
< 		error("offset too large");
---
> 	int bno, i;
132c128
< dowrite(Ram *r, char *buf, uvlong off, long cnt)
---
> dowrite(Ram *r, char *buf, long off, long cnt)

=====================================================

  parent reply	other threads:[~2006-01-14 12:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-13 14:11 cej
2006-01-13 16:41 ` erik quanstrom
2006-01-13 22:33   ` geoff
2006-01-14  0:30     ` erik quanstrom
2006-01-13 22:36   ` C H Forsyth
2006-01-13 22:43     ` geoff
2006-01-14  0:03       ` erik quanstrom
2006-01-14  0:33     ` Devon H. O'Dell
2006-01-14  0:59       ` Paul Lalonde
2006-01-14  1:07         ` erik quanstrom
2006-01-14 12:15   ` erik quanstrom [this message]
2006-01-14 18:22     ` Russ Cox
2006-01-14 21:27       ` erik quanstrom
2006-01-16  2:57       ` erik quanstrom

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060114121550.4FD0134FFB@dexter-peak.quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@cse.psu.edu \
    --cc=cej@gli.cas.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).