From: Jeff Mahoney <jeffm@suse.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org
Subject: Re: [PATCH 01/08] idr: add idr_replace method for replacing pointers
Date: Thu, 13 Apr 2006 20:08:55 -0400 [thread overview]
Message-ID: <443EE817.5000404@suse.com> (raw)
In-Reply-To: <20060413150527.0028bc88.akpm@osdl.org>
-----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-----
next prev parent reply other threads:[~2006-04-14 0:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-13 20:35 [PATCH 01/08] idr: add idr_replace method for replacing pointers Jeff Mahoney
2006-04-13 22:05 ` Andrew Morton
2006-04-14 0:08 ` Jeff Mahoney [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-04-13 20:35 Jeff Mahoney
2006-04-13 20:44 ` Jeff Mahoney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=443EE817.5000404@suse.com \
--to=jeffm@suse.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox