15
15
#include <linux/slab.h>
16
16
#include <linux/seq_file.h>
17
17
#include <linux/err.h>
18
+ #include <keys/user-type.h>
18
19
#include <asm/uaccess.h>
19
20
#include "internal.h"
20
21
21
- static int user_instantiate (struct key * key , const void * data , size_t datalen );
22
- static int user_duplicate (struct key * key , const struct key * source );
23
- static int user_update (struct key * key , const void * data , size_t datalen );
24
- static int user_match (const struct key * key , const void * criterion );
25
- static void user_destroy (struct key * key );
26
- static void user_describe (const struct key * user , struct seq_file * m );
27
- static long user_read (const struct key * key ,
28
- char __user * buffer , size_t buflen );
29
-
30
22
/*
31
23
* user defined keys take an arbitrary string as the description and an
32
24
* arbitrary blob of data as the payload
@@ -42,19 +34,13 @@ struct key_type key_type_user = {
42
34
.read = user_read ,
43
35
};
44
36
45
- struct user_key_payload {
46
- struct rcu_head rcu ; /* RCU destructor */
47
- unsigned short datalen ; /* length of this data */
48
- char data [0 ]; /* actual data */
49
- };
50
-
51
37
EXPORT_SYMBOL_GPL (key_type_user );
52
38
53
39
/*****************************************************************************/
54
40
/*
55
41
* instantiate a user defined key
56
42
*/
57
- static int user_instantiate (struct key * key , const void * data , size_t datalen )
43
+ int user_instantiate (struct key * key , const void * data , size_t datalen )
58
44
{
59
45
struct user_key_payload * upayload ;
60
46
int ret ;
@@ -78,18 +64,20 @@ static int user_instantiate(struct key *key, const void *data, size_t datalen)
78
64
rcu_assign_pointer (key -> payload .data , upayload );
79
65
ret = 0 ;
80
66
81
- error :
67
+ error :
82
68
return ret ;
83
69
84
70
} /* end user_instantiate() */
85
71
72
+ EXPORT_SYMBOL_GPL (user_instantiate );
73
+
86
74
/*****************************************************************************/
87
75
/*
88
76
* duplicate a user defined key
89
77
* - both keys' semaphores are locked against further modification
90
78
* - the new key cannot yet be accessed
91
79
*/
92
- static int user_duplicate (struct key * key , const struct key * source )
80
+ int user_duplicate (struct key * key , const struct key * source )
93
81
{
94
82
struct user_key_payload * upayload , * spayload ;
95
83
int ret ;
@@ -112,6 +100,8 @@ static int user_duplicate(struct key *key, const struct key *source)
112
100
113
101
} /* end user_duplicate() */
114
102
103
+ EXPORT_SYMBOL_GPL (user_duplicate );
104
+
115
105
/*****************************************************************************/
116
106
/*
117
107
* dispose of the old data from an updated user defined key
@@ -131,7 +121,7 @@ static void user_update_rcu_disposal(struct rcu_head *rcu)
131
121
* update a user defined key
132
122
* - the key's semaphore is write-locked
133
123
*/
134
- static int user_update (struct key * key , const void * data , size_t datalen )
124
+ int user_update (struct key * key , const void * data , size_t datalen )
135
125
{
136
126
struct user_key_payload * upayload , * zap ;
137
127
int ret ;
@@ -163,52 +153,59 @@ static int user_update(struct key *key, const void *data, size_t datalen)
163
153
164
154
call_rcu (& zap -> rcu , user_update_rcu_disposal );
165
155
166
- error :
156
+ error :
167
157
return ret ;
168
158
169
159
} /* end user_update() */
170
160
161
+ EXPORT_SYMBOL_GPL (user_update );
162
+
171
163
/*****************************************************************************/
172
164
/*
173
165
* match users on their name
174
166
*/
175
- static int user_match (const struct key * key , const void * description )
167
+ int user_match (const struct key * key , const void * description )
176
168
{
177
169
return strcmp (key -> description , description ) == 0 ;
178
170
179
171
} /* end user_match() */
180
172
173
+ EXPORT_SYMBOL_GPL (user_match );
174
+
181
175
/*****************************************************************************/
182
176
/*
183
177
* dispose of the data dangling from the corpse of a user
184
178
*/
185
- static void user_destroy (struct key * key )
179
+ void user_destroy (struct key * key )
186
180
{
187
181
struct user_key_payload * upayload = key -> payload .data ;
188
182
189
183
kfree (upayload );
190
184
191
185
} /* end user_destroy() */
192
186
187
+ EXPORT_SYMBOL_GPL (user_destroy );
188
+
193
189
/*****************************************************************************/
194
190
/*
195
191
* describe the user key
196
192
*/
197
- static void user_describe (const struct key * key , struct seq_file * m )
193
+ void user_describe (const struct key * key , struct seq_file * m )
198
194
{
199
195
seq_puts (m , key -> description );
200
196
201
197
seq_printf (m , ": %u" , key -> datalen );
202
198
203
199
} /* end user_describe() */
204
200
201
+ EXPORT_SYMBOL_GPL (user_describe );
202
+
205
203
/*****************************************************************************/
206
204
/*
207
205
* read the key data
208
206
* - the key's semaphore is read-locked
209
207
*/
210
- static long user_read (const struct key * key ,
211
- char __user * buffer , size_t buflen )
208
+ long user_read (const struct key * key , char __user * buffer , size_t buflen )
212
209
{
213
210
struct user_key_payload * upayload ;
214
211
long ret ;
@@ -228,3 +225,5 @@ static long user_read(const struct key *key,
228
225
return ret ;
229
226
230
227
} /* end user_read() */
228
+
229
+ EXPORT_SYMBOL_GPL (user_read );
0 commit comments