1 | /* super_block.c
2 | -------------
3 | $Id: super_block.c,v 1.2 2003/09/22 09:02:16 stewart Exp $
4 |
5 | The long awaited super_block.c
6 | i wish i had coded this before, gah, i thought i had.
7 | maybe i should give up the booze and late nights up coding.
8 |
9 | This file contains all those functions dealing with the super
10 | block of the FCFS Object Store.
11 |
12 |
13 | One day, we need a better name than FCFS, but really - come up
14 | with one. StewStore just seems lame.
15 |
16 | (C)2003 Stewart Smith
17 | Distributed under the GNU Public License.
18 | */
19 |
20 | #include <stdio.h>
21 | #include <stdlib.h>
22 | #include <string.h>
23 | #include "testkit/types.h"
24 |
25 | #include "disk.h"
26 | #include "super_block.h"
27 |
28 | int fcfs_write_sb(struct fcfs_disk *disk)
29 | {
30 | struct fcfs_disk_block *block;
31 | block = disk_getblock(disk,0);
32 | disk_writeblock(block);
33 | disk_freeblock(block);
34 | return 1;
35 | }
36 |
37 | int fcfs_sb_mark_dirty(struct fcfs_disk *disk)
38 | {
39 | set_bit(FCFS_FLAG_Dirty,&(disk->sb->flags));
40 | fcfs_write_sb(disk);
41 | return 1;
42 | }
43 |
44 | int fcfs_sb_mark_clean(struct fcfs_disk *disk)
45 | {
46 | clear_bit(FCFS_FLAG_Dirty,&(disk->sb->flags));
47 | fcfs_write_sb(disk);
48 | return 1;
49 | }