Changeset b6035ba in mainline for uspace/lib/libfs
- Timestamp:
- 2009-05-05T22:09:13Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 770d281
- Parents:
- c852f4be
- Location:
- uspace/lib/libfs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libfs/libfs.c
rc852f4be rb6035ba 149 149 last += PLB_SIZE; 150 150 151 void*par = NULL;152 void*cur = ops->root_get(dev_handle);153 void*tmp = NULL;151 fs_node_t *par = NULL; 152 fs_node_t *cur = ops->root_get(dev_handle); 153 fs_node_t *tmp = NULL; 154 154 155 155 if (ops->plb_get_char(next) == '/') … … 190 190 goto out; 191 191 } 192 void *nodep;192 fs_node_t *fn; 193 193 if (lflag & L_CREATE) 194 nodep= ops->create(dev_handle, lflag);194 fn = ops->create(dev_handle, lflag); 195 195 else 196 nodep= ops->node_get(dev_handle,196 fn = ops->node_get(dev_handle, 197 197 index); 198 if ( nodep) {198 if (fn) { 199 199 int rc; 200 200 201 rc = ops->link(cur, nodep, component);201 rc = ops->link(cur, fn, component); 202 202 if (rc != EOK) { 203 203 if (lflag & L_CREATE) { 204 (void)ops->destroy( 205 nodep); 204 (void)ops->destroy(fn); 206 205 } 207 206 ipc_answer_0(rid, rc); … … 209 208 ipc_answer_5(rid, EOK, 210 209 fs_handle, dev_handle, 211 ops->index_get( nodep),212 ops->size_get( nodep),213 ops->lnkcnt_get( nodep));214 ops->node_put( nodep);210 ops->index_get(fn), 211 ops->size_get(fn), 212 ops->lnkcnt_get(fn)); 213 ops->node_put(fn); 215 214 } 216 215 } else { … … 264 263 component[len] = '\0'; 265 264 266 void *nodep;265 fs_node_t *fn; 267 266 if (lflag & L_CREATE) 268 nodep= ops->create(dev_handle, lflag);267 fn = ops->create(dev_handle, lflag); 269 268 else 270 nodep= ops->node_get(dev_handle, index);271 if ( nodep) {269 fn = ops->node_get(dev_handle, index); 270 if (fn) { 272 271 int rc; 273 272 274 rc = ops->link(cur, nodep, component);273 rc = ops->link(cur, fn, component); 275 274 if (rc != EOK) { 276 275 if (lflag & L_CREATE) 277 (void)ops->destroy( nodep);276 (void)ops->destroy(fn); 278 277 ipc_answer_0(rid, rc); 279 278 } else { 280 279 ipc_answer_5(rid, EOK, 281 280 fs_handle, dev_handle, 282 ops->index_get( nodep),283 ops->size_get( nodep),284 ops->lnkcnt_get( nodep));285 ops->node_put( nodep);281 ops->index_get(fn), 282 ops->size_get(fn), 283 ops->lnkcnt_get(fn)); 284 ops->node_put(fn); 286 285 } 287 286 } else { -
uspace/lib/libfs/libfs.h
rc852f4be rb6035ba 43 43 44 44 typedef struct { 45 void * (* match)(void *, const char *); 46 void * (* node_get)(dev_handle_t, fs_index_t); 47 void (* node_put)(void *); 48 void * (* create)(dev_handle_t, int); 49 int (* destroy)(void *); 50 int (* link)(void *, void *, const char *); 51 int (* unlink)(void *, void *); 52 fs_index_t (* index_get)(void *); 53 size_t (* size_get)(void *); 54 unsigned (* lnkcnt_get)(void *); 55 bool (* has_children)(void *); 56 void *(* root_get)(dev_handle_t); 45 void *data; /**< Data of the file system implementation. */ 46 } fs_node_t; 47 48 typedef struct { 49 fs_node_t * (* match)(fs_node_t *, const char *); 50 fs_node_t * (* node_get)(dev_handle_t, fs_index_t); 51 void (* node_put)(fs_node_t *); 52 fs_node_t * (* create)(dev_handle_t, int); 53 int (* destroy)(fs_node_t *); 54 int (* link)(fs_node_t *, fs_node_t *, const char *); 55 int (* unlink)(fs_node_t *, fs_node_t *); 56 fs_index_t (* index_get)(fs_node_t *); 57 size_t (* size_get)(fs_node_t *); 58 unsigned (* lnkcnt_get)(fs_node_t *); 59 bool (* has_children)(fs_node_t *); 60 fs_node_t *(* root_get)(dev_handle_t); 57 61 char (* plb_get_char)(unsigned pos); 58 bool (* is_directory)( void*);59 bool (* is_file)( void*);62 bool (* is_directory)(fs_node_t *); 63 bool (* is_file)(fs_node_t *); 60 64 } libfs_ops_t; 61 65
Note:
See TracChangeset
for help on using the changeset viewer.