Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0224/2

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Your text here.
 [rsc] --rw-rw-r-- M 1695424 glenda sys 3710 Feb 24 15:57 sys/src/cmd/tapefs/32vfs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/32vfs.c:58,64 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/32vfs.c:58,65
	  	f = iget(VROOT);
	  	ram->perm = f.mode;
	  	ram->mtime = f.mdate;
	- 	ram->data = f.addr;
	+ 	ram->addr = f.addr;
	+ 	ram->data = f.data;
	  	ram->ndata = f.size;
	  }
	  
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/32vfs.c:103,109 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/32vfs.c:104,110
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	  	static char buf[Maxbuf+BLSIZE];
	  	int bno, i;
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/32vfs.c:159,167 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/32vfs.c:160,168
	  	f.size = g4byte(dp->size);
	  	if ((flags&VFMT)==VIFCHR || (flags&VFMT)==VIFBLK)
	  		f.size = 0;
	- 	f.addr = emalloc(VNADDR*sizeof(long));
	+ 	f.data = emalloc(VNADDR*sizeof(long));
	  	for (i = 0; i < VNADDR; i++)
	- 		((long*)f.addr)[i] = g3byte(dp->addr+3*i);
	+ 		((long*)f.data)[i] = g3byte(dp->addr+3*i);
	  	f.mode = flags & VMODE;
	  	if ((flags&VFMT)==VIFDIR)
	  		f.mode |= DMDIR;
 [rsc] --rw-rw-r-- M 1695424 glenda sys 2491 Feb 24 15:57 sys/src/cmd/tapefs/cpiofs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/cpiofs.c:36,47 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/cpiofs.c:36,48
	  } dblock;
	  
	  int	tapefile;
	- int	getoct(char*, int);
	+ vlong	getoct(char*, int);
	  
	  void
	  populate(char *name)
	  {
	- 	long offset, isabs, magic, namesize, mode;
	+ 	vlong offset;
	+ 	long isabs, magic, namesize, mode;
	  	Fileinf f;
	  
	  	tapefile = open(name, OREAD);
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/cpiofs.c:76,82 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/cpiofs.c:77,83
	  		f.size = getoct(dblock.dbuf.size, sizeof(dblock.dbuf.size));
	  		f.mdate = getoct(dblock.dbuf.mtime, sizeof(dblock.dbuf.mtime));
	  		namesize = getoct(dblock.dbuf.namesize, sizeof(dblock.dbuf.namesize));
	- 		f.addr = (void*)(offset+sizeof(struct header)+namesize);
	+ 		f.addr = offset+sizeof(struct header)+namesize;
	  		isabs = dblock.nbuf.name[0]=='/';
	  		f.name = &dblock.nbuf.name[isabs];
	  		poppath(f, 1);
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/cpiofs.c:84,93 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/cpiofs.c:85,94
	  	}
	  }
	  
	- int
	+ vlong
	  getoct(char *p, int l)
	  {
	- 	int r;
	+ 	vlong r;
	  
	  	for (r=0; l>0; p++, l--){
	  		r <<= 3;
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/cpiofs.c:109,118 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/cpiofs.c:110,118
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	- 
	- 	seek(tapefile, (vlong)r->data+off, 0);
	+ 	seek(tapefile, r->addr+off, 0);
	  	if (cnt>sizeof(dblock.tbuf))
	  		error("read too big");
	  	read(tapefile, dblock.tbuf, cnt);
 [rsc] --rw-rw-r-- M 1695424 glenda sys 9754 Feb 24 16:00 sys/src/cmd/tapefs/fs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/fs.c:2,8 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/fs.c:2,8
	  #include <libc.h>
	  #include <authsrv.h>
	  #include <fcall.h>
	- #include <tapefs.h>
	+ #include "tapefs.h"
	  
	  Fid	*fids;
	  Ram	*ram;
 [rsc] --rw-rw-r-- M 1695424 glenda sys 1637 Feb 24 15:57 sys/src/cmd/tapefs/tapefs.h
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tapefs.h:38,44 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tapefs.h:38,45
	  	ulong	mtime;
	  	char	*user;
	  	char	*group;
	- 	void	*data;
	+ 	vlong addr;
	+ 	void *data;
	  	long	ndata;
	  };
	  
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tapefs.h:59,66 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tapefs.h:60,68
	  
	  typedef struct fileinf {
	  	char	*name;
	- 	void	*addr;
	- 	long	size;
	+ 	vlong	addr;
	+ 	void	*data;
	+ 	vlong	size;
	  	int	mode;
	  	int	uid;
	  	int	gid;
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tapefs.h:80,86 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tapefs.h:82,88
	  void	populate(char *);
	  void	dotrunc(Ram*);
	  void	docreate(Ram*);
	- char	*doread(Ram*, long, long);
	+ char	*doread(Ram*, vlong, long);
	  void	dowrite(Ram*, char*, long, long);
	  int	dopermw(Ram*);
	  Idmap	*getpass(char*);
 [rsc] --rw-rw-r-- M 1695424 glenda sys 1924 Feb 24 15:57 sys/src/cmd/tapefs/tapfs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tapfs.c:47,53 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tapfs.c:47,53
	  		}
	  		if (tpp->name[0]=='\0')
	  			continue;
	- 		f.addr = (void *)(tpp->taddress[0] + (tpp->taddress[1]<<8));
	+ 		f.addr = tpp->taddress[0] + (tpp->taddress[1]<<8);
	  		if (f.addr==0)
	  			continue;
	  		f.size = tpp->size[0] + (tpp->size[1]<<8);
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tapfs.c:92,102 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tapfs.c:92,102
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	  	if (cnt>sizeof(buffer))
	  		print("count too big\n");
	- 	seek(tapefile, 512*(vlong)r->data+off, 0);
	+ 	seek(tapefile, 512*r->addr+off, 0);
	  	read(tapefile, buffer, cnt);
	  	return buffer;
	  }
 [rsc] --rw-rw-r-- M 1695424 glenda sys 2759 Feb 24 16:16 sys/src/cmd/tapefs/tarfs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tarfs.c:48,58 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tarfs.c:48,61
	  			break;
	  		if (dblock.dbuf.name[0]=='\0')
	  			break;
	- 		f.addr = (void*)(blkno+1);
	+ 		f.addr = blkno+1;
	  		f.mode = strtoul(dblock.dbuf.mode, 0, 8);
	  		f.uid = strtoul(dblock.dbuf.uid, 0, 8);
	  		f.gid = strtoul(dblock.dbuf.gid, 0, 8);
	- 		f.size = strtoul(dblock.dbuf.size, 0, 8);
	+ 		if((uchar)dblock.dbuf.size[0] == 0x80)
	+ 			f.size = g8byte(dblock.dbuf.size+3);
	+ 		else
	+ 			f.size = strtoull(dblock.dbuf.size, 0, 8);
	  		f.mdate = strtoul(dblock.dbuf.mtime, 0, 8);
	  		chksum = strtoul(dblock.dbuf.chksum, 0, 8);
	  		/* the mode test is ugly but sometimes necessary */
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tarfs.c:98,107 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tarfs.c:101,109
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	- 
	- 	seek(tapefile, (TBLOCK * (vlong)r->data)+off, 0);
	+ 	seek(tapefile, TBLOCK*r->addr+off, 0);
	  	if (cnt>sizeof(dblock.tbuf))
	  		error("read too big");
	  	read(tapefile, dblock.tbuf, cnt);
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tarfs.c:130,137 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tarfs.c:132,139
	  int
	  checksum()
	  {
	- 	register i;
	- 	register char *cp;
	+ 	int i;
	+ 	char *cp;
	  
	  	for (cp = dblock.dbuf.chksum; cp < &dblock.dbuf.chksum[sizeof(dblock.dbuf.chksum)]; cp++)
	  		*cp = ' ';
 [rsc] --rw-rw-r-- M 1695424 glenda sys 1999 Feb 24 16:00 sys/src/cmd/tapefs/tpfs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tpfs.c:17,23 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tpfs.c:17,23
	  	unsigned char	size[3];
	  	unsigned char	tmod[4];
	  	unsigned char	taddress[2];
	- 	unsigned char	unused[16];
	+ 	unsigned char	unused2[16];
	  	unsigned char	checksum[2];
	  } dir[496+8];
	  
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tpfs.c:50,56 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tpfs.c:50,56
	  		goodcksum++;
	  		if (tpp->name[0]=='\0')
	  			continue;
	- 		f.addr = (void *)(tpp->taddress[0] + (tpp->taddress[1]<<8));
	+ 		f.addr = tpp->taddress[0] + (tpp->taddress[1]<<8);
	  		if (f.addr==0)
	  			continue;
	  		f.size = (tpp->size[0]<<16) + (tpp->size[1]<<0) + (tpp->size[2]<<8);
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/tpfs.c:85,95 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/tpfs.c:85,95
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	  	if (cnt>sizeof(buffer))
	  		print("count too big\n");
	- 	seek(tapefile, 512*(vlong)r->data+off, 0);
	+ 	seek(tapefile, 512*r->addr+off, 0);
	  	read(tapefile, buffer, cnt);
	  	return buffer;
	  }
 [rsc] --rw-rw-r-- M 1695424 glenda sys 2699 Feb 24 16:00 sys/src/cmd/tapefs/util.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/util.c:2,9 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/util.c:2,9
	  #include <libc.h>
	  #include <auth.h>
	  #include <fcall.h>
	- #include <tapefs.h>
	  #include <bio.h>
	+ #include "tapefs.h"
	  
	  Idmap *
	  getpass(char *file)
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/util.c:93,99 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/util.c:93,100
	  		}
	  		if (new)  {
	  			ent->ndata = fi.size;
	- 			ent->data = fi.addr;
	+ 			ent->addr = fi.addr;
	+ 			ent->data = fi.data;
	  			ent->perm = fi.mode;
	  			ent->mtime = fi.mdate;
	  			ent->user = mapid(uidmap, fi.uid);
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/util.c:130,136 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/util.c:131,138
	  	ent->user = mapid(uidmap, fi.uid);
	  	ent->group = mapid(gidmap, fi.gid);
	  	ent->ndata = fi.size;
	- 	ent->data = fi.addr;
	+ 	ent->data = fi.data;
	+ 	ent->addr = fi.addr;
	  	ent->replete |= replete;
	  	return ent;
	  }
 [rsc] --rw-rw-r-- M 1695424 glenda sys 3776 Feb 24 15:57 sys/src/cmd/tapefs/v10fs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/v10fs.c:58,64 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/v10fs.c:58,65
	  	f = iget(VROOT);
	  	ram->perm = f.mode;
	  	ram->mtime = f.mdate;
	- 	ram->data = f.addr;
	+ 	ram->addr = f.addr;
	+ 	ram->data = f.data;
	  	ram->ndata = f.size;
	  }
	  
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/v10fs.c:103,109 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/v10fs.c:104,110
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	  	static char buf[Maxbuf+BLSIZE];
	  	int bno, i;
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/v10fs.c:159,167 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/v10fs.c:160,168
	  	f.size = g4byte(dp->size);
	  	if ((flags&VFMT)==VIFCHR || (flags&VFMT)==VIFBLK)
	  		f.size = 0;
	- 	f.addr = emalloc(VNADDR*sizeof(long));
	+ 	f.data = emalloc(VNADDR*sizeof(long));
	  	for (i = 0; i < VNADDR; i++)
	- 		((long*)f.addr)[i] = g3byte(dp->addr+3*i);
	+ 		((long*)f.data)[i] = g3byte(dp->addr+3*i);
	  	f.mode = flags & VMODE;
	  	if ((flags&VFMT)==VIFDIR)
	  		f.mode |= DMDIR;
 [rsc] --rw-rw-r-- M 1695424 glenda sys 3993 Feb 24 15:57 sys/src/cmd/tapefs/v6fs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/v6fs.c:59,65 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/v6fs.c:59,66
	  	f = iget(V6ROOT);
	  	ram->perm = f.mode;
	  	ram->mtime = f.mdate;
	- 	ram->data = f.addr;
	+ 	ram->addr = f.addr;
	+ 	ram->data = f.data;
	  	ram->ndata = f.size;
	  }
	  
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/v6fs.c:104,110 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/v6fs.c:105,111
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	  	static char buf[Maxbuf+BLSIZE];
	  	int bno, i;
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/v6fs.c:160,168 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/v6fs.c:161,169
	  	f.size = (dp->hisize << 16) + (dp->losize[1]<<8) + dp->losize[0];
	  	if ((flags&V6FMT)==V6IFCHR || (flags&V6FMT)==V6IFBLK)
	  		f.size = 0;
	- 	f.addr = emalloc(V6NADDR*sizeof(ushort));
	+ 	f.data = emalloc(V6NADDR*sizeof(ushort));
	  	for (i = 0; i < V6NADDR; i++)
	- 		((ushort*)f.addr)[i] = (dp->addr[i][1]<<8) + dp->addr[i][0];
	+ 		((ushort*)f.data)[i] = (dp->addr[i][1]<<8) + dp->addr[i][0];
	  	f.mode = flags & V6MODE;
	  	if ((flags&V6FMT)==V6IFDIR)
	  		f.mode |= DMDIR;
 [rsc] --rw-rw-r-- M 1695424 rsc sys 6588 Feb 24 15:57 sys/src/cmd/tapefs/zipfs.c
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/zipfs.c:10,15 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/zipfs.c:10,16
	  
	  #define FORCE_LOWER	1	/* force filenames to lower case */
	  #define MUNGE_CR	1	/* replace '\r\n' with ' \n' */
	+ #define High64 (1LL<<63)
	  
	  /*
	   * File system for zip archives (read-only)
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/zipfs.c:31,44 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/zipfs.c:32,37
	  static ulong *crctab;
	  static ulong crc;
	  
	- 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 *);
	- 
	  static int findCDir(Biobuf *);
	  static int header(Biobuf *, ZipHead *);
	  static int cheader(Biobuf *, ZipHead *);
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/zipfs.c:75,81 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/zipfs.c:68,76
	  		memset(&zh, 0, sizeof(zh));
	  		if(!cheader(bin, &zh))
	  			break;
	- 		f.addr = (void*)(zh.off | ((zh.iattr & IS_TEXT)? 0x80000000: 0));
	+ 		f.addr = zh.off;
	+ 		if(zh.iattr & IS_TEXT)
	+ 			f.addr |= High64;
	  		f.mode = (zh.madevers == IS_MSDOS && zh.eattr & IS_RDONLY)? 0444: 0644;
	  		if (zh.meth == 0 && zh.uncsize == 0){
	  			p = strchr(zh.file, '\0');
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/zipfs.c:106,112 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/zipfs.c:101,107
	  }
	  
	  char *
	- doread(Ram *r, long off, long cnt)
	+ doread(Ram *r, vlong off, long cnt)
	  {
	  	int i, err;
	  	Block bs;
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/zipfs.c:118,124 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/zipfs.c:113,119
	  	if (cnt > Maxbuf)
	  		sysfatal("file too big (>%d)", Maxbuf);
	  
	- 	if (Bseek(bin, (uvlong)r->data & 0x7fffffff, 0) < 0)
	+ 	if (Bseek(bin, r->addr & 0x7FFFFFFFFFFFFFFFLL, 0) < 0)
	  		sysfatal("seek failed");
	  
	  	memset(&zh, 0, sizeof(zh));
	/n/sourcesdump/2006/0224/plan9/sys/src/cmd/tapefs/zipfs.c:147,153 - 
	/n/sourcesdump/2006/0225/plan9/sys/src/cmd/tapefs/zipfs.c:142,148
	  			if (blockcrc(crctab, crc, cache, r->ndata) != zh.crc)
	  				fprint(2, "%s - crc failed", r->name);
	  
	- 			if ((uvlong)r->data & 0x80000000 && MUNGE_CR){
	+ 			if ((r->addr & High64) && MUNGE_CR){
	  				for (i = 0; i < r->ndata -1; i++)
	  					if (cache[i] == '\r' && cache[i +1] == '\n')
	  						cache[i] = ' ';
 [rsc] --rw-rw-r-- M 1695424 glenda sys 2759 Feb 24 16:16 sys/src/cmd/tapefs/tarfs.c


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].