File system query

Valdis.Kletnieks at Valdis.Kletnieks at
Tue Jun 25 11:19:23 EDT 2013

On Tue, 25 Jun 2013 09:56:43 +0300, Alexandru Juncu said:
> On 23 June 2013 17:18, Dibyayan Chakraborty <dib.coolguy at> wrote:
> > Hi,
> > I came by a really weird macro code in linux/jbd.h which is
> >
> > BUFFER_TRACE(bh,info)  do{} while(0).
> >
> > Please explain the necessity of this.
> I'm not familiar with that specific code, but it looks like a "no op"
> macro. Maybe the definition is the to ensure backwards or forward
> compatibility for the code that calls the macro , but now it doesn't
> do anything.

Actually, the kernel doesn't use this for forward/backward compatability
that much.  It's mostly used for handling optional code - you'll often
find stuff like this in .h files:

#define MY_TRACE printk(lots-o-oarams-here)
#define MY_TRACE() do{} while(0)

That way, the main .c file will compile cleanly whether or not the CONFIG
option is selected.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : 

More information about the Kernelnewbies mailing list