From de612e47f658fa6bb5bcff8a8badbc32c7366ca6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Tigeot?= Date: Mon, 19 Nov 2012 10:30:34 +0100 Subject: [PATCH] Documentation: unrhdr to idr conversion --- doc/porting_drivers.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/doc/porting_drivers.txt b/doc/porting_drivers.txt index 0479eecc29..eb52fbb762 100644 --- a/doc/porting_drivers.txt +++ b/doc/porting_drivers.txt @@ -140,3 +140,29 @@ $DragonFly: doc/notes/porting_drivers.txt,v 1.4 2008/04/06 19:08:30 pavalos Exp away. * callout_drain() should be replaced by callout_stop_sync() + +* UNRHDR functions - DragonFly uses a more generic idr(9) subsystem + compatible with the Linux API of the same name + + This LWN article describes it in details: http://lwn.net/Articles/103209/ + + A typical conversion looks like this: + + #include + + free_unr() has to be replaced by idr_remove() + + alloc_unr() has to be replaced by a code sequence using idr_pre_get and + idr_get_new such as this one: + + retry: + if (idr_pre_get(xxx) ==0) { + kprintf("Memory allocation error\n"); + return error; + } + spin_lock(xxx); + ret = idr_get_new(xxx); + spin_unlock(xxx); + if (ret == EAGAIN) + goto retry; + -- 2.41.0