Re: [2.6 patch] drivers/block/nbd.c: don't defer compile error to runtime

From: Adam Kropelin
Date: Fri Sep 02 2005 - 17:54:14 EST


Adrian Bunk wrote:
> If we can detect a problem at compile time, the compilation should
> fail.

[...]

> if (sizeof(struct nbd_request) != 28) {
> - printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" );
> - return -EIO;
> + extern void nbd_request_wrong_size(void);
> + nbd_request_wrong_size();

BUILD_BUG_ON(sizeof(struct nbd_request) != 28);

...perhaps?

--Adam

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/