summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorFrans Kaashoek <[email protected]>2016-08-25 09:13:00 -0400
committerFrans Kaashoek <[email protected]>2016-08-25 09:13:00 -0400
commit7894fcd21732dd2ddfbb9beca52d037a62ed11f4 (patch)
treeeabcfc4f08613dcf7c35e58d9425f02c4c65224f /log.c
parent6de6a3c952dc8786619bd052e26e6bc1c97be2e6 (diff)
downloadxv6-labs-7894fcd21732dd2ddfbb9beca52d037a62ed11f4.tar.gz
xv6-labs-7894fcd21732dd2ddfbb9beca52d037a62ed11f4.tar.bz2
xv6-labs-7894fcd21732dd2ddfbb9beca52d037a62ed11f4.zip
Remove trailing white space with:
for f in *.{h,c}; do sed -i .sed 's/[[:blank:]]*$//' $f; done (Thanks to Nicolás Wolovick)
Diffstat (limited to 'log.c')
-rw-r--r--log.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/log.c b/log.c
index 12db8ca..a2f1b57 100644
--- a/log.c
+++ b/log.c
@@ -31,7 +31,7 @@
// Contents of the header block, used for both the on-disk header block
// and to keep track in memory of logged block# before commit.
struct logheader {
- int n;
+ int n;
int block[LOGSIZE];
};
@@ -65,7 +65,7 @@ initlog(int dev)
}
// Copy committed blocks from log to their home location
-static void
+static void
install_trans(void)
{
int tail;
@@ -75,7 +75,7 @@ install_trans(void)
struct buf *dbuf = bread(log.dev, log.lh.block[tail]); // read dst
memmove(dbuf->data, lbuf->data, BSIZE); // copy block to dst
bwrite(dbuf); // write dst to disk
- brelse(lbuf);
+ brelse(lbuf);
brelse(dbuf);
}
}
@@ -114,7 +114,7 @@ write_head(void)
static void
recover_from_log(void)
{
- read_head();
+ read_head();
install_trans(); // if committed, copy from log to disk
log.lh.n = 0;
write_head(); // clear the log
@@ -171,7 +171,7 @@ end_op(void)
}
// Copy modified blocks from cache to log.
-static void
+static void
write_log(void)
{
int tail;
@@ -181,7 +181,7 @@ write_log(void)
struct buf *from = bread(log.dev, log.lh.block[tail]); // cache block
memmove(to->data, from->data, BSIZE);
bwrite(to); // write the log
- brelse(from);
+ brelse(from);
brelse(to);
}
}
@@ -193,7 +193,7 @@ commit()
write_log(); // Write modified blocks from cache to log
write_head(); // Write header to disk -- the real commit
install_trans(); // Now install writes to home locations
- log.lh.n = 0;
+ log.lh.n = 0;
write_head(); // Erase the transaction from the log
}
}