On Tue, 25 Jun 2013 09:56:43 +0300, Alexandru Juncu said: > On 23 June 2013 17:18, Dibyayan Chakraborty <dib.coolguy@xxxxxxxxx> 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: #ifdef CONFIG_FOOBAR_DEBUG #define MY_TRACE printk(lots-o-oarams-here) #else #define MY_TRACE() do{} while(0) #endif That way, the main .c file will compile cleanly whether or not the CONFIG option is selected.
Attachment:
pgp6w2NakM2c2.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies