Skip to contentSkip to conversation

Remove list_t infection.

PATCH In review Rusty Russell 12 participants 28 messages Sep 2, 2002 – Sep 9, 2002

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

PATCH 1/1 Remove list_t infection.

This week, it spread to SCTP.

"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

Linus, please apply,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

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

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

include/linux/device.h +3 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/device.h .22733-linux-2.5.33.updated/include/linux/device.h
@@ -57,9 +57,9 @@ struct bus_type {
 	rwlock_t		lock;
 	atomic_t		refcount;
 
-	list_t			node;
-	list_t			devices;
-	list_t			drivers;
+	struct list_head	node;
+	struct list_head	devices;
+	struct list_head	drivers;
 
 	struct driver_dir_entry	dir;
 	struct driver_dir_entry	device_dir;
include/linux/fs.h +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/fs.h .22733-linux-2.5.33.updated/include/linux/fs.h
@@ -322,8 +322,8 @@ struct address_space {
 	struct list_head	io_pages;	/* being prepared for I/O */
 	unsigned long		nrpages;	/* number of total pages */
 	struct address_space_operations *a_ops;	/* methods */
-	list_t			i_mmap;		/* list of private mappings */
-	list_t			i_mmap_shared;	/* list of private mappings */
+	struct list_head	i_mmap;		/* list of private mappings */
+	struct list_head	i_mmap_shared;	/* list of private mappings */
 	spinlock_t		i_shared_lock;  /* and spinlock protecting it */
 	unsigned long		dirtied_when;	/* jiffies of first page dirtying */
 	int			gfp_mask;	/* how to allocate the pages */
include/linux/list.h +26 -23

153 lines not on this page · raw message

include/linux/mm.h +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/mm.h .22733-linux-2.5.33.updated/include/linux/mm.h
@@ -61,7 +61,7 @@ struct vm_area_struct {
 	 * one of the address_space->i_mmap{,shared} lists,
 	 * for shm areas, the list of attaches, otherwise unused.
 	 */
-	list_t shared;
+	struct list_head shared;
 
 	/* Function pointers to deal with this struct. */
 	struct vm_operations_struct * vm_ops;
include/linux/sched.h +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/sched.h .22733-linux-2.5.33.updated/include/linux/sched.h
@@ -264,7 +264,7 @@ struct task_struct {
 	int lock_depth;		/* Lock depth */
 
 	int prio, static_prio;
-	list_t run_list;
+	struct list_head run_list;
 	prio_array_t *array;
 
 	unsigned long sleep_avg;
include/net/sctp/structs.h +9 -9
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/net/sctp/structs.h .22733-linux-2.5.33.updated/include/net/sctp/structs.h
@@ -203,7 +203,7 @@ struct SCTP_protocol {
 	/* This is a list of groups of functions for each address
 	 * family that we support.
 	 */
-	list_t address_families;
+	struct list_head address_families;
 
 	/* This is the hash of all endpoints. */
 	int ep_hashsize;
@@ -225,7 +225,7 @@ struct SCTP_protocol {
 	 *
 	 * It is a list of struct sockaddr_storage_list.
 	 */
-	list_t local_addr_list;
+	struct list_head local_addr_list;
 	spinlock_t local_addr_lock;
 };
 
@@ -250,7 +250,7 @@ typedef struct sctp_func {
 	__u16		net_header_len;	
 	int		sockaddr_len;
 	sa_family_t	sa_family;
-	list_t          list;
+	struct list_head list;
 } sctp_func_t;
 
 sctp_func_t *sctp_get_af_specific(const sockaddr_storage_t *address);
@@ -494,7 +494,7 @@ const sockaddr_storage_t *sctp_source(co
  * sin_addr -- cast to either (struct in_addr) or (struct in6_addr)
  */
 struct sockaddr_storage_list {
-	list_t list;
+	struct list_head list;
 	sockaddr_storage_t a;
 };
 
@@ -582,7 +582,7 @@ void sctp_packet_free(sctp_packet_t *);
  */
 struct SCTP_transport {
 	/* A list of transports. */
-	list_t transports;
+	struct list_head transports;
 
 	/* Reference counting. */
 	atomic_t refcnt;
@@ -863,7 +863,7 @@ struct SCTP_bind_addr {
 	 *	has bound.  This information is passed to one's
 	 *	peer(s) in INIT and INIT ACK chunks.
 	 */
-	list_t address_list;
+	struct list_head address_list;
 
 	int malloced;        /* Are we kfree()able?  */
 };
@@ -988,7 +988,7 @@ struct SCTP_endpoint {
 	 *            is implemented.
 	 */
 	/* This is really a list of sctp_association_t entries. */
-	list_t asocs;
+	struct list_head asocs;
 
 	/* Secret Key: A secret key used by this endpoint to compute
 	 *            the MAC.  This SHOULD be a cryptographic quality
@@ -1070,7 +1070,7 @@ struct SCTP_association {
 	sctp_endpoint_common_t base;
 
 	/* Associations on the same socket. */
-	list_t asocs;
+	struct list_head asocs;
 
 	/* This is a signature that lets us know that this is a
 	 * sctp_association_t data structure.  Used for mapping an
@@ -1104,7 +1104,7 @@ struct SCTP_association {
 		 *
 		 * It is a list of SCTP_transport's.
 		 */
-		list_t transport_addr_list;
+		struct list_head transport_addr_list;
 
 		/* port
 		 *   The transport layer port number.
kernel/exit.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/kernel/exit.c .22733-linux-2.5.33.updated/kernel/exit.c
@@ -407,7 +407,7 @@ void exit_mm(struct task_struct *tsk)
 static inline void forget_original_parent(struct task_struct * father)
 {
 	struct task_struct *p, *reaper;
-	list_t *_p;
+	struct list_head *_p;
 
 	read_lock(&tasklist_lock);
 
@@ -477,7 +477,7 @@ static inline void zap_thread(task_t *p,
 static void exit_notify(void)
 {
 	struct task_struct *t;
-	list_t *_p, *_n;
+	struct list_head *_p, *_n;
 
 	forget_original_parent(current);
 	/*
kernel/sched.c +5 -5
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/kernel/sched.c .22733-linux-2.5.33.updated/kernel/sched.c
@@ -133,7 +133,7 @@ typedef struct runqueue runqueue_t;
 struct prio_array {
 	int nr_active;
 	unsigned long bitmap[BITMAP_SIZE];
-	list_t queue[MAX_PRIO];
+	struct list_head queue[MAX_PRIO];
 };
 
 /*
@@ -152,7 +152,7 @@ struct runqueue {
 	int prev_nr_running[NR_CPUS];
 
 	task_t *migration_thread;
-	list_t migration_queue;
+	struct list_head migration_queue;
 
 } ____cacheline_aligned;
 
@@ -739,7 +739,7 @@ static void load_balance(runqueue_t *thi
 	int imbalance, idx, this_cpu = smp_processor_id();
 	runqueue_t *busiest;
 	prio_array_t *array;
-	list_t *head, *curr;
+	struct list_head *head, *curr;
 	task_t *tmp;
 
 	busiest = find_busiest_queue(this_rq, this_cpu, idle, &imbalance);
@@ -937,7 +937,7 @@ asmlinkage void schedule(void)
 	task_t *prev, *next;
 	runqueue_t *rq;
 	prio_array_t *array;
-	list_t *queue;
+	struct list_head *queue;
 	int idx;
 
 	if (unlikely(in_interrupt()))
@@ -1899,7 +1899,7 @@ void __init init_idle(task_t *idle, int 
  */
 
 typedef struct {
-	list_t list;
+	struct list_head list;
 	task_t *task;
 	struct completion done;
 } migration_req_t;
mm/memory.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/mm/memory.c .22733-linux-2.5.33.updated/mm/memory.c
@@ -1033,11 +1033,11 @@ no_mem:
 	return VM_FAULT_OOM;
 }
 
-static void vmtruncate_list(list_t *head, unsigned long pgoff)
+static void vmtruncate_list(struct list_head *head, unsigned long pgoff)
 {
 	unsigned long start, end, len, diff;
 	struct vm_area_struct *vma;
-	list_t *curr;
+	struct list_head *curr;
 
 	list_for_each(curr, head) {
 		vma = list_entry(curr, struct vm_area_struct, shared);
mm/page_alloc.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/mm/page_alloc.c .22733-linux-2.5.33.updated/mm/page_alloc.c
@@ -237,7 +237,7 @@ int is_head_of_free_region(struct page *
         struct zone *zone = page_zone(page);
         unsigned long flags;
 	int order;
-	list_t *curr;
+	struct list_head *curr;
 
 	/*
 	 * Should not matter as we need quiescent system for
@@ -652,7 +652,7 @@ void show_free_areas(void)
 
 	for (pgdat = pgdat_list; pgdat; pgdat = pgdat->pgdat_next)
 		for (type = 0; type < MAX_NR_ZONES; type++) {
-			list_t *elem;
+			struct list_head *elem;
 			struct zone *zone = &pgdat->node_zones[type];
  			unsigned long nr, flags, order, total = 0;
 
net/sctp/associola.c +6 -6
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/associola.c .22733-linux-2.5.33.updated/net/sctp/associola.c
@@ -296,7 +296,7 @@ void sctp_association_free(sctp_associat
 {
 	sctp_transport_t *transport;
 	sctp_endpoint_t *ep;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 	int i;
 
 	ep = asoc->ep;
@@ -482,7 +482,7 @@ sctp_transport_t *sctp_assoc_lookup_padd
 					  const sockaddr_storage_t *address)
 {
 	sctp_transport_t *t;
-	list_t *pos;
+	struct list_head *pos;
 
 	/* Cycle through all transports searching for a peer address. */
 
@@ -508,7 +508,7 @@ void sctp_assoc_control_transport(sctp_a
 	sctp_transport_t *first;
 	sctp_transport_t *second;
 	sctp_ulpevent_t *event;
-	list_t *pos;
+	struct list_head *pos;
 	int spc_state = 0;
 
 	/* Record the transition on the transport.  */
@@ -780,7 +780,7 @@ sctp_transport_t *sctp_assoc_lookup_tsn(
 {
 	sctp_transport_t *active;
 	sctp_transport_t *match;
-	list_t *entry, *pos;
+	struct list_head *entry, *pos;
 	sctp_transport_t *transport;
 	sctp_chunk_t *chunk;
 	__u32 key = htonl(tsn);
@@ -983,8 +983,8 @@ void sctp_assoc_update(sctp_association_
 sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *asoc)
 {
 	sctp_transport_t *t, *next;
-	list_t *head = &asoc->peer.transport_addr_list;
-	list_t *pos;
+	struct list_head *head = &asoc->peer.transport_addr_list;
+	struct list_head *pos;
 
 	/* If this is the first time SHUTDOWN is sent, use the active
 	 * path.
net/sctp/bind_addr.c +5 -5
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/bind_addr.c .22733-linux-2.5.33.updated/net/sctp/bind_addr.c
@@ -65,7 +65,7 @@ int sctp_bind_addr_copy(sctp_bind_addr_t
 			sctp_scope_t scope, int priority, int flags)
 {
 	struct sockaddr_storage_list *addr;
-	list_t *pos;
+	struct list_head *pos;
 	int error = 0;
 
 	/* All addresses share the same port.  */
@@ -119,7 +119,7 @@ void sctp_bind_addr_init(sctp_bind_addr_
 static void sctp_bind_addr_clean(sctp_bind_addr_t *bp)
 {
 	struct sockaddr_storage_list *addr;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	/* Empty the bind address list. */
 	list_for_each_safe(pos, temp, &bp->address_list) {
@@ -173,7 +173,7 @@ int sctp_add_bind_addr(sctp_bind_addr_t 
  */
 int sctp_del_bind_addr(sctp_bind_addr_t *bp, sockaddr_storage_t *del_addr)
 {
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 	struct sockaddr_storage_list *addr;
 
 	list_for_each_safe(pos, temp, &bp->address_list) {
@@ -206,7 +206,7 @@ sctpParam_t sctp_bind_addrs_to_raw(const
 	sctpIpAddress_t rawaddr_space;
 	int len;
 	struct sockaddr_storage_list *addr;
-	list_t *pos;
+	struct list_head *pos;
 
 	retval.v = NULL;
 	addrparms_len = 0;
@@ -284,7 +284,7 @@ int sctp_raw_to_bind_addrs(sctp_bind_add
 int sctp_bind_addr_has_addr(sctp_bind_addr_t *bp, const sockaddr_storage_t *addr)
 {
 	struct sockaddr_storage_list *laddr;
-	list_t *pos;
+	struct list_head *pos;
 
 	list_for_each(pos, &bp->address_list) {
 		laddr = list_entry(pos, struct sockaddr_storage_list, list);
net/sctp/endpointola.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/endpointola.c .22733-linux-2.5.33.updated/net/sctp/endpointola.c
@@ -257,7 +257,7 @@ sctp_association_t *__sctp_endpoint_look
 {
 	int rport;
 	sctp_association_t *asoc;
-	list_t *pos;
+	struct list_head *pos;
 
 	rport = paddr->v4.sin_port;
 
net/sctp/outqueue.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/outqueue.c .22733-linux-2.5.33.updated/net/sctp/outqueue.c
@@ -104,7 +104,7 @@ void sctp_outqueue_init(sctp_association
 void sctp_outqueue_teardown(sctp_outqueue_t *q)
 {
 	sctp_transport_t *transport;
-	list_t *lchunk, *pos;
+	struct list_head *lchunk, *pos;
 	sctp_chunk_t *chunk;
 
 	/* Throw away unacknowledged chunks. */
@@ -948,7 +948,7 @@ static void sctp_sack_update_unack_data(
 int sctp_sack_outqueue(sctp_outqueue_t *q, sctp_sackhdr_t *sack)
 {
 	sctp_chunk_t *tchunk;
-	list_t *lchunk, *transport_list, *pos;
+	struct list_head *lchunk, *transport_list, *pos;
 	__u32 tsn;
 	__u32 sack_ctsn;
 	__u32 ctsn;
net/sctp/protocol.c +3 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/protocol.c .22733-linux-2.5.33.updated/net/sctp/protocol.c
@@ -198,7 +198,7 @@ static void sctp_get_local_addr_list(sct
 static void __sctp_free_local_addr_list(sctp_protocol_t *proto)
 {
 	struct sockaddr_storage_list *addr;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	list_for_each_safe(pos, temp, &proto->local_addr_list) {
 		addr = list_entry(pos, struct sockaddr_storage_list, list);
@@ -223,7 +223,7 @@ int sctp_copy_local_addr_list(sctp_proto
 {
 	struct sockaddr_storage_list *addr;
 	int error = 0;
-	list_t *pos;
+	struct list_head *pos;
 	long flags __attribute__ ((unused));
 
 	sctp_spin_lock_irqsave(&proto->local_addr_lock, flags);
@@ -327,7 +327,7 @@ int sctp_ctl_sock_init(void)
  */
 sctp_func_t *sctp_get_af_specific(const sockaddr_storage_t *address)
 {
-	list_t *pos;
+	struct list_head *pos;
 	sctp_protocol_t *proto = sctp_get_protocol();
 	sctp_func_t *retval, *af;
 
net/sctp/sm_make_chunk.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/sm_make_chunk.c .22733-linux-2.5.33.updated/net/sctp/sm_make_chunk.c
@@ -1417,7 +1417,7 @@ void sctp_process_init(sctp_association_
 	sctpParam_t param;
 	__u8 *end;
 	sctp_transport_t *transport;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	/* We must include the address that the INIT packet came from.
 	 * This is the only address that matters for an INIT packet.
net/sctp/sm_sideeffect.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/sm_sideeffect.c .22733-linux-2.5.33.updated/net/sctp/sm_sideeffect.c
@@ -1053,7 +1053,7 @@ static void sctp_cmd_hb_timers_start(sct
 				     sctp_association_t *asoc)
 {
 	sctp_transport_t *t;
-	list_t *pos;
+	struct list_head *pos;
 
 	/* Start a heartbeat timer for each transport on the association.
 	 * hold a reference on the transport to make sure none of
@@ -1072,7 +1072,7 @@ static void sctp_cmd_hb_timers_start(sct
 void sctp_cmd_set_bind_addrs(sctp_cmd_seq_t *cmds, sctp_association_t *asoc,
 			     sctp_bind_addr_t *bp)
 {
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	list_for_each_safe(pos, temp, &bp->address_list) {
 		list_del_init(pos);
net/sctp/sm_statefuns.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/sm_statefuns.c .22733-linux-2.5.33.updated/net/sctp/sm_statefuns.c
@@ -1056,7 +1056,7 @@ static sctp_disposition_t sctp_sf_do_dup
 	sctp_ulpevent_t *ev;
 	sctp_chunk_t *repl;
 	sctp_transport_t *new_addr, *addr;
-	list_t *pos, *pos2, *temp;
+	struct list_head *pos, *pos2, *temp;
 	int found, error;
 
 	/* new_asoc is a brand-new association, so these are not yet
net/sctp/socket.c +6 -6
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/socket.c .22733-linux-2.5.33.updated/net/sctp/socket.c
@@ -439,7 +439,7 @@ err_bindx_add:
 #if CONFIG_IP_SCTP_ADDIP
 	/* Add these addresses to all associations on this endpoint.  */
 	if (retval >= 0) {
-		list_t *pos;
+		struct list_head *pos;
 		sctp_endpoint_t *ep;
 		sctp_association_t *asoc;
 		ep = sctp_sk(sk)->ep;
@@ -560,7 +560,7 @@ err_bindx_rem:
 #if CONFIG_IP_SCTP_ADDIP
 	/* Remove these addresses from all associations on this endpoint.  */
 	if (retval >= 0) {
-		list_t *pos;
+		struct list_head *pos;
 		sctp_endpoint_t *ep;
 		sctp_association_t *asoc;
 
@@ -666,7 +666,7 @@ static void sctp_close(struct sock *sk, 
 {
 	sctp_endpoint_t *ep;
 	sctp_association_t *asoc;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p...)\n", sk);
 
@@ -1238,7 +1238,7 @@ static int sctp_setsockopt(struct sock *
 	int retval = 0;
 	char * tmp;
 	sctp_protocol_t *proto = sctp_get_protocol();
-	list_t *pos;
+	struct list_head *pos;
 	sctp_func_t *af;
 
 	SCTP_DEBUG_PRINTK("sctp_setsockopt(sk: %p... optname: %d)\n",
@@ -1661,7 +1661,7 @@ static int sctp_getsockopt(struct sock *
 	int retval = 0;
 	sctp_protocol_t *proto = sctp_get_protocol();
 	sctp_func_t *af;
-	list_t *pos;
+	struct list_head *pos;
 	int len;
 
 	SCTP_DEBUG_PRINTK("sctp_getsockopt(sk: %p, ...)\n", sk);
@@ -2649,7 +2649,7 @@ static void __sctp_write_space(sctp_asso
 void sctp_write_space(struct sock *sk)
 {
 	sctp_association_t *asoc;
-	list_t *pos;
+	struct list_head *pos;
 
 	/* Wake up the tasks in each wait queue.  */
 	list_for_each(pos, &((sctp_sk(sk))->ep->asocs)) {
#1 lore raw
Quoted 4 lines · Rusty Russell

This week, it spread to SCTP.

"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

I am all for your cleanup here, but two nits:

Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Second, if we want to force people to change, we should remove "list_t" too to prevent new uses creeping in. Plus, like Linus says, it is often to break stuff and cleanup the mess...

The attached patch implements the above. A

s/list_t/struct list/ and s/struct list_head/struct list/

over the rest of the kernel will complete the job.

Robert Love

include/linux/list.h +24 -25
diff -urN linux-2.5.33/include/linux/list.h linux/include/linux/list.h
@@ -15,16 +15,14 @@
  * using the generic single-entry routines.
  */
 
-struct list_head {
-	struct list_head *next, *prev;
+struct list {
+	struct list *next, *prev;
 };
 
-typedef struct list_head list_t;
-
 #define LIST_HEAD_INIT(name) { &(name), &(name) }
 
 #define LIST_HEAD(name) \
-	list_t name = LIST_HEAD_INIT(name)
+	struct list name = LIST_HEAD_INIT(name)
 
 #define INIT_LIST_HEAD(ptr) do { \
 	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
@@ -36,7 +34,8 @@
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
-static inline void __list_add(list_t *new, list_t *prev, list_t *next)
+static inline void __list_add(struct list *new, struct list *prev,
+			      struct list *next)
 {
 	next->prev = new;
 	new->next = next;
@@ -52,7 +51,7 @@
  * Insert a new entry after the specified head.
  * This is good for implementing stacks.
  */
-static inline void list_add(list_t *new, list_t *head)
+static inline void list_add(struct list *new, struct list *head)
 {
 	__list_add(new, head, head->next);
 }
@@ -65,7 +64,7 @@
  * Insert a new entry before the specified head.
  * This is useful for implementing queues.
  */
-static inline void list_add_tail(list_t *new, list_t *head)
+static inline void list_add_tail(struct list *new, struct list *head)
 {
 	__list_add(new, head->prev, head);
 }
@@ -77,7 +76,7 @@
  * This is only for internal list manipulation where we know
  * the prev/next entries already!
  */
-static inline void __list_del(list_t * prev, list_t * next)
+static inline void __list_del(struct list * prev, struct list * next)
 {
 	next->prev = prev;
 	prev->next = next;
@@ -88,7 +87,7 @@
  * @entry: the element to delete from the list.
  * Note: list_empty on entry does not return true after this, the entry is in an undefined state.
  */
-static inline void list_del(list_t *entry)
+static inline void list_del(struct list *entry)
 {
 	__list_del(entry->prev, entry->next);
 	entry->next = (void *) 0;
@@ -99,7 +98,7 @@
  * list_del_init - deletes entry from list and reinitialize it.
  * @entry: the element to delete from the list.
  */
-static inline void list_del_init(list_t *entry)
+static inline void list_del_init(struct list *entry)
 {
 	__list_del(entry->prev, entry->next);
 	INIT_LIST_HEAD(entry); 
@@ -110,7 +109,7 @@
  * @list: the entry to move
  * @head: the head that will precede our entry
  */
-static inline void list_move(list_t *list, list_t *head)
+static inline void list_move(struct list *list, struct list *head)
 {
         __list_del(list->prev, list->next);
         list_add(list, head);
@@ -121,7 +120,7 @@
  * @list: the entry to move
  * @head: the head that will follow our entry
  */
-static inline void list_move_tail(list_t *list, list_t *head)
+static inline void list_move_tail(struct list *list, struct list *head)
 {
         __list_del(list->prev, list->next);
         list_add_tail(list, head);
@@ -131,16 +130,16 @@
  * list_empty - tests whether a list is empty
  * @head: the list to test.
  */
-static inline int list_empty(list_t *head)
+static inline int list_empty(struct list *head)
 {
 	return head->next == head;
 }
 
-static inline void __list_splice(list_t *list, list_t *head)
+static inline void __list_splice(struct list *list, struct list *head)
 {
-	list_t *first = list->next;
-	list_t *last = list->prev;
-	list_t *at = head->next;
+	struct list *first = list->next;
+	struct list *last = list->prev;
+	struct list *at = head->next;
 
 	first->prev = head;
 	head->next = first;
@@ -154,7 +153,7 @@
  * @list: the new list to add.
  * @head: the place to add it in the first list.
  */
-static inline void list_splice(list_t *list, list_t *head)
+static inline void list_splice(struct list *list, struct list *head)
 {
 	if (!list_empty(list))
 		__list_splice(list, head);
@@ -167,7 +166,7 @@
  *
  * The list at @list is reinitialised
  */
-static inline void list_splice_init(list_t *list, list_t *head)
+static inline void list_splice_init(struct list *list, struct list *head)
 {
 	if (!list_empty(list)) {
 		__list_splice(list, head);
@@ -177,7 +176,7 @@
 
 /**
  * list_entry - get the struct for this entry
- * @ptr:	the &list_t pointer.
+ * @ptr:	the struct list pointer.
  * @type:	the type of the struct this is embedded in.
  * @member:	the name of the list_struct within the struct.
  */
@@ -186,7 +185,7 @@
 
 /**
  * list_for_each	-	iterate over a list
- * @pos:	the &list_t to use as a loop counter.
+ * @pos:	the pointer to a struct list to use as a loop counter.
  * @head:	the head for your list.
  */
 #define list_for_each(pos, head) \
@@ -194,7 +193,7 @@
         	pos = pos->next, prefetch(pos->next))
 /**
  * list_for_each_prev	-	iterate over a list backwards
- * @pos:	the &list_t to use as a loop counter.
+ * @pos:	the pointer to a struct list to use as a loop counter.
  * @head:	the head for your list.
  */
 #define list_for_each_prev(pos, head) \
@@ -203,8 +202,8 @@
         	
 /**
  * list_for_each_safe	-	iterate over a list safe against removal of list entry
- * @pos:	the &list_t to use as a loop counter.
- * @n:		another &list_t to use as temporary storage
+ * @pos:	the pointer to a struct list to use as a loop counter.
+ * @n:		another pointer to a struct list to use as temporary storage
  * @head:	the head for your list.
  */
 #define list_for_each_safe(pos, n, head) \
#2 lore raw
Quoted 3 lines · Rusty Russell
Quoted 3 lines

This week, it spread to SCTP.
"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

Quoted 3 lines · Robert Love

I am all for your cleanup here, but two nits:
Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Seconded. Throw the whole frog in the blender, please, not just half.

Cheers,
Bill

#3 lore raw
Quoted 5 lines · On Sunday September 1, [email protected] wrote:
Quoted 3 lines · Rusty Russell
Quoted 3 lines

This week, it spread to SCTP.
"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

Quoted 7 lines
Quoted 3 lines · Robert Love

I am all for your cleanup here, but two nits:
Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Seconded. Throw the whole frog in the blender, please, not just half.

The struct in question is a handle on an element of a list, or the head of a list, but it is not a list itself. A list is a number of stuctures each of which contain (inherit from?) the particular structure. So calling it "struct list" would be wrong, because it isn't a list, only part of one.

Maybe "struct list_element" or "struct list_entry" would be OK. But I'm happy with "struct list_head", because the thing is, at least sometimes, the head of a list.

NeilBrown

#4 lore raw
Quoted 1 line · On Sunday September 1, [email protected] wrote:
Quoted 1 line

Seconded. Throw the whole frog in the blender, please, not just half.

Quoted 8 lines · Neil Brown

The struct in question is a handle on an element of a list, or the head of a list, but it is not a list itself. A list is a number of stuctures each of which contain (inherit from?) the particular structure. So calling it "struct list" would be wrong, because it isn't a list, only part of one.
Maybe "struct list_element" or "struct list_entry" would be OK. But I'm happy with "struct list_head", because the thing is, at least sometimes, the head of a list.

Why bother? It's obvious what it is, and the debate weighs more in terms of bickering over what the most descriptive possible term is than all the supposed fluff in terms of diffsize. Just give it an obvious name that doesn't require so many extraneous characters to type and rest assured in that this of all things is too obvious to mistake for anything else. This much time and effort isn't useful to spend explaining or messing with something as trivial as lists. Let names be short and kill the typedef.

Cheers,
Bill

#5 lore raw
In reply to Neil Brown

For the code in question, a list entry _is_ a list is it not? By how big a stretch of the
imagination is each entry a list in a different rotation?

----- Original Message -----
From: "Neil Brown" <[email protected]>
To: "William Lee Irwin III" <[email protected]>
Cc: "Robert Love" <[email protected]>; "Rusty Russell" <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>
Sent: Monday, September 02, 2002 4:23 PM
Subject: Re: [TRIVIAL PATCH] Remove list_t infection.

Quoted 31 lines · On Sunday September 1, [email protected] wrote:
Quoted 5 lines · Rusty Russell
Quoted 3 lines
Quoted 3 lines

This week, it spread to SCTP.
"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

Quoted 7 lines
Quoted 3 lines · Robert Love

I am all for your cleanup here, but two nits:
Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Seconded. Throw the whole frog in the blender, please, not just half.

The struct in question is a handle on an element of a list, or the head of a list, but it is not a list itself. A list is a number of stuctures each of which contain (inherit from?) the particular structure. So calling it "struct list" would be wrong, because it isn't a list, only part of one.

Maybe "struct list_element" or "struct list_entry" would be OK. But I'm happy with "struct list_head", because the thing is, at least sometimes, the head of a list.

NeilBrown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#6 lore raw
In reply to Neil Brown
Quoted 11 lines · Neil Brown
Quoted 10 lines · On Sunday September 1, [email protected] wrote:
Quoted 3 lines · Rusty Russell
Quoted 3 lines

This week, it spread to SCTP.
"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

Quoted 3 lines · Robert Love

I am all for your cleanup here, but two nits:
Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Quoted 8 lines
Quoted 2 lines

Seconded. Throw the whole frog in the blender, please, not just half.

The struct in question is a handle on an element of a list, or the head of a list, but it is not a list itself. A list is a number of stuctures each of which contain (inherit from?) the particular structure. So calling it "struct list" would be wrong, because it isn't a list, only part of one.

Pffft. A struct page isn't a page either.

Signature · 1 line
Daniel
#7 lore raw
In reply to William Lee Irwin III

From: William Lee Irwin III <[email protected]>
Date: Sun, 1 Sep 2002 23:02:57 -0700

Quoted 3 lines · Robert Love

I am all for your cleanup here, but two nits:
Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Seconded. Throw the whole frog in the blender, please, not just half.

The problem is, it isn't a "list", it's a "list header" or "list marker", ie. a list_head.

#8 lore raw
Quoted 4 lines · David S. Miller

From: William Lee Irwin III <[email protected]>
Date: Sun, 1 Sep 2002 23:02:57 -0700

On Mon, Sep 02, 2002 at 01:51:54AM -0400, Robert Love wrote:

Quoted 8 lines
Quoted 3 lines

I am all for your cleanup here, but two nits:
Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Seconded. Throw the whole frog in the blender, please, not just half.

The problem is, it isn't a "list", it's a "list header" or "list marker", ie. a list_head.

No it's not, it's nothing more nor less than a list node, identically, a list.

Signature · 1 line
Daniel
#9 lore raw

From: Daniel Phillips <[email protected]>
Date: Mon, 2 Sep 2002 12:11:53 +0200

Quoted 2 lines · David S. Miller

The problem is, it isn't a "list", it's a "list header" or "list marker", ie. a list_head.

No it's not, it's nothing more nor less than a list node, identically, a list.

A list node is markably different from "the list" itself.

A "list" is the whole of all the nodes on the list, not just one of them.

#10 lore raw
Quoted 7 lines · David S. Miller

From: Daniel Phillips <[email protected]>
Date: Mon, 2 Sep 2002 12:11:53 +0200

Quoted 2 lines · David S. Miller

The problem is, it isn't a "list", it's a "list header" or "list marker", ie. a list_head.

Quoted 7 lines

No it's not, it's nothing more nor less than a list node, identically, a list.

A list node is markably different from "the list" itself.

A "list" is the whole of all the nodes on the list, not just one of them.

Admit it, you never wrote a line of lisp ;-)

Signature · 1 line
Daniel
#11 lore raw

From: Daniel Phillips <[email protected]>
Date: Mon, 2 Sep 2002 12:16:45 +0200

Admit it, you never wrote a line of lisp ;-)

Oh contraire:

;; The most important function in this file. Use it wisely. (defun grrr (object)
"Growl at OBJECT"
(interactive "sWhat are you mad at: ")
(if (equal object "")
(message "You growl at %s" (buffer-name))
(message "You growl at %s" object)))

(defun xyzzy () (interactive) (message "nothing happens"))

;; Defun needed for rmail growling hack below.
;;
(defun growl-at-from ()
"Search for from header in mail and growl at that person" (save-excursion
(save-excursion
(goto-char 0)
(let ((case-fold-search t))
(setq from-location (search-forward "From:" nil)) (setq from-location (+ from-location 1)) (end-of-line)
(setq end-of-from-string (point))
(grrr (buffer-substring from-location end-of-from-string))))))

(add-hook 'rmail-show-message-hook 'growl-at-from)

;; Magic defun to grrr at people who send you mail. (defun rmail-maybe-set-message-counters ()
"Same as normal defun in rmail.el except here
we growl at whoever the mail is from. Pretty crufty eh?"
(if (not (and rmail-deleted-vector
rmail-message-vector rmail-current-message rmail-total-messages))
(rmail-set-message-counters))
(growl-at-from))

#12 lore raw
Quoted 6 lines · David S. Miller

From: Daniel Phillips <[email protected]>
Date: Mon, 2 Sep 2002 12:16:45 +0200

Admit it, you never wrote a line of lisp ;-)

Oh contraire:

[lots of irritating silly parentheses]

Great! Now we can communicate. (cdr from-location) is:

a) a list

or

b) a list marker?

Signature · 1 line
Daniel
#13 lore raw

From: Daniel Phillips <[email protected]>
Date: Mon, 2 Sep 2002 12:25:13 +0200

Great! Now we can communicate. (cdr from-location) is:

a) a list

or

b) a list marker?

It is a lisp object.

#14 lore raw
In reply to David S. Miller
Quoted 3 lines · David S. Miller

A list node is markably different from "the list" itself. A "list" is the whole of all the nodes on the list, not just one of them.

Linus will be the final arbiter of taste here. I've largely said my peace, but will step forth from the shadows long enough to say the decision here (and dear gawd, this is a trivial issue) hinges on this:
(1) one may describe the data structure as accurately as possible, so struct list_marker, struct list_node, or (gawd forbid) struct list_head is the proper name in this context.
(2) brevity is the soul of wit, and the rest may be assumed to be the burden of knowing how to program, so struct list must be twisted a very small bit so it's understood this is a list node and/or head when the abbreviated name is used.
At this point, I beg of you all, defer to Linus and produce useful things instead of debating this kind of issue endlessly. It's basic. It's fundamental. It's trivial. And it's his kernel. Yes, I'm authoritarian, and no, I'm not in charge. These simple things are too easy to debate. The real coding lies elsewhere. Now let's move on please.

Thanks,
Bill

#15 lore raw
In reply to David S. Miller
Quoted 4 lines · David S. Miller

A list node is markably different from "the list" itself.

A "list" is the whole of all the nodes on the list, not just one of them.

Quite.

And that is why there should be _two_ types:

1. struct list
2. struct list_node

With these two types, `list_add' et al. can actually _check_ that you got the arguments the right way around.

-- Jamie

#16 lore raw
Quoted 6 lines · Jamie Lokier

1. struct list
2. struct list_node

With these two types, `list_add' et al. can actually _check_ that you got the arguments the right way around.

Well, the thing is, one of the _advantages_ of "struct list_head" is exactly the fact that the implementation is 100% agnostic about whether a list entry is the head, or just part of the list.

This was actually _the_ major design goal for me. I know the "struct list_head" interfaces are kind of weird (some people initially really didn't like the fact that you had to use magic macros to convert from lists to the containing structures etc, and it's funny to think that a few years ago that list structure was considered "strange"), but the fact that any list entry can be the head of the list was very important.

Some uses of list_head uses "traditional" heads for the linked lists (as heads for hashing etc), while many others just build up the list of all entries, and each entry is a head in its own right and there is no "external head" at all.

That's important. And you'd lose that if list_add() and friends tried to distinguish between a list head and a list entry.

Linus

#17 lore raw

In message <[email protected]> you
write:

Quoted 6 lines · Jamie Lokier
Quoted 4 lines

1. struct list
2. struct list_node

Quoted 6 lines
Quoted 2 lines

With these two types, `list_add' et al. can actually _check_ that you got the arguments the right way around.

Well, the thing is, one of the _advantages_ of "struct list_head" is exactly the fact that the implementation is 100% agnostic about whether a list entry is the head, or just part of the list.

Excellent. Well I'm glad that's sorted.

Now please apply my patch (which got sidelined by nomenclature fetishers), Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

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

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

include/linux/device.h +3 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/device.h .22733-linux-2.5.33.updated/include/linux/device.h
@@ -57,9 +57,9 @@ struct bus_type {
 	rwlock_t		lock;
 	atomic_t		refcount;
 
-	list_t			node;
-	list_t			devices;
-	list_t			drivers;
+	struct list_head	node;
+	struct list_head	devices;
+	struct list_head	drivers;
 
 	struct driver_dir_entry	dir;
 	struct driver_dir_entry	device_dir;
include/linux/fs.h +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/fs.h .22733-linux-2.5.33.updated/include/linux/fs.h
@@ -322,8 +322,8 @@ struct address_space {
 	struct list_head	io_pages;	/* being prepared for I/O */
 	unsigned long		nrpages;	/* number of total pages */
 	struct address_space_operations *a_ops;	/* methods */
-	list_t			i_mmap;		/* list of private mappings */
-	list_t			i_mmap_shared;	/* list of private mappings */
+	struct list_head	i_mmap;		/* list of private mappings */
+	struct list_head	i_mmap_shared;	/* list of private mappings */
 	spinlock_t		i_shared_lock;  /* and spinlock protecting it */
 	unsigned long		dirtied_when;	/* jiffies of first page dirtying */
 	int			gfp_mask;	/* how to allocate the pages */
include/linux/list.h +26 -23

153 lines not on this page · raw message

include/linux/mm.h +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/mm.h .22733-linux-2.5.33.updated/include/linux/mm.h
@@ -61,7 +61,7 @@ struct vm_area_struct {
 	 * one of the address_space->i_mmap{,shared} lists,
 	 * for shm areas, the list of attaches, otherwise unused.
 	 */
-	list_t shared;
+	struct list_head shared;
 
 	/* Function pointers to deal with this struct. */
 	struct vm_operations_struct * vm_ops;
include/linux/sched.h +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/sched.h .22733-linux-2.5.33.updated/include/linux/sched.h
@@ -264,7 +264,7 @@ struct task_struct {
 	int lock_depth;		/* Lock depth */
 
 	int prio, static_prio;
-	list_t run_list;
+	struct list_head run_list;
 	prio_array_t *array;
 
 	unsigned long sleep_avg;
include/net/sctp/structs.h +9 -9
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/net/sctp/structs.h .22733-linux-2.5.33.updated/include/net/sctp/structs.h
@@ -203,7 +203,7 @@ struct SCTP_protocol {
 	/* This is a list of groups of functions for each address
 	 * family that we support.
 	 */
-	list_t address_families;
+	struct list_head address_families;
 
 	/* This is the hash of all endpoints. */
 	int ep_hashsize;
@@ -225,7 +225,7 @@ struct SCTP_protocol {
 	 *
 	 * It is a list of struct sockaddr_storage_list.
 	 */
-	list_t local_addr_list;
+	struct list_head local_addr_list;
 	spinlock_t local_addr_lock;
 };
 
@@ -250,7 +250,7 @@ typedef struct sctp_func {
 	__u16		net_header_len;	
 	int		sockaddr_len;
 	sa_family_t	sa_family;
-	list_t          list;
+	struct list_head list;
 } sctp_func_t;
 
 sctp_func_t *sctp_get_af_specific(const sockaddr_storage_t *address);
@@ -494,7 +494,7 @@ const sockaddr_storage_t *sctp_source(co
  * sin_addr -- cast to either (struct in_addr) or (struct in6_addr)
  */
 struct sockaddr_storage_list {
-	list_t list;
+	struct list_head list;
 	sockaddr_storage_t a;
 };
 
@@ -582,7 +582,7 @@ void sctp_packet_free(sctp_packet_t *);
  */
 struct SCTP_transport {
 	/* A list of transports. */
-	list_t transports;
+	struct list_head transports;
 
 	/* Reference counting. */
 	atomic_t refcnt;
@@ -863,7 +863,7 @@ struct SCTP_bind_addr {
 	 *	has bound.  This information is passed to one's
 	 *	peer(s) in INIT and INIT ACK chunks.
 	 */
-	list_t address_list;
+	struct list_head address_list;
 
 	int malloced;        /* Are we kfree()able?  */
 };
@@ -988,7 +988,7 @@ struct SCTP_endpoint {
 	 *            is implemented.
 	 */
 	/* This is really a list of sctp_association_t entries. */
-	list_t asocs;
+	struct list_head asocs;
 
 	/* Secret Key: A secret key used by this endpoint to compute
 	 *            the MAC.  This SHOULD be a cryptographic quality
@@ -1070,7 +1070,7 @@ struct SCTP_association {
 	sctp_endpoint_common_t base;
 
 	/* Associations on the same socket. */
-	list_t asocs;
+	struct list_head asocs;
 
 	/* This is a signature that lets us know that this is a
 	 * sctp_association_t data structure.  Used for mapping an
@@ -1104,7 +1104,7 @@ struct SCTP_association {
 		 *
 		 * It is a list of SCTP_transport's.
 		 */
-		list_t transport_addr_list;
+		struct list_head transport_addr_list;
 
 		/* port
 		 *   The transport layer port number.
kernel/exit.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/kernel/exit.c .22733-linux-2.5.33.updated/kernel/exit.c
@@ -407,7 +407,7 @@ void exit_mm(struct task_struct *tsk)
 static inline void forget_original_parent(struct task_struct * father)
 {
 	struct task_struct *p, *reaper;
-	list_t *_p;
+	struct list_head *_p;
 
 	read_lock(&tasklist_lock);
 
@@ -477,7 +477,7 @@ static inline void zap_thread(task_t *p,
 static void exit_notify(void)
 {
 	struct task_struct *t;
-	list_t *_p, *_n;
+	struct list_head *_p, *_n;
 
 	forget_original_parent(current);
 	/*
kernel/sched.c +5 -5
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/kernel/sched.c .22733-linux-2.5.33.updated/kernel/sched.c
@@ -133,7 +133,7 @@ typedef struct runqueue runqueue_t;
 struct prio_array {
 	int nr_active;
 	unsigned long bitmap[BITMAP_SIZE];
-	list_t queue[MAX_PRIO];
+	struct list_head queue[MAX_PRIO];
 };
 
 /*
@@ -152,7 +152,7 @@ struct runqueue {
 	int prev_nr_running[NR_CPUS];
 
 	task_t *migration_thread;
-	list_t migration_queue;
+	struct list_head migration_queue;
 
 } ____cacheline_aligned;
 
@@ -739,7 +739,7 @@ static void load_balance(runqueue_t *thi
 	int imbalance, idx, this_cpu = smp_processor_id();
 	runqueue_t *busiest;
 	prio_array_t *array;
-	list_t *head, *curr;
+	struct list_head *head, *curr;
 	task_t *tmp;
 
 	busiest = find_busiest_queue(this_rq, this_cpu, idle, &imbalance);
@@ -937,7 +937,7 @@ asmlinkage void schedule(void)
 	task_t *prev, *next;
 	runqueue_t *rq;
 	prio_array_t *array;
-	list_t *queue;
+	struct list_head *queue;
 	int idx;
 
 	if (unlikely(in_interrupt()))
@@ -1899,7 +1899,7 @@ void __init init_idle(task_t *idle, int 
  */
 
 typedef struct {
-	list_t list;
+	struct list_head list;
 	task_t *task;
 	struct completion done;
 } migration_req_t;
mm/memory.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/mm/memory.c .22733-linux-2.5.33.updated/mm/memory.c
@@ -1033,11 +1033,11 @@ no_mem:
 	return VM_FAULT_OOM;
 }
 
-static void vmtruncate_list(list_t *head, unsigned long pgoff)
+static void vmtruncate_list(struct list_head *head, unsigned long pgoff)
 {
 	unsigned long start, end, len, diff;
 	struct vm_area_struct *vma;
-	list_t *curr;
+	struct list_head *curr;
 
 	list_for_each(curr, head) {
 		vma = list_entry(curr, struct vm_area_struct, shared);
mm/page_alloc.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/mm/page_alloc.c .22733-linux-2.5.33.updated/mm/page_alloc.c
@@ -237,7 +237,7 @@ int is_head_of_free_region(struct page *
         struct zone *zone = page_zone(page);
         unsigned long flags;
 	int order;
-	list_t *curr;
+	struct list_head *curr;
 
 	/*
 	 * Should not matter as we need quiescent system for
@@ -652,7 +652,7 @@ void show_free_areas(void)
 
 	for (pgdat = pgdat_list; pgdat; pgdat = pgdat->pgdat_next)
 		for (type = 0; type < MAX_NR_ZONES; type++) {
-			list_t *elem;
+			struct list_head *elem;
 			struct zone *zone = &pgdat->node_zones[type];
  			unsigned long nr, flags, order, total = 0;
 
net/sctp/associola.c +6 -6
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/associola.c .22733-linux-2.5.33.updated/net/sctp/associola.c
@@ -296,7 +296,7 @@ void sctp_association_free(sctp_associat
 {
 	sctp_transport_t *transport;
 	sctp_endpoint_t *ep;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 	int i;
 
 	ep = asoc->ep;
@@ -482,7 +482,7 @@ sctp_transport_t *sctp_assoc_lookup_padd
 					  const sockaddr_storage_t *address)
 {
 	sctp_transport_t *t;
-	list_t *pos;
+	struct list_head *pos;
 
 	/* Cycle through all transports searching for a peer address. */
 
@@ -508,7 +508,7 @@ void sctp_assoc_control_transport(sctp_a
 	sctp_transport_t *first;
 	sctp_transport_t *second;
 	sctp_ulpevent_t *event;
-	list_t *pos;
+	struct list_head *pos;
 	int spc_state = 0;
 
 	/* Record the transition on the transport.  */
@@ -780,7 +780,7 @@ sctp_transport_t *sctp_assoc_lookup_tsn(
 {
 	sctp_transport_t *active;
 	sctp_transport_t *match;
-	list_t *entry, *pos;
+	struct list_head *entry, *pos;
 	sctp_transport_t *transport;
 	sctp_chunk_t *chunk;
 	__u32 key = htonl(tsn);
@@ -983,8 +983,8 @@ void sctp_assoc_update(sctp_association_
 sctp_transport_t *sctp_assoc_choose_shutdown_transport(sctp_association_t *asoc)
 {
 	sctp_transport_t *t, *next;
-	list_t *head = &asoc->peer.transport_addr_list;
-	list_t *pos;
+	struct list_head *head = &asoc->peer.transport_addr_list;
+	struct list_head *pos;
 
 	/* If this is the first time SHUTDOWN is sent, use the active
 	 * path.
net/sctp/bind_addr.c +5 -5
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/bind_addr.c .22733-linux-2.5.33.updated/net/sctp/bind_addr.c
@@ -65,7 +65,7 @@ int sctp_bind_addr_copy(sctp_bind_addr_t
 			sctp_scope_t scope, int priority, int flags)
 {
 	struct sockaddr_storage_list *addr;
-	list_t *pos;
+	struct list_head *pos;
 	int error = 0;
 
 	/* All addresses share the same port.  */
@@ -119,7 +119,7 @@ void sctp_bind_addr_init(sctp_bind_addr_
 static void sctp_bind_addr_clean(sctp_bind_addr_t *bp)
 {
 	struct sockaddr_storage_list *addr;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	/* Empty the bind address list. */
 	list_for_each_safe(pos, temp, &bp->address_list) {
@@ -173,7 +173,7 @@ int sctp_add_bind_addr(sctp_bind_addr_t 
  */
 int sctp_del_bind_addr(sctp_bind_addr_t *bp, sockaddr_storage_t *del_addr)
 {
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 	struct sockaddr_storage_list *addr;
 
 	list_for_each_safe(pos, temp, &bp->address_list) {
@@ -206,7 +206,7 @@ sctpParam_t sctp_bind_addrs_to_raw(const
 	sctpIpAddress_t rawaddr_space;
 	int len;
 	struct sockaddr_storage_list *addr;
-	list_t *pos;
+	struct list_head *pos;
 
 	retval.v = NULL;
 	addrparms_len = 0;
@@ -284,7 +284,7 @@ int sctp_raw_to_bind_addrs(sctp_bind_add
 int sctp_bind_addr_has_addr(sctp_bind_addr_t *bp, const sockaddr_storage_t *addr)
 {
 	struct sockaddr_storage_list *laddr;
-	list_t *pos;
+	struct list_head *pos;
 
 	list_for_each(pos, &bp->address_list) {
 		laddr = list_entry(pos, struct sockaddr_storage_list, list);
net/sctp/endpointola.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/endpointola.c .22733-linux-2.5.33.updated/net/sctp/endpointola.c
@@ -257,7 +257,7 @@ sctp_association_t *__sctp_endpoint_look
 {
 	int rport;
 	sctp_association_t *asoc;
-	list_t *pos;
+	struct list_head *pos;
 
 	rport = paddr->v4.sin_port;
 
net/sctp/outqueue.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/outqueue.c .22733-linux-2.5.33.updated/net/sctp/outqueue.c
@@ -104,7 +104,7 @@ void sctp_outqueue_init(sctp_association
 void sctp_outqueue_teardown(sctp_outqueue_t *q)
 {
 	sctp_transport_t *transport;
-	list_t *lchunk, *pos;
+	struct list_head *lchunk, *pos;
 	sctp_chunk_t *chunk;
 
 	/* Throw away unacknowledged chunks. */
@@ -948,7 +948,7 @@ static void sctp_sack_update_unack_data(
 int sctp_sack_outqueue(sctp_outqueue_t *q, sctp_sackhdr_t *sack)
 {
 	sctp_chunk_t *tchunk;
-	list_t *lchunk, *transport_list, *pos;
+	struct list_head *lchunk, *transport_list, *pos;
 	__u32 tsn;
 	__u32 sack_ctsn;
 	__u32 ctsn;
net/sctp/protocol.c +3 -3
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/protocol.c .22733-linux-2.5.33.updated/net/sctp/protocol.c
@@ -198,7 +198,7 @@ static void sctp_get_local_addr_list(sct
 static void __sctp_free_local_addr_list(sctp_protocol_t *proto)
 {
 	struct sockaddr_storage_list *addr;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	list_for_each_safe(pos, temp, &proto->local_addr_list) {
 		addr = list_entry(pos, struct sockaddr_storage_list, list);
@@ -223,7 +223,7 @@ int sctp_copy_local_addr_list(sctp_proto
 {
 	struct sockaddr_storage_list *addr;
 	int error = 0;
-	list_t *pos;
+	struct list_head *pos;
 	long flags __attribute__ ((unused));
 
 	sctp_spin_lock_irqsave(&proto->local_addr_lock, flags);
@@ -327,7 +327,7 @@ int sctp_ctl_sock_init(void)
  */
 sctp_func_t *sctp_get_af_specific(const sockaddr_storage_t *address)
 {
-	list_t *pos;
+	struct list_head *pos;
 	sctp_protocol_t *proto = sctp_get_protocol();
 	sctp_func_t *retval, *af;
 
net/sctp/sm_make_chunk.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/sm_make_chunk.c .22733-linux-2.5.33.updated/net/sctp/sm_make_chunk.c
@@ -1417,7 +1417,7 @@ void sctp_process_init(sctp_association_
 	sctpParam_t param;
 	__u8 *end;
 	sctp_transport_t *transport;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	/* We must include the address that the INIT packet came from.
 	 * This is the only address that matters for an INIT packet.
net/sctp/sm_sideeffect.c +2 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/sm_sideeffect.c .22733-linux-2.5.33.updated/net/sctp/sm_sideeffect.c
@@ -1053,7 +1053,7 @@ static void sctp_cmd_hb_timers_start(sct
 				     sctp_association_t *asoc)
 {
 	sctp_transport_t *t;
-	list_t *pos;
+	struct list_head *pos;
 
 	/* Start a heartbeat timer for each transport on the association.
 	 * hold a reference on the transport to make sure none of
@@ -1072,7 +1072,7 @@ static void sctp_cmd_hb_timers_start(sct
 void sctp_cmd_set_bind_addrs(sctp_cmd_seq_t *cmds, sctp_association_t *asoc,
 			     sctp_bind_addr_t *bp)
 {
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	list_for_each_safe(pos, temp, &bp->address_list) {
 		list_del_init(pos);
net/sctp/sm_statefuns.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/sm_statefuns.c .22733-linux-2.5.33.updated/net/sctp/sm_statefuns.c
@@ -1056,7 +1056,7 @@ static sctp_disposition_t sctp_sf_do_dup
 	sctp_ulpevent_t *ev;
 	sctp_chunk_t *repl;
 	sctp_transport_t *new_addr, *addr;
-	list_t *pos, *pos2, *temp;
+	struct list_head *pos, *pos2, *temp;
 	int found, error;
 
 	/* new_asoc is a brand-new association, so these are not yet
net/sctp/socket.c +6 -6
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/net/sctp/socket.c .22733-linux-2.5.33.updated/net/sctp/socket.c
@@ -439,7 +439,7 @@ err_bindx_add:
 #if CONFIG_IP_SCTP_ADDIP
 	/* Add these addresses to all associations on this endpoint.  */
 	if (retval >= 0) {
-		list_t *pos;
+		struct list_head *pos;
 		sctp_endpoint_t *ep;
 		sctp_association_t *asoc;
 		ep = sctp_sk(sk)->ep;
@@ -560,7 +560,7 @@ err_bindx_rem:
 #if CONFIG_IP_SCTP_ADDIP
 	/* Remove these addresses from all associations on this endpoint.  */
 	if (retval >= 0) {
-		list_t *pos;
+		struct list_head *pos;
 		sctp_endpoint_t *ep;
 		sctp_association_t *asoc;
 
@@ -666,7 +666,7 @@ static void sctp_close(struct sock *sk, 
 {
 	sctp_endpoint_t *ep;
 	sctp_association_t *asoc;
-	list_t *pos, *temp;
+	struct list_head *pos, *temp;
 
 	SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p...)\n", sk);
 
@@ -1238,7 +1238,7 @@ static int sctp_setsockopt(struct sock *
 	int retval = 0;
 	char * tmp;
 	sctp_protocol_t *proto = sctp_get_protocol();
-	list_t *pos;
+	struct list_head *pos;
 	sctp_func_t *af;
 
 	SCTP_DEBUG_PRINTK("sctp_setsockopt(sk: %p... optname: %d)\n",
@@ -1661,7 +1661,7 @@ static int sctp_getsockopt(struct sock *
 	int retval = 0;
 	sctp_protocol_t *proto = sctp_get_protocol();
 	sctp_func_t *af;
-	list_t *pos;
+	struct list_head *pos;
 	int len;
 
 	SCTP_DEBUG_PRINTK("sctp_getsockopt(sk: %p, ...)\n", sk);
@@ -2649,7 +2649,7 @@ static void __sctp_write_space(sctp_asso
 void sctp_write_space(struct sock *sk)
 {
 	sctp_association_t *asoc;
-	list_t *pos;
+	struct list_head *pos;
 
 	/* Wake up the tasks in each wait queue.  */
 	list_for_each(pos, &((sctp_sk(sk))->ep->asocs)) {
#18 lore raw
Quoted 11 lines · Rusty Russell

In message <[email protected]> you
write:

Quoted 9 lines · Jamie Lokier
Quoted 6 lines

1. struct list
2. struct list_node

With these two types, `list_add' et al. can actually _check_ that you got the arguments the right way around.

Quoted 7 lines
Quoted 3 lines

Well, the thing is, one of the _advantages_ of "struct list_head" is exactly the fact that the implementation is 100% agnostic about whether a list entry is the head, or just part of the list.

Excellent. Well I'm glad that's sorted.

Now please apply my patch (which got sidelined by nomenclature fetishers),

Yep, half a frog in the blender is better than no frog.

Signature · 1 line
Daniel
#19 lore raw
Quoted 2 lines · Daniel Phillips

Yep, half a frog in the blender is better than no frog.

Quite frankly, I'd rather have no frogs at all in my blenders, thank you very much.

I'll take my blenders with ice, tequila, triple sec and some lemon juice, thank you very much.

Frogs indeed! Spare me.

Linus

#20 lore raw

In message <[email protected]> you wri te:

Quoted 12 lines · Daniel Phillips
Quoted 2 lines

Yep, half a frog in the blender is better than no frog.

Quite frankly, I'd rather have no frogs at all in my blenders, thank you very much.

I'll take my blenders with ice, tequila, triple sec and some lemon juice, thank you very much.

Frogs indeed! Spare me.

I'm confused, but I do know three things:

1) list_t *bad*,

2) Grand renaming of "struct list_head" *bad*, and

3) There's a punchline about frogs, blenders and mixed metaphores coming soon.

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

#21 lore raw
Quoted 2 lines · On 2002.09.04 Rusty Russell wrote:

In message <[email protected]> you wri te:

...

Quoted 7 lines

I'm confused, but I do know three things:

1) list_t *bad*,

2) Grand renaming of "struct list_head" *bad*, and

Why not something like:

struct list_node {
    struct list_node *prev;
    struct list_node *next;
}
struct list {
    struct list_node *prev;
    struct list_node *next;
}   

list_length(struct list *l) list_add(struct list_node *new, struct list *head) list_splice(struct list *list, struct list *head)

New:

#define list_sublist_from(node) ((struct list *)node)

So people would be forced to think if he is using a 'list_head' as a node or as a sublist, and do the right casts to shut up the compiler (that's why you can't do a typedef list_node list..., for the compiler to scream...)

Signature · 4 lines
J.A. Magallon <[email protected]>      \                 Software is like sex:
werewolf.able.es                         \           It's better when it's free
Mandrake Linux release 9.0 (Cooker) for i586
Linux 2.4.20-pre5-j0 (gcc 3.2 (Mandrake Linux 9.0 3.2-1mdk))
#22 lore raw
In reply to Daniel Phillips

Hi,

Quoted 1 line · Daniel Phillips

Yep, half a frog in the blender is better than no frog.

No, it's a complete frog. The thing you're talking about is another. And since the second frog can wait...

Thunder

Signature · 4 lines
--./../...-/. -.--/---/..-/.-./..././.-../..-. .---/..-/.../- .-
--/../-./..-/-/./--..-- ../.----./.-../.-.. --./../...-/. -.--/---/..-
.- -/---/--/---/.-./.-./---/.--/.-.-.-
--./.-/-.../.-./.././.-../.-.-.-
#23 lore raw
In reply to William Lee Irwin III
Quoted 11 lines · William Lee Irwin III
Quoted 3 lines · Rusty Russell
Quoted 3 lines

This week, it spread to SCTP.
"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

Quoted 3 lines · Robert Love

I am all for your cleanup here, but two nits:
Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Seconded. Throw the whole frog in the blender, please, not just half.

Thirded.

Signature · 1 line
Daniel
#24 lore raw
In reply to Robert Love

In message <1030945918.939.3143.camel@phantasy> you write:

Quoted 11 lines · Rusty Russell
Quoted 5 lines

This week, it spread to SCTP.

"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

I am all for your cleanup here, but two nits:

Why not rename list_head while at it? I would vote for just "struct list" ... the name is long, and I like my lines to fit 80 columns.

Because renaming breaks things for no good reason. "list_head is ugly" is insufficient cause: it doesn't cause bugs (cf. skb_realloc).

You want to clean up some ugliness? Find every list_for_each/list_entry pair and substitute list_for_each_entry().

Quoted 3 lines

Second, if we want to force people to change, we should remove "list_t" too to prevent new uses creeping in. Plus, like Linus says, it is often to break stuff and cleanup the mess...

I did: see the patch.

Really, I don't care whether it's "struct list_head" or "list_t", but both is stupid. And since struct list_head is backwards compatible, that's the winner here.

As someone who has been slowly feeding ISO-C declarated initializers into 2.5, I am acutely aware of the cost of widespread change.

Hope that clarifies,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#25 lore raw
In reply to Rusty Russell
Quoted 5 lines · Rusty Russell

This week, it spread to SCTP.

"struct list_head" isn't a great name, but having two names for everything is yet another bar to reading kernel source.

[...]

Quoted 5 lines

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

Good, I see it was actually a *good* thing that I've done a 's/struct list_head/list_t' in list.h, back when I was adding list_move_*().

Otherwise, we wouldn't have noticed much the appearance of list_t, and it might have spread throughout the kernel by the time we reach 2.6.0.

task_t, anyone?

Signature · 2 lines
Dan Aloni
[email protected]
#26 lore raw
Quoted 1 line · Dan Aloni

task_t, anyone?

I actually like task_t, and it is my lone typedef exception, but maybe I am the exception...

My real complaint against typedefs (and list_t in particular) is their inconsistent use. I think we have done a good job universally using task_t vs struct task_struct, and thus its not an issue to keep it... On the other hand, I would not scream too loudly over its removal.

Anyhow, I think any change should be ack'ed by Ingo because its his code and he deals with it a disappropriately large amount of the time.

Robert Love

#27 lore raw
In reply to Dan Aloni

In message <[email protected]> you write:

Quoted 1 line

task_t, anyone?

Great minds think alike. Mainly in the scheduler, but some leakage into exit.c and fork.c.

This one's worse than list_t, since you often want to pass "struct task_struct *" without requiring the definition.

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 working-2.5.33-cset-1.621/Documentation/sched-coding.txt working-2.5.33-cset-1.621-task_t/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 working-2.5.33-cset-1.621/arch/alpha/kernel/process.c working-2.5.33-cset-1.621-task_t/arch/alpha/kernel/process.c
@@ -441,7 +441,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 working-2.5.33-cset-1.621/arch/ia64/kernel/smpboot.c working-2.5.33-cset-1.621-task_t/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 +10 -12
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.33-cset-1.621/include/linux/sched.h working-2.5.33-cset-1.621-task_t/include/linux/sched.h
@@ -143,10 +143,8 @@ struct completion;
 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);
@@ -423,14 +421,14 @@ 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 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 idle_cpu(int cpu);
 
 void yield(void);
@@ -512,7 +510,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)
@@ -657,7 +655,7 @@ extern void exit_sighand(struct task_str
 
 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 *);
@@ -666,8 +664,8 @@ extern void FASTCALL(add_wait_queue(wait
 extern void FASTCALL(add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t * wait));
 extern void FASTCALL(remove_wait_queue(wait_queue_head_t *q, wait_queue_t * wait));
 
-extern void wait_task_inactive(task_t * p);
-extern void kick_if_running(task_t * p);
+extern void wait_task_inactive(struct task_struct * p);
+extern void kick_if_running(struct task_struct * p);
 
 #define __wait_event(wq, condition) 					\
 do {									\
kernel/capability.c +4 -4
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.33-cset-1.621/kernel/capability.c working-2.5.33-cset-1.621-task_t/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 *target;
+     struct task_struct *target;
 
      for_each_task(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 *target;
+     struct task_struct *target;
 
      for_each_task(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 +5 -2
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.33-cset-1.621/kernel/exit.c working-2.5.33-cset-1.621-task_t/kernel/exit.c
@@ -237,7 +237,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 */
 	p->exit_signal = SIGCHLD;
@@ -443,7 +445,8 @@ static inline void forget_original_paren
 	read_unlock(&tasklist_lock);
 }
 
-static inline void zap_thread(task_t *p, task_t *father)
+static inline void zap_thread(struct task_struct *p,
+			      struct task_struct *father)
 {
 	ptrace_unlink(p);
 	list_del_init(&p->sibling);
kernel/fork.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.33-cset-1.621/kernel/fork.c working-2.5.33-cset-1.621-task_t/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 working-2.5.33-cset-1.621/kernel/ptrace.c working-2.5.33-cset-1.621-task_t/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 +42 -40

315 lines not on this page · raw message

kernel/timer.c +1 -1
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.33-cset-1.621/kernel/timer.c working-2.5.33-cset-1.621-task_t/kernel/timer.c
@@ -788,7 +788,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.