Lines Matching refs:idx
203 int idx, next_id = -1;
228 /* allocate the idx, with a NULL struct kern_ipc_perm */
229 idx = idr_alloc_cyclic(&ids->ipcs_idr, NULL, 0, max_idx, GFP_NOWAIT);
230 if (idx >= 0) {
232 * idx got allocated successfully.
236 if (idx <= ids->last_idx) {
242 ids->last_idx = idx;
249 idr_replace(&ids->ipcs_idr, new, idx);
253 idx = idr_alloc(&ids->ipcs_idr, new, ipcid_to_idx(next_id), 0, GFP_NOWAIT);
255 if (idx >= 0) {
256 new->id = (new->seq << ipcmni_seq_shift()) + idx;
258 return idx;
280 int idx, err;
305 idx = ipc_idr_alloc(ids, new);
308 if (idx >= 0 && new->key != IPC_PRIVATE) {
311 idr_remove(&ids->ipcs_idr, idx);
312 idx = err;
315 if (idx < 0) {
319 return idx;
323 if (idx > ids->max_idx) {
324 ids->max_idx = idx;
326 return idx;
466 int idx = ipcid_to_idx(ipcp->id);
468 WARN_ON_ONCE(idr_remove(&ids->ipcs_idr, idx) != ipcp);
473 if (unlikely(idx == ids->max_idx)) {
475 idx--;
476 if (idx == -1) {
479 } while (!idr_find(&ids->ipcs_idr, idx));
480 ids->max_idx = idx;
600 int idx = ipcid_to_idx(id);
602 out = idr_find(&ids->ipcs_idr, idx);