Rev 2760 | Rev 2770 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2760 | Rev 2763 | ||
---|---|---|---|
Line 68... | Line 68... | ||
68 | * Implementation of the libfs interface. |
68 | * Implementation of the libfs interface. |
69 | */ |
69 | */ |
70 | 70 | ||
71 | /* Forward declarations of static functions. */ |
71 | /* Forward declarations of static functions. */ |
72 | static bool tmpfs_match(void *, void *, const char *); |
72 | static bool tmpfs_match(void *, void *, const char *); |
- | 73 | static void *tmpfs_node_get(int, int, unsigned long); |
|
73 | static void *tmpfs_create_node(int); |
74 | static void *tmpfs_create_node(int); |
74 | static bool tmpfs_link_node(void *, void *, const char *); |
75 | static bool tmpfs_link_node(void *, void *, const char *); |
75 | static int tmpfs_unlink_node(void *, void *); |
76 | static int tmpfs_unlink_node(void *, void *); |
76 | static void tmpfs_destroy_node(void *); |
77 | static void tmpfs_destroy_node(void *); |
77 | 78 | ||
Line 122... | Line 123... | ||
122 | } |
123 | } |
123 | 124 | ||
124 | /** libfs operations */ |
125 | /** libfs operations */ |
125 | libfs_ops_t tmpfs_libfs_ops = { |
126 | libfs_ops_t tmpfs_libfs_ops = { |
126 | .match = tmpfs_match, |
127 | .match = tmpfs_match, |
- | 128 | .node_get = tmpfs_node_get, |
|
127 | .create = tmpfs_create_node, |
129 | .create = tmpfs_create_node, |
128 | .destroy = tmpfs_destroy_node, |
130 | .destroy = tmpfs_destroy_node, |
129 | .link = tmpfs_link_node, |
131 | .link = tmpfs_link_node, |
130 | .unlink = tmpfs_unlink_node, |
132 | .unlink = tmpfs_unlink_node, |
131 | .index_get = tmpfs_index_get, |
133 | .index_get = tmpfs_index_get, |
Line 258... | Line 260... | ||
258 | tmpfs_name_t *namep = hash_table_get_instance(hlp, tmpfs_name_t, link); |
260 | tmpfs_name_t *namep = hash_table_get_instance(hlp, tmpfs_name_t, link); |
259 | 261 | ||
260 | return !strcmp(namep->name, component); |
262 | return !strcmp(namep->name, component); |
261 | } |
263 | } |
262 | 264 | ||
- | 265 | void *tmpfs_node_get(int fs_handle, int dev_handle, unsigned long index) |
|
- | 266 | { |
|
- | 267 | link_t *lnk = hash_table_find(&dentries, &index); |
|
- | 268 | if (!lnk) |
|
- | 269 | return NULL; |
|
- | 270 | return hash_table_get_instance(lnk, tmpfs_dentry_t, dh_link); |
|
- | 271 | } |
|
- | 272 | ||
263 | void *tmpfs_create_node(int lflag) |
273 | void *tmpfs_create_node(int lflag) |
264 | { |
274 | { |
265 | assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY)); |
275 | assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY)); |
266 | 276 | ||
267 | tmpfs_dentry_t *node = malloc(sizeof(tmpfs_dentry_t)); |
277 | tmpfs_dentry_t *node = malloc(sizeof(tmpfs_dentry_t)); |