CS350 COS
COS
|
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <time.h>
#include <getopt.h>
#include <o2fs.h>
Go to the source code of this file.
Macros | |
#define | ROUND_UP(_a, _b) (((_a) + (_b) - 1)/(_b)) |
#define | MAXBLOCKSIZE (64*1024*1024) |
#define | TOKEN_EOF 0 |
#define | TOKEN_DIR 1 |
#define | TOKEN_END 2 |
#define | TOKEN_FILE 3 |
#define | TOKEN_STRING 4 |
Functions | |
void | LoadManifest (const char *manifest) |
int | GetToken () |
void | FlushBlock (uint64_t offset, const void *buf, size_t len) |
uint64_t | AppendBlock (const void *buf, size_t len) |
uint64_t | AppendEmpty (void) |
ObjID * | AddFile (const char *file) |
ObjID * | AddDirectory () |
void | BlockBitmap () |
void | Superblock (ObjID *objid) |
void | usage () |
int | main (int argc, char *const *argv) |
Variables | |
char | tempbuf [MAXBLOCKSIZE] |
char | zerobuf [MAXBLOCKSIZE] |
bool | verbose = false |
bool | hasManifest = false |
uint64_t | diskSize = 0 |
uint64_t | diskOffset = 0 |
uint64_t | blockSize = 16*1024 |
uint64_t | bitmapSize |
int | diskfd |
struct stat | diskstat |
char * | tokenBuf |
char * | tokenCur |
char | tokenString [512] |
#define MAXBLOCKSIZE (64*1024*1024) |
Definition at line 20 of file newfs_o2fs.c.
#define ROUND_UP | ( | _a, | |
_b | |||
) | (((_a) + (_b) - 1)/(_b)) |
Definition at line 18 of file newfs_o2fs.c.
#define TOKEN_DIR 1 |
Definition at line 35 of file newfs_o2fs.c.
#define TOKEN_END 2 |
Definition at line 36 of file newfs_o2fs.c.
#define TOKEN_EOF 0 |
Definition at line 34 of file newfs_o2fs.c.
#define TOKEN_FILE 3 |
Definition at line 37 of file newfs_o2fs.c.
#define TOKEN_STRING 4 |
Definition at line 38 of file newfs_o2fs.c.
ObjID * AddDirectory | ( | ) |
Definition at line 171 of file newfs_o2fs.c.
ObjID * AddFile | ( | const char * | file | ) |
Definition at line 125 of file newfs_o2fs.c.
Definition at line 109 of file newfs_o2fs.c.
uint64_t AppendEmpty | ( | void | ) |
void BlockBitmap | ( | ) |
Definition at line 246 of file newfs_o2fs.c.
Definition at line 96 of file newfs_o2fs.c.
int GetToken | ( | ) |
Definition at line 63 of file newfs_o2fs.c.
void LoadManifest | ( | const char * | manifest | ) |
Definition at line 44 of file newfs_o2fs.c.
int main | ( | int | argc, |
char *const * | argv | ||
) |
Definition at line 297 of file newfs_o2fs.c.
void Superblock | ( | ObjID * | objid | ) |
Definition at line 268 of file newfs_o2fs.c.
void usage | ( | ) |
Definition at line 287 of file newfs_o2fs.c.
uint64_t bitmapSize |
Definition at line 30 of file newfs_o2fs.c.
uint64_t blockSize = 16*1024 |
Definition at line 29 of file newfs_o2fs.c.
int diskfd |
Definition at line 31 of file newfs_o2fs.c.
uint64_t diskOffset = 0 |
Definition at line 28 of file newfs_o2fs.c.
uint64_t diskSize = 0 |
Definition at line 27 of file newfs_o2fs.c.
struct stat diskstat |
Definition at line 32 of file newfs_o2fs.c.
Definition at line 26 of file newfs_o2fs.c.
char tempbuf[MAXBLOCKSIZE] |
Definition at line 22 of file newfs_o2fs.c.
char* tokenBuf |
Definition at line 40 of file newfs_o2fs.c.
char* tokenCur |
Definition at line 41 of file newfs_o2fs.c.
char tokenString[512] |
Definition at line 42 of file newfs_o2fs.c.
Definition at line 25 of file newfs_o2fs.c.
char zerobuf[MAXBLOCKSIZE] |
Definition at line 23 of file newfs_o2fs.c.