Rev 2705 | Rev 2707 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2705 | Rev 2706 | ||
|---|---|---|---|
| Line 243... | Line 243... | ||
| 243 | if (PLB_GET_CHAR(next) == '/') |
243 | if (PLB_GET_CHAR(next) == '/') |
| 244 | next++; /* eat slash */ |
244 | next++; /* eat slash */ |
| 245 | 245 | ||
| 246 | char component[NAME_MAX + 1]; |
246 | char component[NAME_MAX + 1]; |
| 247 | int len = 0; |
247 | int len = 0; |
| 248 | while (next <= last) { |
248 | while (dtmp && next <= last) { |
| 249 | 249 | ||
| 250 | /* collect the component */ |
250 | /* collect the component */ |
| 251 | if (PLB_GET_CHAR(next) != '/') { |
251 | if (PLB_GET_CHAR(next) != '/') { |
| 252 | if (len + 1 == NAME_MAX) { |
252 | if (len + 1 == NAME_MAX) { |
| 253 | /* comopnent length overflow */ |
253 | /* comopnent length overflow */ |
| Line 293... | Line 293... | ||
| 293 | } |
293 | } |
| 294 | 294 | ||
| 295 | /* descent one level */ |
295 | /* descent one level */ |
| 296 | dcur = dtmp; |
296 | dcur = dtmp; |
| 297 | dtmp = dtmp->child; |
297 | dtmp = dtmp->child; |
| - | 298 | } |
|
| 298 | 299 | ||
| 299 | /* handle miss: excessive components */ |
300 | /* handle miss: excessive components */ |
| 300 | if (!dtmp && next <= last) { |
301 | if (!dtmp && next <= last) { |
| 301 | if (lflag & L_CREATE) { |
302 | if (lflag & L_CREATE) { |
| 302 | if (dcur->type != TMPFS_DIRECTORY) { |
303 | if (dcur->type != TMPFS_DIRECTORY) { |
| 303 | ipc_answer_0(rid, ENOTDIR); |
304 | ipc_answer_0(rid, ENOTDIR); |
| - | 305 | return; |
|
| - | 306 | } |
|
| - | 307 | ||
| - | 308 | /* collect next component */ |
|
| - | 309 | while (next <= last) { |
|
| - | 310 | if (PLB_GET_CHAR(next) == '/') { |
|
| - | 311 | /* more than one component */ |
|
| - | 312 | ipc_answer_0(rid, ENOENT); |
|
| 304 | return; |
313 | return; |
| 305 | } |
314 | } |
| 306 | - | ||
| 307 | /* collect next component */ |
- | |
| 308 | while (next <= last) { |
- | |
| 309 | if (PLB_GET_CHAR(next) == '/') { |
- | |
| 310 | /* more than one component */ |
- | |
| 311 | ipc_answer_0(rid, ENOENT); |
- | |
| 312 | return; |
- | |
| 313 | } |
- | |
| 314 | if (len + 1 == NAME_MAX) { |
315 | if (len + 1 == NAME_MAX) { |
| 315 | /* component length overflow */ |
316 | /* component length overflow */ |
| 316 | ipc_answer_0(rid, ENAMETOOLONG); |
317 | ipc_answer_0(rid, ENAMETOOLONG); |
| 317 | return; |
318 | return; |
| 318 | } |
- | |
| 319 | component[len++] = PLB_GET_CHAR(next); |
- | |
| 320 | next++; /* process next character */ |
- | |
| 321 | } |
319 | } |
| - | 320 | component[len++] = PLB_GET_CHAR(next); |
|
| - | 321 | next++; /* process next character */ |
|
| - | 322 | } |
|
| 322 | assert(len); |
323 | assert(len); |
| 323 | component[len] = '\0'; |
324 | component[len] = '\0'; |
| 324 | len = 0; |
325 | len = 0; |
| 325 | 326 | ||
| 326 | unsigned long index; |
327 | unsigned long index; |
| 327 | index = create_node(dcur, component, lflag); |
328 | index = create_node(dcur, component, lflag); |
| 328 | if (index) { |
329 | if (index) { |
| 329 | ipc_answer_4(rid, EOK, |
330 | ipc_answer_4(rid, EOK, tmpfs_reg.fs_handle, |
| 330 | tmpfs_reg.fs_handle, dev_handle, |
- | |
| 331 | index, 0); |
331 | dev_handle, index, 0); |
| 332 | } else { |
332 | } else { |
| 333 | ipc_answer_0(rid, ENOSPC); |
333 | ipc_answer_0(rid, ENOSPC); |
| 334 | } |
- | |
| 335 | return; |
- | |
| 336 | } |
334 | } |
| 337 | ipc_answer_0(rid, ENOENT); |
- | |
| 338 | return; |
335 | return; |
| 339 | } |
336 | } |
| - | 337 | ipc_answer_0(rid, ENOENT); |
|
| 340 | 338 | return; |
|
| 341 | } |
339 | } |
| 342 | 340 | ||
| 343 | /* handle hit */ |
341 | /* handle hit */ |
| 344 | if (lflag & L_DESTROY) { |
342 | if (lflag & L_DESTROY) { |
| 345 | int res = destroy_component(dcur); |
343 | int res = destroy_component(dcur); |