On Tue, Jun 03, 2008 at 12:07:49PM +0200, Marc Pignat wrote:This isn't always practical. For example, host is using u8 register for the status, so it might safely return u8 & mask, that will always fit into int. Or very smart/adventurous authors might be aware that, for the particular host, mask's bit isn't last, and safely do uXX & mask. :-) The above is weak argument of course, since it is about optimization. As an counter-evidence, the strict scheme that you described probably less error prone. But is it? To implement it we'll need something like WARN_ON(ret > 0 && ret != 1) to catch erroneous users. Take a closer look though, will it catch uXX & lastbit case? Nope. :-) We can catch bogus users though... via hack (_assuming_ that there are no errno values of 1 << (sizeof(int) * 8 - 1)), i.e. WARN_ON(ret == (1 << (sizeof(int) * 8 - 1)). Though, to do so, we don't need the strict scheme, this debugging hack will work in the current scheme too. -- Anton Vorontsov email: cbouatmailru@gmail.com irc://irc.freenode.net/bd2 --
| Linus Torvalds | Linux 2.6.21 |
| Greg Kroah-Hartman | [PATCH 002/196] Chinese: rephrase English introduction in HOWTO |
| Josef 'Jeff' Sipek | [PATCH 02/24] lookup_one_len_nd - lookup_one_len with nameidata argument |
| david | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | Re: [GIT]: Networking |
| David Miller | [PATCH]: Preliminary release of Sun Neptune driver |
