diff options
Diffstat (limited to 'ipc/util.h')
-rw-r--r-- | ipc/util.h | 60 |
1 files changed, 4 insertions, 56 deletions
diff --git a/ipc/util.h b/ipc/util.h index fc6b7294f764..ca245fae2f98 100644 --- a/ipc/util.h +++ b/ipc/util.h | |||
@@ -131,10 +131,6 @@ int ipc_parse_version (int *cmd); | |||
131 | extern void free_msg(struct msg_msg *msg); | 131 | extern void free_msg(struct msg_msg *msg); |
132 | extern struct msg_msg *load_msg(const void __user *src, int len); | 132 | extern struct msg_msg *load_msg(const void __user *src, int len); |
133 | extern int store_msg(void __user *dest, struct msg_msg *msg, int len); | 133 | extern int store_msg(void __user *dest, struct msg_msg *msg, int len); |
134 | extern int ipcget_new(struct ipc_namespace *, struct ipc_ids *, | ||
135 | struct ipc_ops *, struct ipc_params *); | ||
136 | extern int ipcget_public(struct ipc_namespace *, struct ipc_ids *, | ||
137 | struct ipc_ops *, struct ipc_params *); | ||
138 | 134 | ||
139 | static inline int ipc_buildid(int id, int seq) | 135 | static inline int ipc_buildid(int id, int seq) |
140 | { | 136 | { |
@@ -163,57 +159,9 @@ static inline void ipc_unlock(struct kern_ipc_perm *perm) | |||
163 | rcu_read_unlock(); | 159 | rcu_read_unlock(); |
164 | } | 160 | } |
165 | 161 | ||
166 | static inline struct kern_ipc_perm *ipc_lock_check_down(struct ipc_ids *ids, | 162 | struct kern_ipc_perm *ipc_lock_check_down(struct ipc_ids *ids, int id); |
167 | int id) | 163 | struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids, int id); |
168 | { | 164 | int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids, |
169 | struct kern_ipc_perm *out; | 165 | struct ipc_ops *ops, struct ipc_params *params); |
170 | |||
171 | out = ipc_lock_down(ids, id); | ||
172 | if (IS_ERR(out)) | ||
173 | return out; | ||
174 | |||
175 | if (ipc_checkid(out, id)) { | ||
176 | ipc_unlock(out); | ||
177 | return ERR_PTR(-EIDRM); | ||
178 | } | ||
179 | |||
180 | return out; | ||
181 | } | ||
182 | |||
183 | static inline struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids, | ||
184 | int id) | ||
185 | { | ||
186 | struct kern_ipc_perm *out; | ||
187 | |||
188 | out = ipc_lock(ids, id); | ||
189 | if (IS_ERR(out)) | ||
190 | return out; | ||
191 | |||
192 | if (ipc_checkid(out, id)) { | ||
193 | ipc_unlock(out); | ||
194 | return ERR_PTR(-EIDRM); | ||
195 | } | ||
196 | |||
197 | return out; | ||
198 | } | ||
199 | |||
200 | /** | ||
201 | * ipcget - Common sys_*get() code | ||
202 | * @ns : namsepace | ||
203 | * @ids : IPC identifier set | ||
204 | * @ops : operations to be called on ipc object creation, permission checks | ||
205 | * and further checks | ||
206 | * @params : the parameters needed by the previous operations. | ||
207 | * | ||
208 | * Common routine called by sys_msgget(), sys_semget() and sys_shmget(). | ||
209 | */ | ||
210 | static inline int ipcget(struct ipc_namespace *ns, struct ipc_ids *ids, | ||
211 | struct ipc_ops *ops, struct ipc_params *params) | ||
212 | { | ||
213 | if (params->key == IPC_PRIVATE) | ||
214 | return ipcget_new(ns, ids, ops, params); | ||
215 | else | ||
216 | return ipcget_public(ns, ids, ops, params); | ||
217 | } | ||
218 | 166 | ||
219 | #endif | 167 | #endif |