1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Copyright (C) 2018 Samsung Electronics Co., Ltd. 4 */ 5 6 #include "ksmbd_ida.h" 7 #include "../glob.h" 8 9 int ksmbd_acquire_smb2_tid(struct ida *ida) 10 { 11 return ida_alloc_range(ida, 1, 0xFFFFFFFE, KSMBD_DEFAULT_GFP); 12 } 13 14 int ksmbd_acquire_smb2_uid(struct ida *ida) 15 { 16 int id; 17 18 id = ida_alloc_min(ida, 1, KSMBD_DEFAULT_GFP); 19 if (id == 0xFFFE) 20 id = ida_alloc_min(ida, 1, KSMBD_DEFAULT_GFP); 21 22 return id; 23 } 24 25 int ksmbd_acquire_async_msg_id(struct ida *ida) 26 { 27 return ida_alloc_min(ida, 1, KSMBD_DEFAULT_GFP); 28 } 29 30 int ksmbd_acquire_id(struct ida *ida) 31 { 32 return ida_alloc(ida, KSMBD_DEFAULT_GFP); 33 } 34 35 void ksmbd_release_id(struct ida *ida, int id) 36 { 37 ida_free(ida, id); 38 } 39