Changeset a35b458 in mainline for kernel/generic/src/ipc/sysipc.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/sysipc.c

    r3061bc1 ra35b458  
    6969        if (imethod <= IPC_M_LAST_SYSTEM)
    7070                return true;
    71        
     71
    7272        return false;
    7373}
     
    207207                mutex_unlock(&phone->lock);
    208208        }
    209        
     209
    210210        if (!olddata)
    211211                return rc;
     
    242242            (call->flags & IPC_CALL_FORWARDED))
    243243                IPC_SET_RETVAL(call->data, EFORWARD);
    244        
     244
    245245        SYSIPC_OP(answer_process, call);
    246246}
     
    276276        if (!kobj->phone)
    277277                return ENOENT;
    278        
     278
    279279        call_t *call = ipc_call_alloc(0);
    280280        call->priv = priv;
    281281        memcpy(call->data.args, data->args, sizeof(data->args));
    282        
     282
    283283        errno_t rc = request_preprocess(call, kobj->phone);
    284284        if (!rc) {
     
    322322        } else
    323323                IPC_SET_RETVAL(call->data, rc);
    324        
     324
    325325        memcpy(data->args, call->data.args, sizeof(data->args));
    326326        kobject_put(call->kobject);
    327327        kobject_put(kobj);
    328        
     328
    329329        return EOK;
    330330}
     
    342342        if (atomic_get(&phone->active_calls) >= IPC_MAX_ASYNC_CALLS)
    343343                return -1;
    344        
     344
    345345        return 0;
    346346}
     
    368368        if (!kobj)
    369369                return ENOENT;
    370        
     370
    371371        if (check_call_limit(kobj->phone)) {
    372372                kobject_put(kobj);
    373373                return ELIMIT;
    374374        }
    375        
     375
    376376        call_t *call = ipc_call_alloc(0);
    377377        IPC_SET_IMETHOD(call->data, imethod);
     
    379379        IPC_SET_ARG2(call->data, arg2);
    380380        IPC_SET_ARG3(call->data, arg3);
    381        
     381
    382382        /*
    383383         * To achieve deterministic behavior, zero out arguments that are beyond
     
    388388        /* Set the user-defined label */
    389389        call->data.label = label;
    390        
     390
    391391        errno_t res = request_preprocess(call, kobj->phone);
    392        
     392
    393393        if (!res)
    394394                ipc_call(kobj->phone, call);
    395395        else
    396396                ipc_backsend_err(kobj->phone, call, res);
    397        
     397
    398398        kobject_put(kobj);
    399399        return EOK;
     
    432432        /* Set the user-defined label */
    433433        call->data.label = label;
    434        
     434
    435435        errno_t res = request_preprocess(call, kobj->phone);
    436        
     436
    437437        if (!res)
    438438                ipc_call(kobj->phone, call);
    439439        else
    440440                ipc_backsend_err(kobj->phone, call, res);
    441        
     441
    442442        kobject_put(kobj);
    443443        return EOK;
     
    473473        if (!ckobj)
    474474                return ENOENT;
    475        
     475
    476476        call_t *call = ckobj->call;
    477477
     
    480480        if (need_old)
    481481                old = call->data;
    482        
     482
    483483        bool after_forward = false;
    484484        errno_t rc;
     
    489489                goto error;
    490490        }
    491        
     491
    492492        if (!method_is_forwardable(IPC_GET_IMETHOD(call->data))) {
    493493                rc = EPERM;
    494494                goto error;
    495495        }
    496        
     496
    497497        call->flags |= IPC_CALL_FORWARDED;
    498        
     498
    499499        /*
    500500         * User space is not allowed to change interface and method of system
     
    507507                        if (IPC_GET_IMETHOD(call->data) == IPC_M_CONNECT_TO_ME)
    508508                                phone_dealloc(IPC_GET_ARG5(call->data));
    509                        
     509
    510510                        IPC_SET_ARG1(call->data, imethod);
    511511                        IPC_SET_ARG2(call->data, arg1);
    512512                        IPC_SET_ARG3(call->data, arg2);
    513                        
     513
    514514                        if (slow)
    515515                                IPC_SET_ARG4(call->data, arg3);
    516                        
     516
    517517                        /*
    518518                         * For system methods we deliberately don't
     
    530530                }
    531531        }
    532        
     532
    533533        rc = ipc_forward(call, pkobj->phone, &TASK->answerbox, mode);
    534534        if (rc != EOK) {
     
    609609        if (rc != EOK)
    610610                return (sys_errno_t) rc;
    611        
     611
    612612        return sys_ipc_forward_common(chandle, phandle,
    613613            IPC_GET_IMETHOD(newdata), IPC_GET_ARG1(newdata),
     
    637637        if (!kobj)
    638638                return ENOENT;
    639        
     639
    640640        call_t *call = kobj->call;
    641641
    642642        ipc_data_t saved_data;
    643643        bool saved;
    644        
     644
    645645        if (answer_need_old(call)) {
    646646                memcpy(&saved_data, &call->data, sizeof(call->data));
     
    648648        } else
    649649                saved = false;
    650        
     650
    651651        IPC_SET_RETVAL(call->data, retval);
    652652        IPC_SET_ARG1(call->data, arg1);
     
    654654        IPC_SET_ARG3(call->data, arg3);
    655655        IPC_SET_ARG4(call->data, arg4);
    656        
     656
    657657        /*
    658658         * To achieve deterministic behavior, zero out arguments that are beyond
     
    661661        IPC_SET_ARG5(call->data, 0);
    662662        errno_t rc = answer_preprocess(call, saved ? &saved_data : NULL);
    663        
     663
    664664        ipc_answer(&TASK->answerbox, call);
    665665
     
    683683        if (!kobj)
    684684                return ENOENT;
    685        
     685
    686686        call_t *call = kobj->call;
    687687
    688688        ipc_data_t saved_data;
    689689        bool saved;
    690        
     690
    691691        if (answer_need_old(call)) {
    692692                memcpy(&saved_data, &call->data, sizeof(call->data));
     
    694694        } else
    695695                saved = false;
    696        
     696
    697697        errno_t rc = copy_from_uspace(&call->data.args, &data->args,
    698698            sizeof(call->data.args));
     
    704704                return rc;
    705705        }
    706        
     706
    707707        rc = answer_preprocess(call, saved ? &saved_data : NULL);
    708        
     708
    709709        ipc_answer(&TASK->answerbox, call);
    710710
     
    727727        if (!kobj)
    728728                return ENOENT;
    729        
     729
    730730        errno_t rc = ipc_phone_hangup(kobj->phone);
    731731        kobject_put(kobj);
     
    746746{
    747747        call_t *call;
    748        
     748
    749749restart:
    750        
     750
    751751#ifdef CONFIG_UDEBUG
    752752        udebug_stoppable_begin();
    753753#endif
    754        
     754
    755755        call = ipc_wait_for_call(&TASK->answerbox, usec,
    756756            flags | SYNCH_FLAGS_INTERRUPTIBLE);
    757        
     757
    758758#ifdef CONFIG_UDEBUG
    759759        udebug_stoppable_end();
     
    766766                return EOK;
    767767        }
    768        
     768
    769769        call->data.flags = call->flags;
    770770        if (call->flags & IPC_CALL_NOTIF) {
    771771                /* Set in_phone_hash to the interrupt counter */
    772772                call->data.phone = (void *) call->priv;
    773                
     773
    774774                call->data.cap_handle = CAP_NIL;
    775775
    776776                STRUCT_TO_USPACE(calldata, &call->data);
    777777                kobject_put(call->kobject);
    778                
     778
    779779                return EOK;
    780780        }
    781        
     781
    782782        if (call->flags & IPC_CALL_ANSWERED) {
    783783                process_answer(call);
    784                
     784
    785785                if (call->flags & IPC_CALL_DISCARD_ANSWER) {
    786786                        kobject_put(call->kobject);
     
    789789
    790790                call->data.cap_handle = CAP_NIL;
    791                
     791
    792792                STRUCT_TO_USPACE(calldata, &call->data);
    793793                kobject_put(call->kobject);
    794                
     794
    795795                return EOK;
    796796        }
    797        
     797
    798798        if (process_request(&TASK->answerbox, call))
    799799                goto restart;
    800        
     800
    801801        cap_handle_t handle;
    802802        errno_t rc = cap_alloc(TASK, &handle);
     
    804804                goto error;
    805805        }
    806        
     806
    807807        call->data.cap_handle = handle;
    808808
     
    871871        if (!(perm_get(TASK) & PERM_IRQ_REG))
    872872                return EPERM;
    873        
     873
    874874        return ipc_irq_subscribe(&TASK->answerbox, inr, imethod, ucode, uspace_handle);
    875875}
     
    887887        if (!(perm_get(TASK) & PERM_IRQ_REG))
    888888                return EPERM;
    889        
     889
    890890        ipc_irq_unsubscribe(&TASK->answerbox, cap);
    891        
     891
    892892        return 0;
    893893}
     
    903903        task_id_t taskid;
    904904        cap_handle_t phone;
    905        
     905
    906906        errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(task_id_t));
    907907        if (rc == EOK) {
    908908                rc = ipc_connect_kbox((task_id_t) taskid, &phone);
    909909        }
    910        
     910
    911911        if (rc == EOK) {
    912912                rc = copy_to_uspace(uspace_phone, &phone, sizeof(cap_handle_t));
     
    916916                }
    917917        }
    918        
     918
    919919        return (sys_errno_t) rc;
    920920#else
Note: See TracChangeset for help on using the changeset viewer.