chiark / gitweb /
reorder large structs a little, based on pahole info
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Apr 2010 02:01:24 +0000 (04:01 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 21 Apr 2010 02:01:24 +0000 (04:01 +0200)
cgroup.h
execute.h
job.h
manager.h
ratelimit.h
socket.h
unit.h

index e290ffee9c14947b59c9c47ccf450d0bdab42bd3..d27c063c12fea7d11151be4c5f29adbda507217c 100644 (file)
--- a/cgroup.h
+++ b/cgroup.h
@@ -37,6 +37,12 @@ struct CGroupBonding {
 
         struct cgroup *cgroup;
 
+        /* For the Unit::cgroup_bondings list */
+        LIST_FIELDS(CGroupBonding, by_unit);
+
+        /* For the Manager::cgroup_bondings hashmap */
+        LIST_FIELDS(CGroupBonding, by_path);
+
         /* When shutting down, remove cgroup? */
         bool clean_up:1;
 
@@ -45,12 +51,6 @@ struct CGroupBonding {
 
         /* Inherit parameters from parent group */
         bool inherit:1;
-
-        /* For the Unit::cgroup_bondings list */
-        LIST_FIELDS(CGroupBonding, by_unit);
-
-        /* For the Manager::cgroup_bondings hashmap */
-        LIST_FIELDS(CGroupBonding, by_path);
 };
 
 int cgroup_bonding_realize(CGroupBonding *b);
index 655f1e4f7b4aec9a66446a5e90c089d863ac7e25..cafaf6b631c213226a76b99d2632c084424ebce3 100644 (file)
--- a/execute.h
+++ b/execute.h
@@ -63,9 +63,9 @@ typedef enum ExecOutput {
 } ExecOutput;
 
 struct ExecStatus {
-        pid_t pid;
         usec_t start_timestamp;
         usec_t exit_timestamp;
+        pid_t pid;
         int code;     /* as in siginfo_t::si_code */
         int status;   /* as in sigingo_t::si_status */
 };
@@ -79,46 +79,27 @@ struct ExecCommand {
 
 struct ExecContext {
         char **environment;
-        mode_t umask;
         struct rlimit *rlimit[RLIMIT_NLIMITS];
         char *working_directory, *root_directory;
+
+        mode_t umask;
         int oom_adjust;
         int nice;
         int ioprio;
         int cpu_sched_policy;
         int cpu_sched_priority;
+
         cpu_set_t cpu_affinity;
         unsigned long timer_slack_ns;
 
-        bool oom_adjust_set:1;
-        bool nice_set:1;
-        bool ioprio_set:1;
-        bool cpu_sched_set:1;
-        bool cpu_affinity_set:1;
-        bool timer_slack_ns_set:1;
-
-        /* This is not exposed to the user but available
-         * internally. We need it to make sure that whenever we spawn
-         * /bin/mount it is run in the same process group as us so
-         * that the autofs logic detects that it belongs to us and we
-         * don't enter a trigger loop. */
-        bool no_setsid:1;
-
-        bool cpu_sched_reset_on_fork;
-        bool non_blocking;
-
         ExecInput std_input;
         ExecOutput std_output;
         ExecOutput std_error;
 
-        char *tty_path;
-
         int syslog_priority;
         char *syslog_identifier;
 
-        cap_t capabilities;
-        int secure_bits;
-        uint64_t capability_bounding_set_drop;
+        char *tty_path;
 
         /* Since resolving these names might might involve socket
          * connections and we don't want to deadlock ourselves these
@@ -127,6 +108,28 @@ struct ExecContext {
         char *user;
         char *group;
         char **supplementary_groups;
+
+        uint64_t capability_bounding_set_drop;
+
+        cap_t capabilities;
+        int secure_bits;
+
+        bool cpu_sched_reset_on_fork;
+        bool non_blocking;
+
+        bool oom_adjust_set:1;
+        bool nice_set:1;
+        bool ioprio_set:1;
+        bool cpu_sched_set:1;
+        bool cpu_affinity_set:1;
+        bool timer_slack_ns_set:1;
+
+        /* This is not exposed to the user but available
+         * internally. We need it to make sure that whenever we spawn
+         * /bin/mount it is run in the same process group as us so
+         * that the autofs logic detects that it belongs to us and we
+         * don't enter a trigger loop. */
+        bool no_setsid:1;
 };
 
 typedef enum ExitStatus {
diff --git a/job.h b/job.h
index d04ca9d5b4ebd59ea55ae1b9357ec46a69e17586..e8857edaca4739a42a8e93152eb4bd4099810ef0 100644 (file)
--- a/job.h
+++ b/job.h
@@ -75,28 +75,16 @@ struct JobDependency {
         Job *subject;
         Job *object;
 
-        bool matters;
-
         LIST_FIELDS(JobDependency, subject);
         LIST_FIELDS(JobDependency, object);
+
+        bool matters;
 };
 
 struct Job {
         Manager *manager;
-        uint32_t id;
-
         Unit *unit;
 
-        JobType type;
-        JobState state;
-
-        bool installed:1;
-        bool in_run_queue:1;
-        bool matters_to_anchor:1;
-        bool override:1;
-        bool in_dbus_queue:1;
-        bool sent_dbus_new_signal:1;
-
         LIST_FIELDS(Job, transaction);
         LIST_FIELDS(Job, run_queue);
         LIST_FIELDS(Job, dbus_queue);
@@ -108,6 +96,17 @@ struct Job {
         Job* marker;
         unsigned generation;
 
+        uint32_t id;
+
+        JobType type;
+        JobState state;
+
+        bool installed:1;
+        bool in_run_queue:1;
+        bool matters_to_anchor:1;
+        bool override:1;
+        bool in_dbus_queue:1;
+        bool sent_dbus_new_signal:1;
 };
 
 Job* job_new(Manager *m, JobType type, Unit *unit);
index 9321e809b64037df0750d29bfe307fff22b3371e..356e168bf65c541a36dd16acbd0231ca01b6aa8d 100644 (file)
--- a/manager.h
+++ b/manager.h
@@ -64,13 +64,13 @@ enum WatchType {
 struct Watch {
         int fd;
         WatchType type;
-        bool fd_is_dupped;
         union {
                 union Unit *unit;
                 DBusWatch *bus_watch;
                 DBusTimeout *bus_timeout;
                 bool socket_accept;
         } data;
+        bool fd_is_dupped;
 };
 
 #include "unit.h"
@@ -151,25 +151,13 @@ struct Manager {
         Hashmap *transaction_jobs;      /* Unit object => Job object list 1:1 */
         JobDependency *transaction_anchor;
 
-        bool dispatching_load_queue:1;
-        bool dispatching_run_queue:1;
-        bool dispatching_dbus_queue:1;
-
-        bool request_api_bus_dispatch:1;
-        bool request_system_bus_dispatch:1;
-
-        bool utmp_reboot_written:1;
-
-        bool confirm_spawn:1;
-
-        ManagerExitCode exit_code:4;
-        ManagerRunningAs running_as;
-
         Hashmap *watch_pids;  /* pid => Unit object n:1 */
 
+        Watch signal_watch;
+
         int epoll_fd;
 
-        Watch signal_watch;
+        unsigned n_snapshots;
 
         char **unit_path;
         char **sysvinit_path;
@@ -197,16 +185,28 @@ struct Manager {
         Hashmap *watch_bus;  /* D-Bus names => Unit object n:1 */
         int32_t name_data_slot;
 
+        /* Data specific to the Automount subsystem */
+        int dev_autofs_fd;
+
         /* Data specific to the cgroup subsystem */
         Hashmap *cgroup_bondings; /* path string => CGroupBonding object 1:n */
         char *cgroup_controller;
         char *cgroup_hierarchy;
 
-        /* Data specific to the Automount subsystem */
-        int dev_autofs_fd;
+        /* Flags */
+        ManagerRunningAs running_as;
+        ManagerExitCode exit_code:4;
 
-        /* Data specific to the Snapshot subsystem */
-        unsigned n_snapshots;
+        bool dispatching_load_queue:1;
+        bool dispatching_run_queue:1;
+        bool dispatching_dbus_queue:1;
+
+        bool request_api_bus_dispatch:1;
+        bool request_system_bus_dispatch:1;
+
+        bool utmp_reboot_written:1;
+
+        bool confirm_spawn:1;
 };
 
 int manager_new(ManagerRunningAs running_as, bool confirm_spawn, Manager **m);
index f61a10a91d4cd0e2e497f78513f3f8d912de235f..e7dffb8bfa2d001d1643bcc8f8e79d6b7b1c1f34 100644 (file)
@@ -26,9 +26,9 @@
 
 typedef struct RateLimit {
         usec_t interval;
+        usec_t begin;
         unsigned burst;
         unsigned n_printed, n_missed;
-        usec_t begin;
 } RateLimit;
 
 #define RATELIMIT_DEFINE(_name, _interval, _burst)       \
index eafd64d5e36328839e1f817cd6fc39647ef50d23..7076be7ef471eae1bc653c9249b9ce179a9748ef 100644 (file)
--- a/socket.h
+++ b/socket.h
@@ -65,11 +65,11 @@ typedef struct SocketPort SocketPort;
 
 struct SocketPort {
         SocketType type;
+        int fd;
 
         SocketAddress address;
         char *path;
 
-        int fd;
         Watch fd_watch;
 
         LIST_FIELDS(SocketPort, port);
diff --git a/unit.h b/unit.h
index 76aa0eff5f46676139df7a1e77fd91d9ffa2dee8..d3d4b0e9f629412ee0fe1c24ba86337391526fed 100644 (file)
--- a/unit.h
+++ b/unit.h
@@ -144,17 +144,6 @@ struct Meta {
          * the job for it */
         Job *job;
 
-        bool in_load_queue:1;
-        bool in_dbus_queue:1;
-        bool in_cleanup_queue:1;
-        bool sent_dbus_new_signal:1;
-
-        /* If we go down, pull down everything that depends on us, too */
-        bool recursive_stop;
-
-        /* Garbage collect us we nobody wants or requires us anymore */
-        bool stop_when_unneeded;
-
         usec_t active_enter_timestamp;
         usec_t active_exit_timestamp;
 
@@ -172,6 +161,17 @@ struct Meta {
 
         /* Cleanup queue */
         LIST_FIELDS(Meta, cleanup_queue);
+
+        /* If we go down, pull down everything that depends on us, too */
+        bool recursive_stop;
+
+        /* Garbage collect us we nobody wants or requires us anymore */
+        bool stop_when_unneeded;
+
+        bool in_load_queue:1;
+        bool in_dbus_queue:1;
+        bool in_cleanup_queue:1;
+        bool sent_dbus_new_signal:1;
 };
 
 #include "service.h"
@@ -198,20 +198,6 @@ union Unit {
 struct UnitVTable {
         const char *suffix;
 
-        /* Can units of this type have multiple names? */
-        bool no_alias:1;
-
-        /* If true units of this types can never have "Requires"
-         * dependencies, because state changes can only be observed,
-         * not triggered */
-        bool no_requires:1;
-
-        /* Instances make no sense for this type */
-        bool no_instances:1;
-
-        /* Exclude this type from snapshots */
-        bool no_snapshots:1;
-
         /* This should reset all type-specific variables. This should
          * not allocate memory, and is called with zero-initialized
          * data. It should hence only initialize variables that need
@@ -283,6 +269,20 @@ struct UnitVTable {
 
         /* Type specific cleanups. */
         void (*shutdown)(Manager *m);
+
+        /* Can units of this type have multiple names? */
+        bool no_alias:1;
+
+        /* If true units of this types can never have "Requires"
+         * dependencies, because state changes can only be observed,
+         * not triggered */
+        bool no_requires:1;
+
+        /* Instances make no sense for this type */
+        bool no_instances:1;
+
+        /* Exclude this type from snapshots */
+        bool no_snapshots:1;
 };
 
 extern const UnitVTable * const unit_vtable[_UNIT_TYPE_MAX];