public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/block/nbd.c: don't defer compile error to runtime
@ 2005-09-02 22:10 Adrian Bunk
  2005-09-02 23:20 ` Adam Kropelin
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2005-09-02 22:10 UTC (permalink / raw)
  To: Paul.Clements; +Cc: linux-kernel

If we can detect a problem at compile time, the compilation should fail.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.13-mm1-full/drivers/block/nbd.c.old	2005-09-02 23:48:27.000000000 +0200
+++ linux-2.6.13-mm1-full/drivers/block/nbd.c	2005-09-02 23:53:47.000000000 +0200
@@ -644,8 +644,8 @@
 	int i;
 
 	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();
 	}
 
 	if (nbds_max > MAX_NBD) {


^ permalink raw reply	[flat|nested] 4+ messages in thread
* [2.6 patch] drivers/block/nbd.c: don't defer compile error to runtime
@ 2006-02-20 22:36 Adrian Bunk
  0 siblings, 0 replies; 4+ messages in thread
From: Adrian Bunk @ 2006-02-20 22:36 UTC (permalink / raw)
  To: Adam Kropelin, Paul.Clements; +Cc: linux-kernel

If we can detect a problem at compile time, the compilation should fail.


Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

This patch was already sent on:
- 3 Sep 2005

--- linux-2.6.13-mm1-full/drivers/block/nbd.c.old	2005-09-02 23:48:27.000000000 +0200
+++ linux-2.6.13-mm1-full/drivers/block/nbd.c	2005-09-03 01:08:04.000000000 +0200
@@ -643,10 +643,7 @@
 	int err = -ENOMEM;
 	int i;
 
-	if (sizeof(struct nbd_request) != 28) {
-		printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" );
-		return -EIO;
-	}
+	BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
 
 	if (nbds_max > MAX_NBD) {
 		printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD,


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-20 22:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-02 22:10 [2.6 patch] drivers/block/nbd.c: don't defer compile error to runtime Adrian Bunk
2005-09-02 23:20 ` Adam Kropelin
2005-09-02 23:24   ` Adrian Bunk
  -- strict thread matches above, loose matches on Subject: below --
2006-02-20 22:36 Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox