141,7 → 141,6 |
unsigned last = IPC_GET_ARG2(*request); |
int dev_handle = IPC_GET_ARG3(*request); |
int lflag = IPC_GET_ARG4(*request); |
int index = IPC_GET_ARG5(*request); /* when L_LINK specified */ |
|
if (last < next) |
last += PLB_SIZE; |
181,34 → 180,21 |
|
/* handle miss: match amongst siblings */ |
if (!tmp) { |
if (next <= last) { |
/* there are unprocessed components */ |
ipc_answer_0(rid, ENOENT); |
return; |
} |
/* miss in the last component */ |
if (lflag & (L_CREATE | L_LINK)) { |
/* request to create a new link */ |
if ((next > last) && (lflag & L_CREATE)) { |
/* no components left and L_CREATE specified */ |
if (!ops->is_directory(cur)) { |
ipc_answer_0(rid, ENOTDIR); |
return; |
} |
void *nodep; |
if (lflag & L_CREATE) |
nodep = ops->create(lflag); |
else |
nodep = ops->node_get(fs_handle, |
dev_handle, index); |
} |
void *nodep = ops->create(lflag); |
if (nodep) { |
if (!ops->link(cur, nodep, component)) { |
if (lflag & L_CREATE) |
ops->destroy(nodep); |
ops->destroy(nodep); |
ipc_answer_0(rid, ENOSPC); |
} else { |
ipc_answer_5(rid, EOK, |
fs_handle, dev_handle, |
ops->index_get(nodep), |
ops->size_get(nodep), |
ops->index_get(nodep), 0, |
ops->lnkcnt_get(nodep)); |
} |
} else { |
215,12 → 201,7 |
ipc_answer_0(rid, ENOSPC); |
} |
return; |
} else if (lflag & L_PARENT) { |
/* return parent */ |
ipc_answer_5(rid, EOK, fs_handle, dev_handle, |
ops->index_get(cur), ops->size_get(cur), |
ops->lnkcnt_get(cur)); |
} |
} |
ipc_answer_0(rid, ENOENT); |
return; |
} |
233,7 → 214,7 |
|
/* handle miss: excessive components */ |
if (!tmp && next <= last) { |
if (lflag & (L_CREATE | L_LINK)) { |
if (lflag & L_CREATE) { |
if (!ops->is_directory(cur)) { |
ipc_answer_0(rid, ENOTDIR); |
return; |
258,22 → 239,15 |
component[len] = '\0'; |
len = 0; |
|
void *nodep; |
if (lflag & L_CREATE) |
nodep = ops->create(lflag); |
else |
nodep = ops->node_get(fs_handle, dev_handle, |
index); |
void *nodep = ops->create(lflag); |
if (nodep) { |
if (!ops->link(cur, nodep, component)) { |
if (lflag & L_CREATE) |
ops->destroy(nodep); |
ops->destroy(nodep); |
ipc_answer_0(rid, ENOSPC); |
} else { |
ipc_answer_5(rid, EOK, |
fs_handle, dev_handle, |
ops->index_get(nodep), |
ops->size_get(nodep), |
ops->index_get(nodep), 0, |
ops->lnkcnt_get(nodep)); |
} |
} else { |
286,14 → 260,7 |
} |
|
/* handle hit */ |
if (lflag & L_PARENT) { |
cur = par; |
if (!cur) { |
ipc_answer_0(rid, ENOENT); |
return; |
} |
} |
if (lflag & L_UNLINK) { |
if (lflag & L_DESTROY) { |
unsigned old_lnkcnt = ops->lnkcnt_get(cur); |
int res = ops->unlink(par, cur); |
ipc_answer_5(rid, (ipcarg_t)res, fs_handle, dev_handle, |
300,8 → 267,7 |
ops->index_get(cur), ops->size_get(cur), old_lnkcnt); |
return; |
} |
if (((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) || |
(lflag & L_LINK)) { |
if ((lflag & (L_CREATE | L_EXCLUSIVE)) == (L_CREATE | L_EXCLUSIVE)) { |
ipc_answer_0(rid, EEXIST); |
return; |
} |