From 7fab9d01b5940a67ca070754361afb9dfaa520f2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 11 Aug 2010 22:37:10 +0200 Subject: [PATCH] pahole: rearrange structs to make them smaller --- src/automount.h | 2 +- src/device.h | 4 ++-- src/execute.h | 29 +++++++++++++++-------------- src/manager.h | 8 ++++---- src/mount.h | 4 ++-- src/socket.h | 28 +++++++++++++++------------- src/swap.h | 4 ++-- src/timer.h | 7 +++---- src/unit.h | 8 ++++---- 9 files changed, 48 insertions(+), 46 deletions(-) diff --git a/src/automount.h b/src/automount.h index 13b56eff..4f879f40 100644 --- a/src/automount.h +++ b/src/automount.h @@ -45,10 +45,10 @@ struct Automount { Mount *mount; int pipe_fd; + mode_t directory_mode; Watch pipe_watch; dev_t dev_id; - mode_t directory_mode; Set *tokens; diff --git a/src/device.h b/src/device.h index 5757c913..515db656 100644 --- a/src/device.h +++ b/src/device.h @@ -38,8 +38,6 @@ typedef enum DeviceState { struct Device { Meta meta; - DeviceState state; - char *sysfs; /* In order to be able to distuingish dependencies on @@ -47,6 +45,8 @@ struct Device { devices for the same sysfs path. We chain them up here. */ LIST_FIELDS(struct Device, same_sysfs); + + DeviceState state; }; extern const UnitVTable device_vtable; diff --git a/src/execute.h b/src/execute.h index 4b3449e2..5410f835 100644 --- a/src/execute.h +++ b/src/execute.h @@ -87,8 +87,8 @@ struct ExecCommand { char *path; char **argv; ExecStatus exec_status; - bool ignore; LIST_FIELDS(ExecCommand, command); /* useful for chaining commands */ + bool ignore; }; struct ExecContext { @@ -105,15 +105,12 @@ struct ExecContext { cpu_set_t *cpuset; unsigned cpuset_ncpus; - unsigned long timer_slack_nsec; ExecInput std_input; ExecOutput std_output; ExecOutput std_error; - int syslog_priority; - char *syslog_identifier; - bool syslog_level_prefix; + unsigned long timer_slack_nsec; char *tcpwrap_name; @@ -134,19 +131,21 @@ struct ExecContext { uint64_t capability_bounding_set_drop; + /* Not relevant for spawning processes, just for killing */ + KillMode kill_mode; + int kill_signal; + cap_t capabilities; int secure_bits; + int syslog_priority; + char *syslog_identifier; + bool syslog_level_prefix; + bool cpu_sched_reset_on_fork; bool non_blocking; bool private_tmp; - bool oom_adjust_set:1; - bool nice_set:1; - bool ioprio_set:1; - bool cpu_sched_set:1; - bool timer_slack_nsec_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 @@ -154,9 +153,11 @@ struct ExecContext { * don't enter a trigger loop. */ bool same_pgrp; - /* Not relevant for spawning processes, just for killing */ - KillMode kill_mode; - int kill_signal; + bool oom_adjust_set:1; + bool nice_set:1; + bool ioprio_set:1; + bool cpu_sched_set:1; + bool timer_slack_nsec_set:1; }; typedef enum ExitStatus { diff --git a/src/manager.h b/src/manager.h index c1f787f8..ef40352d 100644 --- a/src/manager.h +++ b/src/manager.h @@ -87,8 +87,6 @@ struct Watch { #include "path-lookup.h" struct Manager { - uint32_t current_job_id; - /* Note that the set of units we know of is allowed to be * incosistent. However the subset of it that is loaded may * not, and the list of jobs may neither. */ @@ -170,6 +168,8 @@ struct Manager { int32_t name_data_slot; int32_t subscribed_data_slot; + uint32_t current_job_id; + /* Data specific to the Automount subsystem */ int dev_autofs_fd; @@ -198,11 +198,11 @@ struct Manager { bool dispatching_run_queue:1; bool dispatching_dbus_queue:1; - int n_deserializing; - bool show_status; bool confirm_spawn; bool sysv_console; + + int n_deserializing; }; int manager_new(ManagerRunningAs running_as, Manager **m); diff --git a/src/mount.h b/src/mount.h index 6c60167d..56a7b12b 100644 --- a/src/mount.h +++ b/src/mount.h @@ -79,10 +79,10 @@ struct Mount { bool failure:1; - usec_t timeout_usec; - mode_t directory_mode; + usec_t timeout_usec; + ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX]; ExecContext exec_context; diff --git a/src/socket.h b/src/socket.h index 230dd200..89fa6cca 100644 --- a/src/socket.h +++ b/src/socket.h @@ -78,6 +78,10 @@ struct Socket { LIST_HEAD(SocketPort, ports); + unsigned n_accepted; + unsigned n_connections; + unsigned max_connections; + unsigned backlog; usec_t timeout_usec; @@ -91,36 +95,34 @@ struct Socket { SocketState state, deserialized_state; + Watch timer_watch; + ExecCommand* control_command; SocketExecCommand control_command_id; pid_t control_pid; - bool accept; - unsigned n_accepted; - unsigned n_connections; - unsigned max_connections; + /* Only for INET6 sockets: issue IPV6_V6ONLY sockopt */ + SocketAddressBindIPv6Only bind_ipv6_only; + + mode_t directory_mode; + mode_t socket_mode; bool failure; - Watch timer_watch; + + bool accept; /* Socket options */ bool keep_alive; + bool free_bind; int priority; + int mark; size_t receive_buffer; size_t send_buffer; int ip_tos; int ip_ttl; size_t pipe_size; - int mark; - bool free_bind; char *bind_to_device; char *tcp_congestion; - - /* Only for INET6 sockets: issue IPV6_V6ONLY sockopt */ - SocketAddressBindIPv6Only bind_ipv6_only; - - mode_t directory_mode; - mode_t socket_mode; }; /* Called from the service code when collecting fds */ diff --git a/src/swap.h b/src/swap.h index d3f24d5c..154d418d 100644 --- a/src/swap.h +++ b/src/swap.h @@ -51,11 +51,11 @@ struct Swap { char *what; + SwapState state, deserialized_state; + bool from_etc_fstab:1; bool from_proc_swaps:1; bool from_fragment:1; - - SwapState state, deserialized_state; }; extern const UnitVTable swap_vtable; diff --git a/src/timer.h b/src/timer.h index 6510ed28..fc74368e 100644 --- a/src/timer.h +++ b/src/timer.h @@ -47,14 +47,13 @@ typedef enum TimerBase { } TimerBase; typedef struct TimerValue { - TimerBase base; usec_t value; - usec_t next_elapse; - bool disabled; - LIST_FIELDS(struct TimerValue, value); + + TimerBase base; + bool disabled; } TimerValue; struct Timer { diff --git a/src/unit.h b/src/unit.h index 82ef9524..e3ca8bbc 100644 --- a/src/unit.h +++ b/src/unit.h @@ -180,6 +180,10 @@ struct Meta { /* Used during GC sweeps */ unsigned gc_marker; + /* When deserializing, temporarily store the job type for this + * unit here, if there was a job scheduled */ + int deserialized_job; /* This is actually of type JobType */ + /* If we go down, pull down everything that depends on us, too */ bool recursive_stop; @@ -198,10 +202,6 @@ struct Meta { /* Don't allow the user to stop this unit manually, allow stopping only indirectly via dependency. */ bool refuse_manual_stop; - /* When deserializing, temporarily store the job type for this - * unit here, if there was a job scheduled */ - int deserialized_job; /* This is actually of type JobType */ - bool in_load_queue:1; bool in_dbus_queue:1; bool in_cleanup_queue:1; -- 2.39.5