Changeset 8565a42 in mainline for uspace/srv/ns


Ignore:
Timestamp:
2018-03-02T20:34:50Z (8 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1a81f69, d5e5fd1
Parents:
3061bc1 (diff), 34e1206 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:34:50)
git-committer:
GitHub <noreply@…> (2018-03-02 20:34:50)
Message:

Remove all trailing whitespace, everywhere.

See individual commit messages for details.

Location:
uspace/srv/ns
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ns/clonable.c

    r3061bc1 r8565a42  
    8484                return;
    8585        }
    86        
     86
    8787        cs_req_t *csr = list_get_instance(req_link, cs_req_t, link);
    8888        list_remove(req_link);
    89        
     89
    9090        /* Currently we can only handle a single type of clonable service. */
    9191        assert(csr->service == SERVICE_LOADER);
    92        
     92
    9393        async_answer_0(callid, EOK);
    94        
     94
    9595        async_sess_t *sess = async_callback_receive(EXCHANGE_SERIALIZE);
    9696        if (sess == NULL)
    9797                async_answer_0(callid, EIO);
    98        
     98
    9999        async_exch_t *exch = async_exchange_begin(sess);
    100100        async_forward_fast(csr->callid, exch, csr->iface, csr->arg3, 0,
    101101            IPC_FF_NONE);
    102102        async_exchange_end(exch);
    103        
     103
    104104        free(csr);
    105105        async_hangup(sess);
     
    120120{
    121121        assert(service == SERVICE_LOADER);
    122        
     122
    123123        cs_req_t *csr = malloc(sizeof(cs_req_t));
    124124        if (csr == NULL) {
     
    126126                return;
    127127        }
    128        
     128
    129129        /* Spawn a loader. */
    130130        errno_t rc = loader_spawn("loader");
    131        
     131
    132132        if (rc != EOK) {
    133133                free(csr);
     
    135135                return;
    136136        }
    137        
     137
    138138        link_initialize(&csr->link);
    139139        csr->service = service;
     
    141141        csr->callid = callid;
    142142        csr->arg3 = IPC_GET_ARG3(*call);
    143        
     143
    144144        /*
    145145         * We can forward the call only after the server we spawned connects
  • uspace/srv/ns/ns.c

    r3061bc1 r8565a42  
    6969                return;
    7070        }
    71        
     71
    7272        async_answer_0(iid, EOK);
    7373
    7474        while (true) {
    7575                process_pending_conn();
    76                
     76
    7777                callid = async_get_call(&call);
    7878                if (!IPC_GET_IMETHOD(call))
    7979                        break;
    80                
     80
    8181                task_id_t id;
    8282                errno_t retval;
    83                
     83
    8484                service_t service;
    8585                sysarg_t phone;
    86                
     86
    8787                switch (IPC_GET_IMETHOD(call)) {
    8888                case NS_REGISTER:
    8989                        service = IPC_GET_ARG1(call);
    9090                        phone = IPC_GET_ARG5(call);
    91                        
     91
    9292                        /*
    9393                         * Server requests service registration.
     
    9999                                retval = register_service(service, phone, &call);
    100100                        }
    101                        
     101
    102102                        break;
    103103                case NS_PING:
     
    120120                        break;
    121121                }
    122                
     122
    123123                async_answer_0(callid, retval);
    124124        }
     
    130130{
    131131        printf("%s: HelenOS IPC Naming Service\n", NAME);
    132        
     132
    133133        errno_t rc = service_init();
    134134        if (rc != EOK)
    135135                return rc;
    136        
     136
    137137        rc = clonable_init();
    138138        if (rc != EOK)
    139139                return rc;
    140        
     140
    141141        rc = task_init();
    142142        if (rc != EOK)
    143143                return rc;
    144        
     144
    145145        async_set_fallback_port_handler(ns_connection, NULL);
    146        
     146
    147147        printf("%s: Accepting connections\n", NAME);
    148148        async_manager();
    149        
     149
    150150        /* Not reached */
    151151        return 0;
  • uspace/srv/ns/service.c

    r3061bc1 r8565a42  
    4343typedef struct {
    4444        ht_link_t link;
    45        
     45
    4646        /** Service ID */
    4747        service_t service;
    48        
     48
    4949        /** Session to the service */
    5050        async_sess_t *sess;
     
    6060        hashed_service_t *service =
    6161            hash_table_get_inst(item, hashed_service_t, link);
    62        
     62
    6363        return service->service;
    6464}
     
    6868        hashed_service_t *service =
    6969            hash_table_get_inst(item, hashed_service_t, link);
    70        
     70
    7171        return service->service == *(service_t *) key;
    7272}
     
    102102                return ENOMEM;
    103103        }
    104        
     104
    105105        list_initialize(&pending_conn);
    106        
     106
    107107        return EOK;
    108108}
     
    116116                if (!link)
    117117                        continue;
    118                
     118
    119119                hashed_service_t *hashed_service = hash_table_get_inst(link, hashed_service_t, link);
    120120                async_exch_t *exch = async_exchange_begin(hashed_service->sess);
     
    122122                    pending->arg3, 0, IPC_FF_NONE);
    123123                async_exchange_end(exch);
    124                
     124
    125125                list_remove(&pending->link);
    126126                free(pending);
    127                
     127
    128128                goto loop;
    129129        }
     
    143143        if (hash_table_find(&service_hash_table, &service))
    144144                return EEXIST;
    145        
     145
    146146        hashed_service_t *hashed_service =
    147147            (hashed_service_t *) malloc(sizeof(hashed_service_t));
    148148        if (!hashed_service)
    149149                return ENOMEM;
    150        
     150
    151151        hashed_service->service = service;
    152152        hashed_service->sess = async_callback_receive(EXCHANGE_SERIALIZE);
    153153        if (hashed_service->sess == NULL)
    154154                return EIO;
    155        
     155
    156156        hash_table_insert(&service_hash_table, &hashed_service->link);
    157157        return EOK;
     
    174174        sysarg_t flags = IPC_GET_ARG4(*call);
    175175        errno_t retval;
    176        
     176
    177177        ht_link_t *link = hash_table_find(&service_hash_table, &service);
    178178        if (!link) {
     
    185185                                goto out;
    186186                        }
    187                        
     187
    188188                        link_initialize(&pending->link);
    189189                        pending->service = service;
     
    191191                        pending->callid = callid;
    192192                        pending->arg3 = arg3;
    193                        
     193
    194194                        list_append(&pending->link, &pending_conn);
    195195                        return;
    196196                }
    197                
     197
    198198                retval = ENOENT;
    199199                goto out;
    200200        }
    201        
     201
    202202        hashed_service_t *hashed_service = hash_table_get_inst(link, hashed_service_t, link);
    203203        async_exch_t *exch = async_exchange_begin(hashed_service->sess);
     
    205205        async_exchange_end(exch);
    206206        return;
    207        
     207
    208208out:
    209209        async_answer_0(callid, retval);
  • uspace/srv/ns/task.c

    r3061bc1 r8565a42  
    4848typedef struct {
    4949        ht_link_t link;
    50        
     50
    5151        task_id_t id;    /**< Task ID. */
    5252        bool finished;   /**< Task is done. */
     
    115115        sysarg_t in_phone_hash = *(sysarg_t*)key;
    116116        p2i_entry_t *entry = hash_table_get_inst(item, p2i_entry_t, link);
    117        
     117
    118118        return (in_phone_hash == entry->in_phone_hash);
    119119}
     
    157157                return ENOMEM;
    158158        }
    159        
     159
    160160        if (!hash_table_create(&phone_to_id, 0, 0, &p2i_ops)) {
    161161                printf(NAME ": No memory available for tasks\n");
    162162                return ENOMEM;
    163163        }
    164        
     164
    165165        list_initialize(&pending_wait);
    166166        return EOK;
     
    171171{
    172172        task_exit_t texit;
    173        
     173
    174174loop:
    175175        list_foreach(pending_wait, link, pending_wait_t, pr) {
     
    177177                if (!link)
    178178                        continue;
    179                
     179
    180180                hashed_task_t *ht = hash_table_get_inst(link, hashed_task_t, link);
    181181                if (!ht->finished)
    182182                        continue;
    183                
     183
    184184                texit = ht->have_rval ? TASK_EXIT_NORMAL :
    185185                    TASK_EXIT_UNEXPECTED;
    186186                async_answer_2(pr->callid, EOK, texit, ht->retval);
    187                
     187
    188188                list_remove(&pr->link);
    189189                free(pr);
     
    197197        hashed_task_t *ht = (link != NULL) ?
    198198            hash_table_get_inst(link, hashed_task_t, link) : NULL;
    199        
     199
    200200        if (ht == NULL) {
    201201                /* No such task exists. */
     
    203203                return;
    204204        }
    205        
     205
    206206        if (ht->finished) {
    207207                task_exit_t texit = ht->have_rval ? TASK_EXIT_NORMAL :
     
    210210                return;
    211211        }
    212        
     212
    213213        /* Add to pending list */
    214214        pending_wait_t *pr =
     
    218218                return;
    219219        }
    220        
     220
    221221        link_initialize(&pr->link);
    222222        pr->id = id;
     
    228228{
    229229        task_id_t id = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
    230        
     230
    231231        ht_link_t *link = hash_table_find(&phone_to_id, &call->in_phone_hash);
    232232        if (link != NULL)
    233233                return EEXIST;
    234        
     234
    235235        p2i_entry_t *entry = (p2i_entry_t *) malloc(sizeof(p2i_entry_t));
    236236        if (entry == NULL)
    237237                return ENOMEM;
    238        
     238
    239239        hashed_task_t *ht = (hashed_task_t *) malloc(sizeof(hashed_task_t));
    240240        if (ht == NULL) {
     
    242242                return ENOMEM;
    243243        }
    244        
     244
    245245        /*
    246246         * Insert into the phone-to-id map.
    247247         */
    248        
     248
    249249        entry->in_phone_hash = call->in_phone_hash;
    250250        entry->id = id;
    251251        hash_table_insert(&phone_to_id, &entry->link);
    252        
     252
    253253        /*
    254254         * Insert into the main table.
    255255         */
    256        
     256
    257257        ht->id = id;
    258258        ht->finished = false;
     
    260260        ht->retval = -1;
    261261        hash_table_insert(&task_hash_table, &ht->link);
    262        
     262
    263263        return EOK;
    264264}
     
    269269        if (link == NULL)
    270270                return ENOENT;
    271        
     271
    272272        p2i_entry_t *entry = hash_table_get_inst(link, p2i_entry_t, link);
    273273        *id = entry->id;
    274        
     274
    275275        return EOK;
    276276}
     
    279279{
    280280        task_id_t id = call->in_task_id;
    281        
     281
    282282        ht_link_t *link = hash_table_find(&task_hash_table, &id);
    283283        hashed_task_t *ht = (link != NULL) ?
    284284            hash_table_get_inst(link, hashed_task_t, link) : NULL;
    285        
     285
    286286        if ((ht == NULL) || (ht->finished))
    287287                return EINVAL;
    288        
     288
    289289        ht->finished = true;
    290290        ht->have_rval = true;
    291291        ht->retval = IPC_GET_ARG1(*call);
    292        
     292
    293293        process_pending_wait();
    294        
     294
    295295        return EOK;
    296296}
     
    302302        if (rc != EOK)
    303303                return rc;
    304        
     304
    305305        /* Delete from phone-to-id map. */
    306306        hash_table_remove(&phone_to_id, &call->in_phone_hash);
    307        
     307
    308308        /* Mark task as finished. */
    309309        ht_link_t *link = hash_table_find(&task_hash_table, &id);
     
    312312
    313313        hashed_task_t *ht = hash_table_get_inst(link, hashed_task_t, link);
    314        
     314
    315315        ht->finished = true;
    316        
     316
    317317        process_pending_wait();
    318318        hash_table_remove(&task_hash_table, &id);
    319        
     319
    320320        return EOK;
    321321}
Note: See TracChangeset for help on using the changeset viewer.