-
Notifications
You must be signed in to change notification settings - Fork 0
/
fs_ctx.h
55 lines (45 loc) · 1.46 KB
/
fs_ctx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
* This code is provided solely for the personal and private use of students
* taking the CSC369H course at the University of Toronto. Copying for purposes
* other than this use is expressly prohibited. All forms of distribution of
* this code, including but not limited to public repositories on GitHub,
* GitLab, Bitbucket, or any other online platform, whether as given or with
* any changes, are expressly prohibited.
*
* Authors: Alexey Khrabrov, Karen Reid
*
* All of the files in this directory and all subdirectories are:
* Copyright (c) 2019 Karen Reid
*/
/**
* CSC369 Assignment 1 - File system runtime context header file.
*/
#pragma once
#include <stddef.h>
#include "options.h"
/**
* Mounted file system runtime state - "fs context".
*/
typedef struct fs_ctx {
/** Pointer to the start of the image. */
void *image;
/** Image size in bytes. */
size_t size;
//TODO: useful runtime state of the mounted file system should be cached
// here (NOT in global variables in a1fs.c)
} fs_ctx;
/**
* Initialize file system context.
*
* @param fs pointer to the context to initialize.
* @param image pointer to the start of the image.
* @param size image size in bytes.
* @return true on success; false on failure (e.g. invalid superblock).
*/
bool fs_ctx_init(fs_ctx *fs, void *image, size_t size);
/**
* Destroy file system context.
*
* Must cleanup all the resources created in fs_ctx_init().
*/
void fs_ctx_destroy(fs_ctx *fs);