aboutsummaryrefslogtreecommitdiff
path: root/src/libdiskfs
diff options
context:
space:
mode:
authorDan Cross <cross@gajendra.net>2020-01-10 14:44:21 +0000
committerDan Cross <cross@gajendra.net>2020-01-10 14:54:30 +0000
commitfa325e9b42b0bdfb48857d1958d9fb7ceac55151 (patch)
tree81d26256d152435135bcb1ae43121979a49f5f2b /src/libdiskfs
parent77a0a5b5194d4441c86de097f2aae297cb75e2c2 (diff)
downloadplan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.gz
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.tar.bz2
plan9port-fa325e9b42b0bdfb48857d1958d9fb7ceac55151.zip
Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
Diffstat (limited to 'src/libdiskfs')
-rw-r--r--src/libdiskfs/block.c2
-rw-r--r--src/libdiskfs/cache.c10
-rw-r--r--src/libdiskfs/ext2.c8
-rw-r--r--src/libdiskfs/ext2.h3
-rw-r--r--src/libdiskfs/fat.c1
-rw-r--r--src/libdiskfs/ffs.c20
-rw-r--r--src/libdiskfs/ffs.h3
-rw-r--r--src/libdiskfs/hfs.c12
-rw-r--r--src/libdiskfs/hfs.h20
-rw-r--r--src/libdiskfs/kfs.c1
-rw-r--r--src/libdiskfs/part.c10
-rw-r--r--src/libdiskfs/venti.c1
-rw-r--r--src/libdiskfs/vfile.c2
13 files changed, 43 insertions, 50 deletions
diff --git a/src/libdiskfs/block.c b/src/libdiskfs/block.c
index 94ea5111..552078a9 100644
--- a/src/libdiskfs/block.c
+++ b/src/libdiskfs/block.c
@@ -46,7 +46,7 @@ blockput(Block *b)
return;
if(!b->_close){
fprint(2, "no blockPut\n");
- abort();
+ abort();
}
(*b->_close)(b);
}
diff --git a/src/libdiskfs/cache.c b/src/libdiskfs/cache.c
index 7b06fa4f..2888ae83 100644
--- a/src/libdiskfs/cache.c
+++ b/src/libdiskfs/cache.c
@@ -3,7 +3,7 @@
#include <diskfs.h>
/*
- * Disk cache. Caches by offset, so higher levels have
+ * Disk cache. Caches by offset, so higher levels have
* to deal with alignment issues (if we get asked for the
* blocks at offsets 0 and 1, we'll do two reads).
*/
@@ -43,7 +43,7 @@ addtohash(DiskCache *d, DiskCacheBlock *b, u64int offset)
if(b->offset != ~(u64int)0){
fprint(2, "bad offset in addtohash\n");
- return;
+ return;
}
b->offset = offset;
h = offset % d->nhash;
@@ -227,8 +227,8 @@ diskcacheread(Disk *dd, u32int len, u64int offset)
return b;
}
-/*
- * It's okay to remove these from the hash table.
+/*
+ * It's okay to remove these from the hash table.
* Either the block is in use by someone or it is on
* the lru list. If it's in use it will get put on the lru
* list once the refs go away.
@@ -264,7 +264,7 @@ diskcacheclose(Disk *dd)
blockput(b->subblock);
free(d);
}
-
+
/* needn't be fast */
static int
isprime(int n)
diff --git a/src/libdiskfs/ext2.c b/src/libdiskfs/ext2.c
index b55f1eb3..ce16f37d 100644
--- a/src/libdiskfs/ext2.c
+++ b/src/libdiskfs/ext2.c
@@ -103,7 +103,7 @@ ext2blockread(Fsys *fsys, u64int vbno)
if(bno != vbno)
return nil;
-/*
+/*
if(bno < fs->firstblock)
return diskread(fs->disk, fs->blocksize, (u64int)bno*fs->blocksize);
*/
@@ -142,7 +142,7 @@ ext2blockread(Fsys *fsys, u64int vbno)
if((bits[boff>>3] & (1<<(boff&7))) == 0){
if(debug)
fprint(2, "block %d not allocated in group %d: bitblock %d/%lld bits[%d] = %#x\n",
- boff, bno/fs->blockspergroup,
+ boff, bno/fs->blockspergroup,
(int)bitblock,
bitpos,
boff>>3,
@@ -174,7 +174,7 @@ ext2fileblock(Ext2 *fs, Inode *ino, u32int bno, int size)
obno = bno;
if(bno < NDIRBLOCKS){
if(debug)
- fprint(2, "fileblock %d -> %d...",
+ fprint(2, "fileblock %d -> %d...",
bno, ino->block[bno]);
return ext2datablock(fs, ino->block[bno], size);
}
@@ -592,7 +592,7 @@ ext2readdir(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int count, u64int coo
if((ok = inoperm(&ino, au, AREAD)) != Nfs3Ok)
return ok;
- if(debug) print("readdir cookie %#llux ino.size %#llux\n",
+ if(debug) print("readdir cookie %#llux ino.size %#llux\n",
(u64int)cookie, (u64int)ino.size);
if(cookie >= ino.size){
diff --git a/src/libdiskfs/ext2.h b/src/libdiskfs/ext2.h
index 7ddd400a..f4c32ce3 100644
--- a/src/libdiskfs/ext2.h
+++ b/src/libdiskfs/ext2.h
@@ -80,7 +80,7 @@ struct Super
u32int revlevel; /* Revision level */
u16int defresuid; /* Default uid for reserved blocks */
u16int defresgid; /* Default gid for reserved blocks */
-
+
/* the following are only available with revlevel = 1 */
u32int firstino; /* First non-reserved inode */
u16int inosize; /* size of inode structure */
@@ -161,4 +161,3 @@ struct Ext2
Disk *disk;
Fsys *fsys;
};
-
diff --git a/src/libdiskfs/fat.c b/src/libdiskfs/fat.c
index 4d12512c..0eb1c995 100644
--- a/src/libdiskfs/fat.c
+++ b/src/libdiskfs/fat.c
@@ -8,4 +8,3 @@ fsysopenfat(Disk *disk)
USED(disk);
return nil;
}
-
diff --git a/src/libdiskfs/ffs.c b/src/libdiskfs/ffs.c
index d8e23392..70552e49 100644
--- a/src/libdiskfs/ffs.c
+++ b/src/libdiskfs/ffs.c
@@ -124,8 +124,8 @@ okay:
fs->nfrag = fsblk->nfrag;
fs->ndfrag = fsblk->ndfrag;
/*
- * used to use
- * fs->blockspergroup = (u64int)fsblk->_cylspergroup *
+ * used to use
+ * fs->blockspergroup = (u64int)fsblk->_cylspergroup *
* fsblk->secspercyl * BYTESPERSEC / fsblk->blocksize;
* for UFS1, but this should work for both UFS1 and UFS2
*/
@@ -190,7 +190,7 @@ ffsclose(Fsys *fsys)
free(fs);
free(fsys);
}
-
+
static int
checkfsblk(Fsblk *super)
{
@@ -311,7 +311,7 @@ ffsdatablock(Ffs *fs, u64int bno, int size)
blockput(b);
return nil;
}
-
+
return b;
}
@@ -319,7 +319,7 @@ static u64int
ifetch(Ffs *fs, u64int bno, u32int off)
{
Block *b;
-
+
if(bno == BADBNO)
return BADBNO;
b = ffsdatablock(fs, bno, fs->blocksize);
@@ -352,10 +352,10 @@ ffsfileblockno(Ffs *fs, Inode *ino, u64int bno)
if(bno < ppb*ppb)
return ifetch(fs, ifetch(fs, ino->ib[1], bno/ppb), bno%ppb);
bno -= ppb*ppb;
-
+
if(bno/ppb/ppb/ppb == 0) /* bno < ppb*ppb*ppb w/o overflow */
return ifetch(fs, ifetch(fs, ifetch(fs, ino->ib[2], bno/ppb/ppb), (bno/ppb)%ppb), bno%ppb);
-
+
fprint(2, "ffsfileblock %llud: way too big\n", bno+NDADDR+ppb+ppb*ppb);
return BADBNO;
}
@@ -364,7 +364,7 @@ static Block*
ffsfileblock(Ffs *fs, Inode *ino, u64int bno, int size)
{
u64int b;
-
+
b = ffsfileblockno(fs, ino, bno);
if(b == ~0)
return nil;
@@ -396,7 +396,7 @@ static void
inode1to2(Inode1 *i1, Inode *i2)
{
int i;
-
+
memset(i2, 0, sizeof *i2);
i2->mode = i1->mode;
i2->nlink = i1->nlink;
@@ -777,7 +777,7 @@ ffsxfileblock(Fsys *fsys, Nfs3Handle *h, u64int offset)
Inode ino;
Nfs3Status ok;
Ffs *fs;
-
+
fs = fsys->priv;
if((ok = handle2ino(fs, h, nil, &ino)) != Nfs3Ok){
nfs3errstr(ok);
diff --git a/src/libdiskfs/ffs.h b/src/libdiskfs/ffs.h
index 6a5a387d..d7881f15 100644
--- a/src/libdiskfs/ffs.h
+++ b/src/libdiskfs/ffs.h
@@ -40,7 +40,7 @@ enum
FSMAGIC = 0x011954,
FSMAGIC2 = 0x19540119,
FSCHECKSUM = 0x7c269d38,
-
+
/* Fsblk.inodefmt */
FS42INODEFMT = -1,
FS44INODEFMT = 2,
@@ -341,4 +341,3 @@ struct Ffs
Disk *disk;
};
-
diff --git a/src/libdiskfs/hfs.c b/src/libdiskfs/hfs.c
index 6784dab4..03e97a15 100644
--- a/src/libdiskfs/hfs.c
+++ b/src/libdiskfs/hfs.c
@@ -89,7 +89,7 @@ fsysopenhfs(Disk *disk)
fsys->_readdir = hfsreaddir;
fsys->_close = hfsclose;
fsys->disk = disk;
-
+
if(hfswrapper(fsys) < 0 || hfssync(fsys) < 0)
goto error;
@@ -130,7 +130,7 @@ hfswrapper(Fsys *fsys)
int magic, hfsstart, subsig, substart, subnblocks;
u32int hfsblocksize;
u64int offset, size;
-
+
fs = fsys->priv;
disk = fsys->disk;
if((b = diskread(disk, 162, 1024)) == nil)
@@ -143,12 +143,12 @@ hfswrapper(Fsys *fsys)
substart = get16(mdb+126);
subnblocks = get16(mdb+128);
blockput(b);
-
+
if(magic != Hfssig)
return 0;
if(subsig != Hfsplussig && subsig != Hfsxsig)
return 0;
-
+
offset = hfsstart*512 + substart*hfsblocksize;
size = subnblocks*hfsblocksize;
@@ -748,7 +748,7 @@ hfsreaddir(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int count,
if(ino.u.nentries>>31)
return Nfs3ErrIo;
nentries = ino.u.nentries*2; /* even data, odd resource */
-
+
i = cookie>>32;
cnid = cookie&0xFFFFFFFF;
if(debug) print("readdir %ud %ud %ud...", cnid, i, nentries);
@@ -784,7 +784,7 @@ hfsreaddir(Fsys *fsys, SunAuthUnix *au, Nfs3Handle *h, u32int count,
goto badparent;
i++;
}
-
+
memset(&e, 0, sizeof e);
for(; i<nentries; i++){
rsrc = i&1;
diff --git a/src/libdiskfs/hfs.h b/src/libdiskfs/hfs.h
index 662c3389..bf5ebc9f 100644
--- a/src/libdiskfs/hfs.h
+++ b/src/libdiskfs/hfs.h
@@ -3,12 +3,12 @@
wrapper.
Apple technical note 1150 documents the file system:
-
+
http://developer.apple.com/technotes/tn/tn1150.html
-
+
Briefly an hfs file system comprises a volume header, an
optional journal, and a set of forks.
-
+
Most fs metadata resides in forks including a block allocation
bitmap, a tree storing extents (q.v.) for forks and bad disk
blocks, and a tree storing catalog (file and directory)
@@ -52,11 +52,11 @@ enum
NAMELEN = 255,
UTFNAMELEN = NAMELEN*UTFmax,
-
+
NEXTENTS = 8,
-
+
Dfork = 0, Rfork = 255,
-
+
/* fixed cnids */
RootpId = 1, RootId, ExtentsId, CatalogId,
BadblockId, AllocId, MinuserId = 16,
@@ -71,7 +71,7 @@ enum
/* values in Node.type */
LeafNode = -1, IndexNode, HeaderNode, MapNode,
-
+
/* catalog record types */
Folder = 1, File, FolderThread, FileThread,
@@ -163,14 +163,14 @@ struct Treeref
{
Tree *tree;
u32int cnid; /* tree->fork->cnid, for debugging prints */
-
+
Block *block; /* a node in the tree */
u32int nno;
Node node;
-
+
int rno; /* a record in the node */
int klen;
- uchar *key;
+ uchar *key;
int dlen;
uchar *data;
};
diff --git a/src/libdiskfs/kfs.c b/src/libdiskfs/kfs.c
index 51d7c5e3..216ad277 100644
--- a/src/libdiskfs/kfs.c
+++ b/src/libdiskfs/kfs.c
@@ -8,4 +8,3 @@ fsysopenkfs(Disk *disk)
USED(disk);
return nil;
}
-
diff --git a/src/libdiskfs/part.c b/src/libdiskfs/part.c
index dc5d171f..0da5a234 100644
--- a/src/libdiskfs/part.c
+++ b/src/libdiskfs/part.c
@@ -27,7 +27,7 @@ static int
diskpartsync(Disk *dd)
{
DiskPart *d = (DiskPart*)dd;
-
+
if(d->subdisk)
return disksync(d->subdisk);
return 0;
@@ -37,7 +37,7 @@ static void
diskpartclose(Disk *dd)
{
DiskPart *d = (DiskPart*)dd;
-
+
if(d->subdisk)
diskclose(d->subdisk);
free(d);
@@ -47,18 +47,18 @@ Disk*
diskpart(Disk *subdisk, u64int offset, u64int size)
{
DiskPart *d;
-
+
d = mallocz(sizeof(DiskPart), 1);
if(d == nil)
return nil;
-
+
d->subdisk = subdisk;
d->offset = offset;
d->size = size;
d->disk._read = diskpartread;
d->disk._sync = diskpartsync;
d->disk._close = diskpartclose;
-
+
return &d->disk;
}
diff --git a/src/libdiskfs/venti.c b/src/libdiskfs/venti.c
index a497d5e0..c6f15cae 100644
--- a/src/libdiskfs/venti.c
+++ b/src/libdiskfs/venti.c
@@ -159,4 +159,3 @@ Err:
_nfilereads_darwin_sucks(); /* force Darwin ld to pull in file.o */
return nil;
}
-
diff --git a/src/libdiskfs/vfile.c b/src/libdiskfs/vfile.c
index 72ca0446..d9be4b12 100644
--- a/src/libdiskfs/vfile.c
+++ b/src/libdiskfs/vfile.c
@@ -31,5 +31,3 @@ diskVentiRead(Disk *dd, u32int len, u64int offset)
walk down blocks
return the one
}
-
-