Skip to contentSkip to conversation

Re-xmit: task_t removal patch

PATCH New Rusty Russell 1 participant 1 message Sep 20, 2002

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Re-xmit: task_t removal patch

Against 2.5.36.

Name: task_t removal patch
Author: Rusty Russell
Section: Misc
Status: Trivial

D: This removes task_t, which is a gratuitous typedef for a "struct
D: task_struct". Unless there is good reason, the kernel doesn't usually
D: typedef, as typedefs cannot be predeclared unlike structs.

Documentation/sched-coding.txt +6 -6
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/Documentation/sched-coding.txt .4321-linux-2.5.36.updated/Documentation/sched-coding.txt
@@ -31,14 +31,14 @@ to be locked, lock acquires must be orde
 
 A specific runqueue is locked via
 
-	task_rq_lock(task_t pid, unsigned long *flags)
+	task_rq_lock(struct task_struct *task, unsigned long *flags)
 
-which disables preemption, disables interrupts, and locks the runqueue pid is
+which disables preemption, disables interrupts, and locks the runqueue task is
 running on.  Likewise,
 
-	task_rq_unlock(task_t pid, unsigned long *flags)
+	task_rq_unlock(struct task_struct *task, unsigned long *flags)
 
-unlocks the runqueue pid is running on, restores interrupts to their previous
+unlocks the runqueue task is running on, restores interrupts to their previous
 state, and reenables preemption.
 
 The routines
@@ -99,11 +99,11 @@ rt_task(pid)
 Process Control Methods
 -----------------------
 
-void set_user_nice(task_t *p, long nice)
+void set_user_nice(struct task_struct *p, long nice)
 	Sets the "nice" value of task p to the given value.
 int setscheduler(pid_t pid, int policy, struct sched_param *param)
 	Sets the scheduling policy and parameters for the given pid.
-void set_cpus_allowed(task_t *p, unsigned long new_mask)
+void set_cpus_allowed(struct task_struct *p, unsigned long new_mask)
 	Sets a given task's CPU affinity and migrates it to a proper cpu.
 	Callers must have a valid reference to the task and assure the
 	task not exit prematurely.  No locks can be held during the call.
arch/alpha/kernel/process.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/arch/alpha/kernel/process.c .4321-linux-2.5.36.updated/arch/alpha/kernel/process.c
@@ -443,7 +443,7 @@ out:
  */
 
 unsigned long
