Changeset 455241b in mainline for kernel/generic/src/ipc/ops


Ignore:
Timestamp:
2025-01-16T19:29:20Z (12 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Children:
ff4d31c
Parents:
df721df
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-01-16 19:23:14)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2025-01-16 19:29:20)
Message:

Integrate kobject_t into target structures

This just means fewer allocations and indirections.

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

Legend:

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

    rdf721df r455241b  
    8888
    8989        /* Set the recipient-assigned label */
    90         pobj->phone->label = ipc_get_arg5(&answer->data);
     90        phone_from_kobject(pobj)->label = ipc_get_arg5(&answer->data);
    9191
    9292        /* Restore phone handle in answer's ARG5 */
     
    9696        if (ipc_get_retval(&answer->data) == EOK) {
    9797                /* Hand over reference from pobj to the answerbox */
    98                 (void) ipc_phone_connect(pobj->phone, &TASK->answerbox);
     98                (void) ipc_phone_connect(phone_from_kobject(pobj), &TASK->answerbox);
    9999        } else {
    100100                /* Drop the extra reference */
  • kernel/generic/src/ipc/ops/concttome.c

    rdf721df r455241b  
    4949                 * Set the sender-assigned label to the new phone.
    5050                 */
    51                 pobj->phone->label = ipc_get_arg5(&call->data);
     51                phone_from_kobject(pobj)->label = ipc_get_arg5(&call->data);
    5252        }
    5353        call->priv = (sysarg_t) pobj;
     
    8888                kobject_add_ref(pobj);
    8989
    90                 if (ipc_phone_connect(pobj->phone,
     90                if (ipc_phone_connect(phone_from_kobject(pobj),
    9191                    &answer->sender->answerbox)) {
    9292                        /* Pass the reference to the capability */
  • kernel/generic/src/ipc/ops/stchngath.c

    rdf721df r455241b  
    4545        task_t *other_task_s;
    4646
    47         kobject_t *sender_obj = kobject_get(TASK,
    48             (cap_handle_t) ipc_get_arg5(&call->data), KOBJECT_TYPE_PHONE);
    49         if (!sender_obj)
     47        phone_t *sender_phone = phone_from_kobject(kobject_get(TASK,
     48            (cap_handle_t) ipc_get_arg5(&call->data), KOBJECT_TYPE_PHONE));
     49        if (!sender_phone)
    5050                return ENOENT;
    5151
    52         mutex_lock(&sender_obj->phone->lock);
    53         if (sender_obj->phone->state != IPC_PHONE_CONNECTED) {
    54                 mutex_unlock(&sender_obj->phone->lock);
    55                 kobject_put(sender_obj);
     52        mutex_lock(&sender_phone->lock);
     53        if (sender_phone->state != IPC_PHONE_CONNECTED) {
     54                mutex_unlock(&sender_phone->lock);
     55                kobject_put(&sender_phone->kobject);
    5656                return EINVAL;
    5757        }
    5858
    59         other_task_s = sender_obj->phone->callee->task;
     59        other_task_s = sender_phone->callee->task;
    6060
    61         mutex_unlock(&sender_obj->phone->lock);
     61        mutex_unlock(&sender_phone->lock);
    6262
    6363        /* Remember the third party task hash. */
    6464        ipc_set_arg5(&call->data, (sysarg_t) other_task_s);
    6565
    66         kobject_put(sender_obj);
     66        kobject_put(&sender_phone->kobject);
    6767        return EOK;
    6868}
     
    7777                task_t *other_task_r;
    7878
    79                 kobject_t *recipient_obj = kobject_get(TASK,
     79                phone_t *recipient_phone = phone_from_kobject(kobject_get(TASK,
    8080                    (cap_handle_t) ipc_get_arg1(&answer->data),
    81                     KOBJECT_TYPE_PHONE);
    82                 if (!recipient_obj) {
     81                    KOBJECT_TYPE_PHONE));
     82                if (!recipient_phone) {
    8383                        ipc_set_retval(&answer->data, ENOENT);
    8484                        return ENOENT;
    8585                }
    8686
    87                 mutex_lock(&recipient_obj->phone->lock);
    88                 if (recipient_obj->phone->state != IPC_PHONE_CONNECTED) {
    89                         mutex_unlock(&recipient_obj->phone->lock);
     87                mutex_lock(&recipient_phone->lock);
     88                if (recipient_phone->state != IPC_PHONE_CONNECTED) {
     89                        mutex_unlock(&recipient_phone->lock);
    9090                        ipc_set_retval(&answer->data, EINVAL);
    91                         kobject_put(recipient_obj);
     91                        kobject_put(&recipient_phone->kobject);
    9292                        return EINVAL;
    9393                }
    9494
    95                 other_task_r = recipient_obj->phone->callee->task;
     95                other_task_r = recipient_phone->callee->task;
    9696                other_task_s = (task_t *) ipc_get_arg5(olddata);
    9797
     
    114114                }
    115115
    116                 mutex_unlock(&recipient_obj->phone->lock);
    117                 kobject_put(recipient_obj);
     116                mutex_unlock(&recipient_phone->lock);
     117                kobject_put(&recipient_phone->kobject);
    118118        }
    119119
Note: See TracChangeset for help on using the changeset viewer.