OpenCores
URL https://opencores.org/ocsvn/test_project/test_project/trunk

Subversion Repositories test_project

[/] [test_project/] [trunk/] [linux_sd_driver/] [include/] [linux/] [klist.h] - Blame information for rev 81

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 62 marcus.erl
/*
2
 *      klist.h - Some generic list helpers, extending struct list_head a bit.
3
 *
4
 *      Implementations are found in lib/klist.c
5
 *
6
 *
7
 *      Copyright (C) 2005 Patrick Mochel
8
 *
9
 *      This file is rleased under the GPL v2.
10
 */
11
 
12
#ifndef _LINUX_KLIST_H
13
#define _LINUX_KLIST_H
14
 
15
#include <linux/spinlock.h>
16
#include <linux/completion.h>
17
#include <linux/kref.h>
18
#include <linux/list.h>
19
 
20
struct klist_node;
21
struct klist {
22
        spinlock_t              k_lock;
23
        struct list_head        k_list;
24
        void                    (*get)(struct klist_node *);
25
        void                    (*put)(struct klist_node *);
26
};
27
 
28
 
29
extern void klist_init(struct klist * k, void (*get)(struct klist_node *),
30
                       void (*put)(struct klist_node *));
31
 
32
struct klist_node {
33
        struct klist            * n_klist;
34
        struct list_head        n_node;
35
        struct kref             n_ref;
36
        struct completion       n_removed;
37
};
38
 
39
extern void klist_add_tail(struct klist_node * n, struct klist * k);
40
extern void klist_add_head(struct klist_node * n, struct klist * k);
41
 
42
extern void klist_del(struct klist_node * n);
43
extern void klist_remove(struct klist_node * n);
44
 
45
extern int klist_node_attached(struct klist_node * n);
46
 
47
 
48
struct klist_iter {
49
        struct klist            * i_klist;
50
        struct list_head        * i_head;
51
        struct klist_node       * i_cur;
52
};
53
 
54
 
55
extern void klist_iter_init(struct klist * k, struct klist_iter * i);
56
extern void klist_iter_init_node(struct klist * k, struct klist_iter * i,
57
                                 struct klist_node * n);
58
extern void klist_iter_exit(struct klist_iter * i);
59
extern struct klist_node * klist_next(struct klist_iter * i);
60
 
61
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.