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.
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
--- .22733-linux-2.5.33/include/linux/device.h 2002-08-28 09:29:52.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/device.h 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/include/linux/fs.h 2002-08-28 09:29:52.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/fs.h 2002-09-02 15:15:09.000000000 +1000
@@ -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 */
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/list.h .22733-linux-2.5.33.updated/include/linux/list.h
--- .22733-linux-2.5.33/include/linux/list.h 2002-09-01 12:23:07.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/list.h 2002-09-02 15:15:09.000000000 +1000
@@ -19,12 +19,10 @@ struct list_head {
struct list_head *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_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
@@ -36,7 +34,9 @@ typedef struct list_head list_t;
* 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_head *new,
+ struct list_head *prev,
+ struct list_head *next)
{
next->prev = new;
new->next = next;
@@ -52,7 +52,7 @@ static inline void __list_add(list_t *ne
* 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_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
@@ -65,7 +65,7 @@ static inline void list_add(list_t *new,
* 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_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
@@ -77,7 +77,7 @@ static inline void list_add_tail(list_t
* 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_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
@@ -88,7 +88,7 @@ static inline void __list_del(list_t * p
* @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_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (void *) 0;
@@ -99,7 +99,7 @@ static inline void list_del(list_t *entr
* 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_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
@@ -110,7 +110,7 @@ static inline void list_del_init(list_t
* @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_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
@@ -121,7 +121,8 @@ static inline void list_move(list_t *lis
* @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_head *list,
+ struct list_head *head)
{
__list_del(list->prev, list->next);
list_add_tail(list, head);
@@ -131,16 +132,17 @@ static inline void list_move_tail(list_t
* 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 *head)
{
return head->next == head;
}
-static inline void __list_splice(list_t *list, list_t *head)
+static inline void __list_splice(struct list_head *list,
+ struct list_head *head)
{
- list_t *first = list->next;
- list_t *last = list->prev;
- list_t *at = head->next;
+ struct list_head *first = list->next;
+ struct list_head *last = list->prev;
+ struct list_head *at = head->next;
first->prev = head;
head->next = first;
@@ -154,7 +156,7 @@ static inline void __list_splice(list_t
* @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_head *list, struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head);
@@ -167,7 +169,8 @@ static inline void list_splice(list_t *l
*
* 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_head *list,
+ struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head);
@@ -177,7 +180,7 @@ static inline void list_splice_init(list
/**
* list_entry - get the struct for this entry
- * @ptr: the &list_t pointer.
+ * @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
@@ -186,7 +189,7 @@ static inline void list_splice_init(list
/**
* list_for_each - iterate over a list
- * @pos: the &list_t to use as a loop counter.
+ * @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
*/
#define list_for_each(pos, head) \
@@ -194,7 +197,7 @@ static inline void list_splice_init(list
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 &struct list_head to use as a loop counter.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
@@ -203,8 +206,8 @@ static inline void list_splice_init(list
/**
* 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 &struct list_head to use as a loop counter.
+ * @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
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
--- .22733-linux-2.5.33/include/linux/mm.h 2002-09-01 12:23:07.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/mm.h 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/include/linux/sched.h 2002-09-01 12:23:07.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/sched.h 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/include/net/sctp/structs.h 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/net/sctp/structs.h 2002-09-02 15:17:45.000000000 +1000
@@ -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.
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
--- .22733-linux-2.5.33/kernel/exit.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/kernel/exit.c 2002-09-02 15:15:09.000000000 +1000
@@ -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);
/*
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
--- .22733-linux-2.5.33/kernel/sched.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/kernel/sched.c 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/mm/memory.c 2002-08-28 09:29:54.000000000 +1000
+++ .22733-linux-2.5.33.updated/mm/memory.c 2002-09-02 15:15:09.000000000 +1000
@@ -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);
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
--- .22733-linux-2.5.33/mm/page_alloc.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/mm/page_alloc.c 2002-09-02 15:15:21.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/associola.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/associola.c 2002-09-02 15:18:21.000000000 +1000
@@ -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.
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
--- .22733-linux-2.5.33/net/sctp/bind_addr.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/bind_addr.c 2002-09-02 15:18:29.000000000 +1000
@@ -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);
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
--- .22733-linux-2.5.33/net/sctp/endpointola.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/endpointola.c 2002-09-02 15:18:39.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/outqueue.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/outqueue.c 2002-09-02 15:18:44.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/protocol.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/protocol.c 2002-09-02 15:18:54.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/sm_make_chunk.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/sm_make_chunk.c 2002-09-02 15:18:59.000000000 +1000
@@ -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.
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
--- .22733-linux-2.5.33/net/sctp/sm_sideeffect.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/sm_sideeffect.c 2002-09-02 15:19:03.000000000 +1000
@@ -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);
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
--- .22733-linux-2.5.33/net/sctp/sm_statefuns.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/sm_statefuns.c 2002-09-02 15:19:11.000000000 +1000
@@ -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
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
--- .22733-linux-2.5.33/net/sctp/socket.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/socket.c 2002-09-02 15:19:18.000000000 +1000
@@ -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)) {
On Mon, 2002-09-02 at 01:23, Rusty Russell wrote:
> 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
diff -urN linux-2.5.33/include/linux/list.h linux/include/linux/list.h
--- linux-2.5.33/include/linux/list.h Sun Sep 01 15:26:31 2002
+++ linux/include/linux/list.h Mon Sep 2 01:44:43 2002
@@ -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) \
On Mon, 2002-09-02 at 01:23, Rusty Russell wrote:
>> 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.
On Mon, Sep 02, 2002 at 01:51:54AM -0400, Robert Love wrote:
> 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
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:
> 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.
On Sunday September 1, [email protected] wrote:
> On Mon, 2002-09-02 at 01:23, Rusty Russell wrote:
> >> 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.
>
> On Mon, Sep 02, 2002 at 01:51:54AM -0400, Robert Love wrote:
> > 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
On Sunday September 1, [email protected] wrote:
>> Seconded. Throw the whole frog in the blender, please, not just half.
On Mon, Sep 02, 2002 at 04:23:55PM +1000, Neil Brown wrote:
> 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
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.
> On Sunday September 1, [email protected] wrote:
> > On Mon, 2002-09-02 at 01:23, Rusty Russell wrote:
> > >> 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.
> >
> > On Mon, Sep 02, 2002 at 01:51:54AM -0400, Robert Love wrote:
> > > 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/
>
In message <1030945918.939.3143.camel@phantasy> you write:
> On Mon, 2002-09-02 at 01:23, Rusty Russell wrote:
>
> > 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().
> 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.
On Monday 02 September 2002 08:02, William Lee Irwin III wrote:
> On Mon, 2002-09-02 at 01:23, Rusty Russell wrote:
> >> 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.
>
> On Mon, Sep 02, 2002 at 01:51:54AM -0400, Robert Love wrote:
> > 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.
--
Daniel
On Monday 02 September 2002 08:23, Neil Brown wrote:
> On Sunday September 1, [email protected] wrote:
> > On Mon, 2002-09-02 at 01:23, Rusty Russell wrote:
> > >> 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.
> >
> > On Mon, Sep 02, 2002 at 01:51:54AM -0400, Robert Love wrote:
> > > 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.
Pffft. A struct page isn't a page either.
--
Daniel
On Monday 02 September 2002 08:20, David S. Miller wrote:
> 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:
> > 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.
--
Daniel
On Monday 02 September 2002 12:05, David S. Miller wrote:
> From: Daniel Phillips <[email protected]>
> Date: Mon, 2 Sep 2002 12:11:53 +0200
>
> On Monday 02 September 2002 08:20, David S. Miller wrote:
> > 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.
Admit it, you never wrote a line of lisp ;-)
--
Daniel
From: Daniel Phillips <[email protected]>
Date: Mon, 2 Sep 2002 12:11:53 +0200
On Monday 02 September 2002 08:20, David S. Miller wrote:
> 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.
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))
On Monday 02 September 2002 12:11, David S. Miller wrote:
> 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?
--
Daniel
On Mon, Sep 02, 2002 at 03:05:53AM -0700, David S. Miller wrote:
> 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
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.
David S. Miller wrote:
> 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
On Tue, 3 Sep 2002, Jamie Lokier wrote:
>
> 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
In message <[email protected]> you
write:
>
> On Tue, 3 Sep 2002, Jamie Lokier wrote:
> >
> > 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.
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.
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
--- .22733-linux-2.5.33/include/linux/device.h 2002-08-28 09:29:52.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/device.h 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/include/linux/fs.h 2002-08-28 09:29:52.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/fs.h 2002-09-02 15:15:09.000000000 +1000
@@ -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 */
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .22733-linux-2.5.33/include/linux/list.h .22733-linux-2.5.33.updated/include/linux/list.h
--- .22733-linux-2.5.33/include/linux/list.h 2002-09-01 12:23:07.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/list.h 2002-09-02 15:15:09.000000000 +1000
@@ -19,12 +19,10 @@ struct list_head {
struct list_head *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_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
@@ -36,7 +34,9 @@ typedef struct list_head list_t;
* 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_head *new,
+ struct list_head *prev,
+ struct list_head *next)
{
next->prev = new;
new->next = next;
@@ -52,7 +52,7 @@ static inline void __list_add(list_t *ne
* 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_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
@@ -65,7 +65,7 @@ static inline void list_add(list_t *new,
* 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_head *new, struct list_head *head)
{
__list_add(new, head->prev, head);
}
@@ -77,7 +77,7 @@ static inline void list_add_tail(list_t
* 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_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
@@ -88,7 +88,7 @@ static inline void __list_del(list_t * p
* @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_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = (void *) 0;
@@ -99,7 +99,7 @@ static inline void list_del(list_t *entr
* 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_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
@@ -110,7 +110,7 @@ static inline void list_del_init(list_t
* @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_head *list, struct list_head *head)
{
__list_del(list->prev, list->next);
list_add(list, head);
@@ -121,7 +121,8 @@ static inline void list_move(list_t *lis
* @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_head *list,
+ struct list_head *head)
{
__list_del(list->prev, list->next);
list_add_tail(list, head);
@@ -131,16 +132,17 @@ static inline void list_move_tail(list_t
* 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 *head)
{
return head->next == head;
}
-static inline void __list_splice(list_t *list, list_t *head)
+static inline void __list_splice(struct list_head *list,
+ struct list_head *head)
{
- list_t *first = list->next;
- list_t *last = list->prev;
- list_t *at = head->next;
+ struct list_head *first = list->next;
+ struct list_head *last = list->prev;
+ struct list_head *at = head->next;
first->prev = head;
head->next = first;
@@ -154,7 +156,7 @@ static inline void __list_splice(list_t
* @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_head *list, struct list_head *head)
{
if (!list_empty(list))
__list_splice(list, head);
@@ -167,7 +169,8 @@ static inline void list_splice(list_t *l
*
* 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_head *list,
+ struct list_head *head)
{
if (!list_empty(list)) {
__list_splice(list, head);
@@ -177,7 +180,7 @@ static inline void list_splice_init(list
/**
* list_entry - get the struct for this entry
- * @ptr: the &list_t pointer.
+ * @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @member: the name of the list_struct within the struct.
*/
@@ -186,7 +189,7 @@ static inline void list_splice_init(list
/**
* list_for_each - iterate over a list
- * @pos: the &list_t to use as a loop counter.
+ * @pos: the &struct list_head to use as a loop counter.
* @head: the head for your list.
*/
#define list_for_each(pos, head) \
@@ -194,7 +197,7 @@ static inline void list_splice_init(list
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 &struct list_head to use as a loop counter.
* @head: the head for your list.
*/
#define list_for_each_prev(pos, head) \
@@ -203,8 +206,8 @@ static inline void list_splice_init(list
/**
* 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 &struct list_head to use as a loop counter.
+ * @n: another &struct list_head to use as temporary storage
* @head: the head for your list.
*/
#define list_for_each_safe(pos, n, head) \
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
--- .22733-linux-2.5.33/include/linux/mm.h 2002-09-01 12:23:07.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/mm.h 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/include/linux/sched.h 2002-09-01 12:23:07.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/linux/sched.h 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/include/net/sctp/structs.h 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/include/net/sctp/structs.h 2002-09-02 15:17:45.000000000 +1000
@@ -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.
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
--- .22733-linux-2.5.33/kernel/exit.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/kernel/exit.c 2002-09-02 15:15:09.000000000 +1000
@@ -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);
/*
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
--- .22733-linux-2.5.33/kernel/sched.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/kernel/sched.c 2002-09-02 15:15:09.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/mm/memory.c 2002-08-28 09:29:54.000000000 +1000
+++ .22733-linux-2.5.33.updated/mm/memory.c 2002-09-02 15:15:09.000000000 +1000
@@ -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);
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
--- .22733-linux-2.5.33/mm/page_alloc.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/mm/page_alloc.c 2002-09-02 15:15:21.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/associola.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/associola.c 2002-09-02 15:18:21.000000000 +1000
@@ -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.
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
--- .22733-linux-2.5.33/net/sctp/bind_addr.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/bind_addr.c 2002-09-02 15:18:29.000000000 +1000
@@ -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);
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
--- .22733-linux-2.5.33/net/sctp/endpointola.c 2002-09-01 12:23:08.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/endpointola.c 2002-09-02 15:18:39.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/outqueue.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/outqueue.c 2002-09-02 15:18:44.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/protocol.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/protocol.c 2002-09-02 15:18:54.000000000 +1000
@@ -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;
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
--- .22733-linux-2.5.33/net/sctp/sm_make_chunk.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/sm_make_chunk.c 2002-09-02 15:18:59.000000000 +1000
@@ -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.
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
--- .22733-linux-2.5.33/net/sctp/sm_sideeffect.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/sm_sideeffect.c 2002-09-02 15:19:03.000000000 +1000
@@ -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);
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
--- .22733-linux-2.5.33/net/sctp/sm_statefuns.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/sm_statefuns.c 2002-09-02 15:19:11.000000000 +1000
@@ -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
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
--- .22733-linux-2.5.33/net/sctp/socket.c 2002-09-01 12:23:09.000000000 +1000
+++ .22733-linux-2.5.33.updated/net/sctp/socket.c 2002-09-02 15:19:18.000000000 +1000
@@ -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)) {
On Wednesday 04 September 2002 02:41, Rusty Russell wrote:
> In message <[email protected]> you
> write:
> >
> > On Tue, 3 Sep 2002, Jamie Lokier wrote:
> > >
> > > 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.
>
> 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.
--
Daniel
On Wed, 4 Sep 2002, Daniel Phillips wrote:
>
> 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
In message <[email protected]> you wri
te:
>
> On Wed, 4 Sep 2002, Daniel Phillips wrote:
> >
> > 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.
Hi,
On Wed, 4 Sep 2002, Daniel Phillips wrote:
> 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
--
--./../...-/. -.--/---/..-/.-./..././.-../..-. .---/..-/.../- .-
--/../-./..-/-/./--..-- ../.----./.-../.-.. --./../...-/. -.--/---/..-
.- -/---/--/---/.-./.-./---/.--/.-.-.-
--./.-/-.../.-./.././.-../.-.-.-
On 2002.09.04 Rusty Russell wrote:
>In message <[email protected]> you wri
>te:
...
>
>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...)
--
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))
On Mon, Sep 02, 2002 at 03:23:02PM +1000, Rusty Russell wrote:
> 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.
>
[...]
>
> 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?
--
Dan Aloni
[email protected]
On Fri, 2002-09-06 at 05:28, Dan Aloni wrote:
> 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
In message <[email protected]> you write:
> 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.
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
--- working-2.5.33-cset-1.621/Documentation/sched-coding.txt 2002-05-30 10:00:45.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/Documentation/sched-coding.txt 2002-09-09 15:48:07.000000000 +1000
@@ -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.
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
--- working-2.5.33-cset-1.621/arch/alpha/kernel/process.c 2002-07-25 10:13:01.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/arch/alpha/kernel/process.c 2002-09-09 15:46:54.000000000 +1000
@@ -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;
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
--- working-2.5.33-cset-1.621/arch/ia64/kernel/smpboot.c 2002-09-01 12:22:58.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/arch/ia64/kernel/smpboot.c 2002-09-09 15:47:02.000000000 +1000
@@ -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;
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
--- working-2.5.33-cset-1.621/include/linux/sched.h 2002-09-09 13:31:53.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/include/linux/sched.h 2002-09-09 13:36:41.000000000 +1000
@@ -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 { \
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
--- working-2.5.33-cset-1.621/kernel/capability.c 2002-07-21 17:43:10.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/kernel/capability.c 2002-09-09 13:36:22.000000000 +1000
@@ -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;
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
--- working-2.5.33-cset-1.621/kernel/exit.c 2002-09-09 13:31:54.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/kernel/exit.c 2002-09-09 13:35:55.000000000 +1000
@@ -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);
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
--- working-2.5.33-cset-1.621/kernel/fork.c 2002-09-09 13:31:54.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/kernel/fork.c 2002-09-09 13:36:02.000000000 +1000
@@ -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)
{
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
--- working-2.5.33-cset-1.621/kernel/ptrace.c 2002-09-09 13:31:54.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/kernel/ptrace.c 2002-09-09 13:36:28.000000000 +1000
@@ -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();
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal working-2.5.33-cset-1.621/kernel/sched.c working-2.5.33-cset-1.621-task_t/kernel/sched.c
--- working-2.5.33-cset-1.621/kernel/sched.c 2002-09-09 13:31:54.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/kernel/sched.c 2002-09-09 13:35:23.000000000 +1000
@@ -117,7 +117,7 @@
#define BASE_TIMESLICE(p) (MIN_TIMESLICE + \
((MAX_TIMESLICE - MIN_TIMESLICE) * (MAX_PRIO-1-(p)->static_prio)/(MAX_USER_PRIO - 1)))
-static inline unsigned int task_timeslice(task_t *p)
+static inline unsigned int task_timeslice(struct task_struct *p)
{
return BASE_TIMESLICE(p);
}
@@ -147,11 +147,11 @@ struct runqueue {
spinlock_t lock;
unsigned long nr_running, nr_switches, expired_timestamp,
nr_uninterruptible;
- task_t *curr, *idle;
+ struct task_struct *curr, *idle;
prio_array_t *active, *expired, arrays[2];
int prev_nr_running[NR_CPUS];
- task_t *migration_thread;
+ struct task_struct *migration_thread;
struct list_head migration_queue;
} ____cacheline_aligned;
@@ -178,7 +178,8 @@ static struct runqueue runqueues[NR_CPUS
* interrupts. Note the ordering: we can safely lookup the task_rq without
* explicitly disabling preemption.
*/
-static inline runqueue_t *task_rq_lock(task_t *p, unsigned long *flags)
+static inline runqueue_t *task_rq_lock(struct task_struct *p,
+ unsigned long *flags)
{
struct runqueue *rq;
@@ -250,7 +251,7 @@ static inline void enqueue_task(struct t
*
* Both properties are important to certain workloads.
*/
-static inline int effective_prio(task_t *p)
+static inline int effective_prio(struct task_struct *p)
{
int bonus, prio;
@@ -271,7 +272,7 @@ static inline int effective_prio(task_t
* Also update all the scheduling statistics stuff. (sleep average
* calculation, priority modifiers, etc.)
*/
-static inline void activate_task(task_t *p, runqueue_t *rq)
+static inline void activate_task(struct task_struct *p, runqueue_t *rq)
{
unsigned long sleep_time = jiffies - p->sleep_timestamp;
prio_array_t *array = rq->active;
@@ -312,7 +313,7 @@ static inline void deactivate_task(struc
* might also involve a cross-CPU call to trigger the scheduler on
* the target CPU.
*/
-static inline void resched_task(task_t *p)
+static inline void resched_task(struct task_struct *p)
{
#ifdef CONFIG_SMP
int need_resched, nrpolling;
@@ -339,7 +340,7 @@ static inline void resched_task(task_t *
* The caller must ensure that the task *will* unschedule sometime soon,
* else this function might spin for a *long* time.
*/
-void wait_task_inactive(task_t * p)
+void wait_task_inactive(struct task_struct * p)
{
unsigned long flags;
runqueue_t *rq;
@@ -378,7 +379,7 @@ repeat:
* while the message is in flight then it will notice the
* sigpending condition anyway.)
*/
-void kick_if_running(task_t * p)
+void kick_if_running(struct task_struct * p)
{
if ((task_running(task_rq(p), p)) && (task_cpu(p) != smp_processor_id()))
resched_task(p);
@@ -397,7 +398,7 @@ void kick_if_running(task_t * p)
*
* returns failure only if the task is already active.
*/
-static int try_to_wake_up(task_t * p, int sync)
+static int try_to_wake_up(struct task_struct * p, int sync)
{
unsigned long flags;
int success = 0;
@@ -434,7 +435,7 @@ repeat_lock_task:
return success;
}
-int wake_up_process(task_t * p)
+int wake_up_process(struct task_struct * p)
{
return try_to_wake_up(p, 0);
}
@@ -445,7 +446,7 @@ int wake_up_process(task_t * p)
* This function will do some initial scheduler statistics housekeeping
* that must be done for every newly created process.
*/
-void wake_up_forked_process(task_t * p)
+void wake_up_forked_process(struct task_struct * p)
{
runqueue_t *rq = this_rq_lock();
@@ -475,7 +476,7 @@ void wake_up_forked_process(task_t * p)
* artificially, because any timeslice recovered here
* was given away by the parent in the first place.)
*/
-void sched_exit(task_t * p)
+void sched_exit(struct task_struct * p)
{
local_irq_disable();
if (p->first_time_slice) {
@@ -498,7 +499,7 @@ void sched_exit(task_t * p)
* @prev: the thread we just switched away from.
*/
#if CONFIG_SMP || CONFIG_PREEMPT
-asmlinkage void schedule_tail(task_t *prev)
+asmlinkage void schedule_tail(struct task_struct *prev)
{
finish_arch_switch(this_rq(), prev);
}
@@ -508,7 +509,8 @@ asmlinkage void schedule_tail(task_t *pr
* context_switch - switch to the new MM and the new
* thread's register state.
*/
-static inline task_t * context_switch(task_t *prev, task_t *next)
+static inline struct task_struct *context_switch(struct task_struct *prev,
+ struct task_struct *next)
{
struct mm_struct *mm = next->mm;
struct mm_struct *oldmm = prev->active_mm;
@@ -711,7 +713,7 @@ out:
* pull_task - move a task from a remote runqueue to the local runqueue.
* Both runqueues must be locked.
*/
-static inline void pull_task(runqueue_t *src_rq, prio_array_t *src_array, task_t *p, runqueue_t *this_rq, int this_cpu)
+static inline void pull_task(runqueue_t *src_rq, prio_array_t *src_array, struct task_struct *p, runqueue_t *this_rq, int this_cpu)
{
dequeue_task(p, src_array);
src_rq->nr_running--;
@@ -740,7 +742,7 @@ static void load_balance(runqueue_t *thi
runqueue_t *busiest;
prio_array_t *array;
struct list_head *head, *curr;
- task_t *tmp;
+ struct task_struct *tmp;
busiest = find_busiest_queue(this_rq, this_cpu, idle, &imbalance);
if (!busiest)
@@ -776,7 +778,7 @@ skip_bitmap:
head = array->queue + idx;
curr = head->prev;
skip_queue:
- tmp = list_entry(curr, task_t, run_list);
+ tmp = list_entry(curr, struct task_struct, run_list);
/*
* We do not migrate tasks that are:
@@ -856,7 +858,7 @@ void scheduler_tick(int user_ticks, int
{
int cpu = smp_processor_id();
runqueue_t *rq = this_rq();
- task_t *p = current;
+ struct task_struct *p = current;
if (p == rq->idle) {
/* note: this timer irq context must be accounted for as well */
@@ -934,7 +936,7 @@ void scheduling_functions_start_here(voi
*/
asmlinkage void schedule(void)
{
- task_t *prev, *next;
+ struct task_struct *prev, *next;
runqueue_t *rq;
prio_array_t *array;
struct list_head *queue;
@@ -998,7 +1000,7 @@ pick_next_task:
idx = sched_find_first_bit(array->bitmap);
queue = array->queue + idx;
- next = list_entry(queue->next, task_t, run_list);
+ next = list_entry(queue->next, struct task_struct, run_list);
switch_tasks:
prefetch(next);
@@ -1053,7 +1055,7 @@ need_resched:
int default_wake_function(wait_queue_t *curr, unsigned mode, int sync)
{
- task_t *p = curr->task;
+ struct task_struct *p = curr->task;
return ((p->state & mode) && try_to_wake_up(p, sync));
}
@@ -1233,7 +1235,7 @@ long sleep_on_timeout(wait_queue_head_t
void scheduling_functions_end_here(void) { }
-void set_user_nice(task_t *p, long nice)
+void set_user_nice(struct task_struct *p, long nice)
{
unsigned long flags;
prio_array_t *array;
@@ -1321,7 +1323,7 @@ asmlinkage long sys_nice(int increment)
* RT tasks are offset by -200. Normal tasks are centered
* around 0, value goes from -16 to +15.
*/
-int task_prio(task_t *p)
+int task_prio(struct task_struct *p)
{
return p->prio - MAX_USER_RT_PRIO;
}
@@ -1330,7 +1332,7 @@ int task_prio(task_t *p)
* task_nice - return the nice value of a given task.
* @p: the task in question.
*/
-int task_nice(task_t *p)
+int task_nice(struct task_struct *p)
{
return TASK_NICE(p);
}
@@ -1348,7 +1350,7 @@ int idle_cpu(int cpu)
* find_process_by_pid - find a process with a matching PID value.
* @pid: the pid in question.
*/
-static inline task_t *find_process_by_pid(pid_t pid)
+static inline struct task_struct *find_process_by_pid(pid_t pid)
{
return pid ? find_task_by_pid(pid) : current;
}
@@ -1363,7 +1365,7 @@ static int setscheduler(pid_t pid, int p
prio_array_t *array;
unsigned long flags;
runqueue_t *rq;
- task_t *p;
+ struct task_struct *p;
if (!param || pid < 0)
goto out_nounlock;
@@ -1471,7 +1473,7 @@ asmlinkage long sys_sched_setparam(pid_t
asmlinkage long sys_sched_getscheduler(pid_t pid)
{
int retval = -EINVAL;
- task_t *p;
+ struct task_struct *p;
if (pid < 0)
goto out_nounlock;
@@ -1499,7 +1501,7 @@ asmlinkage long sys_sched_getparam(pid_t
{
struct sched_param lp;
int retval = -EINVAL;
- task_t *p;
+ struct task_struct *p;
if (!param || pid < 0)
goto out_nounlock;
@@ -1541,7 +1543,7 @@ asmlinkage int sys_sched_setaffinity(pid
{
unsigned long new_mask;
int retval;
- task_t *p;
+ struct task_struct *p;
if (len < sizeof(new_mask))
return -EINVAL;
@@ -1594,7 +1596,7 @@ asmlinkage int sys_sched_getaffinity(pid
unsigned int real_len;
unsigned long mask;
int retval;
- task_t *p;
+ struct task_struct *p;
real_len = sizeof(mask);
if (len < real_len)
@@ -1732,7 +1734,7 @@ asmlinkage long sys_sched_rr_get_interva
{
int retval = -EINVAL;
struct timespec t;
- task_t *p;
+ struct task_struct *p;
if (pid < 0)
goto out_nounlock;
@@ -1758,10 +1760,10 @@ out_unlock:
return retval;
}
-static void show_task(task_t * p)
+static void show_task(struct task_struct * p)
{
unsigned long free = 0;
- task_t *relative;
+ struct task_struct *relative;
int state;
static const char * stat_nam[] = { "R", "S", "D", "Z", "T", "W" };
@@ -1807,7 +1809,7 @@ static void show_task(task_t * p)
printk(" (NOTLB)\n");
{
- extern void show_trace_task(task_t *tsk);
+ extern void show_trace_task(struct task_struct *tsk);
show_trace_task(p);
}
}
@@ -1829,7 +1831,7 @@ char * render_sigset_t(sigset_t *set, ch
void show_state(void)
{
- task_t *p;
+ struct task_struct *p;
#if (BITS_PER_LONG == 32)
printk("\n"
@@ -1852,7 +1854,7 @@ void show_state(void)
read_unlock(&tasklist_lock);
}
-void __init init_idle(task_t *idle, int cpu)
+void __init init_idle(struct task_struct *idle, int cpu)
{
runqueue_t *idle_rq = cpu_rq(cpu), *rq = cpu_rq(task_cpu(idle));
unsigned long flags;
@@ -1897,7 +1899,7 @@ void __init init_idle(task_t *idle, int
typedef struct {
struct list_head list;
- task_t *task;
+ struct task_struct *task;
struct completion done;
} migration_req_t;
@@ -1910,7 +1912,7 @@ typedef struct {
* task must not exit() & deallocate itself prematurely. The
* call is not atomic; no spinlocks may be held.
*/
-void set_cpus_allowed(task_t *p, unsigned long new_mask)
+void set_cpus_allowed(struct task_struct *p, unsigned long new_mask)
{
unsigned long flags;
migration_req_t req;
@@ -1991,7 +1993,7 @@ static int migration_thread(void * data)
int cpu_src, cpu_dest;
migration_req_t *req;
unsigned long flags;
- task_t *p;
+ struct task_struct *p;
spin_lock_irqsave(&rq->lock, flags);
head = &rq->migration_queue;
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
--- working-2.5.33-cset-1.621/kernel/timer.c 2002-08-11 15:31:43.000000000 +1000
+++ working-2.5.33-cset-1.621-task_t/kernel/timer.c 2002-09-09 13:36:13.000000000 +1000
@@ -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.