|
5 | 5 |
|
6 | 6 | #include "ksmbd_ida.h"
|
7 | 7 |
|
8 |
| -static inline int __acquire_id(struct ida *ida, int from, int to) |
9 |
| -{ |
10 |
| - return ida_simple_get(ida, from, to, GFP_KERNEL); |
11 |
| -} |
12 |
| - |
13 | 8 | int ksmbd_acquire_smb2_tid(struct ida *ida)
|
14 | 9 | {
|
15 |
| - int id; |
16 |
| - |
17 |
| - id = __acquire_id(ida, 1, 0xFFFFFFFF); |
18 |
| - |
19 |
| - return id; |
| 10 | + return ida_alloc_range(ida, 1, 0xFFFFFFFE, GFP_KERNEL); |
20 | 11 | }
|
21 | 12 |
|
22 | 13 | int ksmbd_acquire_smb2_uid(struct ida *ida)
|
23 | 14 | {
|
24 | 15 | int id;
|
25 | 16 |
|
26 |
| - id = __acquire_id(ida, 1, 0); |
| 17 | + id = ida_alloc_min(ida, 1, GFP_KERNEL); |
27 | 18 | if (id == 0xFFFE)
|
28 |
| - id = __acquire_id(ida, 1, 0); |
| 19 | + id = ida_alloc_min(ida, 1, GFP_KERNEL); |
29 | 20 |
|
30 | 21 | return id;
|
31 | 22 | }
|
32 | 23 |
|
33 | 24 | int ksmbd_acquire_async_msg_id(struct ida *ida)
|
34 | 25 | {
|
35 |
| - return __acquire_id(ida, 1, 0); |
| 26 | + return ida_alloc_min(ida, 1, GFP_KERNEL); |
36 | 27 | }
|
37 | 28 |
|
38 | 29 | int ksmbd_acquire_id(struct ida *ida)
|
39 | 30 | {
|
40 |
| - return __acquire_id(ida, 0, 0); |
| 31 | + return ida_alloc(ida, GFP_KERNEL); |
41 | 32 | }
|
42 | 33 |
|
43 | 34 | void ksmbd_release_id(struct ida *ida, int id)
|
44 | 35 | {
|
45 |
| - ida_simple_remove(ida, id); |
| 36 | + ida_free(ida, id); |
46 | 37 | }
|
0 commit comments