android_kernel_xiaomi_sm7250/include
mochel@digitalimplant.org 9a19fea436 [PATCH] Add initial implementation of klist helpers.
This klist interface provides a couple of structures that wrap around
struct list_head to provide explicit list "head" (struct klist) and
list "node" (struct klist_node) objects. For struct klist, a spinlock
is included that protects access to the actual list itself. struct
klist_node provides a pointer to the klist that owns it and a kref
reference count that indicates the number of current users of that node
in the list.

The entire point is to provide an interface for iterating over a list
that is safe and allows for modification of the list during the
iteration (e.g. insertion and removal), including modification of the
current node on the list.

It works using a 3rd object type - struct klist_iter - that is declared
and initialized before an iteration. klist_next() is used to acquire the
next element in the list. It returns NULL if there are no more items.
This klist interface provides a couple of structures that wrap around
struct list_head to provide explicit list "head" (struct klist) and
list "node" (struct klist_node) objects. For struct klist, a spinlock
is included that protects access to the actual list itself. struct
klist_node provides a pointer to the klist that owns it and a kref
reference count that indicates the number of current users of that node
in the list.

The entire point is to provide an interface for iterating over a list
that is safe and allows for modification of the list during the
iteration (e.g. insertion and removal), including modification of the
current node on the list.

It works using a 3rd object type - struct klist_iter - that is declared
and initialized before an iteration. klist_next() is used to acquire the
next element in the list. It returns NULL if there are no more items.
Internally, that routine takes the klist's lock, decrements the reference
count of the previous klist_node and increments the count of the next
klist_node. It then drops the lock and returns.

There are primitives for adding and removing nodes to/from a klist.
When deleting, klist_del() will simply decrement the reference count.
Only when the count goes to 0 is the node removed from the list.
klist_remove() will try to delete the node from the list and block
until it is actually removed. This is useful for objects (like devices)
that have been removed from the system and must be freed (but must wait
until all accessors have finished).

Internally, that routine takes the klist's lock, decrements the reference
count of the previous klist_node and increments the count of the next
klist_node. It then drops the lock and returns.

There are primitives for adding and removing nodes to/from a klist.
When deleting, klist_del() will simply decrement the reference count.
Only when the count goes to 0 is the node removed from the list.
klist_remove() will try to delete the node from the list and block
until it is actually removed. This is useful for objects (like devices)
that have been removed from the system and must be freed (but must wait
until all accessors have finished).

Signed-off-by: Patrick Mochel <mochel@digitalimplant.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

diff -Nru a/include/linux/klist.h b/include/linux/klist.h
2005-06-20 15:15:14 -07:00
..
acpi
asm-alpha [PATCH] AGP fix for Xen VMM 2005-06-07 12:35:43 -07:00
asm-arm Merge with ../linux-2.6-smp 2005-06-19 19:26:54 +01:00
asm-arm26 [PATCH] Remove obsolete HAVE_ARCH_GET_SIGNAL_TO_DELIVER? 2005-06-12 20:43:21 -07:00
asm-cris
asm-frv
asm-generic
asm-h8300 [PATCH] h8300 build error fix 2005-06-06 14:42:23 -07:00
asm-i386 Merge of master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart 2005-06-07 13:41:30 -07:00
asm-ia64 [PATCH] ia64: fix floating-point preemption problem 2005-06-08 16:21:14 -07:00
asm-m32r
asm-m68k
asm-m68knommu
asm-mips
asm-parisc
asm-ppc Merge with master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6.git 2005-06-18 08:36:46 +01:00
asm-ppc64 [PATCH] ppc64: Fix PER_LINUX32 behaviour 2005-06-08 16:24:15 -07:00
asm-s390 [PATCH] s390: uml ptrace fixes 2005-06-04 17:13:00 -07:00
asm-sh [PATCH] sh: PREEMPT_ACTIVE fix 2005-05-28 16:46:13 -07:00
asm-sh64 [PATCH] sh: PREEMPT_ACTIVE fix 2005-05-28 16:46:13 -07:00
asm-sparc [PATCH] sparc32: silence access_ok() warnings 2005-06-08 16:21:13 -07:00
asm-sparc64 [PATCH] AGP fix for Xen VMM 2005-06-07 12:35:43 -07:00
asm-um [PATCH] uml: remove jail mode + other leftovers 2005-05-28 16:46:14 -07:00
asm-v850
asm-x86_64 [PATCH] AGP fix for Xen VMM 2005-06-07 12:35:43 -07:00
linux [PATCH] Add initial implementation of klist helpers. 2005-06-20 15:15:14 -07:00
math-emu
media
mtd
net [PKT_SCHED]: Generic queue management interface for qdiscs using internal skb queues 2005-06-18 22:57:26 -07:00
pcmcia
rxrpc
scsi Automatic merge of ../scsi-misc-2.6-old/ 2005-05-26 14:14:55 -04:00
sound
video