-thread_saved_pc(task_t *t)
+thread_saved_pc(struct task_struct *t)
 {
 	unsigned long base = (unsigned long)t->thread_info;
 	unsigned long fp, sp = t->thread_info->pcb.ksp;
arch/ia64/kernel/smpboot.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/arch/ia64/kernel/smpboot.c .4321-linux-2.5.36.updated/arch/ia64/kernel/smpboot.c
@@ -75,7 +75,7 @@ extern void start_ap (void);
 extern unsigned long ia64_iobase;
 
 int cpucount;
-task_t *task_for_booting_cpu;
+struct task_struct *task_for_booting_cpu;
 
 /* Bitmask of currently online CPUs */
 volatile unsigned long cpu_online_map;
include/linux/sched.h +18 -18
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/include/linux/sched.h .4321-linux-2.5.36.updated/include/linux/sched.h
@@ -146,10 +146,8 @@ struct sched_param {
 extern rwlock_t tasklist_lock;
 extern spinlock_t mmlist_lock;
 
-typedef struct task_struct task_t;
-
-extern void sched_init(void);
-extern void init_idle(task_t *idle, int cpu);
+ extern void sched_init(void);
+extern void init_idle(struct task_struct *idle, int cpu);
 extern void show_state(void);
 extern void cpu_init (void);
 extern void trap_init(void);
@@ -219,7 +217,7 @@ struct signal_struct {
 	spinlock_t		siglock;
 
         /* current thread group signal load-balancing target: */
-        task_t                  *curr_target;
+        struct task_struct	*curr_target;
 
 	struct sigpending	shared_pending;
 
@@ -442,15 +440,15 @@ do { if (atomic_dec_and_test(&(tsk)->usa
 #define _STK_LIM	(8*1024*1024)
 
 #if CONFIG_SMP
-extern void set_cpus_allowed(task_t *p, unsigned long new_mask);
+extern void set_cpus_allowed(struct task_struct *p, unsigned long new_mask);
 #else
 # define set_cpus_allowed(p, new_mask) do { } while (0)
 #endif
 
-extern void set_user_nice(task_t *p, long nice);
-extern int task_prio(task_t *p);
-extern int task_nice(task_t *p);
-extern int task_curr(task_t *p);
+extern void set_user_nice(struct task_struct *p, long nice);
+extern int task_prio(struct task_struct *p);
+extern int task_nice(struct task_struct *p);
+extern int task_curr(struct task_struct *p);
 extern int idle_cpu(int cpu);
 
 void yield(void);
@@ -532,7 +530,7 @@ extern long FASTCALL(interruptible_sleep
 						    signed long timeout));
 extern int FASTCALL(wake_up_process(struct task_struct * tsk));
 extern void FASTCALL(wake_up_forked_process(struct task_struct * tsk));
-extern void FASTCALL(sched_exit(task_t * p));
+extern void FASTCALL(sched_exit(struct task_struct * p));
 
 #define wake_up(x)			__wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, 1)
 #define wake_up_nr(x, nr)		__wake_up((x),TASK_UNINTERRUPTIBLE | TASK_INTERRUPTIBLE, nr)
@@ -682,7 +680,7 @@ extern void remove_thread_group(struct t
 
 extern void reparent_to_init(void);
 extern void daemonize(void);
-extern task_t *child_reaper;
+extern struct task_struct *child_reaper;
 
 extern int do_execve(char *, char **, char **, struct pt_regs *);
 extern struct task_struct *do_fork(unsigned long, unsigned long, struct pt_regs *, unsigned long, int *);
@@ -692,11 +690,11 @@ extern void FASTCALL(add_wait_queue_excl
 extern void FASTCALL(remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
 
 #ifdef CONFIG_SMP
-extern void wait_task_inactive(task_t * p);
+extern void wait_task_inactive(struct task_struct *p);
 #else
 #define wait_task_inactive(p)	do { } while (0)
 #endif
-extern void kick_if_running(task_t * p);
+extern void kick_if_running(struct task_struct *p);
 
 #define __wait_event(wq, condition) 					\
 do {									\
@@ -824,7 +822,7 @@ static inline struct task_struct *younge
 #define while_each_thread(g, t) \
 	while ((t = next_thread(t)) != g)
 
-static inline task_t *next_thread(task_t *p)
+static inline struct task_struct *next_thread(struct task_struct *p)
 {
 	if (!p->sig)
 		BUG();
@@ -833,10 +831,11 @@ static inline task_t *next_thread(task_t
 				!rwlock_is_locked(&tasklist_lock))
 		BUG();
 #endif
-	return list_entry((p)->thread_group.next, task_t, thread_group);
+	return list_entry((p)->thread_group.next,
+			  struct task_struct, thread_group);
 }
 
-static inline task_t *prev_thread(task_t *p)
+static inline struct task_struct *prev_thread(struct task_struct *p)
 {
 	if (!p->sig)
 		BUG();
@@ -845,7 +844,8 @@ static inline task_t *prev_thread(task_t
 				!rwlock_is_locked(&tasklist_lock))
 		BUG();
 #endif
-	return list_entry((p)->thread_group.prev, task_t, thread_group);
+	return list_entry((p)->thread_group.prev,
+			  struct task_struct, thread_group);
 }
 
 #define thread_group_leader(p)	(p->pid == p->tgid)
kernel/capability.c +4 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/kernel/capability.c .4321-linux-2.5.36.updated/kernel/capability.c
@@ -33,7 +33,7 @@ asmlinkage long sys_capget(cap_user_head
      int ret = 0;
      pid_t pid;
      __u32 version;
-     task_t *target;
+     struct task_struct *target;
      struct __user_cap_data_struct data;
 
      if (get_user(version, &header->version))
@@ -83,7 +83,7 @@ static inline void cap_set_pg(int pgrp, 
 			      kernel_cap_t *inheritable,
 			      kernel_cap_t *permitted)
 {
-     task_t *g, *target;
+     struct task_struct *g, *target;
 
      do_each_thread(g, target) {
              if (target->pgrp != pgrp)
@@ -100,7 +100,7 @@ static inline void cap_set_all(kernel_ca
 			       kernel_cap_t *inheritable,
 			       kernel_cap_t *permitted)
 {
-     task_t *g, *target;
+     struct task_struct *g, *target;
 
      do_each_thread(g, target) {
              if (target == current || target->pid == 1)
@@ -125,7 +125,7 @@ asmlinkage long sys_capset(cap_user_head
 {
      kernel_cap_t inheritable, permitted, effective;
      __u32 version;
-     task_t *target;
+     struct task_struct *target;
      int ret;
      pid_t pid;
 
kernel/exit.c +8 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/kernel/exit.c .4321-linux-2.5.36.updated/kernel/exit.c
@@ -268,7 +268,9 @@ void daemonize(void)
 	reparent_to_init();
 }
 
-static void reparent_thread(task_t *p, task_t *reaper, task_t *child_reaper)
+static void reparent_thread(struct task_struct *p,
+			    struct task_struct *reaper,
+			    struct task_struct *child_reaper)
 {
 	/* We dont want people slaying init */
 	if (p->exit_signal != -1)
@@ -468,11 +470,13 @@ static inline void forget_original_paren
 	}
 }
 
-static inline void zap_thread(task_t *p, task_t *father, int traced)
+static inline void zap_thread(struct task_struct *p,
+			      struct task_struct *father,
+			      int traced)
 {
 	/* If someone else is tracing this thread, preserve the ptrace links.  */
 	if (unlikely(traced)) {
-		task_t *trace_task = p->parent;
+		struct task_struct *trace_task = p->parent;
 		int ptrace_flag = p->ptrace;
 		BUG_ON (ptrace_flag == 0);
 
@@ -696,7 +700,7 @@ asmlinkage long sys_exit_group(int error
 	do_exit(exit_code);
 }
 
-static int eligible_child(pid_t pid, int options, task_t *p)
+static int eligible_child(pid_t pid, int options, struct task_struct *p)
 {
 	if (pid > 0) {
 		if (p->pid != pid)
kernel/fork.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/kernel/fork.c .4321-linux-2.5.36.updated/kernel/fork.c
@@ -65,7 +65,7 @@ rwlock_t tasklist_lock __cacheline_align
  * the very last portion of sys_exit() is executed with
  * preemption turned off.
  */
-static task_t *task_cache[NR_CPUS] __cacheline_aligned;
+static struct task_struct *task_cache[NR_CPUS] __cacheline_aligned;
 
 void __put_task_struct(struct task_struct *tsk)
 {
kernel/ptrace.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/kernel/ptrace.c .4321-linux-2.5.36.updated/kernel/ptrace.c
@@ -24,7 +24,7 @@
  *
  * Must be called with the tasklist lock write-held.
  */
-void __ptrace_link(task_t *child, task_t *new_parent)
+void __ptrace_link(struct task_struct *child, struct task_struct *new_parent)
 {
 	if (!list_empty(&child->ptrace_list))
 		BUG();
@@ -42,7 +42,7 @@ void __ptrace_link(task_t *child, task_t
  *
  * Must be called with the tasklist lock write-held.
  */
-void __ptrace_unlink(task_t *child)
+void __ptrace_unlink(struct task_struct *child)
 {
 	if (!child->ptrace)
 		BUG();
kernel/sched.c +43 -41

323 lines not on this page · raw message

kernel/signal.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/kernel/signal.c .4321-linux-2.5.36.updated/kernel/signal.c
@@ -874,7 +874,7 @@ int __broadcast_thread_group(struct task
 
 	/* send a signal to all members of the list */
 	list_for_each(entry, &p->thread_group) {
-		tmp = list_entry(entry, task_t, thread_group);
+		tmp = list_entry(entry, struct task_struct, thread_group);
 		err = __force_sig_info(sig, tmp);
 	}
 	return err;
kernel/timer.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .4321-linux-2.5.36/kernel/timer.c .4321-linux-2.5.36.updated/kernel/timer.c
@@ -790,7 +790,7 @@ asmlinkage long sys_getegid(void)
 
 static void process_timeout(unsigned long __data)
 {
-	wake_up_process((task_t *)__data);
+	wake_up_process((struct task_struct *)__data);
 }
 
 /**

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.