Changeset 5559712 in mainline for uspace/srv/sysman/unit.h


Ignore:
Timestamp:
2019-08-03T09:28:50Z (6 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
c0e4fc50
Parents:
2dda1d4
git-author:
Michal Koutný <xm.koutny+hos@…> (2015-05-07 11:49:47)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2019-08-03 09:28:50)
Message:

sysman: Naive autostart instrumentation of locsrv

  • Add IPC_FLAG_AUTOSTART flag.
  • libsysman: sysman's broker and control API.
  • Simple implementation of service unit, exposee verification is missing.
  • Simple mapping of exposee to unit name in locsrv.
  • Temporary debug prints in locsrv.

Conflicts:

boot/Makefile.common
boot/arch/amd64/Makefile.inc
uspace/lib/c/include/ipc/services.h
uspace/srv/locsrv/locsrv.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/sysman/unit.h

    r2dda1d4 r5559712  
    4545        UNIT_MOUNT,
    4646        UNIT_CONFIGURATION,
     47        UNIT_SERVICE
    4748} unit_type_t;
    4849
     
    7374#include "unit_mnt.h"
    7475#include "unit_tgt.h"
     76#include "unit_svc.h"
    7577
    76 #define DEFINE_CAST(NAME, TYPE, ENUM_TYPE)                           \
    77         static inline TYPE *CAST_##NAME(unit_t *u)                   \
    78         {                                                            \
    79                 if (u->type == ENUM_TYPE)                            \
    80                         return (TYPE *)u;                            \
    81                 else                                                 \
    82                         return NULL;                                 \
    83         }                                                            \
     78#define DEFINE_CAST(NAME, TYPE, ENUM_TYPE)                                     \
     79        static inline TYPE *CAST_##NAME(unit_t *u)                             \
     80        {                                                                      \
     81                if (u->type == ENUM_TYPE)                                      \
     82                        return (TYPE *)u;                                      \
     83                else                                                           \
     84                        return NULL;                                           \
     85        }                                                                      \
    8486
    8587DEFINE_CAST(CFG, unit_cfg_t, UNIT_CONFIGURATION)
    8688DEFINE_CAST(MNT, unit_mnt_t, UNIT_MOUNT)
    8789DEFINE_CAST(TGT, unit_tgt_t, UNIT_TARGET)
     90DEFINE_CAST(SVC, unit_svc_t, UNIT_SERVICE)
    8891
    8992struct unit_vmt {
     
    97100
    98101        int (*start)(unit_t *);
     102
     103        void (*exposee_created)(unit_t *);
     104
     105        void (*fail)(unit_t *);
    99106};
    100107
    101108extern unit_vmt_t *unit_type_vmts[];
    102109
    103 #define DEFINE_UNIT_VMT(PREFIX)                                      \
    104         unit_vmt_t PREFIX##_ops = {                                  \
    105                 .size    = sizeof(PREFIX##_t),                       \
    106                 .init    = &PREFIX##_init,                           \
    107                 .load    = &PREFIX##_load,                           \
    108                 .destroy = &PREFIX##_destroy,                        \
    109                 .start   = &PREFIX##_start                           \
     110#define DEFINE_UNIT_VMT(PREFIX)                                                \
     111        unit_vmt_t PREFIX##_vmt = {                                            \
     112                .size            = sizeof(PREFIX##_t),                         \
     113                .init            = &PREFIX##_init,                             \
     114                .load            = &PREFIX##_load,                             \
     115                .destroy         = &PREFIX##_destroy,                          \
     116                .start           = &PREFIX##_start,                            \
     117                .exposee_created = &PREFIX##_exposee_created,                  \
     118                .fail            = &PREFIX##_fail                              \
    110119        };
    111120
     
    115124extern void unit_destroy(unit_t **);
    116125
    117 // TODO add flags argument with explicit notification?
    118 extern void unit_set_state(unit_t *, unit_state_t);
    119 
    120126extern int unit_load(unit_t *, ini_configuration_t *, text_parse_t *);
    121127extern int unit_start(unit_t *);
     128extern void unit_exposee_created(unit_t *);
     129extern void unit_fail(unit_t *);
     130
     131extern void unit_notify_state(unit_t *);
    122132
    123133extern unit_type_t unit_type_name_to_type(const char *);
Note: See TracChangeset for help on using the changeset viewer.