[lkml]   [2010]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] fs: O_* bit numbers uniqueness check

> + /* please add new bits here to ensure allocation uniqueness */
> + BUG_ON(20 != hweight32(

I wonder if there's a way to make this BUILD_BUG_ON(), so the problem is
caught at compile time (a change like adding an O_ flag is often compile
tested only for obscure archs). One could create a compile-time
macro-ized version of hweight32() and use that, I guess, although I'm
not sure it's worth the ugliness.

Failing that maybe this should be WARN_ON()? I'd be annoyed if my arch
wouldn't boot because some strange new O_ flag happened to collide.

- R.

 \ /
  Last update: 2010-01-06 08:11    [W:0.126 / U:0.244 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site