manager: split transaction.[ch]

manager.c takes care of the main loop, unit management, signal handling, ...
transaction.c computes transactions.

After split:
manager.c:     65 KB
transaction.c: 40 KB
This commit is contained in:
Michal Schmidt 2012-04-19 23:54:11 +02:00
parent 7527cb5275
commit 75778e21df
6 changed files with 1141 additions and 1106 deletions

View file

@ -681,6 +681,8 @@ libsystemd_core_la_SOURCES = \
src/core/job.h \
src/core/manager.c \
src/core/manager.h \
src/core/transaction.c \
src/core/transaction.h \
src/core/load-fragment.c \
src/core/load-fragment.h \
src/core/service.c \

View file

@ -34,6 +34,7 @@ typedef enum JobMode JobMode;
typedef enum JobResult JobResult;
#include "manager.h"
#include "transaction.h"
#include "unit.h"
#include "hashmap.h"
#include "list.h"

File diff suppressed because it is too large Load diff

View file

@ -33,7 +33,6 @@
#define MANAGER_MAX_NAMES 131072 /* 128K */
typedef struct Manager Manager;
typedef struct Transaction Transaction;
typedef enum WatchType WatchType;
typedef struct Watch Watch;
@ -92,12 +91,6 @@ struct Watch {
#include "dbus.h"
#include "path-lookup.h"
struct Transaction {
/* Jobs to be added */
Hashmap *jobs; /* Unit object => Job object list 1:1 */
JobDependency *anchor;
};
struct Manager {
/* Note that the set of units we know of is allowed to be
* inconsistent. However the subset of it that is loaded may

1101
src/core/transaction.c Normal file

File diff suppressed because it is too large Load diff

36
src/core/transaction.h Normal file
View file

@ -0,0 +1,36 @@
#ifndef footransactionhfoo
#define footransactionhfoo
typedef struct Transaction Transaction;
#include "unit.h"
#include "manager.h"
#include "job.h"
#include "hashmap.h"
struct Transaction {
/* Jobs to be added */
Hashmap *jobs; /* Unit object => Job object list 1:1 */
JobDependency *anchor;
};
Transaction *transaction_new(void);
void transaction_free(Transaction *tr);
int transaction_add_job_and_dependencies(
Transaction *tr,
JobType type,
Unit *unit,
Job *by,
bool matters,
bool override,
bool conflicts,
bool ignore_requirements,
bool ignore_order,
DBusError *e,
Job **_ret);
int transaction_activate(Transaction *tr, Manager *m, JobMode mode, DBusError *e);
int transaction_add_isolate_jobs(Transaction *tr, Manager *m);
void transaction_abort(Transaction *tr);
#endif