Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
remzi-arpacidusseau
GitHub Repository: remzi-arpacidusseau/ostep-projects
Path: blob/master/filesystems-distributed-ufs/mfs.h
909 views
1
#ifndef __MFS_h__
2
#define __MFS_h__
3
4
#define MFS_DIRECTORY (0)
5
#define MFS_REGULAR_FILE (1)
6
7
#define MFS_BLOCK_SIZE (4096)
8
9
typedef struct __MFS_Stat_t {
10
int type; // MFS_DIRECTORY or MFS_REGULAR
11
int size; // bytes
12
// note: no permissions, access times, etc.
13
} MFS_Stat_t;
14
15
typedef struct __MFS_DirEnt_t {
16
char name[28]; // up to 28 bytes of name in directory (including \0)
17
int inum; // inode number of entry (-1 means entry not used)
18
} MFS_DirEnt_t;
19
20
21
int MFS_Init(char *hostname, int port);
22
int MFS_Lookup(int pinum, char *name);
23
int MFS_Stat(int inum, MFS_Stat_t *m);
24
int MFS_Write(int inum, char *buffer, int offset, int nbytes);
25
int MFS_Read(int inum, char *buffer, int offset, int nbytes);
26
int MFS_Creat(int pinum, int type, char *name);
27
int MFS_Unlink(int pinum, char *name);
28
int MFS_Shutdown();
29
30
#endif // __MFS_h__
31
32