Changeset e7ac23d0 in mainline for kernel/generic/src/ipc/ipc.c


Ignore:
Timestamp:
2017-08-20T14:53:21Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3f74275
Parents:
49115ac
Message:

Hide kobject implementation details

File:
1 edited

Legend:

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

    r49115ac re7ac23d0  
    735735{
    736736        call_t *call;
    737         size_t i;
     737        bool all_clean;
    738738
    739739restart:
     
    742742         * Locking is needed as there may be connection handshakes in progress.
    743743         */
    744         for (i = 0; i < MAX_KERNEL_OBJECTS; i++) {
    745                 phone_t *phone = phone_get_current(i);
    746                 if (!phone)
    747                         continue;
     744        all_clean = true;
     745        for_each_kobject_current(kobj, KOBJECT_TYPE_PHONE) {
     746                phone_t *phone = &kobj->phone;
    748747
    749748                mutex_lock(&phone->lock);
     
    781780                if (phone->state != IPC_PHONE_FREE) {
    782781                        mutex_unlock(&phone->lock);
     782                        all_clean = false;
    783783                        break;
    784784                }
     
    788788               
    789789        /* Got into cleanup */
    790         if (i == MAX_KERNEL_OBJECTS)
     790        if (all_clean)
    791791                return;
    792792               
     
    820820
    821821        /* Disconnect all our phones ('ipc_phone_hangup') */
    822         for (int i = 0; i < MAX_KERNEL_OBJECTS; i++) {
    823                 phone_t *phone = phone_get_current(i);
    824                 if (!phone)
    825                         continue;
     822        for_each_kobject_current(kobj, KOBJECT_TYPE_PHONE) {
     823                phone_t *phone = &kobj->phone;
    826824                ipc_phone_hangup(phone);
    827825        }
     
    913911        printf("[phone cap] [calls] [state\n");
    914912       
    915         size_t i;
    916         for (i = 0; i < MAX_KERNEL_OBJECTS; i++) {
    917                 phone_t *phone = phone_get(task, i);
    918                 if (!phone)
     913        for_each_kobject(task, kobj, KOBJECT_TYPE_PHONE) {
     914                phone_t *phone = &kobj->phone;
     915                int cap = kobject_to_cap(task, kobj);
     916
     917                if (SYNCH_FAILED(mutex_trylock(&phone->lock))) {
     918                        printf("%-11d (mutex busy)\n", cap);
    919919                        continue;
    920 
    921                 if (SYNCH_FAILED(mutex_trylock(&phone->lock))) {
    922                         printf("%-10zu (mutex busy)\n", i);
    923                         continue;
    924920                }
    925921               
    926922                if (phone->state != IPC_PHONE_FREE) {
    927                         printf("%-11zu %7" PRIun " ", i,
     923                        printf("%-11d %7" PRIun " ", cap,
    928924                            atomic_get(&phone->active_calls));
    929925                       
Note: See TracChangeset for help on using the changeset viewer.