plan 9 import
This commit is contained in:
parent
3bff492520
commit
38c7eb9bd2
4 changed files with 20 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue