diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/tapefs/32vfs.c | 17 | ||||
-rw-r--r-- | src/cmd/tapefs/fs.c | 1 | ||||
-rw-r--r-- | src/cmd/tapefs/tapefs.h | 6 | ||||
-rw-r--r-- | src/cmd/tapefs/tarfs.c | 2 |
4 files changed, 20 insertions, 6 deletions
diff --git a/src/cmd/tapefs/32vfs.c b/src/cmd/tapefs/32vfs.c index c273bcf4..adccd590 100644 --- a/src/cmd/tapefs/32vfs.c +++ b/src/cmd/tapefs/32vfs.c @@ -20,9 +20,11 @@ #define VSUPERB 1 #define VROOT 2 /* root inode */ #define VNAMELEN 14 -#define BLSIZE 512 +#define MAXBLSIZE 1024 +int BLSIZE; #define LINOPB (BLSIZE/sizeof(struct v32dinode)) -#define LNINDIR (BLSIZE/sizeof(unsigned long)) +#define LNINDIR (BLSIZE/4) +#define MAXLNINDIR (MAXBLSIZE/4) struct v32dinode { unsigned char flags[2]; @@ -51,6 +53,13 @@ populate(char *name) { Fileinf f; + BLSIZE = 512; /* 32v */ + if(blocksize){ + /* 1024 for 4.1BSD */ + if(blocksize != 512 && blocksize != 1024) + error("bad block size"); + BLSIZE = blocksize; + } replete = 0; tapefile = open(name, OREAD); if (tapefile<0) @@ -106,7 +115,7 @@ docreate(Ram *r) char * doread(Ram *r, vlong off, long cnt) { - static char buf[Maxbuf+BLSIZE]; + static char buf[Maxbuf+MAXBLSIZE]; int bno, i; bno = off/BLSIZE; @@ -147,7 +156,7 @@ dopermw(Ram *r) Fileinf iget(int ino) { - char buf[BLSIZE]; + char buf[MAXBLSIZE]; struct v32dinode *dp; long flags, i; Fileinf f; diff --git a/src/cmd/tapefs/fs.c b/src/cmd/tapefs/fs.c index bc83648e..1e56ae44 100644 --- a/src/cmd/tapefs/fs.c +++ b/src/cmd/tapefs/fs.c @@ -16,6 +16,7 @@ ulong path; Idmap *uidmap; Idmap *gidmap; int replete; +int blocksize; /* for 32v */ int verbose; int newtap; /* tap with time in sec */ diff --git a/src/cmd/tapefs/tapefs.h b/src/cmd/tapefs/tapefs.h index a76cf383..13c8cd2b 100644 --- a/src/cmd/tapefs/tapefs.h +++ b/src/cmd/tapefs/tapefs.h @@ -3,7 +3,10 @@ #define g2byte(x) (((x)[1]<<8) + (x)[0]) /* little-endian */ #define g3byte(x) (((x)[2]<<16) + ((x)[1]<<8) + (x)[0]) #define g4byte(x) (((x)[3]<<24) + ((x)[2]<<16) + ((x)[1]<<8) + (x)[0]) -#define g8byte(x) (((vlong)g4byte(x)<<32) | (u32int)g4byte(x+4)) + +/* big endian */ +#define b4byte(x) (((x)[0]<<24) + ((x)[1]<<16) + ((x)[2]<<8) + (x)[3]) +#define b8byte(x) (((vlong)b4byte(x)<<32) | (u32int)b4byte((x)+4)) enum { @@ -78,6 +81,7 @@ extern char *user; extern Idmap *uidmap; extern Idmap *gidmap; extern int replete; +extern int blocksize; void error(char*); void *erealloc(void*, ulong); void *emalloc(ulong); diff --git a/src/cmd/tapefs/tarfs.c b/src/cmd/tapefs/tarfs.c index 5bbd8b9c..e5da154e 100644 --- a/src/cmd/tapefs/tarfs.c +++ b/src/cmd/tapefs/tarfs.c @@ -53,7 +53,7 @@ populate(char *name) f.uid = strtoul(dblock.dbuf.uid, 0, 8); f.gid = strtoul(dblock.dbuf.gid, 0, 8); if((uchar)dblock.dbuf.size[0] == 0x80) - f.size = g8byte(dblock.dbuf.size+3); + f.size = b8byte(dblock.dbuf.size+3); else f.size = strtoull(dblock.dbuf.size, 0, 8); f.mdate = strtoul(dblock.dbuf.mtime, 0, 8); |