summaryrefslogtreecommitdiff
path: root/fs.c
diff options
context:
space:
mode:
authorrsc <rsc>2006-09-06 17:57:47 +0000
committerrsc <rsc>2006-09-06 17:57:47 +0000
commit48b824703b35e17965c738743c7394e1fc0017ec (patch)
tree6ac3358c12018c06bddc9769338bce8061040f43 /fs.c
parent96d467b3a9027412eed8bf5ec3c4521db44469ef (diff)
downloadxv6-labs-48b824703b35e17965c738743c7394e1fc0017ec.tar.gz
xv6-labs-48b824703b35e17965c738743c7394e1fc0017ec.tar.bz2
xv6-labs-48b824703b35e17965c738743c7394e1fc0017ec.zip
break single-line if statements
Diffstat (limited to 'fs.c')
-rw-r--r--fs.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs.c b/fs.c
index 132fddb..91d76cc 100644
--- a/fs.c
+++ b/fs.c
@@ -371,20 +371,23 @@ newblock(struct inode *ip, uint lbn)
if(lbn < NDIRECT) {
if(ip->addrs[lbn] == 0) {
b = balloc(ip->dev);
- if(b <= 0) return -1;
+ if(b <= 0)
+ return -1;
ip->addrs[lbn] = b;
}
} else {
if(ip->addrs[INDIRECT] == 0) {
b = balloc(ip->dev);
- if(b <= 0) return -1;
+ if(b <= 0)
+ return -1;
ip->addrs[INDIRECT] = b;
}
inbp = bread(ip->dev, ip->addrs[INDIRECT]);
inaddrs = (uint*) inbp->data;
if(inaddrs[lbn - NDIRECT] == 0) {
b = balloc(ip->dev);
- if(b <= 0) return -1;
+ if(b <= 0)
+ return -1;
inaddrs[lbn - NDIRECT] = b;
bwrite(inbp, ip->addrs[INDIRECT]);
}
@@ -407,7 +410,8 @@ writei(struct inode *ip, char *addr, uint off, uint n)
int lbn;
while(r < n) {
lbn = off / BSIZE;
- if(lbn >= MAXFILE) return r;
+ if(lbn >= MAXFILE)
+ return r;
if(newblock(ip, lbn) < 0) {
cprintf("newblock failed\n");
return r;
@@ -422,8 +426,10 @@ writei(struct inode *ip, char *addr, uint off, uint n)
}
if(r > 0) {
if(off > ip->size) {
- if(ip->type == T_DIR) ip->size = ((off / BSIZE) + 1) * BSIZE;
- else ip->size = off;
+ if(ip->type == T_DIR)
+ ip->size = ((off / BSIZE) + 1) * BSIZE;
+ else
+ ip->size = off;
}
iupdate(ip);
}
@@ -462,7 +468,8 @@ namei(char *path, int mode, uint *ret_off, char **ret_last, struct inode **ret_i
if(ret_ip)
*ret_ip = 0;
- if(*cp == '/') dp = iget(rootdev, 1);
+ if(*cp == '/')
+ dp = iget(rootdev, 1);
else {
dp = p->cwd;
iincref(dp);