Rev 4432 | Rev 4528 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4432 | Rev 4518 | ||
|---|---|---|---|
| Line 38... | Line 38... | ||
| 38 | #include <errno.h> |
38 | #include <errno.h> |
| 39 | #include <stdlib.h> |
39 | #include <stdlib.h> |
| 40 | #include <string.h> |
40 | #include <string.h> |
| 41 | #include <assert.h> |
41 | #include <assert.h> |
| 42 | #include <bool.h> |
42 | #include <bool.h> |
| - | 43 | #include <fibril_sync.h> |
|
| 43 | #include "vfs.h" |
44 | #include "vfs.h" |
| 44 | 45 | ||
| 45 | /** |
46 | /** |
| 46 | * This is a per-connection table of open files. |
47 | * This is a per-connection table of open files. |
| 47 | * Our assumption is that each client opens only one connection and therefore |
48 | * Our assumption is that each client opens only one connection and therefore |
| Line 87... | Line 88... | ||
| 87 | files[i] = (vfs_file_t *) malloc(sizeof(vfs_file_t)); |
88 | files[i] = (vfs_file_t *) malloc(sizeof(vfs_file_t)); |
| 88 | if (!files[i]) |
89 | if (!files[i]) |
| 89 | return ENOMEM; |
90 | return ENOMEM; |
| 90 | 91 | ||
| 91 | memset(files[i], 0, sizeof(vfs_file_t)); |
92 | memset(files[i], 0, sizeof(vfs_file_t)); |
| 92 | futex_initialize(&files[i]->lock, 1); |
93 | fibril_mutex_initialize(&files[i]->lock); |
| 93 | vfs_file_addref(files[i]); |
94 | vfs_file_addref(files[i]); |
| 94 | return (int) i; |
95 | return (int) i; |
| 95 | } |
96 | } |
| 96 | } |
97 | } |
| 97 | 98 | ||