-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_block_ops.h
48 lines (33 loc) · 919 Bytes
/
data_block_ops.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
#ifndef __DATA_BLOCK_OPS__
#define __DATA_BLOCK_OPS__
#include <sys/types.h>
#include "common_includes.h"
#define ALLOCATE_DATA_BLOCK "allocate_data_block"
#define FREE_DATA_BLOCK "free_data_block"
#define READ_DATA_BLOCK "read_data_block"
#define WRITE_DATA_BLOCK "write_data_block"
/*
Allocate a new data block
@return Data block number on success or -1 on failure
*/
ssize_t allocate_data_block();
/*
Read information contained in a data block.
@param index: The data block number.
@return Buffer with contents or NULL
*/
char* read_data_block(ssize_t index);
/*
Write information to a data block
@param index: The data block number.
@param buf: the buffer which contains data to write
@return Success or failure
*/
bool write_data_block(ssize_t index, char* buffer);
/*
Free a data block.
@param index: The data block number.
@return Success or failure
*/
bool free_data_block(ssize_t index);
#endif