Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 3529f148 in mainline


Ignore:
Timestamp:
2020-03-06T19:14:20Z (4 weeks ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
13b4504
Parents:
06599a1
git-author:
Matthieu Riolo <matthieu.riolo@…> (2020-02-29 11:22:13)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2020-03-06 19:14:20)
Message:

Adding types task_wait_flag_t and ipc_start_flag_t which replaces makros

Location:
uspace
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/proc/task_anywait.c

    r06599a1 r3529f148  
    3939static task_id_t task_id;
    4040static task_exit_t last_texit;
    41 static int last_flags;
     41static task_wait_flag_t last_flags;
    4242static int last_retval;
    4343static bool handler_hit;
     
    4949static FIBRIL_CONDVAR_INITIALIZE(sync_cv);
    5050
    51 static void task_event_handler(task_id_t tid, int flags, task_exit_t texit,
     51static void task_event_handler(task_id_t tid, task_wait_flag_t flags, task_exit_t texit,
    5252    int retval)
    5353{
  • uspace/lib/c/generic/devman.c

    r06599a1 r3529f148  
    286286}
    287287
    288 async_sess_t *devman_device_connect(devman_handle_t handle, unsigned int flags)
     288async_sess_t *devman_device_connect(devman_handle_t handle, ipc_start_flag_t flags)
    289289{
    290290        async_sess_t *sess;
     
    359359
    360360errno_t devman_fun_get_handle(const char *pathname, devman_handle_t *handle,
    361     unsigned int flags)
     361    ipc_start_flag_t flags)
    362362{
    363363        async_exch_t *exch;
  • uspace/lib/c/generic/loc.c

    r06599a1 r3529f148  
    454454
    455455errno_t loc_namespace_get_id(const char *name, service_id_t *handle,
    456     unsigned int flags)
     456    ipc_start_flag_t flags)
    457457{
    458458        async_exch_t *exch;
     
    503503 */
    504504errno_t loc_category_get_id(const char *name, category_id_t *cat_id,
    505     unsigned int flags)
     505    ipc_start_flag_t flags)
    506506{
    507507        async_exch_t *exch;
     
    558558
    559559async_sess_t *loc_service_connect(service_id_t handle, iface_t iface,
    560     unsigned int flags)
     560    ipc_start_flag_t flags)
    561561{
    562562        async_sess_t *sess;
  • uspace/lib/c/generic/task.c

    r06599a1 r3529f148  
    417417 * @return EOK on success, else error code.
    418418 */
    419 errno_t task_wait_task_id(task_id_t id, int flags, task_exit_t *texit, int *retval)
     419errno_t task_wait_task_id(task_id_t id, task_wait_flag_t flags, task_exit_t *texit, int *retval)
    420420{
    421421        task_wait_t wait;
  • uspace/lib/c/include/devman.h

    r06599a1 r3529f148  
    5353extern errno_t devman_drv_fun_offline(devman_handle_t);
    5454
    55 extern async_sess_t *devman_device_connect(devman_handle_t, unsigned int);
     55extern async_sess_t *devman_device_connect(devman_handle_t, ipc_start_flag_t);
    5656extern async_sess_t *devman_parent_device_connect(devman_handle_t,
    5757    unsigned int);
    5858
    5959extern errno_t devman_fun_get_handle(const char *, devman_handle_t *,
    60     unsigned int);
     60    ipc_start_flag_t);
    6161extern errno_t devman_fun_get_child(devman_handle_t, devman_handle_t *);
    6262extern errno_t devman_dev_get_parent(devman_handle_t, devman_handle_t *);
  • uspace/lib/c/include/ipc/common.h

    r06599a1 r3529f148  
    4141/* Well known phone descriptors */
    4242static cap_phone_handle_t const PHONE_INITIAL = (cap_phone_handle_t) (CAP_NIL + 1);
    43 #define IPC_FLAG_BLOCKING   0x01
    4443
    45 /**
    46  * IPC_FLAG_AUTOSTART_ is for use in brokers only. In client code use
    47  * IPC_AUTOSTART that includes implies blocking behavior.
    48  */
    49 #define IPC_FLAG_AUTOSTART_  0x02
     44typedef enum {
     45        /**
     46         * IPC_FLAG_AUTOSTART_ is for use in brokers only. In client code use
     47         * IPC_AUTOSTART that includes implies blocking behavior.
     48         */
     49        IPC_FLAG_BLOCKING = 0x01,
     50        IPC_FLAG_AUTOSTART_ = 0x02,
    5051
    51 /**
    52  * Similar to blocking IPC_FLAG_BLOCKING behavior, broker will attempt to
    53  * start the server.
    54  */
    55 #define IPC_AUTOSTART (IPC_FLAG_BLOCKING | IPC_FLAG_AUTOSTART_)
     52        /**
     53         * Similar to blocking IPC_FLAG_BLOCKING behavior, broker will attempt to
     54         * start the server.
     55         */
     56        IPC_AUTOSTART = (IPC_FLAG_BLOCKING | IPC_FLAG_AUTOSTART_),
     57} ipc_start_flag_t;
    5658
    5759typedef ipc_data_t ipc_call_t;
  • uspace/lib/c/include/loc.h

    r06599a1 r3529f148  
    5252
    5353extern errno_t loc_service_get_id(const char *, service_id_t *,
    54     unsigned int);
     54    ipc_start_flag_t);
    5555extern errno_t loc_service_get_name(service_id_t, char **);
    5656extern errno_t loc_service_get_server_name(service_id_t, char **);
    5757extern errno_t loc_namespace_get_id(const char *, service_id_t *,
    58     unsigned int);
     58    ipc_start_flag_t);
    5959extern errno_t loc_category_get_id(const char *, category_id_t *,
    60     unsigned int);
     60    ipc_start_flag_t);
    6161extern errno_t loc_category_get_name(category_id_t, char **);
    6262extern errno_t loc_category_get_svcs(category_id_t, category_id_t **, size_t *);
     
    6464
    6565extern async_sess_t *loc_service_connect(service_id_t, iface_t,
    66     unsigned int);
     66    ipc_start_flag_t);
    6767
    6868extern int loc_null_create(void);
  • uspace/lib/c/include/task.h

    r06599a1 r3529f148  
    4141#include <types/task.h>
    4242
    43 #define TASK_WAIT_EXIT   0x1
    44 #define TASK_WAIT_RETVAL 0x2
    45 #define TASK_WAIT_BOTH   0x4
    46 
    47 static inline void task_wait_set(task_wait_t *wait, int flags)
     43static inline void task_wait_set(task_wait_t *wait, task_wait_flag_t flags)
    4844{
    4945        wait->flags = flags;
     
    7066extern void task_cancel_wait(task_wait_t *);
    7167extern errno_t task_wait(task_wait_t *, task_exit_t *, int *);
    72 extern errno_t task_wait_task_id(task_id_t, int, task_exit_t *, int *);
     68extern errno_t task_wait_task_id(task_id_t, task_wait_flag_t, task_exit_t *, int *);
    7369
    7470extern errno_t task_retval(int);
  • uspace/lib/c/include/types/task.h

    r06599a1 r3529f148  
    3939
    4040typedef enum {
     41        TASK_WAIT_NONE   = 0x0,
     42        TASK_WAIT_EXIT   = 0x1,
     43        TASK_WAIT_RETVAL = 0x2,
     44        TASK_WAIT_BOTH   = 0x4
     45} task_wait_flag_t;
     46
     47typedef enum {
    4148        TASK_EXIT_RUNNING,   /**< Internal taskman value. */
    4249        TASK_EXIT_NORMAL,
     
    4552
    4653typedef struct {
    47         int flags;
     54        task_wait_flag_t flags;
    4855        ipc_call_t result;
    4956        aid_t aid;
     
    5158} task_wait_t;
    5259
    53 typedef void (*task_event_handler_t)(task_id_t, int, task_exit_t, int);
     60typedef void (*task_event_handler_t)(task_id_t, task_wait_flag_t, task_exit_t, int);
    5461
    5562#endif
  • uspace/lib/gui/window.c

    r06599a1 r3529f148  
    616616        win->surface = NULL;
    617617
    618         unsigned int ipc_flags = IPC_AUTOSTART;
     618        ipc_start_flag_t ipc_flags = IPC_AUTOSTART;
    619619        service_id_t reg_dsid;
    620620        errno_t rc = loc_service_get_id(winreg, &reg_dsid, ipc_flags);
  • uspace/lib/posix/src/sys/wait.c

    r06599a1 r3529f148  
    101101        assert(options == 0 /* None of the options are supported. */);
    102102
    103         int flags = TASK_WAIT_RETVAL | TASK_WAIT_EXIT;
     103        task_wait_flag_t flags = TASK_WAIT_RETVAL | TASK_WAIT_EXIT;
    104104        task_exit_t texit;
    105105        int retval;
  • uspace/lib/sysman/include/sysman/ctl.h

    r06599a1 r3529f148  
    3535errno_t sysman_unit_handle(const char *, unit_handle_t *);
    3636
    37 errno_t sysman_unit_start_by_name(const char *, int);
    38 errno_t sysman_unit_start(unit_handle_t, int);
    39 errno_t sysman_unit_stop(unit_handle_t, int);
     37errno_t sysman_unit_start_by_name(const char *, ipc_start_flag_t);
     38errno_t sysman_unit_start(unit_handle_t, ipc_start_flag_t);
     39errno_t sysman_unit_stop(unit_handle_t, ipc_start_flag_t);
    4040
    4141errno_t sysman_get_units(unit_handle_t **, size_t *);
  • uspace/lib/sysman/src/ctl.c

    r06599a1 r3529f148  
    6464 * TODO convert to name->handle API
    6565 */
    66 errno_t sysman_unit_start_by_name(const char *unit_name, int flags)
     66errno_t sysman_unit_start_by_name(const char *unit_name, ipc_start_flag_t flags)
    6767{
    6868        async_exch_t *exch = sysman_exchange_begin(SYSMAN_PORT_CTL);
     
    8181}
    8282
    83 errno_t sysman_unit_start(unit_handle_t handle, int flags)
     83errno_t sysman_unit_start(unit_handle_t handle, ipc_start_flag_t flags)
    8484{
    8585        async_exch_t *exch = sysman_exchange_begin(SYSMAN_PORT_CTL);
     
    9191}
    9292
    93 errno_t sysman_unit_stop(unit_handle_t handle, int flags)
     93errno_t sysman_unit_stop(unit_handle_t handle, ipc_start_flag_t flags)
    9494{
    9595        async_exch_t *exch = sysman_exchange_begin(SYSMAN_PORT_CTL);
  • uspace/srv/sysman/connection_ctl.c

    r06599a1 r3529f148  
    104104        }
    105105
    106         int flags = ipc_get_arg1(icall);
     106        ipc_start_flag_t flags = ipc_get_arg1(icall);
    107107        sysman_log(LVL_DEBUG2, "%s(%s, %x)", __func__, unit_name, flags);
    108108
     
    144144
    145145        unit_handle_t handle = ipc_get_arg1(icall);
    146         sysarg_t flags = ipc_get_arg2(icall);
    147         sysman_log(LVL_DEBUG2, "%s(%p, %" SCNuPTR ", %i)", __func__, icall->cap_handle, flags, state);
     146        ipc_start_flag_t flags = ipc_get_arg2(icall);
     147        sysman_log(LVL_DEBUG2, "%s(%p, %u, %i)", __func__, icall->cap_handle, flags, state);
    148148
    149149        unit_t *unit = repo_find_unit_by_handle(handle);
  • uspace/srv/sysman/sm_task.c

    r06599a1 r3529f148  
    4141struct sm_task_event {
    4242        task_id_t task_id;
    43         int flags;
     43        task_wait_flag_t flags;
    4444        task_exit_t texit;
    4545        int retval;
     
    5151 * @note This function runs in separate fibril (not same as event loop).
    5252 */
    53 static void sm_task_event_handler(task_id_t tid, int flags, task_exit_t texit,
     53static void sm_task_event_handler(task_id_t tid, task_wait_flag_t flags, task_exit_t texit,
    5454    int retval)
    5555{
  • uspace/srv/sysman/units/unit_mnt.c

    r06599a1 r3529f148  
    5454        char *device;
    5555        char *options;
    56         unsigned int flags;
     56        ipc_start_flag_t flags;
    5757        unsigned int instance;
    5858
     
    208208         */
    209209
    210         mnt_data.flags |= u_mnt->blocking ? IPC_FLAG_BLOCKING : 0;
    211         mnt_data.flags |= u_mnt->autostart ? IPC_AUTOSTART : 0;
     210        mnt_data.flags |= u_mnt->blocking ? true : 0;
     211        mnt_data.flags |= u_mnt->autostart ? true : 0;
    212212        mnt_data.unit = unit;
    213213
  • uspace/srv/taskman/event.c

    r06599a1 r3529f148  
    5050        task_id_t waiter_id;  /**< Task ID who waits. */
    5151        ipc_call_t *icall;  /**< Call ID waiting for the event. */
    52         int flags;            /**< Wait flags. */
     52        task_wait_flag_t flags; /**< Wait flags. */
    5353} pending_wait_t;
    5454
     
    6767}
    6868
    69 static int event_flags(task_t *task)
    70 {
    71         int flags = 0;
     69static task_wait_flag_t event_flags(task_t *task)
     70{
     71        task_wait_flag_t flags = TASK_WAIT_NONE;
    7272        if (task->retval_type == RVAL_SET) {
    7373                flags |= TASK_WAIT_RETVAL;
     
    8888static void event_notify(task_t *sender, async_sess_t *sess)
    8989{
    90         int flags = event_flags(sender);
    91         if (flags == 0) {
     90        task_wait_flag_t flags = event_flags(sender);
     91        if (flags == TASK_WAIT_NONE) {
    9292                return;
    9393        }
     
    114114static void event_notify_all(task_t *sender)
    115115{
    116         int flags = event_flags(sender);
    117         if (flags == 0) {
     116        task_wait_flag_t flags = event_flags(sender);
     117        if (flags == TASK_WAIT_NONE) {
    118118                return;
    119119        }
     
    140140                        continue; // TODO really when does this happen?
    141141                }
    142                 int notify_flags = event_flags(t);
     142                task_wait_flag_t notify_flags = event_flags(t);
    143143
    144144                /*
     
    146146                 * thus it can be never present in rest flags.
    147147                 */
    148                 int rest = (~notify_flags & pr->flags) & ~TASK_WAIT_RETVAL;
     148                task_wait_flag_t rest = (~notify_flags & pr->flags) & ~TASK_WAIT_RETVAL;
    149149                rest &= ~TASK_WAIT_BOTH;
    150                 int match = notify_flags & pr->flags;
     150                bool match = notify_flags & pr->flags;
    151151                // TODO why do I even accept such calls?
    152152                bool answer = !(pr->icall->flags & IPC_CALL_NOTIF);
     
    233233}
    234234
    235 void wait_for_task(task_id_t id, int flags, ipc_call_t *icall,
     235void wait_for_task(task_id_t id, task_wait_flag_t flags, ipc_call_t *icall,
    236236    task_id_t waiter_id)
    237237{
  • uspace/srv/taskman/event.h

    r06599a1 r3529f148  
    4444    ipc_call_t *);
    4545extern void dump_events(task_id_t, ipc_call_t *);
    46 extern void wait_for_task(task_id_t, int, ipc_call_t *, task_id_t);
     46extern void wait_for_task(task_id_t, task_wait_flag_t, ipc_call_t *, task_id_t);
    4747extern errno_t task_set_retval(task_id_t, int, bool);
    4848
  • uspace/srv/taskman/main.c

    r06599a1 r3529f148  
    9797
    9898        /* After forward we can dispose all session-related resources */
    99         async_hangup(sess_ref->sess);
     99        //async_hangup(sess_ref->sess);
    100100        free(sess_ref);
    101101
Note: See TracChangeset for help on using the changeset viewer.