Skip to content

Commit

Permalink
rename milestone to target
Browse files Browse the repository at this point in the history
  • Loading branch information
poettering committed Jan 26, 2010
1 parent 44d8db9 commit c22cbe2
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COMMON= \
automount.o \
mount.o \
device.o \
milestone.o \
target.o \
snapshot.o \
socket.o \
timer.o \
Expand Down
2 changes: 0 additions & 2 deletions fixme
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

- snapshot system

- s/milestone/target/

- hookup with battery status, suspend/resume

- add a job mode which shuts everything down but what is requested
Expand Down
2 changes: 1 addition & 1 deletion load-fragment.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ int name_load_fragment(Name *n) {
[NAME_SERVICE] = "Service",
[NAME_TIMER] = "Timer",
[NAME_SOCKET] = "Socket",
[NAME_MILESTONE] = "Milestone",
[NAME_TARGET] = "Target",
[NAME_DEVICE] = "Device",
[NAME_MOUNT] = "Mount",
[NAME_AUTOMOUNT] = "Automount",
Expand Down
10 changes: 5 additions & 5 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

int main(int argc, char *argv[]) {
Manager *m = NULL;
Name *milestone = NULL, *syslog = NULL;
Name *target = NULL, *syslog = NULL;
Job *job = NULL;
int r, retval = 1;

Expand All @@ -21,8 +21,8 @@ int main(int argc, char *argv[]) {
goto finish;
}

if ((r = manager_load_name(m, "default.milestone", &milestone)) < 0) {
log_error("Failed to load default milestone: %s", strerror(-r));
if ((r = manager_load_name(m, "default.target", &target)) < 0) {
log_error("Failed to load default target: %s", strerror(-r));
goto finish;
}

Expand All @@ -31,8 +31,8 @@ int main(int argc, char *argv[]) {
goto finish;
}

if ((r = manager_add_job(m, JOB_START, milestone, JOB_REPLACE, false, &job)) < 0) {
log_error("Failed to start default milestone: %s", strerror(-r));
if ((r = manager_add_job(m, JOB_START, target, JOB_REPLACE, false, &job)) < 0) {
log_error("Failed to start default target: %s", strerror(-r));
goto finish;
}

Expand Down
26 changes: 0 additions & 26 deletions milestone.c

This file was deleted.

23 changes: 0 additions & 23 deletions milestone.h

This file was deleted.

2 changes: 1 addition & 1 deletion name.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const NameVTable * const name_vtable[_NAME_TYPE_MAX] = {
[NAME_SERVICE] = &service_vtable,
[NAME_TIMER] = &timer_vtable,
[NAME_SOCKET] = &socket_vtable,
[NAME_MILESTONE] = &milestone_vtable,
[NAME_TARGET] = &target_vtable,
[NAME_DEVICE] = &device_vtable,
[NAME_MOUNT] = &mount_vtable,
[NAME_AUTOMOUNT] = &automount_vtable,
Expand Down
8 changes: 4 additions & 4 deletions name.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum NameType {
NAME_SERVICE = 0,
NAME_TIMER,
NAME_SOCKET,
NAME_MILESTONE,
NAME_TARGET,
NAME_DEVICE,
NAME_MOUNT,
NAME_AUTOMOUNT,
Expand Down Expand Up @@ -121,7 +121,7 @@ struct Meta {
#include "service.h"
#include "timer.h"
#include "socket.h"
#include "milestone.h"
#include "target.h"
#include "device.h"
#include "mount.h"
#include "automount.h"
Expand All @@ -132,7 +132,7 @@ union Name {
Service service;
Timer timer;
Socket socket;
Milestone milestone;
Target target;
Device device;
Mount mount;
Automount automount;
Expand Down Expand Up @@ -184,7 +184,7 @@ extern const NameVTable * const name_vtable[_NAME_TYPE_MAX];
DEFINE_CAST(SOCKET, Socket);
DEFINE_CAST(TIMER, Timer);
DEFINE_CAST(SERVICE, Service);
DEFINE_CAST(MILESTONE, Milestone);
DEFINE_CAST(TARGET, Target);
DEFINE_CAST(DEVICE, Device);
DEFINE_CAST(MOUNT, Mount);
DEFINE_CAST(AUTOMOUNT, Automount);
Expand Down
26 changes: 26 additions & 0 deletions target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*-*- Mode: C; c-basic-offset: 8 -*-*/

#include "name.h"
#include "target.h"
#include "load-fragment.h"

static void target_done(Name *n) {
Target *m = TARGET(n);

assert(m);

/* Nothing here for now */
}

static NameActiveState target_active_state(Name *n) {
return TARGET(n)->state == TARGET_DEAD ? NAME_INACTIVE : NAME_ACTIVE;
}

const NameVTable target_vtable = {
.suffix = ".target",

.init = name_load_fragment,
.done = target_done,

.active_state = target_active_state
};
23 changes: 23 additions & 0 deletions target.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*-*- Mode: C; c-basic-offset: 8 -*-*/

#ifndef footargethfoo
#define footargethfoo

typedef struct Target Target;

#include "name.h"

typedef enum TargetState {
TARGET_DEAD,
TARGET_ACTIVE
} TargetState;

struct Target {
Meta meta;

TargetState state;
};

extern const NameVTable target_vtable;

#endif
4 changes: 0 additions & 4 deletions test1/default.milestone

This file was deleted.

4 changes: 4 additions & 0 deletions test1/default.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[Meta]
Names=multiuser.target
Wants=postfix.socket syslog.socket
Description=Default Target

0 comments on commit c22cbe2

Please sign in to comment.