Bug#405529: Patch to remove DevFS code from drbd

2007-01-16 Thread Julien Morot
Le lundi 08 janvier 2007 à 01:46 +1100, Paul TBBle Hampson a écrit :
> tags 405529 +patch
> Thankyou Mr Bug Control Robot
> 
> Here's a patch, culled from a diff between 0.7.21 and 0.7.22
> and so hopefully able to sneak into Etch.
> 
> I've compile-tested it, but I don't run drbd myself so I can't
> confirm its operation... Happily it was pretty easy, upstream
> just put a #define around all the devfs code and defaulted the
> define (NO_MORE_DEV_FS) to on.
> 

Hi,

With your patch, drbd compile fine now, thanks. But currently I prefer
to don't test againts my production servers for obviously reasons. And I
can't reboot them easily :/ I'll try to take the time to perform 2 tests
servers. Thanks again.

Cheers,

-- 
Julien Morot
Administrateur Systèmes Prowebserver
65 rue Néricault-Destouches
37000 Tours
02 47 05 49 94
http://www.prowebserver.fr/




Bug#405529: Patch to remove DevFS code from drbd

2007-01-07 Thread Paul TBBle Hampson
tags 405529 +patch
Thankyou Mr Bug Control Robot

Here's a patch, culled from a diff between 0.7.21 and 0.7.22
and so hopefully able to sneak into Etch.

I've compile-tested it, but I don't run drbd myself so I can't
confirm its operation... Happily it was pretty easy, upstream
just put a #define around all the devfs code and defaulted the
define (NO_MORE_DEV_FS) to on.

-- 
Paul "TBBle" Hampson, [EMAIL PROTECTED]

Shorter .sig for a more eco-friendly paperless office.
diff -ru drbd-0.7.21/drbd/drbd_int.h drbd-0.7.22/drbd/drbd_int.h
--- drbd-0.7.21/drbd/drbd_int.h	2006-07-21 17:44:53.0 +1000
+++ drbd-0.7.22/drbd/drbd_int.h	2006-10-19 22:50:13.0 +1000
@@ -73,8 +73,10 @@
 extern int major_nr;
 extern int use_nbd_major;
 
+#ifndef NO_MORE_DEV_FS
 // use_nbd_major ? "nbd" : "drbd";
 extern char* drbd_devfs_name;
+#endif
 
 #include 
 #ifdef DRBD_MAJOR
diff -ru drbd-0.7.21/drbd/drbd_main.c drbd-0.7.22/drbd/drbd_main.c
--- drbd-0.7.21/drbd/drbd_main.c	2006-07-21 17:44:53.0 +1000
+++ drbd-0.7.22/drbd/drbd_main.c	2006-10-19 20:43:02.0 +1000
@@ -49,7 +49,9 @@
 #include 
 #endif
 #include 
+#ifndef NO_MORE_DEV_FS
 #include 
+#endif
 
 #define __KERNEL_SYSCALLS__
 #include 
@@ -144,9 +146,10 @@
 #endif
 int disable_bd_claim = 0;
 
+#ifndef NO_MORE_DEV_FS
 // devfs name
 char* drbd_devfs_name = "drbd";
-
+#endif
 
 // global panic flag
 volatile int drbd_did_panic = 0;
@@ -1695,8 +1698,10 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 	devfs_unregister(devfs_handle);
 #else
+#ifndef NO_MORE_DEV_FS
 	devfs_remove(drbd_devfs_name);
 #endif
+#endif
 
 	if (unregister_blkdev(MAJOR_NR, DEVICE_NAME) != 0)
 		printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
@@ -1769,7 +1774,9 @@
 		return err;
 	}
 
+#ifndef NO_MORE_DEV_FS
 	drbd_devfs_name = (major_nr == NBD_MAJOR) ? "nbd" : "drbd";
+#endif
 
 	/*
 	 * allocate all necessary structs
@@ -1791,7 +1798,9 @@
 	if (unlikely(!drbd_blocksizes)) goto Enomem;
 #else
 
+#ifndef NO_MORE_DEV_FS
 	devfs_mk_dir(drbd_devfs_name);
+#endif
 
 	for (i = 0; i < minor_count; i++) {
 		drbd_dev*mdev = drbd_conf + i;
@@ -1814,7 +1823,9 @@
 		disk->first_minor = i;
 		disk->fops = &drbd_ops;
 		sprintf(disk->disk_name, DEVICE_NAME "%d", i);
+#ifndef NO_MORE_DEV_FS
 		sprintf(disk->devfs_name, "%s/%d", drbd_devfs_name, i);
+#endif
 		disk->private_data = mdev;
 		add_disk(disk);
 
diff -ru drbd-0.7.21/drbd/linux/drbd_config.h drbd-0.7.22/drbd/linux/drbd_config.h
--- drbd-0.7.21/drbd/linux/drbd_config.h	2006-08-02 00:33:07.0 +1000
+++ drbd-0.7.22/drbd/linux/drbd_config.h	2006-10-23 18:38:56.0 +1000
@@ -69,4 +69,6 @@
 // but more recent kernels define it in arch/um/include/mem.h
 #define HAVE_UML_TO_VIRT
 
+//#define NO_MORE_DEV_FS
+
 #endif
diff -ru drbd-0.7.21/drbd_config.h drbd-0.7.22/drbd_config.h
--- drbd-0.7.21/drbd_config.h	2006-08-02 00:33:07.0 +1000
+++ drbd-0.7.22/drbd_config.h	2006-10-23 18:38:56.0 +1000
@@ -69,4 +69,6 @@
 // but more recent kernels define it in arch/um/include/mem.h
 #define HAVE_UML_TO_VIRT
 
+//#define NO_MORE_DEV_FS
+
 #endif
diff -ru drbd-0.7.21/scripts/adjust_drbd_config_h.sh drbd-0.7.22/scripts/adjust_drbd_config_h.sh
--- drbd-0.7.21/scripts/adjust_drbd_config_h.sh	2005-05-09 18:01:56.0 +1000
+++ drbd-0.7.22/scripts/adjust_drbd_config_h.sh	2006-10-23 18:38:57.0 +1000
@@ -80,6 +80,7 @@
   else
 have_mm_inline_h=0
   fi
+no_more_dev_fs=0
 else
 # 2.6. kernel. just leave it alone...
 need_sighand_hack=0
@@ -87,6 +88,7 @@
 need_RH_2_4_18_hack=0
 have_find_next_bit=0
 have_mm_inline_h=0
+no_more_dev_fs=1
 fi
 
 test -e ./linux/drbd_config.h.orig || cp ./linux/drbd_config.h{,.orig}
@@ -101,7 +103,9 @@
  s{.*(#define HAVE_FIND_NEXT_BIT.*)}
   { ( $have_find_next_bit ? '' : '//' ) . \$1}e;
  s{.*(#define HAVE_MM_INLINE_H.*)}
-  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;" \
+  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;
+ s{.*(#define NO_MORE_DEV_FS.*)}
+  { ( $no_more_dev_fs ? '' : '//' ) . \$1}e;" \
 	  < ./linux/drbd_config.h \
 	  > ./linux/drbd_config.h.new
 


pgpErsWfKc3YC.pgp
Description: PGP signature