[$] IDA: simplifying the complex task of allocating integers
It is common for kernel code to generate unique integers for identifiers.When one plugs in a flash drive, it will show up as/dev/sdN; that N (a letter derived from anumber) must be generated in thekernel, and it should not already be in use for another drive or unpleasantthings will happen. One might think that generating such numbers would notbe a difficult task, but that turns out not to be the case, especially insituations where many numbers must be tracked. The IDA (for "IDallocator", perhaps) API exists to handle this specialized task. In pastkernels, it has managed to make the process of getting an unused numbersurprisingly complex; the 4.19 kernel has a new IDA API that simplifies thingsconsiderably.