[DRBD-cvs] drbd by phil; [patch by LGE] Get names ob block device...
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Wed, 9 Jun 2004 16:18:05 +0200 (CEST)
DRBD CVS committal
Author : phil
Module : drbd
Dir : drbd/drbd
Modified Files:
Tag: rel-0_7-branch
drbd_fs.c
Log Message:
[patch by LGE] Get names ob block devices from kernel if available.
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_fs.c,v
retrieving revision 1.28.2.103
retrieving revision 1.28.2.104
diff -u -3 -r1.28.2.103 -r1.28.2.104
--- drbd_fs.c 8 Jun 2004 12:46:33 -0000 1.28.2.103
+++ drbd_fs.c 9 Jun 2004 14:17:59 -0000 1.28.2.104
@@ -412,19 +412,29 @@
memset(&cn,0,sizeof(cn));
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
- cn.lower_device_major = MAJOR(mdev->backing_bdev ?
- mdev->backing_bdev->bd_dev : 0);
- cn.lower_device_minor = MINOR(mdev->backing_bdev ?
- mdev->backing_bdev->bd_dev : 0);
- cn.meta_device_major = MAJOR(mdev->md_bdev ?
- mdev->md_bdev->bd_dev : 0);
- cn.meta_device_minor = MINOR(mdev->md_bdev ?
- mdev->md_bdev->bd_dev : 0);
+ if (mdev->backing_bdev) {
+ cn.lower_device_major = MAJOR(mdev->backing_bdev->bd_dev);
+ cn.lower_device_minor = MINOR(mdev->backing_bdev->bd_dev);
+ bdevname(mdev->backing_bdev,cn.lower_device_name);
+ }
+ if (mdev->md_bdev) {
+ cn.meta_device_major = MAJOR(mdev->md_bdev->bd_dev);
+ cn.meta_device_minor = MINOR(mdev->md_bdev->bd_dev);
+ bdevname(mdev->md_bdev,cn.meta_device_name);
+ }
#else
cn.lower_device_major=MAJOR(mdev->backing_bdev);
cn.lower_device_minor=MINOR(mdev->backing_bdev);
cn.meta_device_major=MAJOR(mdev->md_bdev);
cn.meta_device_minor=MINOR(mdev->md_bdev);
+ if (mdev->backing_bdev) {
+ strncpy(cn.lower_device_name,
+ bdevname(mdev->backing_bdev), BDEVNAME_SIZE);
+ }
+ if (mdev->md_bdev) {
+ strncpy(cn.meta_device_name,
+ bdevname(mdev->md_bdev), BDEVNAME_SIZE);
+ }
#endif
cn.cstate=mdev->cstate;
cn.state=mdev->state;