diff options
| author | Laurent Bercot <ska-skaware@skarnet.org> | 2026-01-24 16:17:39 +0000 |
|---|---|---|
| committer | Laurent Bercot <ska-skaware@skarnet.org> | 2026-01-24 16:17:39 +0000 |
| commit | 7551c712d73f1d07f6dec2c9b8183a43204f4aa5 (patch) | |
| tree | c219efcd39d6a5ef72bf3cef2898f04b41cfb25f /src/repo/s6rc_repo_fixset.c | |
| parent | b71b06951c8f9250f87a16cd1e60b2d779bfcfff (diff) | |
| download | s6-rc-7551c712d73f1d07f6dec2c9b8183a43204f4aa5.tar.gz | |
Rename "sub" to "prescription"
Diffstat (limited to 'src/repo/s6rc_repo_fixset.c')
| -rw-r--r-- | src/repo/s6rc_repo_fixset.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/repo/s6rc_repo_fixset.c b/src/repo/s6rc_repo_fixset.c index d0252a0..ed66679 100644 --- a/src/repo/s6rc_repo_fixset.c +++ b/src/repo/s6rc_repo_fixset.c @@ -11,13 +11,13 @@ #include <s6-rc/repo.h> -static inline int s6rc_repo_fixsub (char const *repo, char const *set, uint8_t sub, s6rc_repo_sv *byname, char const **bysub, uint32_t ntot, uint32_t options, uint32_t const *subind, uint32_t const *subn, unsigned int verbosity, stralloc *sa, genalloc *badga, genalloc *gatmp) +static inline int s6rc_repo_fixrx (char const *repo, char const *set, uint8_t rx, s6rc_repo_sv *byname, char const **byrx, uint32_t ntot, uint32_t options, uint32_t const *rxind, uint32_t const *rxn, unsigned int verbosity, stralloc *sa, genalloc *badga, genalloc *gatmp) { size_t sabase = sa->len ; uint32_t const *bads ; uint32_t badn ; int e = 0 ; - if (!s6rc_repo_badsub(repo, set, bysub + subind[sub], subn[sub], sub, options & 1 ? 2 : 1, byname, ntot, sa, badga, gatmp)) return 111 ; + if (!s6rc_repo_badrx(repo, set, byrx + rxind[rx], rxn[rx], rx, options & 1 ? 2 : 1, byname, ntot, sa, badga, gatmp)) return 111 ; bads = genalloc_s(uint32_t, badga) ; badn = genalloc_len(uint32_t, badga) ; if (!badn) return 0 ; @@ -28,12 +28,12 @@ static inline int s6rc_repo_fixsub (char const *repo, char const *set, uint8_t s { tomove[j] = byname[bads[j]] ; if (verbosity >= 2) - strerr_warni(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": ", "moving service ", sa->s + tomove[j].pos, " from ", s6rc_repo_subnames[tomove[j].sub], " to ", s6rc_repo_subnames[sub]) ; - else if (tomove[j].sub == 0 && verbosity) - strerr_warnw(options & 4 ? "(dry run) " : "", "service ", sa->s + tomove[j].pos, " will be unmasked by an upfix to ", s6rc_repo_subnames[sub]) ; - else if (sub == 0 && verbosity) - strerr_warnw(options & 4 ? "(dry run) " : "", "service ", sa->s + tomove[j].pos, " will be masked by a downfix to ", s6rc_repo_subnames[sub]) ; - if (tomove[j].sub == 3) + strerr_warni(options & 4 ? "(dry run) " : "", "in set ", set, " of repository ", repo, ": ", "moving service ", sa->s + tomove[j].pos, " from ", s6rc_repo_rxnames[tomove[j].rx], " to ", s6rc_repo_rxnames[rx]) ; + else if (tomove[j].rx == 0 && verbosity) + strerr_warnw(options & 4 ? "(dry run) " : "", "service ", sa->s + tomove[j].pos, " will be unmasked by an upfix to ", s6rc_repo_rxnames[rx]) ; + else if (rx == 0 && verbosity) + strerr_warnw(options & 4 ? "(dry run) " : "", "service ", sa->s + tomove[j].pos, " will be masked by a downfix to ", s6rc_repo_rxnames[rx]) ; + if (tomove[j].rx == 3) { if (!(options & 2)) { @@ -47,14 +47,14 @@ static inline int s6rc_repo_fixsub (char const *repo, char const *set, uint8_t s } } else if (verbosity) - strerr_warnw(options & 4 ? "(dry run) " : "", "service ", sa->s + tomove[j].pos, " will automatically be marked non-essential by a downfix to ", s6rc_repo_subnames[sub]) ; + strerr_warnw(options & 4 ? "(dry run) " : "", "service ", sa->s + tomove[j].pos, " will automatically be marked non-essential by a downfix to ", s6rc_repo_rxnames[rx]) ; } } if (!(options & 4)) { - if (!s6rc_repo_moveservices(repo, set, tomove, badn, sub, sa->s, verbosity)) { e = 111 ; goto err ; } + if (!s6rc_repo_moveservices(repo, set, tomove, badn, rx, sa->s, verbosity)) { e = 111 ; goto err ; } } - for (uint32_t j = 0 ; j < badn ; j++) byname[bads[j]].sub = sub ; + for (uint32_t j = 0 ; j < badn ; j++) byname[bads[j]].rx = rx ; err: genalloc_setlen(uint32_t, badga, 0) ; @@ -67,25 +67,25 @@ int s6rc_repo_fixset (char const *repo, char const *set, uint32_t options, unsig int e = 0 ; size_t sabase = sa->len ; uint32_t ntot ; - uint32_t subind[4] ; - uint32_t sublen[4] ; + uint32_t rxind[4] ; + uint32_t rxlen[4] ; s6rc_repo_sv *byname ; genalloc_setlen(s6rc_repo_sv, svlist, 0) ; - if (!s6rc_repo_makesvlist(repo, set, sa, svlist, subind)) return 0 ; + if (!s6rc_repo_makesvlist(repo, set, sa, svlist, rxind)) return 0 ; byname = genalloc_s(s6rc_repo_sv, svlist) ; ntot = genalloc_len(s6rc_repo_sv, svlist) ; if (!ntot) return 0 ; - for (uint8_t sub = 0 ; sub < 4 ; sub++) sublen[sub] = (sub == 3 ? ntot : subind[sub+1]) - subind[sub] ; + for (uint8_t rx = 0 ; rx < 4 ; rx++) rxlen[rx] = (rx == 3 ? ntot : rxind[rx+1]) - rxind[rx] ; - char const *bysub[ntot] ; - char bysub_storage[sa->len - sabase] ; - memcpy(bysub_storage, sa->s + sabase, sa->len - sabase) ; - for (uint32_t i = 0 ; i < ntot ; i++) bysub[i] = bysub_storage + byname[i].pos - sabase ; + char const *byrx[ntot] ; + char byrx_storage[sa->len - sabase] ; + memcpy(byrx_storage, sa->s + sabase, sa->len - sabase) ; + for (uint32_t i = 0 ; i < ntot ; i++) byrx[i] = byrx_storage + byname[i].pos - sabase ; qsortr(byname, ntot, sizeof(s6rc_repo_sv), &s6rc_repo_sv_cmpr, sa->s) ; - for (uint8_t sub = 0 ; sub < 4 ; sub++) if (sublen[sub]) + for (uint8_t rx = 0 ; rx < 4 ; rx++) if (rxlen[rx]) { - e = s6rc_repo_fixsub(repo, set, sub, byname, bysub, ntot, options, subind, sublen, verbosity, sa, badga, gatmp) ; + e = s6rc_repo_fixrx(repo, set, rx, byname, byrx, ntot, options, rxind, rxlen, verbosity, sa, badga, gatmp) ; if (e) break ; } |
