diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-07-11 17:02:25 -0400 |
---|---|---|
committer | Dominique Martinet <dominique.martinet@cea.fr> | 2018-08-29 00:39:57 -0400 |
commit | 6348b903d79119a8157aace08ab99521f5dba139 (patch) | |
tree | 08f038b40e025f0a842b0db31330d1b7080e093c /net/9p | |
parent | 996d5b4db4b191f2676cf8775565cab8a5e2753b (diff) |
9p: Remove p9_idpool
There are no more users left of the p9_idpool; delete it.
Link: http://lkml.kernel.org/r/20180711210225.19730-7-willy@infradead.org
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Cc: Eric Van Hensbergen <ericvh@gmail.com>
Cc: Ron Minnich <rminnich@sandia.gov>
Cc: Latchesar Ionkov <lucho@ionkov.net>
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
Diffstat (limited to 'net/9p')
-rw-r--r-- | net/9p/Makefile | 1 | ||||
-rw-r--r-- | net/9p/util.c | 140 |
2 files changed, 0 insertions, 141 deletions
diff --git a/net/9p/Makefile b/net/9p/Makefile index c0486cfc85d9..aa0a5641e5d0 100644 --- a/net/9p/Makefile +++ b/net/9p/Makefile | |||
@@ -8,7 +8,6 @@ obj-$(CONFIG_NET_9P_RDMA) += 9pnet_rdma.o | |||
8 | mod.o \ | 8 | mod.o \ |
9 | client.o \ | 9 | client.o \ |
10 | error.o \ | 10 | error.o \ |
11 | util.o \ | ||
12 | protocol.o \ | 11 | protocol.o \ |
13 | trans_fd.o \ | 12 | trans_fd.o \ |
14 | trans_common.o \ | 13 | trans_common.o \ |
diff --git a/net/9p/util.c b/net/9p/util.c deleted file mode 100644 index 55ad98277e85..000000000000 --- a/net/9p/util.c +++ /dev/null | |||
@@ -1,140 +0,0 @@ | |||
1 | /* | ||
2 | * net/9p/util.c | ||
3 | * | ||
4 | * This file contains some helper functions | ||
5 | * | ||
6 | * Copyright (C) 2007 by Latchesar Ionkov <lucho@ionkov.net> | ||
7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | ||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 | ||
12 | * as published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to: | ||
21 | * Free Software Foundation | ||
22 | * 51 Franklin Street, Fifth Floor | ||
23 | * Boston, MA 02111-1301 USA | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #include <linux/module.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/fs.h> | ||
30 | #include <linux/sched.h> | ||
31 | #include <linux/parser.h> | ||
32 | #include <linux/idr.h> | ||
33 | #include <linux/slab.h> | ||
34 | #include <net/9p/9p.h> | ||
35 | |||
36 | /** | ||
37 | * struct p9_idpool - per-connection accounting for tag idpool | ||
38 | * @lock: protects the pool | ||
39 | * @pool: idr to allocate tag id from | ||
40 | * | ||
41 | */ | ||
42 | |||
43 | struct p9_idpool { | ||
44 | spinlock_t lock; | ||
45 | struct idr pool; | ||
46 | }; | ||
47 | |||
48 | /** | ||
49 | * p9_idpool_create - create a new per-connection id pool | ||
50 | * | ||
51 | */ | ||
52 | |||
53 | struct p9_idpool *p9_idpool_create(void) | ||
54 | { | ||
55 | struct p9_idpool *p; | ||
56 | |||
57 | p = kmalloc(sizeof(struct p9_idpool), GFP_KERNEL); | ||
58 | if (!p) | ||
59 | return ERR_PTR(-ENOMEM); | ||
60 | |||
61 | spin_lock_init(&p->lock); | ||
62 | idr_init(&p->pool); | ||
63 | |||
64 | return p; | ||
65 | } | ||
66 | EXPORT_SYMBOL(p9_idpool_create); | ||
67 | |||
68 | /** | ||
69 | * p9_idpool_destroy - create a new per-connection id pool | ||
70 | * @p: idpool to destroy | ||
71 | */ | ||
72 | |||
73 | void p9_idpool_destroy(struct p9_idpool *p) | ||
74 | { | ||
75 | idr_destroy(&p->pool); | ||
76 | kfree(p); | ||
77 | } | ||
78 | EXPORT_SYMBOL(p9_idpool_destroy); | ||
79 | |||
80 | /** | ||
81 | * p9_idpool_get - allocate numeric id from pool | ||
82 | * @p: pool to allocate from | ||
83 | * | ||
84 | * Bugs: This seems to be an awful generic function, should it be in idr.c with | ||
85 | * the lock included in struct idr? | ||
86 | */ | ||
87 | |||
88 | int p9_idpool_get(struct p9_idpool *p) | ||
89 | { | ||
90 | int i; | ||
91 | unsigned long flags; | ||
92 | |||
93 | idr_preload(GFP_NOFS); | ||
94 | spin_lock_irqsave(&p->lock, flags); | ||
95 | |||
96 | /* no need to store exactly p, we just need something non-null */ | ||
97 | i = idr_alloc(&p->pool, p, 0, 0, GFP_NOWAIT); | ||
98 | |||
99 | spin_unlock_irqrestore(&p->lock, flags); | ||
100 | idr_preload_end(); | ||
101 | if (i < 0) | ||
102 | return -1; | ||
103 | |||
104 | p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", i, p); | ||
105 | return i; | ||
106 | } | ||
107 | EXPORT_SYMBOL(p9_idpool_get); | ||
108 | |||
109 | /** | ||
110 | * p9_idpool_put - release numeric id from pool | ||
111 | * @id: numeric id which is being released | ||
112 | * @p: pool to release id into | ||
113 | * | ||
114 | * Bugs: This seems to be an awful generic function, should it be in idr.c with | ||
115 | * the lock included in struct idr? | ||
116 | */ | ||
117 | |||
118 | void p9_idpool_put(int id, struct p9_idpool *p) | ||
119 | { | ||
120 | unsigned long flags; | ||
121 | |||
122 | p9_debug(P9_DEBUG_MUX, " id %d pool %p\n", id, p); | ||
123 | |||
124 | spin_lock_irqsave(&p->lock, flags); | ||
125 | idr_remove(&p->pool, id); | ||
126 | spin_unlock_irqrestore(&p->lock, flags); | ||
127 | } | ||
128 | EXPORT_SYMBOL(p9_idpool_put); | ||
129 | |||
130 | /** | ||
131 | * p9_idpool_check - check if the specified id is available | ||
132 | * @id: id to check | ||
133 | * @p: pool to check | ||
134 | */ | ||
135 | |||
136 | int p9_idpool_check(int id, struct p9_idpool *p) | ||
137 | { | ||
138 | return idr_find(&p->pool, id) != NULL; | ||
139 | } | ||
140 | EXPORT_SYMBOL(p9_idpool_check); | ||