Re: [PATCH 01/08] idr: add idr_replace method for replacing pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Morton wrote:
> Jeff Mahoney <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux