Changeset 102f641 in mainline for uspace/srv


Ignore:
Timestamp:
2019-09-02T19:01:50Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
25697163
Parents:
241f1985
Message:

Correcting syntax according to ccheck

Location:
uspace/srv
Files:
40 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/drv_conn.c

    r241f1985 r102f641  
    115115        sysman_main_exposee_added(unit_name, call->task_id);
    116116        free(unit_name);
    117        
     117
    118118        switch (driver->state) {
    119119        case DRIVER_NOT_STARTED:
  • uspace/srv/hid/compositor/compositor.c

    r241f1985 r102f641  
    23052305        /* Finally, register compositor server. */
    23062306        async_set_fallback_port_handler(client_connection, NULL);
    2307        
     2307
    23082308        rc = loc_server_register(NAME);
    23092309        if (rc != EOK) {
     
    23112311                return rc;
    23122312        }
    2313        
     2313
    23142314        server_name = name;
    2315        
     2315
    23162316        /* Prepare window registrator (entrypoint for clients). */
    23172317        char winreg[LOC_NAME_MAXLEN + 1];
  • uspace/srv/loader/main.c

    r241f1985 r102f641  
    4343 * and completely hidden from applications.
    4444 */
    45 
    4645
    4746#include <stdio.h>
     
    443442        /* Set a handler of incomming connections. */
    444443        async_set_fallback_port_handler(ldr_connection, NULL);
    445        
     444
    446445        /* Announce to taskman. */
    447446        errno_t rc = taskman_intro_loader();
     
    457456         */
    458457        async_manager();
    459        
     458
    460459        /* Never reached */
    461460        return 0;
  • uspace/srv/locsrv/locsrv.c

    r241f1985 r102f641  
    608608
    609609        list_append(&service->server_services, &service->server->services);
    610        
     610
    611611        fibril_mutex_unlock(&service->server->services_mutex);
    612612        fibril_condvar_broadcast(&services_list_cv);
     
    841841        int flags = ipc_get_arg1(icall);
    842842        bool start_requested = false;
    843        
     843
    844844recheck:
    845845
     
    853853         */
    854854        if (svc == NULL) {
    855                 /* TODO:
     855                /*
     856                 * TODO:
    856857                 * Consider non-blocking service start, return some dummy id
    857858                 * and block only after connection request (actually makes more
     
    892893                async_answer_0(icall, rc);
    893894        }
    894        
     895
    895896        fibril_mutex_unlock(&services_list_mutex);
    896897        free(ns_name);
  • uspace/srv/net/loopip/loopip.c

    r241f1985 r102f641  
    116116
    117117        prodcons_initialize(&loopip_rcv_queue);
    118        
     118
    119119        const char *svc_name = SERVICE_NAME_LOOPBACK;
    120120        service_id_t sid;
  • uspace/srv/ns/ns.c

    r241f1985 r102f641  
    118118        if (rc != EOK)
    119119                return rc;
    120        
     120
    121121        rc = taskman_intro_ns_noasync();
    122122        if (rc != EOK) {
     
    125125        }
    126126        task_retval_noasync(0);
    127        
     127
    128128        async_set_fallback_port_handler(ns_connection, NULL);
    129129
    130130        printf("%s: Accepting connections\n", NAME);
    131        
     131
    132132        async_manager();
    133133
  • uspace/srv/sysman/connection_broker.c

    r241f1985 r102f641  
    9696        }
    9797
    98 
    9998        retval = ENOTSUP;
    10099
     
    119118        while (true) {
    120119                ipc_call_t call;
    121                
     120
    122121                if (!async_get_call(&call) || !ipc_get_imethod(&call)) {
    123122                        /* Client disconnected */
     
    146145        }
    147146}
    148 
    149 
  • uspace/srv/sysman/connection_ctl.c

    r241f1985 r102f641  
    4141#include "sysman.h"
    4242
    43 
    4443// TODO possibly provide as type-safe function + macro in sysman.h for generic boxing
    4544static ipc_call_t *box_callid(ipc_call_t *icall)
     
    215214        size_t act_size;
    216215        int rc;
    217        
     216
    218217        if (!async_data_read_receive(&call, &size)) {
    219218                async_answer_0(&call, EREFUSED);
     
    221220                return;
    222221        }
    223        
    224        
     222
    225223        unit_handle_t *handles = malloc(size);
    226224        if (handles == NULL && size > 0) {
     
    229227                return;
    230228        }
    231        
    232        
     229
    233230        rc = fill_handles_buffer(handles, size, &act_size);
    234231        if (rc != EOK) {
     
    237234                return;
    238235        }
    239        
     236
    240237        size_t real_size = min(act_size, size);
    241238        sysarg_t retval = async_data_read_finalize(&call, handles, real_size);
    242239        free(handles);
    243        
     240
    244241        async_answer_1(icall, retval, act_size);
    245242}
     
    249246        ipc_call_t call;
    250247        size_t size;
    251        
     248
    252249        if (!async_data_read_receive(&call, &size)) {
    253250                async_answer_0(&call, EREFUSED);
     
    255252                return;
    256253        }
    257        
     254
    258255        unit_t *u = repo_find_unit_by_handle(ipc_get_arg1(icall));
    259256        if (u == NULL) {
     
    262259                return;
    263260        }
    264        
     261
    265262        size_t real_size = min(str_size(u->name) + 1, size);
    266263        sysarg_t retval = async_data_read_finalize(&call, u->name, real_size);
    267        
     264
    268265        async_answer_0(icall, retval);
    269266}
     
    303300        while (true) {
    304301                ipc_call_t call;
    305                
     302
    306303                if (!async_get_call(&call) || !ipc_get_imethod(&call)) {
    307304                        /* Client disconnected */
     
    339336        }
    340337}
    341 
  • uspace/srv/sysman/edge.c

    r241f1985 r102f641  
    118118}
    119119
    120 
    121120/**
    122121 * @return        EOK on success
  • uspace/srv/sysman/edge.h

    r241f1985 r102f641  
    7171extern void edge_remove(unit_edge_t **);
    7272
    73 
    7473#endif
    75 
    76 
  • uspace/srv/sysman/job.c

    r241f1985 r102f641  
    3939#include "sysman.h"
    4040
    41 
    4241/*
    4342 * Static functions
    4443 */
    45 
    4644
    4745/** Remove blocking_job from blocked job structure
     
    273271        sysman_raise_event(&sysman_event_job_finished, job);
    274272}
    275 
  • uspace/srv/sysman/job.h

    r241f1985 r102f641  
    6565        /** Jobs that this job is preventing from running */
    6666        dyn_array_t blocked_jobs;
    67         /** No. of jobs that the job is actually blocking (may differ from size
    68          * of blocked_jobs for not fully merged job */
     67        /**
     68         * No. of jobs that the job is actually blocking (may differ from size
     69         * of blocked_jobs for not fully merged job
     70         */
    6971        size_t blocked_jobs_count;
    7072        /** No. of jobs that must finish before this job */
  • uspace/srv/sysman/job_closure.c

    r241f1985 r102f641  
    3737#include "log.h"
    3838
    39 
    4039/** Struct describes how to traverse units graph */
    4140struct bfs_ops;
     
    5251         * return result of visit (error stops further traversal)
    5352         */
    54         int (* visit)(unit_t *, unit_edge_t *, bfs_ops_t *, void *);
     53        int (*visit)(unit_t *, unit_edge_t *, bfs_ops_t *, void *);
    5554
    5655        /** Clean units remaining in BFS queue after error */
    57         void (* clean)(unit_t *, bfs_ops_t *, void *);
     56        void (*clean)(unit_t *, bfs_ops_t *, void *);
    5857};
    5958
     
    6564{
    6665        assert(blocking_job->blocked_jobs.size ==
    67             blocking_job->blocked_jobs_count);
     66            blocking_job->blocked_jobs_count);
    6867
    6968        int rc = dyn_array_append(&blocking_job->blocked_jobs, job_t *,
     
    203202        unit->bfs_tag = true;
    204203        list_append(&unit->bfs_link, &units_fifo);
    205        
     204
    206205        while (!list_empty(&units_fifo)) {
    207206                unit = list_get_instance(list_first(&units_fifo), unit_t,
     
    209208                list_remove(&unit->bfs_link);
    210209
    211 
    212                 if (ops->direction == BFS_FORWARD)
    213                     list_foreach(unit->edges_out, edges_out, unit_edge_t, e) {
    214                         unit_t *u = e->output;
    215                         if (!u->bfs_tag) {
    216                                 u->bfs_tag = true;
    217                                 list_append(&u->bfs_link, &units_fifo);
     210                if (ops->direction == BFS_FORWARD) {
     211                        list_foreach(unit->edges_out, edges_out, unit_edge_t, e) {
     212                                unit_t *u = e->output;
     213                                if (!u->bfs_tag) {
     214                                        u->bfs_tag = true;
     215                                        list_append(&u->bfs_link, &units_fifo);
     216                                }
     217                                rc = ops->visit(u, e, ops, arg);
     218                                if (rc != EOK) {
     219                                        goto finish;
     220                                }
    218221                        }
    219                         rc = ops->visit(u, e, ops, arg);
    220                         if (rc != EOK) {
    221                                 goto finish;
    222                         }
    223                 } else
    224                     list_foreach(unit->edges_in, edges_in, unit_edge_t, e) {
    225                         unit_t *u = e->input;
    226                         if (!u->bfs_tag) {
    227                                 u->bfs_tag = true;
    228                                 list_append(&u->bfs_link, &units_fifo);
    229                         }
    230                         rc = ops->visit(u, e, ops, arg);
    231                         if (rc != EOK) {
    232                                 goto finish;
     222                } else {
     223                        list_foreach(unit->edges_in, edges_in, unit_edge_t, e) {
     224                                unit_t *u = e->input;
     225                                if (!u->bfs_tag) {
     226                                        u->bfs_tag = true;
     227                                        list_append(&u->bfs_link, &units_fifo);
     228                                }
     229                                rc = ops->visit(u, e, ops, arg);
     230                                if (rc != EOK) {
     231                                        goto finish;
     232                                }
    233233                        }
    234234                }
     
    243243                list_remove(cur_link);
    244244        }
    245        
     245
    246246        return rc;
    247247}
     
    349349        }
    350350
    351        
    352351        /* Clean after ourselves (BFS tag jobs) */
    353352        dyn_array_foreach(*job_closure, job_t *, job_it) {
     
    360359        return rc;
    361360}
    362 
  • uspace/srv/sysman/job_queue.c

    r241f1985 r102f641  
    230230        }
    231231
    232         /* Unmerged jobs are enqueued, merged are disposed
     232        /*
     233         * Unmerged jobs are enqueued, merged are disposed
    233234         *
    234235         * TODO Ensure that jobs that block merged jobs contain the corrent job
     
    242243                }
    243244
    244 
    245245                unit_t *u = job->unit;
    246246                assert(u->job == NULL);
     
    274274        }
    275275}
    276 
    277 
  • uspace/srv/sysman/log.c

    r241f1985 r102f641  
    3939static log_level_t max_level = LVL_NOTE;
    4040
    41 extern void sysman_log_init(log_level_t level)
     41void sysman_log_init(log_level_t level)
    4242{
    4343        max_level = level;
     
    5151        va_list args;
    5252        va_start(args, fmt);
    53        
     53
    5454        vprintf(fmt, args);
    5555        printf("\n");
  • uspace/srv/sysman/main.c

    r241f1985 r102f641  
    8383
    8484/** Build hard coded configuration */
    85 static errno_t create_entry_configuration(void) {
     85static errno_t create_entry_configuration(void)
     86{
    8687        errno_t rc;
    8788        unit_t *mnt_initrd = NULL;
     
    108109        cfg_init->name           = str_dup(UNIT_CFG_INITRD);
    109110        CAST_CFG(cfg_init)->path = str_dup(INITRD_CFG_PATH);
    110        
     111
    111112        tgt_init = unit_create(UNIT_TARGET);
    112113        if (tgt_init == NULL) {
     
    115116        }
    116117        tgt_init->name = str_dup(TARGET_INIT);
    117        
    118118
    119119        /*
     
    160160        }
    161161        job_del_ref(&job);
    162        
     162
    163163        const char **target_name_ptr = arg;
    164164        prepare_and_run_job(target_name_ptr + 1);
  • uspace/srv/sysman/repo.c

    r241f1985 r102f641  
    107107}
    108108
    109 
    110109static hash_table_ops_t units_by_name_ht_ops = {
    111110        .hash            = &units_by_name_ht_hash,
     
    133132{
    134133        sysman_log(LVL_DEBUG2, "%s(%s, %i)", __func__, name, lock);
    135         if (lock) fibril_rwlock_read_lock(&repo_lock);
     134        if (lock)
     135                fibril_rwlock_read_lock(&repo_lock);
    136136        ht_link_t *ht_link = hash_table_find(&units_by_name, (void *)name);
    137         if (lock) fibril_rwlock_read_unlock(&repo_lock);
     137        if (lock)
     138                fibril_rwlock_read_unlock(&repo_lock);
    138139
    139140        if (ht_link != NULL) {
     
    177178}
    178179
    179 void repo_begin_update(void) {
     180void repo_begin_update(void)
     181{
    180182        sysman_log(LVL_DEBUG2, "%s", __func__);
    181183        fibril_rwlock_write_lock(&repo_lock);
  • uspace/srv/sysman/repo.h

    r241f1985 r102f641  
    8383
    8484#endif
    85 
    86 
  • uspace/srv/sysman/sm_task.c

    r241f1985 r102f641  
    3838#include "sm_task.h"
    3939
    40 
    4140/** Structure for boxing task event */
    4241struct sm_task_event {
     
    103102        CAST_SVC(u_svc)->main_task_id = tid;
    104103        CAST_SVC(u_svc)->anonymous = true;
    105         /* exec_start is left undefined, maybe could be hinted by kernel's task
    106          * name */
     104        /*
     105         * exec_start is left undefined, maybe could be hinted by kernel's task
     106         * name
     107         */
    107108
    108109        /*
     
    125126
    126127        return CAST_SVC(u_svc);
    127        
     128
    128129fail:
    129130        if (in_repo_update) {
     
    177178                u_svc->unit.state = STATE_STARTING;
    178179        }
    179 
    180180
    181181        /* Simple incomplete state automaton */
  • uspace/srv/sysman/sysman.c

    r241f1985 r102f641  
    4040#include "unit.h"
    4141
    42 
    4342/* Do not expose this generally named type */
    4443typedef struct {
     
    9998{
    10099        void *object = *(void **)key;
    101         return (
    102             hash_table_get_inst(item, observed_object_t, ht_link)->object ==
    103             object);
     100        return hash_table_get_inst(item, observed_object_t, ht_link)->object ==
     101            object;
    104102}
    105103
     
    357355}
    358356
    359 
    360357/*
    361358 * Event handlers
     
    436433        notify_observers(data);
    437434}
    438 
  • uspace/srv/sysman/sysman.h

    r241f1985 r102f641  
    5353extern errno_t sysman_run_job(unit_t *, unit_state_t, int, callback_handler_t, void *);
    5454
    55 
    5655extern void sysman_raise_event(event_handler_t, void *);
    5756extern void sysman_process_queue(void);
  • uspace/srv/sysman/test/job_closure.c

    r241f1985 r102f641  
    3838PCUT_INIT
    3939
    40        
     40PCUT_TEST_SUITE(job_closure);
     41
    4142static dyn_array_t exp_closure;
    4243static dyn_array_t act_closure;
     
    107108}
    108109
    109 PCUT_TEST_SUITE(job_closure);
    110 
    111 PCUT_TEST_BEFORE {
     110PCUT_TEST_BEFORE
     111{
    112112        mock_create_units();
    113113        mock_set_units_state(STATE_STOPPED);
     
    124124}
    125125
    126 PCUT_TEST_AFTER {
     126PCUT_TEST_AFTER
     127{
    127128        destroy_job_closure(&act_closure);
    128129        dyn_array_destroy(&act_closure);
     
    134135}
    135136
    136 PCUT_TEST(job_closure_linear) {
     137PCUT_TEST(job_closure_linear)
     138{
    137139        unit_t *u0 = mock_units[UNIT_SERVICE][0];
    138140        unit_t *u1 = mock_units[UNIT_SERVICE][1];
     
    165167}
    166168
    167 PCUT_TEST(job_closure_fork) {
     169PCUT_TEST(job_closure_fork)
     170{
    168171        unit_t *u0 = mock_units[UNIT_SERVICE][0];
    169172        unit_t *u1 = mock_units[UNIT_SERVICE][1];
     
    196199}
    197200
    198 PCUT_TEST(job_closure_triangle) {
     201PCUT_TEST(job_closure_triangle)
     202{
    199203        unit_t *u0 = mock_units[UNIT_SERVICE][0];
    200204        unit_t *u1 = mock_units[UNIT_SERVICE][1];
     
    230234}
    231235
    232 PCUT_TEST(job_closure_isolate_linears) {
     236PCUT_TEST(job_closure_isolate_linears)
     237{
    233238        unit_t *u0 = mock_units[UNIT_SERVICE][0];
    234239        unit_t *u1 = mock_units[UNIT_SERVICE][1];
  • uspace/srv/sysman/test/job_queue.c

    r241f1985 r102f641  
    3838PCUT_INIT
    3939
     40PCUT_TEST_SUITE(job_queue);
     41
    4042static bool initialized = false;
    4143
     
    5153}
    5254
    53 PCUT_TEST_SUITE(job_queue);
    54 
    55 PCUT_TEST_BEFORE {
     55PCUT_TEST_BEFORE
     56{
    5657        mock_create_units();
    5758        mock_set_units_state(STATE_STOPPED);
     
    7374}
    7475
    75 PCUT_TEST_AFTER {
     76PCUT_TEST_AFTER
     77{
    7678        mock_destroy_units();
    7779}
    7880
    79 PCUT_TEST(single_start_sync) {
     81PCUT_TEST(single_start_sync)
     82{
    8083        unit_type_vmts[UNIT_TARGET]->start = &mock_unit_vmt_start_sync;
    8184
     
    9497}
    9598
    96 PCUT_TEST(single_start_async) {
     99PCUT_TEST(single_start_async)
     100{
    97101        unit_type_vmts[UNIT_TARGET]->start = &mock_unit_vmt_start_async;
    98102        unit_type_vmts[UNIT_TARGET]->exposee_created =
     
    117121}
    118122
    119 PCUT_TEST(multipath_to_started_unit) {
     123PCUT_TEST(multipath_to_started_unit)
     124{
    120125        /* Setup mock behavior */
    121126        unit_type_vmts[UNIT_SERVICE]->start = &mock_unit_vmt_start_sync;
     
    133138        mock_add_edge(s0, m0);
    134139        mock_add_edge(s1, m0);
    135        
     140
    136141        /* S1 requires another mount and S0 */
    137142        mock_add_edge(s1, s0);
     
    152157}
    153158
    154 PCUT_TEST(merge_jobs_with_callback) {
     159PCUT_TEST(merge_jobs_with_callback)
     160{
    155161        /* Setup mock behavior */
    156162        unit_type_vmts[UNIT_SERVICE]->start = &mock_unit_vmt_start_async;
     
    169175        /* Job not finished */
    170176        PCUT_ASSERT_NULL(j0);
    171 
    172177
    173178        /*
     
    188193        PCUT_ASSERT_NOT_NULL(j0);
    189194        PCUT_ASSERT_NOT_NULL(j1);
    190        
     195
    191196        /*
    192197         * Jobs were, merged so both callbacks should have been called with the
     
    202207}
    203208
    204 
    205209PCUT_EXPORT(job_queue);
  • uspace/srv/sysman/test/main.c

    r241f1985 r102f641  
    3434PCUT_IMPORT(job_queue);
    3535
    36 PCUT_MAIN()
     36PCUT_MAIN();
  • uspace/srv/sysman/test/mock_unit.c

    r241f1985 r102f641  
    104104        unit_notify_state(unit);
    105105}
    106 
  • uspace/srv/sysman/unit.c

    r241f1985 r102f641  
    5555
    5656static config_item_t unit_configuration[] = {
    57         {"After", &unit_parse_unit_list, 0, ""},
     57        { "After", &unit_parse_unit_list, 0, "" },
    5858        CONFIGURATION_ITEM_SENTINEL
    5959};
    6060
    61 
    6261static void unit_init(unit_t *unit, unit_type_t type)
    6362{
     
    6665        size_t size = unit_type_vmts[type]->size;
    6766        memset(unit, 0, size);
    68        
     67
    6968        unit->type = type;
    7069        unit->state = STATE_STOPPED;
     
    9796
    9897        UNIT_VMT(unit)->destroy(unit);
    99         /* TODO:
     98        /*
     99         * TODO:
    100100         *      edges
    101101         */
     
    116116                    unit_section, unit, text_parse);
    117117        }
    118                                
     118
    119119        if (rc != EOK) {
    120120                return rc;
  • uspace/srv/sysman/unit.h

    r241f1985 r102f641  
    9999#include "unit_svc.h"
    100100
    101 #define DEFINE_CAST(NAME, TYPE, ENUM_TYPE)                                     \
    102         static inline TYPE *CAST_##NAME(unit_t *u)                             \
    103         {                                                                      \
    104                 if (u->type == ENUM_TYPE)                                      \
     101#define DEFINE_CAST(NAME, TYPE, ENUM_TYPE)                         \
     102        static inline TYPE *CAST_##NAME(unit_t *u)                     \
     103        {                                                              \
     104                if (u->type == ENUM_TYPE)                                  \
    105105                        return (TYPE *)u;                                      \
    106                 else                                                           \
     106                else                                                       \
    107107                        return NULL;                                           \
    108         }                                                                      \
     108        }
    109109
    110 DEFINE_CAST(CFG, unit_cfg_t, UNIT_CONFIGURATION)
    111 DEFINE_CAST(MNT, unit_mnt_t, UNIT_MOUNT)
    112 DEFINE_CAST(TGT, unit_tgt_t, UNIT_TARGET)
    113 DEFINE_CAST(SVC, unit_svc_t, UNIT_SERVICE)
     110DEFINE_CAST(CFG, unit_cfg_t, UNIT_CONFIGURATION);
     111DEFINE_CAST(MNT, unit_mnt_t, UNIT_MOUNT);
     112DEFINE_CAST(TGT, unit_tgt_t, UNIT_TARGET);
     113DEFINE_CAST(SVC, unit_svc_t, UNIT_SERVICE);
    114114
    115115struct unit_vmt {
  • uspace/srv/sysman/units/unit_cfg.c

    r241f1985 r102f641  
    4646
    4747static config_item_t unit_configuration[] = {
    48         {"Path", &config_parse_string, offsetof(unit_cfg_t, path), NULL},
     48        { "Path", &config_parse_string, offsetof(unit_cfg_t, path), NULL },
    4949        CONFIGURATION_ITEM_SENTINEL
    5050};
     
    8181                goto finish;
    8282        }
    83        
     83
    8484        /* We parse files as part of ongoing repo transaction (locked). */
    8585        unit_t *u = repo_find_unit_by_name_unsafe(unit_name);
     
    231231
    232232        errno_t rc = cfg_load_configuration(u_cfg->path);
    233        
     233
    234234        if (rc == EOK) {
    235235                unit->state = STATE_STARTED;
     
    267267}
    268268
    269 DEFINE_UNIT_VMT(unit_cfg)
    270 
     269DEFINE_UNIT_VMT(unit_cfg);
  • uspace/srv/sysman/units/unit_mnt.c

    r241f1985 r102f641  
    4141
    4242static config_item_t unit_configuration[] = {
    43         {"What",      &config_parse_string, offsetof(unit_mnt_t, device),     NULL},
    44         {"Where",     &config_parse_string, offsetof(unit_mnt_t, mountpoint), NULL},
    45         {"Type",      &config_parse_string, offsetof(unit_mnt_t, type),       NULL},
    46         {"Autostart", &config_parse_bool,   offsetof(unit_mnt_t, autostart),  "true"},
    47         {"Blocking",  &config_parse_bool,   offsetof(unit_mnt_t, blocking),   "true"},
     43        { "What",      &config_parse_string, offsetof(unit_mnt_t, device),     NULL },
     44        { "Where",     &config_parse_string, offsetof(unit_mnt_t, mountpoint), NULL },
     45        { "Type",      &config_parse_string, offsetof(unit_mnt_t, type),       NULL },
     46        { "Autostart", &config_parse_bool,   offsetof(unit_mnt_t, autostart),  "true" },
     47        { "Blocking",  &config_parse_bool,   offsetof(unit_mnt_t, blocking),   "true" },
    4848        CONFIGURATION_ITEM_SENTINEL
    4949};
     
    195195        assert(!u_mnt->autostart || u_mnt->blocking);
    196196
    197        
    198197        assert(unit->state == STATE_STOPPED);
    199198
     
    203202        mnt_data.mountpoint = u_mnt->mountpoint;
    204203        mnt_data.device     = u_mnt->device;
    205         /* TODO use other mount parameters
     204        /*
     205         * TODO use other mount parameters
    206206         * mnt_data.options    = u_mnt->options;
    207207         * mnt_data.instance   = u_mnt->instance;
     
    235235        assert(!u_mnt->autostart || u_mnt->blocking);
    236236
    237        
    238237        // note: we should never hit STATE_STARTING, since it'd mean there are
    239238        //       two jobs running at once (unless job cancellation is implemented)
     
    284283}
    285284
    286 
    287 DEFINE_UNIT_VMT(unit_mnt)
    288 
     285DEFINE_UNIT_VMT(unit_mnt);
  • uspace/srv/sysman/units/unit_mnt.h

    r241f1985 r102f641  
    3939        char *device;
    4040
    41         /** Should be underlying units (FS server, device) be autostarted
    42          * (implies blocking) */
     41        /**
     42         * Should be underlying units (FS server, device) be autostarted
     43         * (implies blocking)
     44         */
    4345        bool autostart;
    4446
     
    5052
    5153#endif
    52 
  • uspace/srv/sysman/units/unit_svc.c

    r241f1985 r102f641  
    4040
    4141static config_item_t unit_configuration[] = {
    42         {"ExecStart", &util_parse_command, offsetof(unit_svc_t, exec_start), NULL},
     42        { "ExecStart", &util_parse_command, offsetof(unit_svc_t, exec_start), NULL },
    4343        CONFIGURATION_ITEM_SENTINEL
    4444};
     
    8282        assert(u_svc);
    8383
    84        
    8584        assert(unit->state == STATE_STOPPED);
    8685
     
    117116        assert(u_svc);
    118117
    119        
    120118        // note: May change when job cancellation is possible.
    121119        assert(unit->state == STATE_STARTED);
     
    133131
    134132        if (rc != EOK) {
    135                 /* Task may still be running, but be conservative about unit's
    136                  * state. */
     133                /*
     134                 * Task may still be running, but be conservative about unit's
     135                 * state.
     136                 */
    137137                unit->state = STATE_FAILED;
    138138                return rc;
     
    144144}
    145145
    146 
    147146static void unit_svc_exposee_created(unit_t *unit)
    148147{
    149148        assert(CAST_SVC(unit));
    150         assert(unit->state == STATE_STOPPED || unit->state == STATE_STARTING || unit->state==STATE_STARTED);
     149        assert(unit->state == STATE_STOPPED || unit->state == STATE_STARTING || unit->state == STATE_STARTED);
    151150
    152151        /* Exposee itself doesn't represent started unit. */
     
    160159}
    161160
    162 DEFINE_UNIT_VMT(unit_svc)
    163 
     161DEFINE_UNIT_VMT(unit_svc);
  • uspace/srv/sysman/units/unit_svc.h

    r241f1985 r102f641  
    5151
    5252#endif
    53 
  • uspace/srv/sysman/units/unit_tgt.c

    r241f1985 r102f641  
    8282}
    8383
    84 
    85 DEFINE_UNIT_VMT(unit_tgt)
    86 
     84DEFINE_UNIT_VMT(unit_tgt);
  • uspace/srv/sysman/util.c

    r241f1985 r102f641  
    8686        command->argv[command->argc] = NULL;
    8787
    88 
    8988        if (command->argc > MAX_COMMAND_ARGS) {
    9089                text_parse_raise_error(parse, lineno,
     
    9594        }
    9695}
    97 
    9896
    9997void util_command_init(command_t *command)
  • uspace/srv/taskman/event.c

    r241f1985 r102f641  
    167167                                async_answer_1(pr->icall, EINTR, t->exit);
    168168                        } else {
    169                                 /* Send both exit status and retval, caller
    170                                  * should know what is valid */
     169                                /*
     170                                 * Send both exit status and retval, caller
     171                                 * should know what is valid
     172                                 */
    171173                                async_answer_3(pr->icall, EOK, t->exit,
    172174                                    t->retval, rest);
     
    180182                }
    181183
    182                
    183184                list_remove(&pr->link);
    184185                free(pr);
     
    233234
    234235void wait_for_task(task_id_t id, int flags, ipc_call_t *icall,
    235      task_id_t waiter_id)
     236    task_id_t waiter_id)
    236237{
    237238        assert(!(flags & TASK_WAIT_BOTH) ||
     
    247248                return;
    248249        }
    249        
     250
    250251        if (t->exit != TASK_EXIT_RUNNING) {
    251252                //TODO are flags BOTH processed correctly here?
     
    253254                return;
    254255        }
    255        
     256
    256257        /*
    257258         * Add request to pending list or reuse existing item for a second
     
    274275                        goto finish;
    275276                }
    276        
     277
    277278                link_initialize(&pr->link);
    278279                pr->id = id;
     
    305306}
    306307
    307 
    308308errno_t task_set_retval(task_id_t sender, int retval, bool wait_for_exit)
    309309{
    310310        errno_t rc = EOK;
    311        
     311
    312312        fibril_rwlock_write_lock(&task_hash_table_lock);
    313313        task_t *t = task_get_by_id(sender);
     
    317317                goto finish;
    318318        }
    319        
     319
    320320        t->retval = retval;
    321321        t->retval_type = wait_for_exit ? RVAL_SET_EXIT : RVAL_SET;
    322        
     322
    323323        event_notify_all(t);
    324324        process_pending_wait();
    325        
     325
    326326finish:
    327327        fibril_rwlock_write_unlock(&task_hash_table_lock);
  • uspace/srv/taskman/main.c

    r241f1985 r102f641  
    5454#include "taskman.h"
    5555
    56 
    5756typedef struct {
    5857        link_t link;
     
    7473{
    7574        DPRINTF("%s:%i from %llu\n", __func__, __LINE__, icall->task_id);
    76         /* We don't accept the connection request, we forward it instead to
    77          * freshly spawned loader. */
     75        /*
     76         * We don't accept the connection request, we forward it instead to
     77         * freshly spawned loader.
     78         */
    7879        errno_t rc = loader_spawn("loader");
    79        
     80
    8081        if (rc != EOK) {
    8182                async_answer_0(icall, rc);
    8283                return;
    8384        }
    84        
     85
    8586        /* Wait until spawned task presents itself to us. */
    8687        link_t *link = prodcons_consume(&sess_queue);
     
    148149        /* Used only for connection forwarding -- atomic */
    149150        session_ns = async_callback_receive(EXCHANGE_ATOMIC);
    150        
     151
    151152        if (session_ns == NULL) {
    152153                rc = ENOENT;
     
    218219        // TODO check that loader is expected, would probably discard prodcons
    219220        //      scheme
    220        
     221
    221222        /* Preallocate session container */
    222223        sess_ref_t *sess_ref = malloc(sizeof(sess_ref_t));
     
    265266static bool handle_implicit_call(ipc_call_t *icall)
    266267{
    267         /*DPRINTF("%s:%i %i(%i) from %llu\n", __func__, __LINE__,
    268             IPC_GET_IMETHOD(*icall),
    269             IPC_GET_ARG1(*icall),
    270             icall->in_task_id);*/
    271 
    272268        if (ipc_get_imethod(icall) < IPC_FIRST_USER_METHOD) {
    273269                switch (ipc_get_arg1(icall)) {
     
    330326}
    331327
    332 
    333 
    334328int main(int argc, char *argv[])
    335329{
     
    358352                return rc;
    359353        }
    360        
     354
    361355        task_id_t self_id = task_get_id();
    362356        rc = task_intro(self_id);
  • uspace/srv/taskman/task.c

    r241f1985 r102f641  
    4646        void *arg;
    4747} walker_context_t;
    48        
     48
    4949/*
    5050 * Forwards
     
    5959static size_t ht_task_key_hash(const void *key)
    6060{
    61         return *(task_id_t*)key;
     61        return *(task_id_t *)key;
    6262}
    6363
     
    7171{
    7272        task_t *ht = hash_table_get_inst(item, task_t, link);
    73         return ht->id == *(task_id_t*)key;
     73        return ht->id == *(task_id_t *)key;
    7474}
    7575
     
    127127
    128128        fibril_rwlock_initialize(&task_hash_table_lock);
    129        
     129
    130130        return EOK;
    131131}
     
    145145                return NULL;
    146146        }
    147        
     147
    148148        task_t *t = hash_table_get_inst(link, task_t, link);
    149149        return t;
     
    202202                goto finish;
    203203        }
    204        
     204
    205205        t = malloc(sizeof(task_t));
    206206        if (t == NULL) {
     
    217217        hash_table_insert(&task_hash_table, &t->link);
    218218        DPRINTF("%s: %llu\n", __func__, t->id);
    219        
     219
    220220finish:
    221221        fibril_rwlock_write_unlock(&task_hash_table_lock);
     
    223223}
    224224
    225 
    226225/**
    227226 * @}
  • uspace/srv/taskman/task.h

    r241f1985 r102f641  
    4343/** What type of retval from the task we have */
    4444typedef enum {
    45         RVAL_UNSET,     /**< unset */
    46         RVAL_SET,       /**< retval set, e.g. by server */
    47         RVAL_SET_EXIT   /**< retval set, wait for expected task exit */
     45        /* unset */
     46        RVAL_UNSET,
     47
     48        /* retval set, e.g. by server */
     49        RVAL_SET,
     50
     51        /* retval set, wait for expected task exit */
     52        RVAL_SET_EXIT
    4853} retval_t;
    4954
     
    5156typedef struct {
    5257        ht_link_t link;
    53        
    54         task_id_t id;          /**< Task id. */
    55         task_exit_t exit;      /**< Task's uspace exit status. */
    56         bool failed;           /**< Task failed (task can exit unexpectedly
    57                                     even w/out failure). */
    58         retval_t retval_type;  /**< Task returned a value. */
    59         int retval;            /**< The return value. */
    6058
    61         link_t listeners;      /**< Link to listeners list. */
    62         async_sess_t *sess;    /**< Session for notifications to task. */
     59        /* Task id. */
     60        task_id_t id;
     61        /* Task's uspace exit status. */
     62        task_exit_t exit;
     63        /* Task failed (task can exit unexpectedly even w/out failure). */
     64        bool failed;
     65        /* Task returned a value. */
     66        retval_t retval_type;
     67        /* The return value. */
     68        int retval;
     69        /* Link to listeners list. */
     70        link_t listeners;
     71        /* Session for notifications to task. */
     72        async_sess_t *sess;
    6373} task_t;
    6474
    65 typedef bool (* task_walker_t)(task_t *, void *);
     75typedef bool (*task_walker_t)(task_t *, void *);
    6676
    6777extern fibril_rwlock_t task_hash_table_lock;
  • uspace/srv/vfs/vfs.c

    r241f1985 r102f641  
    155155                return rc;
    156156        }
    157        
     157
    158158        /*
    159159         * Start accepting connections.
  • uspace/srv/vfs/vfs_register.c

    r241f1985 r102f641  
    174174        sysman_main_exposee_added(unit_name, req->task_id);
    175175        free(unit_name);
    176        
     176
    177177        /*
    178178         * Add fs_info to the list of registered FS's.
Note: See TracChangeset for help on using the changeset viewer.