/trunk/kernel/generic/include/syscall/syscall.h |
---|
52,7 → 52,7 |
SYS_IPC_CALL_ASYNC_FAST, |
SYS_IPC_CALL_ASYNC_SLOW, |
SYS_IPC_ANSWER_FAST, |
SYS_IPC_ANSWER, |
SYS_IPC_ANSWER_SLOW, |
SYS_IPC_FORWARD_FAST, |
SYS_IPC_WAIT, |
SYS_IPC_HANGUP, |
/trunk/kernel/generic/include/ipc/sysipc.h |
---|
47,8 → 47,8 |
unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4); |
unative_t sys_ipc_call_async_slow(unative_t phoneid, ipc_data_t *data); |
unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, |
unative_t arg1, unative_t arg2); |
unative_t sys_ipc_answer(unative_t callid, ipc_data_t *data); |
unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4); |
unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data); |
unative_t sys_ipc_wait_for_call(ipc_data_t *calldata, uint32_t usec, |
int nonblocking); |
unative_t sys_ipc_forward_fast(unative_t callid, unative_t phoneid, |
/trunk/kernel/generic/src/syscall/syscall.c |
---|
137,7 → 137,7 |
(syshandler_t) sys_ipc_call_async_fast, |
(syshandler_t) sys_ipc_call_async_slow, |
(syshandler_t) sys_ipc_answer_fast, |
(syshandler_t) sys_ipc_answer, |
(syshandler_t) sys_ipc_answer_slow, |
(syshandler_t) sys_ipc_forward_fast, |
(syshandler_t) sys_ipc_wait_for_call, |
(syshandler_t) sys_ipc_hangup, |
/trunk/kernel/generic/src/ipc/sysipc.c |
---|
592,11 → 592,13 |
* @param retval Return value of the answer. |
* @param arg1 Service-defined return value. |
* @param arg2 Service-defined return value. |
* @param arg3 Service-defined return value. |
* @param arg4 Service-defined return value. |
* |
* @return Return 0 on success, otherwise return an error code. |
*/ |
unative_t sys_ipc_answer_fast(unative_t callid, unative_t retval, |
unative_t arg1, unative_t arg2) |
unative_t arg1, unative_t arg2, unative_t arg3, unative_t arg4) |
{ |
call_t *call; |
ipc_data_t saved_data; |
619,6 → 621,8 |
IPC_SET_RETVAL(call->data, retval); |
IPC_SET_ARG1(call->data, arg1); |
IPC_SET_ARG2(call->data, arg2); |
IPC_SET_ARG3(call->data, arg3); |
IPC_SET_ARG4(call->data, arg4); |
rc = answer_preprocess(call, saveddata ? &saved_data : NULL); |
ipc_answer(&TASK->answerbox, call); |
632,7 → 636,7 |
* |
* @return Return 0 on success, otherwise return an error code. |
*/ |
unative_t sys_ipc_answer(unative_t callid, ipc_data_t *data) |
unative_t sys_ipc_answer_slow(unative_t callid, ipc_data_t *data) |
{ |
call_t *call; |
ipc_data_t saved_data; |
/trunk/uspace/app/tester/ipc/answer.c |
---|
46,7 → 46,7 |
break; |
} |
if (!cnt) |
return; |
return NULL; |
printf("Choose message:\n"); |
do { |
c = getchar(); |
69,7 → 69,7 |
else if (c == 'e') |
errn = ENOENT; |
printf("Answering %P\n", callids[i]); |
ipc_answer_fast(callids[i], errn, 0, 0); |
ipc_answer_0(callids[i], errn); |
callids[i] = 0; |
return NULL; |
/trunk/uspace/app/tester/ipc/register.c |
---|
29,6 → 29,7 |
#include <stdio.h> |
#include <unistd.h> |
#include <async.h> |
#include <errno.h> |
#include "../tester.h" |
static void client_connection(ipc_callid_t iid, ipc_call_t *icall) |
40,7 → 41,7 |
int i; |
printf("Connected phone: %P, accepting\n", icall->in_phone_hash); |
ipc_answer_fast(iid, 0, 0, 0); |
ipc_answer_0(iid, EOK); |
for (i = 0; i < 1024; i++) |
if (!connections[i]) { |
connections[i] = phonehash; |
55,7 → 56,8 |
retval = 0; |
break; |
default: |
printf("Received message from %P: %X\n", phonehash,callid); |
printf("Received message from %P: %X\n", phonehash, |
callid); |
for (i = 0; i < 1024; i++) |
if (!callids[i]) { |
callids[i] = callid; |
63,7 → 65,7 |
} |
continue; |
} |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
} |
} |
/trunk/uspace/app/tester/ipc/send_async.c |
---|
38,7 → 38,6 |
char * test_send_async(bool quiet) |
{ |
int phoneid; |
int res; |
static int msgid = 1; |
char c; |
/trunk/uspace/lib/libc/include/ipc/ipc.h |
---|
190,13 → 190,29 |
} |
extern ipc_callid_t ipc_trywait_for_call(ipc_call_t *data); |
#define ipc_answer_fast_0(callid, retval) \ |
ipc_answer_fast((callid), (retval), 0, 0) |
#define ipc_answer_fast_1(callid, retval, arg1) \ |
ipc_answer_fast((callid), (retval), (arg1), 0) |
/* |
* User-friendly wrappers for ipc_answer_fast() and ipc_answer_slow(). |
* They are in the form of ipc_answer_m(), where m is the number of return |
* arguments. The macros decide between the fast and the slow version according |
* to m. |
*/ |
#define ipc_answer_0(callid, retval) \ |
ipc_answer_fast((callid), (retval), 0, 0, 0, 0) |
#define ipc_answer_1(callid, retval, arg1) \ |
ipc_answer_fast((callid), (retval), (arg1), 0, 0, 0) |
#define ipc_answer_2(callid, retval, arg1, arg2) \ |
ipc_answer_fast((callid), (retval), (arg1), (arg2), 0, 0) |
#define ipc_answer_3(callid, retval, arg1, arg2, arg3) \ |
ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), 0) |
#define ipc_answer_4(callid, retval, arg1, arg2, arg3, arg4) \ |
ipc_answer_fast((callid), (retval), (arg1), (arg2), (arg3), (arg4)) |
#define ipc_answer_5(callid, retval, arg1, arg2, arg3, arg4, arg5) \ |
ipc_answer_slow((callid), (retval), (arg1), (arg2), (arg3), (arg4), (arg5)) |
extern ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, |
ipcarg_t arg1, ipcarg_t arg2); |
extern ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call); |
ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4); |
extern ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval, |
ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5); |
/* |
* User-friendly wrappers for ipc_call_async_fast() and ipc_call_async_slow(). |
244,10 → 260,8 |
extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, |
ipcarg_t arg1); |
extern int ipc_data_send(int phoneid, void *src, size_t size); |
extern int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst, |
size_t *size); |
extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call, |
void *dst, size_t size); |
extern int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size); |
extern ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size); |
#endif |
/trunk/uspace/lib/libc/generic/ipc.c |
---|
375,33 → 375,50 |
/** Answer a received call - fast version. |
* |
* The fast answer makes use of passing retval and first two arguments in |
* registers. If you need to return more, use the ipc_answer() instead. |
* The fast answer makes use of passing retval and first four arguments in |
* registers. If you need to return more, use the ipc_answer_slow() instead. |
* |
* @param callid Hash of the call being answered. |
* @param retval Return value. |
* @param arg1 First return argument. |
* @param arg2 Second return argument. |
* @param arg3 Third return argument. |
* @param arg4 Fourth return argument. |
* |
* @return Zero on success or a value from @ref errno.h on failure. |
*/ |
ipcarg_t ipc_answer_fast(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, |
ipcarg_t arg2) |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4) |
{ |
return __SYSCALL4(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2); |
return __SYSCALL6(SYS_IPC_ANSWER_FAST, callid, retval, arg1, arg2, arg3, |
arg4); |
} |
/** Answer a received call - full version. |
/** Answer a received call - slow full version. |
* |
* @param callid Hash of the call being answered. |
* @param call Call structure with the answer. |
* Must be already initialized by the responder. |
* @param retval Return value. |
* @param arg1 First return argument. |
* @param arg2 Second return argument. |
* @param arg3 Third return argument. |
* @param arg4 Fourth return argument. |
* @param arg5 Fifth return argument. |
* |
* @return Zero on success or a value from @ref errno.h on failure. |
*/ |
ipcarg_t ipc_answer(ipc_callid_t callid, ipc_call_t *call) |
ipcarg_t ipc_answer_slow(ipc_callid_t callid, ipcarg_t retval, ipcarg_t arg1, |
ipcarg_t arg2, ipcarg_t arg3, ipcarg_t arg4, ipcarg_t arg5) |
{ |
return __SYSCALL2(SYS_IPC_ANSWER, callid, (sysarg_t) call); |
ipc_call_t data; |
IPC_SET_RETVAL(data, retval); |
IPC_SET_ARG1(data, arg1); |
IPC_SET_ARG2(data, arg2); |
IPC_SET_ARG3(data, arg3); |
IPC_SET_ARG4(data, arg4); |
IPC_SET_ARG5(data, arg5); |
return __SYSCALL2(SYS_IPC_ANSWER_SLOW, callid, (sysarg_t) &data); |
} |
658,7 → 675,6 |
* |
* @param callid Storage where the hash of the IPC_M_DATA_SEND call will |
* be stored. |
* @param call Storage where the incoming call will be stored. |
* @param dst Storage where the suggested destination address will |
* be stored. May be NULL. |
* @param size Storage where the suggested size will be stored. May be |
666,19 → 682,19 |
* |
* @return Non-zero on success, zero on failure. |
*/ |
int ipc_data_receive(ipc_callid_t *callid, ipc_call_t *call, void **dst, |
size_t *size) |
int ipc_data_receive(ipc_callid_t *callid, void **dst, size_t *size) |
{ |
ipc_call_t data; |
assert(callid); |
assert(call); |
*callid = async_get_call(call); |
if (IPC_GET_METHOD(*call) != IPC_M_DATA_SEND) |
*callid = async_get_call(&data); |
if (IPC_GET_METHOD(data) != IPC_M_DATA_SEND) |
return 0; |
if (dst) |
*dst = (void *) IPC_GET_ARG1(*call); |
*dst = (void *) IPC_GET_ARG1(data); |
if (size) |
*size = (size_t) IPC_GET_ARG3(*call); |
*size = (size_t) IPC_GET_ARG3(data); |
return 1; |
} |
688,19 → 704,14 |
* so that the user doesn't have to remember the meaning of each IPC argument. |
* |
* @param callid Hash of the IPC_M_DATA_SEND call to answer. |
* @param call Call structure with the request. |
* @param dst Final destination address for the IPC_M_DATA_SEND call. |
* @param size Final size for the IPC_M_DATA_SEND call. |
* |
* @return Zero on success or a value from @ref errno.h on failure. |
*/ |
ipcarg_t ipc_data_deliver(ipc_callid_t callid, ipc_call_t *call, void *dst, |
size_t size) |
ipcarg_t ipc_data_deliver(ipc_callid_t callid, void *dst, size_t size) |
{ |
IPC_SET_RETVAL(*call, EOK); |
IPC_SET_ARG1(*call, (ipcarg_t) dst); |
IPC_SET_ARG3(*call, (ipcarg_t) size); |
return ipc_answer(callid, call); |
return ipc_answer_3(callid, EOK, (ipcarg_t) dst, 0, (ipcarg_t) size); |
} |
/** @} |
/trunk/uspace/lib/libc/generic/async.c |
---|
75,14 → 75,14 |
* my_client_connection(icallid, *icall) |
* { |
* if (want_refuse) { |
* ipc_answer_fast(icallid, ELIMIT, 0, 0); |
* ipc_answer_0(icallid, ELIMIT); |
* return; |
* } |
* ipc_answer_fast(icallid, EOK, 0, 0); |
* ipc_answer_0(icallid, EOK); |
* |
* callid = async_get_call(&call); |
* handle_call(callid, call); |
* ipc_answer_fast(callid, 1, 2, 3); |
* ipc_answer_2(callid, 1, 2, 3); |
* |
* callid = async_get_call(&call); |
* .... |
395,7 → 395,7 |
*/ |
static void default_client_connection(ipc_callid_t callid, ipc_call_t *call) |
{ |
ipc_answer_fast(callid, ENOENT, 0, 0); |
ipc_answer_0(callid, ENOENT); |
} |
/** Default fibril function that gets called to handle interrupt notifications. |
440,11 → 440,11 |
list_remove(&msg->link); |
if (msg->callid == FIBRIL_connection->close_callid) |
close_answered = 1; |
ipc_answer_fast(msg->callid, EHANGUP, 0, 0); |
ipc_answer_0(msg->callid, EHANGUP); |
free(msg); |
} |
if (FIBRIL_connection->close_callid) |
ipc_answer_fast(FIBRIL_connection->close_callid, 0, 0, 0); |
ipc_answer_0(FIBRIL_connection->close_callid, EOK); |
return 0; |
} |
475,7 → 475,7 |
conn = malloc(sizeof(*conn)); |
if (!conn) { |
if (callid) |
ipc_answer_fast(callid, ENOMEM, 0, 0); |
ipc_answer_0(callid, ENOMEM); |
return NULL; |
} |
conn->in_phone_hash = in_phone_hash; |
491,7 → 491,7 |
if (!conn->wdata.fid) { |
free(conn); |
if (callid) |
ipc_answer_fast(callid, ENOMEM, 0, 0); |
ipc_answer_0(callid, ENOMEM); |
return NULL; |
} |
/* Add connection to the connection hash table */ |
536,7 → 536,7 |
return; |
/* Unknown call from unknown phone - hang it up */ |
ipc_answer_fast(callid, EHANGUP, 0, 0); |
ipc_answer_0(callid, EHANGUP); |
} |
/** Fire all timeouts that expired. */ |
/trunk/uspace/srv/kbd/generic/kbd.c |
---|
68,7 → 68,10 |
kbd_arch_process(&keybuffer, call); |
if (cons_connected && phone2cons != -1) { |
/* recode to ASCII - one interrupt can produce more than one code so result is stored in fifo */ |
/* |
* recode to ASCII - one interrupt can produce more than one |
* code so result is stored in fifo |
*/ |
while (!keybuffer_empty(&keybuffer)) { |
if (!keybuffer_pop(&keybuffer, (int *)&chr)) |
break; |
85,11 → 88,11 |
int retval; |
if (cons_connected) { |
ipc_answer_fast(iid, ELIMIT, 0, 0); |
ipc_answer_0(iid, ELIMIT); |
return; |
} |
cons_connected = 1; |
ipc_answer_fast(iid, 0, 0, 0); |
ipc_answer_0(iid, EOK); |
while (1) { |
callid = async_get_call(&call); |
98,7 → 101,7 |
cons_connected = 0; |
ipc_hangup(phone2cons); |
phone2cons = -1; |
ipc_answer_fast(callid, 0,0,0); |
ipc_answer_0(callid, EOK); |
return; |
case IPC_M_CONNECT_TO_ME: |
if (phone2cons != -1) { |
111,7 → 114,7 |
default: |
retval = EINVAL; |
} |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
} |
} |
/trunk/uspace/srv/ns/ns.c |
---|
92,7 → 92,7 |
if (!*addr) { |
ph_addr = (void *) sysinfo_value(name); |
if (!ph_addr) { |
ipc_answer_fast_0(callid, ENOENT); |
ipc_answer_0(callid, ENOENT); |
return; |
} |
*addr = as_get_mappable_page(PAGE_SIZE); |
99,7 → 99,7 |
physmem_map(ph_addr, *addr, 1, |
AS_AREA_READ | AS_AREA_CACHEABLE); |
} |
ipc_answer_fast(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ); |
ipc_answer_2(callid, EOK, (ipcarg_t) *addr, AS_AREA_READ); |
} |
int main(int argc, char **argv) |
128,7 → 128,7 |
&klogaddr); |
break; |
default: |
ipc_answer_fast_0(callid, ENOENT); |
ipc_answer_0(callid, ENOENT); |
} |
continue; |
case IPC_M_PHONE_HUNGUP: |
153,7 → 153,7 |
break; |
} |
if (!(callid & IPC_CALLID_NOTIFICATION)) { |
ipc_answer_fast_0(callid, retval); |
ipc_answer_0(callid, retval); |
} |
} |
} |
/trunk/uspace/srv/console/console.c |
---|
277,8 → 277,7 |
for (j = 0; j < conn->screenbuffer.size_y; j++) |
for (i = 0; i < conn->screenbuffer.size_x; i++) { |
field = get_field_at(&conn->screenbuffer, i, |
j); |
field = get_field_at(&conn->screenbuffer, i, j); |
if (!style_same(*style, field->style)) |
set_style(&field->style); |
style = &field->style; |
349,8 → 348,8 |
/* if client is awaiting key, send it */ |
if (conn->keyrequest_counter > 0) { |
conn->keyrequest_counter--; |
ipc_answer_fast(fifo_pop(conn->keyrequests), 0, |
c, 0); |
ipc_answer_1(fifo_pop(conn->keyrequests), EOK, |
c); |
break; |
} |
361,7 → 360,7 |
default: |
retval = ENOENT; |
} |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
} |
} |
375,7 → 374,7 |
connection_t *conn; |
if ((consnum = find_free_connection()) == -1) { |
ipc_answer_fast(iid, ELIMIT, 0, 0); |
ipc_answer_0(iid, ELIMIT); |
return; |
} |
conn = &connections[consnum]; |
387,7 → 386,7 |
screenbuffer_clear(&conn->screenbuffer); |
/* Accept the connection */ |
ipc_answer_fast(iid, 0, 0, 0); |
ipc_answer_0(iid, EOK); |
while (1) { |
async_serialize_end(); |
403,8 → 402,8 |
/* Answer all pending requests */ |
while (conn->keyrequest_counter > 0) { |
conn->keyrequest_counter--; |
ipc_answer_fast(fifo_pop(conn->keyrequests), |
ENOENT, 0, 0); |
ipc_answer_0(fifo_pop(conn->keyrequests), |
ENOENT); |
break; |
} |
conn->used = 0; |
464,7 → 463,7 |
* No key available and too many |
* requests => fail. |
*/ |
ipc_answer_fast(callid, ELIMIT, 0, 0); |
ipc_answer_0(callid, ELIMIT); |
} |
continue; |
} |
471,7 → 470,7 |
keybuffer_pop(&conn->keybuffer, (int *) &arg1); |
break; |
} |
ipc_answer_fast(callid, 0, arg1, arg2); |
ipc_answer_2(callid, EOK, arg1, arg2); |
} |
} |
/trunk/uspace/srv/rd/rd.c |
---|
90,7 → 90,7 |
* Hang up the phone if we cannot proceed any further. |
* This is the answer to the call that opened the connection. |
*/ |
ipc_answer_fast(iid, EHANGUP, 0, 0); |
ipc_answer_0(iid, EHANGUP); |
return; |
} else { |
/* |
97,7 → 97,7 |
* Answer the first IPC_M_CONNECT_ME_TO call. |
* Return supported block size as ARG1. |
*/ |
ipc_answer_fast(iid, EOK, BLOCK_SIZE, 0); |
ipc_answer_1(iid, EOK, BLOCK_SIZE); |
} |
/* |
110,13 → 110,13 |
* The client sends an as_area that can absorb the whole |
* block. |
*/ |
ipc_answer_fast(callid, EOK, (uintptr_t) fs_va, 0); |
ipc_answer_1(callid, EOK, (uintptr_t) fs_va); |
} else { |
/* |
* The client offered as_area too small. |
* Close the connection. |
*/ |
ipc_answer_fast(callid, EHANGUP, 0, 0); |
ipc_answer_0(callid, EHANGUP); |
return; |
} |
} else { |
125,7 → 125,7 |
* At this point we can't handle protocol variations. |
* Close the connection. |
*/ |
ipc_answer_fast(callid, EHANGUP, 0, 0); |
ipc_answer_0(callid, EHANGUP); |
return; |
} |
137,7 → 137,7 |
* The other side has hung up. |
* Answer the message and exit the fibril. |
*/ |
ipc_answer_fast(callid, EOK, 0, 0); |
ipc_answer_0(callid, EOK); |
return; |
case RD_READ_BLOCK: |
offset = IPC_GET_ARG1(call); |
177,7 → 177,7 |
retval = EINVAL; |
break; |
} |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
} |
} |
/trunk/uspace/srv/fb/main.c |
---|
44,7 → 44,7 |
void *dest; |
dest = as_get_mappable_page(IPC_GET_ARG2(*call)); |
if (ipc_answer_fast(callid, 0, (sysarg_t) dest, 0) == 0) { |
if (ipc_answer_1(callid, EOK, (sysarg_t) dest) == 0) { |
if (*area) |
as_area_destroy(*area); |
*area = dest; |
/trunk/uspace/srv/fb/sysio.c |
---|
117,18 → 117,18 |
int i; |
if (client_connected) { |
ipc_answer_fast(iid, ELIMIT, 0,0); |
ipc_answer_0(iid, ELIMIT); |
return; |
} |
client_connected = 1; |
ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */ |
ipc_answer_0(iid, EOK); /* Accept connection */ |
while (1) { |
callid = async_get_call(&call); |
switch (IPC_GET_METHOD(call)) { |
case IPC_M_PHONE_HUNGUP: |
client_connected = 0; |
ipc_answer_fast(callid, 0, 0, 0); |
ipc_answer_0(callid, EOK); |
return; /* Exit thread */ |
case FB_PUTCHAR: |
c = IPC_GET_ARG1(call); |
150,7 → 150,7 |
retval = 0; |
break; |
case FB_GET_CSIZE: |
ipc_answer_fast(callid, 0, HEIGHT, WIDTH); |
ipc_answer_2(callid, EOK, HEIGHT, WIDTH); |
continue; |
case FB_CLEAR: |
clrscr(); |
179,7 → 179,7 |
retval = ENOENT; |
} |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
} |
} |
/trunk/uspace/srv/fb/fb.c |
---|
356,8 → 356,7 |
lines, vport->style.bg_color); |
} else if (lines < 0) { |
lines = -lines; |
for (y = vport->y + vport->height-1; y >= vport->y + lines; |
y--) |
for (y = vport->y + vport->height-1; y >= vport->y + lines; y--) |
memcpy(&screen.fbaddress[POINTPOS(vport->x,y)], |
&screen.fbaddress[POINTPOS(vport->x,y - lines)], |
screen.pixelbytes * vport->width); |
380,8 → 379,7 |
dsty = vport->y + y; |
memcpy(&screen.fbaddress[POINTPOS(dstx,dsty)], |
&vport->dbdata[srcoff], |
vport->width*screen.pixelbytes); |
&vport->dbdata[srcoff], vport->width * screen.pixelbytes); |
} |
} |
397,9 → 395,8 |
vport->dboffset %= vport->height; |
} else if (lines < 0) { |
lines = -lines; |
draw_rectangle(vport, 0, vport->height-lines, |
vport->width, lines, |
vport->style.bg_color); |
draw_rectangle(vport, 0, vport->height-lines, vport->width, |
lines, vport->style.bg_color); |
if (vport->dboffset < lines) |
vport->dboffset += vport->height; |
441,8 → 438,8 |
* @param transparent If false, print background color |
*/ |
static void |
draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, |
unsigned int sy, style_t style, int transparent) |
draw_glyph(viewport_t *vport,uint8_t glyph, unsigned int sx, unsigned int sy, |
style_t style, int transparent) |
{ |
int i; |
unsigned int y; |
452,11 → 449,9 |
glline = fb_font[glyph * FONT_SCANLINES + y]; |
for (i = 0; i < 8; i++) { |
if (glline & (1 << (7 - i))) |
putpixel(vport, sx + i, sy + y, |
style.fg_color); |
putpixel(vport, sx + i, sy + y, style.fg_color); |
else if (!transparent) |
putpixel(vport, sx + i, sy + y, |
style.bg_color); |
putpixel(vport, sx + i, sy + y, style.bg_color); |
} |
} |
} |
664,8 → 659,8 |
col = i % vport->cols; |
row = i / vport->cols; |
draw_glyph(vport, data[i].character, col * COL_WIDTH, row * |
FONT_SCANLINES, data[i].style, |
style_same(data[i].style,vport->style)); |
FONT_SCANLINES, data[i].style, style_same(data[i].style, |
vport->style)); |
} |
cursor_print(vport); |
} |
757,7 → 752,7 |
if (IPC_GET_ARG1(*call) == shm_id) { |
void *dest = as_get_mappable_page(IPC_GET_ARG2(*call)); |
shm_size = IPC_GET_ARG2(*call); |
if (!ipc_answer_fast(callid, 0, (sysarg_t) dest, 0)) |
if (!ipc_answer_1(callid, EOK, (sysarg_t) dest)) |
shm = dest; |
else |
shm_id = 0; |
805,8 → 800,8 |
} |
ppm_draw(shm, shm_size, IPC_GET_ARG1(*call), |
IPC_GET_ARG2(*call), vport->width - x, |
vport->height - y, (putpixel_cb_t)putpixel, vport); |
IPC_GET_ARG2(*call), vport->width - x, vport->height - y, |
(putpixel_cb_t)putpixel, vport); |
break; |
case FB_DRAW_TEXT_DATA: |
if (!interbuffer) { |
825,7 → 820,7 |
} |
if (handled) |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
return handled; |
} |
983,8 → 978,8 |
visibility = pointer_mask_bits[bytepos] & |
(1 << (j % 8)); |
if (visibility) { |
color = pointer_bits[bytepos] & (1 << (j % 8)) |
? 0 : 0xffffff; |
color = pointer_bits[bytepos] & |
(1 << (j % 8)) ? 0 : 0xffffff; |
if (pointer_x + j < screen.xres && pointer_y + |
i < screen.yres) |
putpixel(&viewports[0], pointer_x + j, |
1106,7 → 1101,7 |
handled = 0; |
} |
if (handled) |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
return handled; |
} |
1157,7 → 1152,7 |
} |
if (handled) |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
return handled; |
} |
1179,11 → 1174,11 |
viewport_t *vport = &viewports[0]; |
if (client_connected) { |
ipc_answer_fast(iid, ELIMIT, 0,0); |
ipc_answer_0(iid, ELIMIT); |
return; |
} |
client_connected = 1; |
ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */ |
ipc_answer_0(iid, EOK); /* Accept connection */ |
while (1) { |
if (vport->cursor_active || anims_enabled) |
1222,7 → 1217,7 |
retval = EINVAL; |
break; |
} |
ipc_answer_fast(callid, 0, 0, 0); |
ipc_answer_0(callid, EOK); |
draw_char(vport, c, row, col, vport->style, |
IPC_GET_METHOD(call) == FB_TRANS_PUTCHAR); |
1252,7 → 1247,7 |
retval = 0; |
break; |
case FB_GET_CSIZE: |
ipc_answer_fast(callid, 0, vport->rows, vport->cols); |
ipc_answer_2(callid, EOK, vport->rows, vport->cols); |
continue; |
case FB_SCROLL: |
i = IPC_GET_ARG1(call); |
1280,9 → 1275,9 |
} |
viewports[i].dboffset = 0; |
if (IPC_GET_ARG2(call) == 1 && !viewports[i].dbdata) |
viewports[i].dbdata = malloc(screen.pixelbytes |
* viewports[i].width * |
viewports[i].height); |
viewports[i].dbdata = |
malloc(screen.pixelbytes * |
viewports[i].width * viewports[i].height); |
else if (IPC_GET_ARG2(call) == 0 && |
viewports[i].dbdata) { |
free(viewports[i].dbdata); |
1335,7 → 1330,7 |
retval = 0; |
break; |
case FB_GET_RESOLUTION: |
ipc_answer_fast(callid, 0, screen.xres,screen.yres); |
ipc_answer_2(callid, EOK, screen.xres, screen.yres); |
continue; |
case FB_POINTER_MOVE: |
pointer_enabled = 1; |
1345,7 → 1340,7 |
default: |
retval = ENOENT; |
} |
ipc_answer_fast(callid,retval, 0, 0); |
ipc_answer_0(callid, retval); |
} |
} |
/trunk/uspace/srv/fb/ega.c |
---|
195,11 → 195,11 |
int i; |
if (client_connected) { |
ipc_answer_fast(iid, ELIMIT, 0,0); |
ipc_answer_0(iid, ELIMIT); |
return; |
} |
client_connected = 1; |
ipc_answer_fast(iid, 0, 0, 0); /* Accept connection */ |
ipc_answer_0(iid, EOK); /* Accept connection */ |
while (1) { |
callid = async_get_call(&call); |
206,7 → 206,7 |
switch (IPC_GET_METHOD(call)) { |
case IPC_M_PHONE_HUNGUP: |
client_connected = 0; |
ipc_answer_fast(callid, 0, 0, 0); |
ipc_answer_0(callid, EOK); |
return; /* Exit thread */ |
case IPC_M_AS_AREA_SEND: |
/* We accept one area for data interchange */ |
213,8 → 213,8 |
intersize = IPC_GET_ARG2(call); |
if (intersize >= scr_width * scr_height * |
sizeof(*interbuf)) { |
receive_comm_area(callid, &call, (void *) |
&interbuf); |
receive_comm_area(callid, &call, |
(void *) &interbuf); |
continue; |
} |
retval = EINVAL; |
228,7 → 228,7 |
retval = 0; |
break; |
case FB_GET_CSIZE: |
ipc_answer_fast(callid, 0, scr_height, scr_width); |
ipc_answer_2(callid, EOK, scr_height, scr_width); |
continue; |
case FB_CLEAR: |
clrscr(); |
300,7 → 300,7 |
default: |
retval = ENOENT; |
} |
ipc_answer_fast(callid, retval, 0, 0); |
ipc_answer_0(callid, retval); |
} |
} |
/trunk/uspace/srv/fs/fat/fat.c |
---|
93,7 → 93,7 |
* IPC_M_CONNECT_ME_TO calls as opposed to callback connections |
* created by IPC_M_CONNECT_TO_ME. |
*/ |
ipc_answer_fast_0(iid, EOK); |
ipc_answer_0(iid, EOK); |
} |
dprintf("VFS-FAT connection established.\n"); |
104,7 → 104,7 |
callid = async_get_call(&call); |
switch (IPC_GET_METHOD(call)) { |
default: |
ipc_answer_fast_0(callid, ENOTSUP); |
ipc_answer_0(callid, ENOTSUP); |
break; |
} |
} |
/trunk/uspace/srv/pci/pci.c |
---|
66,18 → 66,18 |
while (1) { |
ipc_call_t call; |
ipc_callid_t callid; |
ipcarg_t retval = ENOTSUP; |
callid = ipc_wait_for_call(&call); |
switch(IPC_GET_METHOD(call)) { |
case IPC_M_CONNECT_ME_TO: |
IPC_SET_RETVAL(call, 0); |
retval = EOK; |
break; |
} |
if (! (callid & IPC_CALLID_NOTIFICATION)) { |
ipc_answer(callid, &call); |
ipc_answer_0(callid, retval); |
printf("%s: received call from %lX\n", NAME, |
call.in_phone_hash); |
} |
printf("%s: received call from %lX\n", NAME, call.in_phone_hash); |
} |
pci_cleanup(pacc); |
return 0; |
/trunk/uspace/srv/devmap/devmap.c |
---|
113,7 → 113,7 |
} |
if (item == &devices_list) { |
printf("DevMap: no device named %s.\n", name); |
printf("DEVMAP: no device named %s.\n", name); |
return NULL; |
} |
189,13 → 189,13 |
iid = async_get_call(&icall); |
if (IPC_GET_METHOD(icall) != DEVMAP_DRIVER_REGISTER) { |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
if (NULL == |
(driver = (devmap_driver_t *)malloc(sizeof(devmap_driver_t)))) { |
ipc_answer_fast(iid, ENOMEM, 0, 0); |
ipc_answer_0(iid, ENOMEM); |
return; |
} |
202,11 → 202,11 |
/* |
* Get driver name |
*/ |
if (!ipc_data_receive(&callid, &call, NULL, &name_size)) { |
printf("Unexpected request: %u.\n", IPC_GET_METHOD(call)); |
if (!ipc_data_receive(&callid, NULL, &name_size)) { |
printf("Unexpected request.\n"); |
free(driver); |
ipc_answer_fast(callid, EREFUSED, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(callid, EREFUSED); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
214,8 → 214,8 |
printf("Too logn name: %u: maximum is %u.\n", name_size, |
DEVMAP_NAME_MAXLEN); |
free(driver); |
ipc_answer_fast(callid, EINVAL, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
225,8 → 225,8 |
if (NULL == (driver->name = (char *)malloc(name_size + 1))) { |
printf("Cannot allocate space for driver name.\n"); |
free(driver); |
ipc_answer_fast(callid, ENOMEM, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(callid, ENOMEM); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
233,11 → 233,11 |
/* |
* Send confirmation to sender and get data into buffer. |
*/ |
if (EOK != ipc_data_deliver(callid, &call, driver->name, name_size)) { |
if (EOK != ipc_data_deliver(callid, driver->name, name_size)) { |
printf("Cannot read driver name.\n"); |
free(driver->name); |
free(driver); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
259,19 → 259,19 |
callid = async_get_call(&call); |
if (IPC_M_CONNECT_TO_ME != IPC_GET_METHOD(call)) { |
printf("DevMap: Unexpected method: %u.\n", |
printf("DEVMAP: Unexpected method: %u.\n", |
IPC_GET_METHOD(call)); |
ipc_answer_fast(callid, ENOTSUP, 0, 0); |
ipc_answer_0(callid, ENOTSUP); |
free(driver->name); |
free(driver); |
ipc_answer_fast(iid, ENOTSUP, 0, 0); |
ipc_answer_0(iid, ENOTSUP); |
return; |
} |
driver->phone = IPC_GET_ARG3(call); |
ipc_answer_fast(callid, EOK, 0, 0); |
ipc_answer_0(callid, EOK); |
list_initialize(&(driver->drivers)); |
287,7 → 287,7 |
list_append(&(driver->drivers), &drivers_list); |
futex_up(&drivers_list_futex); |
ipc_answer_fast(iid, EOK, 0, 0); |
ipc_answer_0(iid, EOK); |
printf("Driver registered.\n"); |
*odriver = driver; |
294,8 → 294,8 |
return; |
} |
/** Unregister device driver, unregister all its devices and free driver structure. |
* |
/** Unregister device driver, unregister all its devices and free driver |
* structure. |
*/ |
static int devmap_driver_unregister(devmap_driver_t *driver) |
{ |
350,13 → 350,12 |
devmap_driver_t *driver) |
{ |
ipc_callid_t callid; |
ipc_call_t call; |
size_t size; |
devmap_device_t *device; |
if (NULL == driver) { |
printf("Invalid driver registration.\n"); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
364,15 → 363,15 |
if (NULL == |
(device = (devmap_device_t *)malloc(sizeof(devmap_device_t)))) { |
printf("Cannot allocate new device.\n"); |
ipc_answer_fast(iid, ENOMEM, 0, 0); |
ipc_answer_0(iid, ENOMEM); |
return; |
} |
/* Get device name */ |
if (!ipc_data_receive(&callid, &call, NULL, &size)) { |
if (!ipc_data_receive(&callid, NULL, &size)) { |
free(device); |
printf("Cannot read device name.\n"); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
379,8 → 378,8 |
if (size > DEVMAP_NAME_MAXLEN) { |
printf("Too long device name: %u.\n", size); |
free(device); |
ipc_answer_fast(callid, EINVAL, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
390,12 → 389,12 |
if (NULL == device->name) { |
printf("Cannot read device name.\n"); |
free(device); |
ipc_answer_fast(callid, ENOMEM, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(callid, ENOMEM); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
ipc_data_deliver(callid, &call, device->name, size); |
ipc_data_deliver(callid, device->name, size); |
device->name[size] = 0; |
list_initialize(&(device->devices)); |
409,7 → 408,7 |
futex_up(&devices_list_futex); |
free(device->name); |
free(device); |
ipc_answer_fast(iid, EEXISTS, 0, 0); |
ipc_answer_0(iid, EEXISTS); |
return; |
} |
419,18 → 418,18 |
device->driver = driver; |
/* Insert device into list of all devices */ |
list_append(&(device->devices), &devices_list); |
list_append(&device->devices, &devices_list); |
/* Insert device into list of devices that belog to one driver */ |
futex_down(&(device->driver->devices_futex)); |
futex_down(&device->driver->devices_futex); |
list_append(&(device->driver_devices), &(device->driver->devices)); |
list_append(&device->driver_devices, &device->driver->devices); |
futex_up(&(device->driver->devices_futex)); |
futex_up(&device->driver->devices_futex); |
futex_up(&devices_list_futex); |
printf("Device '%s' registered.\n", device->name); |
ipc_answer_fast(iid, EOK, device->handle, 0); |
ipc_answer_1(iid, EOK, device->handle); |
return; |
} |
464,9 → 463,9 |
dev = devmap_device_find_handle(handle); |
if (NULL == dev) { |
printf("DevMap: No registered device with handle %d.\n", |
printf("DEVMAP: No registered device with handle %d.\n", |
handle); |
ipc_answer_fast(callid, ENOENT, 0, 0); |
ipc_answer_0(callid, ENOENT); |
return; |
} |
486,7 → 485,6 |
size_t name_size; |
const devmap_device_t *dev; |
ipc_callid_t callid; |
ipc_call_t call; |
ipcarg_t retval; |
494,15 → 492,15 |
* Wait for incoming message with device name (but do not |
* read the name itself until the buffer is allocated). |
*/ |
if (!ipc_data_receive(&callid, &call, NULL, &name_size)) { |
ipc_answer_fast(callid, EREFUSED, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
if (!ipc_data_receive(&callid, NULL, &name_size)) { |
ipc_answer_0(callid, EREFUSED); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
if (name_size > DEVMAP_NAME_MAXLEN) { |
ipc_answer_fast(callid, EINVAL, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
510,8 → 508,8 |
* Allocate buffer for device name. |
*/ |
if (NULL == (name = (char *)malloc(name_size))) { |
ipc_answer_fast(callid, ENOMEM, 0, 0); |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
ipc_answer_0(callid, ENOMEM); |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
518,9 → 516,8 |
/* |
* Send confirmation to sender and get data into buffer. |
*/ |
if (EOK != (retval = ipc_data_deliver(callid, &call, name, |
name_size))) { |
ipc_answer_fast(iid, EREFUSED, 0, 0); |
if (EOK != (retval = ipc_data_deliver(callid, name, name_size))) { |
ipc_answer_0(iid, EREFUSED); |
return; |
} |
533,14 → 530,14 |
* Device was not found. |
*/ |
if (NULL == dev) { |
printf("DevMap: device %s has not been registered.\n", name); |
ipc_answer_fast(iid, ENOENT, 0, 0); |
printf("DEVMAP: device %s has not been registered.\n", name); |
ipc_answer_0(iid, ENOENT); |
return; |
} |
printf("DevMap: device %s has handler %d.\n", name, dev->handle); |
printf("DEVMAP: device %s has handler %d.\n", name, dev->handle); |
ipc_answer_fast(iid, EOK, dev->handle, 0); |
ipc_answer_1(iid, EOK, dev->handle); |
return; |
} |
559,17 → 556,17 |
* Device not found. |
*/ |
if (NULL == device) { |
ipc_answer_fast(iid, ENOENT, 0, 0); |
ipc_answer_0(iid, ENOENT); |
return; |
} |
ipc_answer_fast(iid, EOK, 0, 0); |
ipc_answer_0(iid, EOK); |
name_size = strlen(device->name); |
/* FIXME: |
we have no channel from DevMap to client -> |
we have no channel from DEVMAP to client -> |
sending must be initiated by client |
int rc = ipc_data_send(phone, device->name, name_size); |
594,12 → 591,12 |
bool cont = true; |
devmap_driver_t *driver = NULL; |
ipc_answer_fast(iid, EOK, 0, 0); |
ipc_answer_0(iid, EOK); |
devmap_driver_register(&driver); |
if (NULL == driver) { |
printf("DevMap: driver registration failed.\n"); |
printf("DEVMAP: driver registration failed.\n"); |
return; |
} |
608,16 → 605,16 |
switch (IPC_GET_METHOD(call)) { |
case IPC_M_PHONE_HUNGUP: |
printf("DevMap: connection hung up.\n"); |
printf("DEVMAP: connection hung up.\n"); |
cont = false; |
continue; /* Exit thread */ |
case DEVMAP_DRIVER_UNREGISTER: |
printf("DevMap: unregister driver.\n"); |
printf("DEVMAP: unregister driver.\n"); |
if (NULL == driver) { |
printf("DevMap: driver was not registered!\n"); |
ipc_answer_fast(callid, ENOENT, 0, 0); |
printf("DEVMAP: driver was not registered!\n"); |
ipc_answer_0(callid, ENOENT); |
} else { |
ipc_answer_fast(callid, EOK, 0, 0); |
ipc_answer_0(callid, EOK); |
} |
break; |
case DEVMAP_DEVICE_REGISTER: |
636,7 → 633,7 |
break; |
default: |
if (!(callid & IPC_CALLID_NOTIFICATION)) { |
ipc_answer_fast(callid, ENOENT, 0, 0); |
ipc_answer_0(callid, ENOENT); |
} |
} |
} |
661,7 → 658,7 |
ipc_call_t call; |
bool cont = true; |
ipc_answer_fast(iid, EOK, 0, 0); /* Accept connection */ |
ipc_answer_0(iid, EOK); /* Accept connection */ |
while (cont) { |
callid = async_get_call(&call); |
668,13 → 665,13 |
switch (IPC_GET_METHOD(call)) { |
case IPC_M_PHONE_HUNGUP: |
printf("DevMap: connection hung up.\n"); |
printf("DEVMAP: connection hung up.\n"); |
cont = false; |
continue; /* Exit thread */ |
case DEVMAP_DEVICE_CONNECT_ME_TO: |
/* Connect client to selected device */ |
printf("DevMap: connect to device %d.\n", |
printf("DEVMAP: connect to device %d.\n", |
IPC_GET_ARG1(call)); |
devmap_forward(callid, &call); |
break; |
689,7 → 686,7 |
break; |
default: |
if (!(callid & IPC_CALLID_NOTIFICATION)) { |
ipc_answer_fast(callid, ENOENT, 0, 0); |
ipc_answer_0(callid, ENOENT); |
} |
} |
} |
702,7 → 699,7 |
devmap_connection(ipc_callid_t iid, ipc_call_t *icall) |
{ |
printf("DevMap: new connection.\n"); |
printf("DEVMAP: new connection.\n"); |
/* Select interface */ |
switch ((ipcarg_t)(IPC_GET_ARG1(*icall))) { |
713,14 → 710,14 |
devmap_connection_client(iid, icall); |
break; |
default: |
ipc_answer_fast(iid, ENOENT, 0, 0); /* No such interface */ |
printf("DevMap: Unknown interface %u.\n", |
ipc_answer_0(iid, ENOENT); /* No such interface */ |
printf("DEVMAP: Unknown interface %u.\n", |
(ipcarg_t)(IPC_GET_ARG1(*icall))); |
} |
/* Cleanup */ |
printf("DevMap: connection closed.\n"); |
printf("DEVMAP: connection closed.\n"); |
return; |
} |
731,10 → 728,10 |
{ |
ipcarg_t phonead; |
printf("DevMap: HelenOS device mapper.\n"); |
printf("DEVMAP: HelenOS device mapper.\n"); |
if (devmap_init() != 0) { |
printf("Error while initializing DevMap service.\n"); |
printf("Error while initializing DEVMAP service.\n"); |
return -1; |
} |
/trunk/uspace/srv/vfs/vfs.c |
---|
59,7 → 59,7 |
* The connection was opened via the IPC_CONNECT_ME_TO call. |
* This call needs to be answered. |
*/ |
ipc_answer_fast_0(iid, EOK); |
ipc_answer_0(iid, EOK); |
/* |
* Here we enter the main connection fibril loop. |
103,7 → 103,7 |
case VFS_UNLINK: |
case VFS_RENAME: |
default: |
ipc_answer_fast_0(callid, ENOTSUP); |
ipc_answer_0(callid, ENOTSUP); |
break; |
} |
} |
/trunk/uspace/srv/vfs/vfs_open.c |
---|
46,7 → 46,7 |
void vfs_open(ipc_callid_t rid, ipc_call_t *request) |
{ |
if (!vfs_files_init()) { |
ipc_answer_fast_0(rid, ENOMEM); |
ipc_answer_0(rid, ENOMEM); |
return; |
} |
60,11 → 60,10 |
size_t size; |
ipc_callid_t callid; |
ipc_call_t call; |
if (!ipc_data_receive(&callid, &call, NULL, &size)) { |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
if (!ipc_data_receive(&callid, NULL, &size)) { |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
77,14 → 76,14 |
char *path = malloc(size); |
if (!path) { |
ipc_answer_fast_0(callid, ENOMEM); |
ipc_answer_fast_0(rid, ENOMEM); |
ipc_answer_0(callid, ENOMEM); |
ipc_answer_0(rid, ENOMEM); |
return; |
} |
int rc; |
if ((rc = ipc_data_deliver(callid, &call, path, size))) { |
ipc_answer_fast_0(rid, rc); |
if ((rc = ipc_data_deliver(callid, path, size))) { |
ipc_answer_0(rid, rc); |
free(path); |
return; |
} |
103,7 → 102,7 |
rc = vfs_lookup_internal(path, size, &triplet, NULL); |
if (rc) { |
futex_up(&unlink_futex); |
ipc_answer_fast_0(rid, rc); |
ipc_answer_0(rid, rc); |
free(path); |
return; |
} |
123,7 → 122,7 |
int fd = vfs_fd_alloc(); |
if (fd < 0) { |
vfs_node_put(node); |
ipc_answer_fast_0(rid, fd); |
ipc_answer_0(rid, fd); |
return; |
} |
vfs_file_t *file = vfs_file_get(fd); |
142,7 → 141,7 |
/* |
* Success! Return the new file descriptor to the client. |
*/ |
ipc_answer_fast_1(rid, EOK, fd); |
ipc_answer_1(rid, EOK, fd); |
} |
/** |
/trunk/uspace/srv/vfs/vfs_mount.c |
---|
84,11 → 84,10 |
* system and the path of the mountpoint. |
*/ |
ipc_callid_t callid; |
ipc_call_t call; |
size_t size; |
if (!ipc_data_receive(&callid, &call, NULL, &size)) { |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
if (!ipc_data_receive(&callid, NULL, &size)) { |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
99,8 → 98,8 |
*/ |
if ((size < FS_NAME_MAXLEN + 1) || |
(size > FS_NAME_MAXLEN + MAX_PATH_LEN)) { |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
110,8 → 109,8 |
uint8_t *buf; |
buf = malloc(size); |
if (!buf) { |
ipc_answer_fast_0(callid, ENOMEM); |
ipc_answer_fast_0(rid, ENOMEM); |
ipc_answer_0(callid, ENOMEM); |
ipc_answer_0(rid, ENOMEM); |
return; |
} |
118,7 → 117,7 |
/* |
* Deliver the data. |
*/ |
(void) ipc_data_deliver(callid, &call, buf, size); |
(void) ipc_data_deliver(callid, buf, size); |
char fs_name[FS_NAME_MAXLEN + 1]; |
memcpy(fs_name, buf, FS_NAME_MAXLEN); |
131,7 → 130,7 |
int fs_handle = fs_name_to_handle(fs_name, true); |
if (!fs_handle) { |
free(buf); |
ipc_answer_fast_0(rid, ENOENT); |
ipc_answer_0(rid, ENOENT); |
return; |
} |
146,13 → 145,13 |
rc = lookup_root(fs_handle, dev_handle, &mounted_root); |
if (rc != EOK) { |
free(buf); |
ipc_answer_fast_0(rid, rc); |
ipc_answer_0(rid, rc); |
return; |
} |
vfs_node_t *mr_node = vfs_node_get(&mounted_root); |
if (!mr_node) { |
free(buf); |
ipc_answer_fast_0(rid, ENOMEM); |
ipc_answer_0(rid, ENOMEM); |
return; |
} |
176,7 → 175,7 |
futex_up(&rootfs_futex); |
vfs_node_put(mr_node); /* failed -> drop reference */ |
free(buf); |
ipc_answer_fast_0(rid, rc); |
ipc_answer_0(rid, rc); |
return; |
} |
mp_node = vfs_node_get(&mp); |
185,7 → 184,7 |
futex_up(&rootfs_futex); |
vfs_node_put(mr_node); /* failed -> drop reference */ |
free(buf); |
ipc_answer_fast_0(rid, ENOMEM); |
ipc_answer_0(rid, ENOMEM); |
return; |
} |
/* |
206,7 → 205,7 |
rootfs = mounted_root; |
futex_up(&rootfs_futex); |
free(buf); |
ipc_answer_fast_0(rid, EOK); |
ipc_answer_0(rid, EOK); |
return; |
} else { |
/* |
216,7 → 215,7 |
futex_up(&rootfs_futex); |
free(buf); |
vfs_node_put(mr_node); /* failed -> drop reference */ |
ipc_answer_fast_0(rid, ENOENT); |
ipc_answer_0(rid, ENOENT); |
return; |
} |
} |
254,11 → 253,11 |
} |
if (rc2 == EOK) |
ipc_answer_fast_0(rid, rc1); |
ipc_answer_0(rid, rc1); |
else if (rc1 == EOK) |
ipc_answer_fast_0(rid, rc2); |
ipc_answer_0(rid, rc2); |
else |
ipc_answer_fast_0(rid, rc1); |
ipc_answer_0(rid, rc1); |
} |
/** |
/trunk/uspace/srv/vfs/vfs_register.c |
---|
155,13 → 155,13 |
* The first call has to be IPC_M_DATA_SEND in which we receive the |
* VFS info structure from the client FS. |
*/ |
if (!ipc_data_receive(&callid, &call, NULL, &size)) { |
if (!ipc_data_receive(&callid, NULL, &size)) { |
/* |
* The client doesn't obey the same protocol as we do. |
*/ |
dprintf("Receiving of VFS info failed.\n"); |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
177,8 → 177,8 |
* the info structure. |
*/ |
dprintf("Received VFS info has bad size.\n"); |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
189,19 → 189,19 |
fs_info = (fs_info_t *) malloc(sizeof(fs_info_t)); |
if (!fs_info) { |
dprintf("Could not allocate memory for FS info.\n"); |
ipc_answer_fast_0(callid, ENOMEM); |
ipc_answer_fast_0(rid, ENOMEM); |
ipc_answer_0(callid, ENOMEM); |
ipc_answer_0(rid, ENOMEM); |
return; |
} |
link_initialize(&fs_info->fs_link); |
rc = ipc_data_deliver(callid, &call, &fs_info->vfs_info, size); |
rc = ipc_data_deliver(callid, &fs_info->vfs_info, size); |
if (rc != EOK) { |
dprintf("Failed to deliver the VFS info into our AS, rc=%d.\n", |
rc); |
free(fs_info); |
ipc_answer_fast_0(callid, rc); |
ipc_answer_fast_0(rid, rc); |
ipc_answer_0(callid, rc); |
ipc_answer_0(rid, rc); |
return; |
} |
209,8 → 209,8 |
if (!vfs_info_sane(&fs_info->vfs_info)) { |
free(fs_info); |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
226,8 → 226,8 |
dprintf("FS is already registered.\n"); |
futex_up(&fs_head_futex); |
free(fs_info); |
ipc_answer_fast_0(callid, EEXISTS); |
ipc_answer_fast_0(rid, EEXISTS); |
ipc_answer_0(callid, EEXISTS); |
ipc_answer_0(rid, EEXISTS); |
return; |
} |
248,12 → 248,12 |
list_remove(&fs_info->fs_link); |
futex_up(&fs_head_futex); |
free(fs_info); |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
fs_info->phone = IPC_GET_ARG3(call); |
ipc_answer_fast_0(callid, EOK); |
ipc_answer_0(callid, EOK); |
dprintf("Callback connection to FS created.\n"); |
267,8 → 267,8 |
futex_up(&fs_head_futex); |
ipc_hangup(fs_info->phone); |
free(fs_info); |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
282,8 → 282,8 |
futex_up(&fs_head_futex); |
ipc_hangup(fs_info->phone); |
free(fs_info); |
ipc_answer_fast_0(callid, EINVAL); |
ipc_answer_fast_0(rid, EINVAL); |
ipc_answer_0(callid, EINVAL); |
ipc_answer_0(rid, EINVAL); |
return; |
} |
290,7 → 290,7 |
/* |
* Commit to read-only sharing the PLB with the client. |
*/ |
ipc_answer_fast(callid, EOK, (ipcarg_t) plb, |
ipc_answer_2(callid, EOK, (ipcarg_t) plb, |
(ipcarg_t) (AS_AREA_READ | AS_AREA_CACHEABLE)); |
dprintf("Sharing PLB.\n"); |
301,7 → 301,7 |
* system a global file system handle. |
*/ |
fs_info->fs_handle = (int) atomic_postinc(&fs_handle_next); |
ipc_answer_fast_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); |
ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); |
futex_up(&fs_head_futex); |