lkml.org 
[lkml]   [2006]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/08] idr: add idr_replace method for replacing pointers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Andrew Morton wrote:
> Jeff Mahoney <jeffm@suse.com> wrote:
>> +/**
>> + * idr_replace - replace pointer for given id
>> + * @idp: idr handle
>> + * @ptr: pointer you want associated with the ide
>> + * @id: lookup key
>> + *
>> + * Replace the pointer registered with the id. A -ENOENT
>> + * return indicates that @id was not found.
>> + *
>> + * The caller must serialize vs idr_find(), idr_get_new(), and idr_remove().
>> + */
>> +int idr_replace(struct idr *idp, void *ptr, int id)
>
> I'd have thought it would be more flexible were this to return the old
> pointer.
>
> If there was no old item, we could return NULL and "succeed". But that gets
> a bit ill-defined, because lack of an old pointer can occur if either a)
> there was a layer, but the slot was empty or b) there wasn't a layer for
> this new item. So perhaps it's best to continue considering lack of an old
> pointer as an error, with ERR_PTR(-ENOENT).

Sure, I'll make those changes now.

- -Jeff


- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFEPugXLPWxlyuTD7IRAswwAJ0XVEBu/kRp4RNcW3JNeNRTqCYEowCfR01q
0hPOY5g0V8WEaOU8lWBfG/U=
=iJrK
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-04-14 02:11    [from the cache]
©2003-2011 Jasper Spaans