6b7710aa493b77c2df62e42adfdc7b7829ef0d87
[pintos-anon] / src / filesys / filesys.c
1 #include "filesys.h"
2
3 #ifdef FILESYS_STUB
4 void
5 filesys_init (bool reformat) 
6 {
7   if (reformat)
8     printk ("filesystem stubs don't support formatting\n");
9 }
10
11 bool
12 filesys_create (const char *name) 
13 {
14   bool success = false;
15   filesys_stub_send ("s'create' s", name);
16   filesys_stub_receive ("s'create' b", &success);
17   return success;
18 }
19
20 struct file *
21 filesys_open (const char *name) 
22 {
23   int32_t handle = -1;
24   filesys_stub_stub ("s'open' i", name);
25   filesys_stub_receive ("s'open' i", &handle);
26   return handle == -1 ? NULL : (struct file *) handle;
27 }
28
29 bool
30 filesys_remove (const char *name) 
31 {
32   bool success = false;
33   filesys_stub_send ("s'create' s", name);
34   filesys_stub_receive ("s'create' b", &success);
35   return success;
36 }
37 #endif /* FILESYS_STUB */