aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-10-09 00:59:02 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-10-09 00:59:02 +0000
commitc71344185cc93d9322513a1d9506cb14b1c308a2 (patch)
treef52094f03bc4e18e97e1c27786b55c1738a76f7c /src
parenta6883e06261447cec639c6d260270ec0664c2153 (diff)
downloads6-rc-c71344185cc93d9322513a1d9506cb14b1c308a2.tar.gz
But this day is not today, so screw it. We gotta keep em separated
Diffstat (limited to 'src')
-rw-r--r--src/include/s6-rc/repo.h2
-rw-r--r--src/include/s6-rc/s6rc-utils.h16
-rw-r--r--src/libs6rc/deps-lib/s6rc2
-rw-r--r--src/libs6rc/s6rc_get_major.c21
-rw-r--r--src/repo/deps-lib/s6rcrepo3
-rw-r--r--src/repo/s6rc_repo_read_major.c (renamed from src/libs6rc/s6rc_read_major.c)4
-rw-r--r--src/repo/s6rc_repo_setuptodate.c2
7 files changed, 20 insertions, 30 deletions
diff --git a/src/include/s6-rc/repo.h b/src/include/s6-rc/repo.h
index 0607977..6ecec15 100644
--- a/src/include/s6-rc/repo.h
+++ b/src/include/s6-rc/repo.h
@@ -25,6 +25,8 @@ extern int s6rc_repo_ls (char const *, stralloc *, genalloc *) ;
extern char const s6rc_repo_rxnames[4][7] ;
+extern uint32_t s6rc_repo_read_major (char const *) ; /* the major a db was compiled with */
+
extern int s6rc_repo_makestores (char const *, char const *const *, uint16_t, char *) ;
extern int s6rc_repo_fillset (char const *, char const *, char const *const *, uint32_t) ;
diff --git a/src/include/s6-rc/s6rc-utils.h b/src/include/s6-rc/s6rc-utils.h
index e453ade..1058dd1 100644
--- a/src/include/s6-rc/s6rc-utils.h
+++ b/src/include/s6-rc/s6rc-utils.h
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <stdint.h>
+#include <skalibs/uint16.h>
#include <skalibs/stralloc.h>
#include <s6-rc/s6rc-db.h>
@@ -24,7 +25,18 @@ extern int s6rc_livedir_canon (char const **) ;
extern int s6rc_live_state_size (char const *, uint32_t *, uint32_t *) ;
extern int s6rc_live_state_read (char const *, unsigned char *, uint32_t) ;
-extern uint32_t s6rc_get_major (char const *) ; /* always pass S6RC_VERSION */
-extern uint32_t s6rc_read_major (char const *) ; /* the major a db was compiled with */
+static inline uint32_t s6rc_get_major (char const *s)
+{
+ size_t len = 0, l ;
+ uint32_t acc = 0 ;
+ uint16_t u ;
+ l = uint16_scan(s + len, &u) ;
+ if (!l || s[len + l++] != '.') return 0 ;
+ len += l ; acc = acc << 16 | u ;
+ l = uint16_scan(s + len, &u) ;
+ if (!l || s[len + l++] != '.') return 0 ;
+ len += l ; acc = acc << 16 | u ;
+ return acc ;
+}
#endif
diff --git a/src/libs6rc/deps-lib/s6rc b/src/libs6rc/deps-lib/s6rc
index c16ccdf..f1a8370 100644
--- a/src/libs6rc/deps-lib/s6rc
+++ b/src/libs6rc/deps-lib/s6rc
@@ -4,7 +4,6 @@ s6rc_db_check_revdeps.o
s6rc_db_read.o
s6rc_db_read_sizes.o
s6rc_db_read_uint32.o
-s6rc_get_major.o
s6rc_graph_closure.o
s6rc_graph_clean.o
s6rc_live_state_size.o
@@ -14,7 +13,6 @@ s6rc_livedir_create.o
s6rc_livedir_prefix.o
s6rc_livedir_prefixsize.o
s6rc_lock.o
-s6rc_read_major.o
s6rc_read_uint.o
s6rc_sanitize_dir.o
s6rc_servicedir_internal.o
diff --git a/src/libs6rc/s6rc_get_major.c b/src/libs6rc/s6rc_get_major.c
deleted file mode 100644
index 3bb9fb1..0000000
--- a/src/libs6rc/s6rc_get_major.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/* ISC license. */
-
-#include <stdint.h>
-
-#include <skalibs/uint16.h>
-
-#include <s6-rc/s6rc-utils.h>
-
-uint32_t s6rc_get_major (char const *s)
-{
- size_t len = 0, l ;
- uint32_t acc = 0 ;
- uint16_t u ;
- l = uint16_scan(s + len, &u) ;
- if (!l || s[len + l++] != '.') return 0 ;
- len += l ; acc = acc << 16 | u ;
- l = uint16_scan(s + len, &u) ;
- if (!l || s[len + l++] != '.') return 0 ;
- len += l ; acc = acc << 16 | u ;
- return acc ;
-}
diff --git a/src/repo/deps-lib/s6rcrepo b/src/repo/deps-lib/s6rcrepo
index 1f1cfa1..aee5f34 100644
--- a/src/repo/deps-lib/s6rcrepo
+++ b/src/repo/deps-lib/s6rcrepo
@@ -21,6 +21,7 @@ s6rc_repo_makestores.o
s6rc_repo_makesvlist.o
s6rc_repo_makesvlist_byname.o
s6rc_repo_moveservices.o
+s6rc_repo_read_major.o
s6rc_repo_removeinternals.o
s6rc_repo_rxnames.o
s6rc_repo_sanitize_setname.o
@@ -37,7 +38,5 @@ s6rc_repo_syncset_tmp.o
s6rc_repo_touch.o
s6rc_repo_touchset.o
s6rc_repo_type_check.o
--ls6rc
--ls6
-lskarnet
${SPAWN_LIB}
diff --git a/src/libs6rc/s6rc_read_major.c b/src/repo/s6rc_repo_read_major.c
index 2be5121..08d646b 100644
--- a/src/libs6rc/s6rc_read_major.c
+++ b/src/repo/s6rc_repo_read_major.c
@@ -7,11 +7,11 @@
#include <skalibs/uint32.h>
#include <skalibs/djbunix.h>
-#include <s6-rc/s6rc-utils.h>
+#include <s6-rc/repo.h>
#include <skalibs/posixishard.h>
-uint32_t s6rc_read_major (char const *compiled)
+uint32_t s6rc_repo_read_major (char const *compiled)
{
size_t clen = strlen(compiled) ;
ssize_t r ;
diff --git a/src/repo/s6rc_repo_setuptodate.c b/src/repo/s6rc_repo_setuptodate.c
index b6bd35d..f01143f 100644
--- a/src/repo/s6rc_repo_setuptodate.c
+++ b/src/repo/s6rc_repo_setuptodate.c
@@ -41,7 +41,7 @@ int s6rc_repo_setuptodate (char const *repo, char const *set)
return -1 ;
}
{
- uint32_t version = s6rc_read_major(dstfn) ;
+ uint32_t version = s6rc_repo_read_major(dstfn) ;
if (!version)
{
strerr_warnfusys("read major version from ", dstfn) ;