Changeset 06901c6b in mainline
- Timestamp:
- 2008-04-14T05:15:16Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e13d1feb
- Parents:
- c9f6e49f
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libfs/libfs.c
rc9f6e49f r06901c6b 151 151 void *par = NULL; 152 152 void *cur = ops->root_get(dev_handle); 153 void *tmp = NULL; 153 154 154 155 if (ops->plb_get_char(next) == '/') … … 156 157 157 158 while (ops->has_children(cur) && next <= last) { 158 void *tmp;159 160 159 /* collect the component */ 161 160 len = 0; … … 164 163 /* comopnent length overflow */ 165 164 ipc_answer_0(rid, ENAMETOOLONG); 166 return;165 goto out; 167 166 } 168 167 component[len++] = ops->plb_get_char(next); … … 182 181 /* there are unprocessed components */ 183 182 ipc_answer_0(rid, ENOENT); 184 return;183 goto out; 185 184 } 186 185 /* miss in the last component */ … … 189 188 if (!ops->is_directory(cur)) { 190 189 ipc_answer_0(rid, ENOTDIR); 191 return;190 goto out; 192 191 } 193 192 void *nodep; … … 208 207 ops->size_get(nodep), 209 208 ops->lnkcnt_get(nodep)); 209 ops->node_put(nodep); 210 210 } 211 211 } else { 212 212 ipc_answer_0(rid, ENOSPC); 213 213 } 214 return;214 goto out; 215 215 } else if (lflag & L_PARENT) { 216 216 /* return parent */ … … 220 220 } 221 221 ipc_answer_0(rid, ENOENT); 222 return;222 goto out; 223 223 } 224 225 if (par) 226 ops->node_put(par); 224 227 225 228 /* descend one level */ 226 229 par = cur; 227 230 cur = tmp; 231 tmp = NULL; 228 232 } 229 233 … … 233 237 if (!ops->is_directory(cur)) { 234 238 ipc_answer_0(rid, ENOTDIR); 235 return;239 goto out; 236 240 } 237 241 … … 242 246 /* more than one component */ 243 247 ipc_answer_0(rid, ENOENT); 244 return;248 goto out; 245 249 } 246 250 if (len + 1 == NAME_MAX) { 247 251 /* component length overflow */ 248 252 ipc_answer_0(rid, ENAMETOOLONG); 249 return;253 goto out; 250 254 } 251 255 component[len++] = ops->plb_get_char(next); … … 272 276 ops->size_get(nodep), 273 277 ops->lnkcnt_get(nodep)); 278 ops->node_put(nodep); 274 279 } 275 280 } else { 276 281 ipc_answer_0(rid, ENOSPC); 277 282 } 278 return;283 goto out; 279 284 } 280 285 ipc_answer_0(rid, ENOENT); 281 return;286 goto out; 282 287 } 283 288 284 289 /* handle hit */ 285 290 if (lflag & L_PARENT) { 291 ops->node_put(cur); 286 292 cur = par; 293 par = NULL; 287 294 if (!cur) { 288 295 ipc_answer_0(rid, ENOENT); 289 return;296 goto out; 290 297 } 291 298 } … … 295 302 ipc_answer_5(rid, (ipcarg_t)res, fs_handle, dev_handle, 296 303 ops->index_get(cur), ops->size_get(cur), old_lnkcnt); 297 return;304 goto out; 298 305 } 299 306 if (((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) || 300 307 (lflag & L_LINK)) { 301 308 ipc_answer_0(rid, EEXIST); 302 return;309 goto out; 303 310 } 304 311 if ((lflag & L_FILE) && (ops->is_directory(cur))) { 305 312 ipc_answer_0(rid, EISDIR); 306 return;313 goto out; 307 314 } 308 315 if ((lflag & L_DIRECTORY) && (ops->is_file(cur))) { 309 316 ipc_answer_0(rid, ENOTDIR); 310 return;317 goto out; 311 318 } 312 319 313 320 ipc_answer_5(rid, EOK, fs_handle, dev_handle, ops->index_get(cur), 314 321 ops->size_get(cur), ops->lnkcnt_get(cur)); 322 323 out: 324 if (par) 325 ops->node_put(par); 326 if (cur) 327 ops->node_put(cur); 328 if (tmp) 329 ops->node_put(tmp); 315 330 } 316 331 -
uspace/lib/libfs/libfs.h
rc9f6e49f r06901c6b 45 45 void * (* match)(void *, const char *); 46 46 void * (* node_get)(dev_handle_t, fs_index_t, fs_index_t); 47 void (* node_put)(void *); 47 48 void * (* create)(int); 48 49 void (* destroy)(void *); -
uspace/srv/fs/fat/fat_ops.c
rc9f6e49f r06901c6b 275 275 276 276 return node; 277 } 278 279 static void fat_node_put(void *node) 280 { 281 /* TODO */ 277 282 } 278 283 … … 415 420 .match = fat_match, 416 421 .node_get = fat_node_get, 422 .node_put = fat_node_put, 417 423 .create = NULL, 418 424 .destroy = NULL, -
uspace/srv/fs/tmpfs/tmpfs_ops.c
rc9f6e49f r06901c6b 72 72 static void *tmpfs_match(void *, const char *); 73 73 static void *tmpfs_node_get(dev_handle_t, fs_index_t, fs_index_t); 74 static void tmpfs_node_put(void *); 74 75 static void *tmpfs_create_node(int); 75 76 static bool tmpfs_link_node(void *, void *, const char *); … … 122 123 .match = tmpfs_match, 123 124 .node_get = tmpfs_node_get, 125 .node_put = tmpfs_node_put, 124 126 .create = tmpfs_create_node, 125 127 .destroy = tmpfs_destroy_node, … … 274 276 return NULL; 275 277 return hash_table_get_instance(lnk, tmpfs_dentry_t, dh_link); 278 } 279 280 void tmpfs_node_put(void *node) 281 { 282 /* nothing to do */ 276 283 } 277 284
Note:
See TracChangeset
for help on using the changeset viewer.