Changeset 46577995 in mainline for kernel/generic/src/ipc/ops


Ignore:
Timestamp:
2018-01-04T20:50:52Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
e211ea04
Parents:
facacc71
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:47:53)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-04 20:50:52)
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

After this commit, HelenOS is free of code that mixes error codes with non-error
values on the assumption that error codes are negative.

Location:
kernel/generic/src/ipc/ops
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/ops/conctmeto.c

    rfacacc71 r46577995  
    4040#include <arch.h>
    4141
    42 static int request_preprocess(call_t *call, phone_t *phone)
     42static errno_t request_preprocess(call_t *call, phone_t *phone)
    4343{
    4444        cap_handle_t phone_handle;
    45         int rc = phone_alloc(TASK, &phone_handle);
     45        errno_t rc = phone_alloc(TASK, &phone_handle);
    4646
    4747        /* Remember the phone capability or that an error occured. */
     
    6161}
    6262
    63 static int request_forget(call_t *call)
     63static errno_t request_forget(call_t *call)
    6464{
    6565        cap_handle_t phone_handle = (cap_handle_t) call->priv;
     
    7777}
    7878
    79 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     79static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
    8080{
    8181        /* Hand over reference from ARG5 to phone */
     
    9393}
    9494
    95 static int answer_process(call_t *answer)
     95static errno_t answer_process(call_t *answer)
    9696{
    9797        cap_handle_t phone_handle = (cap_handle_t) answer->priv;
  • kernel/generic/src/ipc/ops/concttome.c

    rfacacc71 r46577995  
    4343{
    4444        cap_handle_t phone_handle;
    45         int rc = phone_alloc(TASK, &phone_handle);
     45        errno_t rc = phone_alloc(TASK, &phone_handle);
    4646        IPC_SET_ARG5(call->data, (rc == EOK) ? phone_handle : -1);
    4747        return 0;
    4848}
    4949
    50 static int answer_cleanup(call_t *answer, ipc_data_t *olddata)
     50static errno_t answer_cleanup(call_t *answer, ipc_data_t *olddata)
    5151{
    5252        cap_handle_t phone_handle = (cap_handle_t) IPC_GET_ARG5(*olddata);
     
    5858}
    5959
    60 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     60static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
    6161{
    6262        cap_handle_t phone_handle = (cap_handle_t) IPC_GET_ARG5(*olddata);
  • kernel/generic/src/ipc/ops/dataread.c

    rfacacc71 r46577995  
    4141#include <config.h>
    4242
    43 static int request_preprocess(call_t *call, phone_t *phone)
     43static errno_t request_preprocess(call_t *call, phone_t *phone)
    4444{
    4545        size_t size = IPC_GET_ARG2(call->data);
     
    5757}
    5858
    59 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     59static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
    6060{
    6161        assert(!answer->buffer);
     
    7676                               
    7777                        answer->buffer = malloc(size, 0);
    78                         int rc = copy_from_uspace(answer->buffer,
     78                        errno_t rc = copy_from_uspace(answer->buffer,
    7979                            (void *) src, size);
    8080                        if (rc) {
     
    9595}
    9696
    97 static int answer_process(call_t *answer)
     97static errno_t answer_process(call_t *answer)
    9898{
    9999        if (answer->buffer) {
    100100                uintptr_t dst = IPC_GET_ARG1(answer->data);
    101101                size_t size = IPC_GET_ARG2(answer->data);
    102                 int rc;
     102                errno_t rc;
    103103
    104104                rc = copy_to_uspace((void *) dst, answer->buffer, size);
  • kernel/generic/src/ipc/ops/datawrite.c

    rfacacc71 r46577995  
    4141#include <config.h>
    4242
    43 static int request_preprocess(call_t *call, phone_t *phone)
     43static errno_t request_preprocess(call_t *call, phone_t *phone)
    4444{
    4545        uintptr_t src = IPC_GET_ARG1(call->data);
     
    5757
    5858        call->buffer = (uint8_t *) malloc(size, 0);
    59         int rc = copy_from_uspace(call->buffer, (void *) src, size);
     59        errno_t rc = copy_from_uspace(call->buffer, (void *) src, size);
    6060        if (rc != 0) {
    6161                /*
     
    6969}
    7070
    71 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     71static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
    7272{
    7373        assert(answer->buffer);
     
    8080                       
    8181                if (size <= max_size) {
    82                         int rc = copy_to_uspace((void *) dst,
     82                        errno_t rc = copy_to_uspace((void *) dst,
    8383                            answer->buffer, size);
    8484                        if (rc)
  • kernel/generic/src/ipc/ops/debug.c

    rfacacc71 r46577995  
    4444}
    4545
    46 static int answer_process(call_t *answer)
     46static errno_t answer_process(call_t *answer)
    4747{
    4848        if (answer->buffer) {
    4949                uintptr_t dst = IPC_GET_ARG1(answer->data);
    5050                size_t size = IPC_GET_ARG2(answer->data);
    51                 int rc;
     51                errno_t rc;
    5252
    5353                rc = copy_to_uspace((void *) dst, answer->buffer, size);
  • kernel/generic/src/ipc/ops/pagein.c

    rfacacc71 r46577995  
    4444#include <arch.h>
    4545
    46 static int pagein_request_preprocess(call_t *call, phone_t *phone)
     46static errno_t pagein_request_preprocess(call_t *call, phone_t *phone)
    4747{
    4848        /*
     
    5858}
    5959
    60 static int pagein_answer_preprocess(call_t *answer, ipc_data_t *olddata)
     60static errno_t pagein_answer_preprocess(call_t *answer, ipc_data_t *olddata)
    6161{
    6262        /*
  • kernel/generic/src/ipc/ops/sharein.c

    rfacacc71 r46577995  
    4141#include <arch.h>
    4242
    43 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     43static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
    4444{
    4545        if (!IPC_GET_RETVAL(answer->data)) {
     
    4949                       
    5050                uintptr_t dst_base = (uintptr_t) -1;
    51                 int rc = as_area_share(AS, IPC_GET_ARG1(answer->data),
     51                errno_t rc = as_area_share(AS, IPC_GET_ARG1(answer->data),
    5252                    IPC_GET_ARG1(*olddata), as, IPC_GET_ARG2(answer->data),
    5353                    &dst_base, IPC_GET_ARG3(answer->data));
  • kernel/generic/src/ipc/ops/shareout.c

    rfacacc71 r46577995  
    4242#include <arch.h>
    4343
    44 static int request_preprocess(call_t *call, phone_t *phone)
     44static errno_t request_preprocess(call_t *call, phone_t *phone)
    4545{
    4646        size_t size = as_area_get_size(IPC_GET_ARG1(call->data));
     
    5353}
    5454
    55 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     55static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
    5656{
    57         int rc = EOK;
     57        errno_t rc = EOK;
    5858
    5959        if (!IPC_GET_RETVAL(answer->data)) {
  • kernel/generic/src/ipc/ops/stchngath.c

    rfacacc71 r46577995  
    4141#include <macros.h>
    4242
    43 static int request_preprocess(call_t *call, phone_t *phone)
     43static errno_t request_preprocess(call_t *call, phone_t *phone)
    4444{
    4545        task_t *other_task_s;
     
    6868}
    6969
    70 static int answer_preprocess(call_t *answer, ipc_data_t *olddata)
     70static errno_t answer_preprocess(call_t *answer, ipc_data_t *olddata)
    7171{
    72         int rc = EOK;
     72        errno_t rc = EOK;
    7373
    7474        if (!IPC_GET_RETVAL(answer->data)) {
Note: See TracChangeset for help on using the changeset viewer.