Skip to content

Commit 3678e2f

Browse files
committed
Expand the INIT_SIGNALS and INIT_SIGHAND macros and remove
There doesn't seem to be any need to have the INIT_SIGNALS and INIT_SIGHAND macros, so expand them in their single places of use and remove them. Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Tony Luck <tony.luck@intel.com> Tested-by: Will Deacon <will.deacon@arm.com> (arm64) Tested-by: Palmer Dabbelt <palmer@sifive.com> Acked-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 4e7e3ad commit 3678e2f

2 files changed

Lines changed: 32 additions & 41 deletions

File tree

‎include/linux/init_task.h‎

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
extern struct files_struct init_files;
2525
extern struct fs_struct init_fs;
26+
extern struct nsproxy init_nsproxy;
27+
extern struct group_info init_groups;
28+
extern struct cred init_cred;
2629

2730
#ifndef CONFIG_VIRT_CPU_ACCOUNTING_NATIVE
2831
#define INIT_PREV_CPUTIME(x) .prev_cputime = { \
@@ -33,52 +36,16 @@ extern struct fs_struct init_fs;
3336
#endif
3437

3538
#ifdef CONFIG_POSIX_TIMERS
36-
#define INIT_POSIX_TIMERS(s) \
37-
.posix_timers = LIST_HEAD_INIT(s.posix_timers),
3839
#define INIT_CPU_TIMERS(s) \
3940
.cpu_timers = { \
4041
LIST_HEAD_INIT(s.cpu_timers[0]), \
4142
LIST_HEAD_INIT(s.cpu_timers[1]), \
42-
LIST_HEAD_INIT(s.cpu_timers[2]), \
43-
},
44-
#define INIT_CPUTIMER(s) \
45-
.cputimer = { \
46-
.cputime_atomic = INIT_CPUTIME_ATOMIC, \
47-
.running = false, \
48-
.checking_timer = false, \
43+
LIST_HEAD_INIT(s.cpu_timers[2]), \
4944
},
5045
#else
51-
#define INIT_POSIX_TIMERS(s)
5246
#define INIT_CPU_TIMERS(s)
53-
#define INIT_CPUTIMER(s)
5447
#endif
5548

56-
#define INIT_SIGNALS(sig) { \
57-
.nr_threads = 1, \
58-
.thread_head = LIST_HEAD_INIT(init_task.thread_node), \
59-
.wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),\
60-
.shared_pending = { \
61-
.list = LIST_HEAD_INIT(sig.shared_pending.list), \
62-
.signal = {{0}}}, \
63-
INIT_POSIX_TIMERS(sig) \
64-
INIT_CPU_TIMERS(sig) \
65-
.rlim = INIT_RLIMITS, \
66-
INIT_CPUTIMER(sig) \
67-
INIT_PREV_CPUTIME(sig) \
68-
.cred_guard_mutex = \
69-
__MUTEX_INITIALIZER(sig.cred_guard_mutex), \
70-
}
71-
72-
extern struct nsproxy init_nsproxy;
73-
74-
#define INIT_SIGHAND(sighand) { \
75-
.count = ATOMIC_INIT(1), \
76-
.action = { { { .sa_handler = SIG_DFL, } }, }, \
77-
.siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
78-
.signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(sighand.signalfd_wqh), \
79-
}
80-
81-
extern struct group_info init_groups;
8249

8350
#define INIT_STRUCT_PID { \
8451
.count = ATOMIC_INIT(1), \
@@ -103,8 +70,6 @@ extern struct group_info init_groups;
10370
.pid = &init_struct_pid, \
10471
}
10572

106-
extern struct cred init_cred;
107-
10873
#define INIT_TASK_COMM "swapper"
10974

11075
/* Attach to the init_task data structure for proper alignment */

‎init/init_task.c‎

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,34 @@
1313
#include <asm/pgtable.h>
1414
#include <linux/uaccess.h>
1515

16-
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
17-
static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
16+
static struct signal_struct init_signals = {
17+
.nr_threads = 1,
18+
.thread_head = LIST_HEAD_INIT(init_task.thread_node),
19+
.wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(init_signals.wait_chldexit),
20+
.shared_pending = {
21+
.list = LIST_HEAD_INIT(init_signals.shared_pending.list),
22+
.signal = {{0}}
23+
},
24+
.rlim = INIT_RLIMITS,
25+
.cred_guard_mutex = __MUTEX_INITIALIZER(init_signals.cred_guard_mutex),
26+
#ifdef CONFIG_POSIX_TIMERS
27+
.posix_timers = LIST_HEAD_INIT(init_signals.posix_timers),
28+
.cputimer = {
29+
.cputime_atomic = INIT_CPUTIME_ATOMIC,
30+
.running = false,
31+
.checking_timer = false,
32+
},
33+
#endif
34+
INIT_CPU_TIMERS(init_signals)
35+
INIT_PREV_CPUTIME(init_signals)
36+
};
37+
38+
static struct sighand_struct init_sighand = {
39+
.count = ATOMIC_INIT(1),
40+
.action = { { { .sa_handler = SIG_DFL, } }, },
41+
.siglock = __SPIN_LOCK_UNLOCKED(init_sighand.siglock),
42+
.signalfd_wqh = __WAIT_QUEUE_HEAD_INITIALIZER(init_sighand.signalfd_wqh),
43+
};
1844

1945
/*
2046
* Set up the first task table, touch at your own risk!. Base=0,

0 commit comments

Comments
 (0)