herdd: rename runlevels to targets
This commit is contained in:
+11
-11
@@ -1,8 +1,8 @@
|
||||
#include "log.h"
|
||||
#include "queue.h"
|
||||
#include "runlevel.h"
|
||||
#include "service.h"
|
||||
#include "spawn.h"
|
||||
#include "target.h"
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
@@ -46,7 +46,7 @@ static int load_services(const char *dir, struct queue *out)
|
||||
snprintf(filepath, sizeof filepath, "%s/%s", dir, dent->d_name);
|
||||
tracef(" - %s\n", dent->d_name);
|
||||
struct service *s = NULL;
|
||||
int err = service_load(filepath, &s);
|
||||
int err = service_load(dent->d_name, filepath, &s);
|
||||
if (err != SUCCESS) {
|
||||
printf("failed to load %s (%s)\n",
|
||||
filepath,
|
||||
@@ -60,7 +60,7 @@ static int load_services(const char *dir, struct queue *out)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
static int load_runlevels(const char *dir, struct queue *out)
|
||||
static int load_targets(const char *dir, struct queue *out)
|
||||
{
|
||||
DIR *d = opendir(dir);
|
||||
if (!d) {
|
||||
@@ -74,8 +74,8 @@ static int load_runlevels(const char *dir, struct queue *out)
|
||||
char filepath[4096];
|
||||
snprintf(filepath, sizeof filepath, "%s/%s", dir, dent->d_name);
|
||||
tracef(" - %s\n", dent->d_name);
|
||||
struct runlevel *rl = NULL;
|
||||
int err = runlevel_load(filepath, &rl);
|
||||
struct target *rl = NULL;
|
||||
int err = target_load(dent->d_name, filepath, &rl);
|
||||
if (err != SUCCESS) {
|
||||
printf("failed to load %s (%s)\n",
|
||||
filepath,
|
||||
@@ -83,7 +83,7 @@ static int load_runlevels(const char *dir, struct queue *out)
|
||||
continue;
|
||||
}
|
||||
|
||||
tracef("runlevel: %s\n", rl->rl_description);
|
||||
tracef("target: %s\n", rl->rl_description);
|
||||
for (size_t i = 0; i < rl->rl_requires_count; i++) {
|
||||
tracef(" requires: %s\n", rl->rl_requires[i]);
|
||||
}
|
||||
@@ -99,19 +99,19 @@ int main(int argc, const char *argv[], const char *envp[])
|
||||
{
|
||||
sys_remote_set(SYS_REMOTE_NSD, 0, 0);
|
||||
|
||||
struct queue *runlevels = global_runlevels();
|
||||
struct queue *targets = global_targets();
|
||||
struct queue *services = global_services();
|
||||
|
||||
int err = load_runlevels("/etc/herdd/runlevels", runlevels);
|
||||
int err = load_targets("/etc/herdd/targets", targets);
|
||||
err = load_services("/etc/herdd/services", services);
|
||||
|
||||
struct runlevel *rl = runlevel_find("single-user");
|
||||
struct target *rl = target_find("single-user.target");
|
||||
if (!rl) {
|
||||
log_fail("Cannot find runlevel single-user.");
|
||||
log_fail("Cannot find target single-user.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
runlevel_activate(rl);
|
||||
target_activate(rl);
|
||||
#if 1
|
||||
pid_t child = fork();
|
||||
kern_logf(" fork returned %d", child);
|
||||
|
||||
Reference in New Issue
Block a user