Commit 7ee7c12b7121cd49d528de219e4ffd5459657998

Authored by Alexey Dobriyan
Committed by Al Viro
1 parent 9a18540915

[PATCH] devpts: switch to IDA

Devpts code wants just numbers for tty indexes.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff

... ... @@ -29,7 +29,7 @@
29 29 #define DEVPTS_DEFAULT_MODE 0600
30 30  
31 31 extern int pty_limit; /* Config limit on Unix98 ptys */
32   -static DEFINE_IDR(allocated_ptys);
  32 +static DEFINE_IDA(allocated_ptys);
33 33 static DEFINE_MUTEX(allocated_ptys_lock);
34 34  
35 35 static struct vfsmount *devpts_mnt;
36 36  
37 37  
38 38  
39 39  
... ... @@ -180,24 +180,24 @@
180 180 int devpts_new_index(void)
181 181 {
182 182 int index;
183   - int idr_ret;
  183 + int ida_ret;
184 184  
185 185 retry:
186   - if (!idr_pre_get(&allocated_ptys, GFP_KERNEL)) {
  186 + if (!ida_pre_get(&allocated_ptys, GFP_KERNEL)) {
187 187 return -ENOMEM;
188 188 }
189 189  
190 190 mutex_lock(&allocated_ptys_lock);
191   - idr_ret = idr_get_new(&allocated_ptys, NULL, &index);
192   - if (idr_ret < 0) {
  191 + ida_ret = ida_get_new(&allocated_ptys, &index);
  192 + if (ida_ret < 0) {
193 193 mutex_unlock(&allocated_ptys_lock);
194   - if (idr_ret == -EAGAIN)
  194 + if (ida_ret == -EAGAIN)
195 195 goto retry;
196 196 return -EIO;
197 197 }
198 198  
199 199 if (index >= pty_limit) {
200   - idr_remove(&allocated_ptys, index);
  200 + ida_remove(&allocated_ptys, index);
201 201 mutex_unlock(&allocated_ptys_lock);
202 202 return -EIO;
203 203 }
... ... @@ -208,7 +208,7 @@
208 208 void devpts_kill_index(int idx)
209 209 {
210 210 mutex_lock(&allocated_ptys_lock);
211   - idr_remove(&allocated_ptys, idx);
  211 + ida_remove(&allocated_ptys, idx);
212 212 mutex_unlock(&allocated_ptys_lock);
213 213 }
214 214