diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2008-05-27 17:52:01 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2008-05-28 05:56:31 -0700 |
commit | 32c69fb74cbc8f881b1e2a65da050281348bc4a8 (patch) | |
tree | 5a861eda06fcaa4f9239e47a5f713d23494aab32 | |
parent | 36bc7508384796ed94fbc1d1acb137e4e9d70dd5 (diff) |
Introduce rc change fields, cstart and cstop
To differentiate between currently active rc levels and to-be-changed
rc levels, new members cstart and cstop have been added to the initd_t
type. These will be used in the dep solver to test for deps that are
marked for removal.
-rw-r--r-- | lib/active.c | 14 | ||||
-rw-r--r-- | lib/initd.c | 9 | ||||
-rw-r--r-- | lib/types.h | 5 |
3 files changed, 26 insertions, 2 deletions
diff --git a/lib/active.c b/lib/active.c index 232f90a..7c55071 100644 --- a/lib/active.c +++ b/lib/active.c @@ -70,6 +70,12 @@ bool initd_is_active(const initd_t *ip, initd_rc_t rc, initd_key_t key) case KEY_ASTOP: match = ip->astop; break; + case KEY_CSTART: + match = ip->cstart; + break; + case KEY_CSTOP: + match = ip->cstop; + break; default: /* Wrong key type */ return false; @@ -182,7 +188,7 @@ static void set_active_from_symlink(initd_list_t *ilp, const char *tbase; size_t idlen; initd_t *ip; - initd_key_t key; + initd_key_t key, ckey; if (!(ilp || rcp || link || tgt)) return; @@ -207,16 +213,20 @@ static void set_active_from_symlink(initd_list_t *ilp, /* is this a start (S) or stop (K) link? */ if (link[0] == 'S') { key = KEY_ASTART; + ckey = KEY_CSTART; } else if (link[0] == 'K') { key = KEY_ASTOP; + ckey = KEY_CSTOP; } else { fprintf(stderr, "link %s is not a valid S or K link\n", link); return; } - /* set this level as active in the initd_t */ + /* set this level as active and match in the changed field + * of the initd_t */ initd_set_rc(ip, key, rcp->rc); + initd_set_rc(ip, ckey, rcp->rc); /* add the link to the active list */ add_active_link(ip, link, rcp, key); diff --git a/lib/initd.c b/lib/initd.c index 3424022..7fce001 100644 --- a/lib/initd.c +++ b/lib/initd.c @@ -19,6 +19,7 @@ initd_t *initd_new(const char *name) { ip->dstart = ip->dstop = 0; ip->astart = ip->astop = 0; + ip->cstart = ip->cstop = 0; ip->astart_links = strarg_new(); ip->astop_links = strarg_new(); @@ -81,6 +82,8 @@ initd_t *initd_copy(const initd_t *source) dest->dstop = source->dstop; dest->astart = source->astart; dest->astop = source->astop; + dest->cstart = source->cstart; + dest->cstop = source->cstop; dest->astart_links = strarg_copy(source->astart_links); dest->astop_links = strarg_copy(source->astop_links); @@ -109,6 +112,12 @@ void initd_set_rc(initd_t *ip, initd_key_t key, initd_rc_t level) case KEY_ASTOP: ip->astop |= level; break; + case KEY_CSTART: + ip->cstart |= level; + break; + case KEY_CSTOP: + ip->cstop |= level; + break; case KEY_DSTART: ip->dstart |= level; break; diff --git a/lib/types.h b/lib/types.h index 92b7812..de96205 100644 --- a/lib/types.h +++ b/lib/types.h @@ -11,6 +11,8 @@ typedef enum initd_key { KEY_PROV, /* Provides */ KEY_ASTART, /* Active Start levels */ KEY_ASTOP, /* Active Stop levels */ + KEY_CSTART, /* Changed Start levels */ + KEY_CSTOP, /* Changed Stop levels */ KEY_DSTART, /* Default-Start */ KEY_DSTOP, /* Default-Stop */ KEY_RSTART, /* Required-Start */ @@ -80,6 +82,9 @@ typedef struct initd { initd_rc_t astart; /* Active Start levels */ initd_rc_t astop; /* Active Stop levels */ + initd_rc_t cstart; /* Changed Start levels */ + initd_rc_t cstop; /* Changed Stop levels */ + strarg_t *astart_links; /* Active Start links */ strarg_t *astop_links; /* Active Stop links */ |