[DRBD-cvs] svn commit by lars - r3025 - branches/drbd-8.1/drbd - d330d33fc649b127a811e37378aec9430897bd77 DRBD: get rid

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Aug 27 12:12:04 CEST 2007


Author: lars
Date: 2007-08-27 12:12:02 +0200 (Mon, 27 Aug 2007)
New Revision: 3025

Modified:
   branches/drbd-8.1/drbd/drbd_int.h
   branches/drbd-8.1/drbd/drbd_main.c
   branches/drbd-8.1/drbd/drbd_nl.c
   branches/drbd-8.1/drbd/drbd_wrappers.h
Log:
d330d33fc649b127a811e37378aec9430897bd77 DRBD: get rid of DEVICE_NAME macro, open-code "drbd"

Modified: branches/drbd-8.1/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.1/drbd/drbd_int.h	2007-08-27 09:01:12 UTC (rev 3024)
+++ branches/drbd-8.1/drbd/drbd_int.h	2007-08-27 10:12:02 UTC (rev 3025)
@@ -59,9 +59,6 @@
 #include <linux/blkdev.h>
 #include <linux/bio.h>
 
-#undef DEVICE_NAME
-#define DEVICE_NAME "drbd"
-
 // XXX do we need this?
 #ifndef TRUE
 #define TRUE 1
@@ -134,7 +131,7 @@
 /* Info: do not remove the spaces around the "," before ##
  *	 Otherwise this is not portable from gcc-2.95 to gcc-3.3 */
 #define PRINTK(level, fmt, args...) \
-	printk(level DEVICE_NAME "%d: " fmt, \
+	printk(level "drbd%d: " fmt, \
 		mdev->minor , ##args)
 
 #define ALERT(fmt, args...) PRINTK(KERN_ALERT, fmt , ##args)

Modified: branches/drbd-8.1/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_main.c	2007-08-27 09:01:12 UTC (rev 3024)
+++ branches/drbd-8.1/drbd/drbd_main.c	2007-08-27 10:12:02 UTC (rev 3025)
@@ -1641,8 +1641,8 @@
 	++total;
 	if (fallback && time_before(last_rep+3600*HZ, now)) {
 		last_rep = now;
-		printk(KERN_INFO DEVICE_NAME
-		       ": sendpage() omitted: %lu/%lu\n", fallback, total);
+		printk(KERN_INFO "drbd: sendpage() omitted: %lu/%lu\n",
+			fallback, total);
 	}
 #endif
 
@@ -1941,7 +1941,7 @@
 		return -ENODEV;
 
 	/*
-	printk(KERN_ERR DEVICE_NAME ": close(inode=%p,file=%p)"
+	printk(KERN_ERR "drbd: close(inode=%p,file=%p)"
 	       "current=%p,minor=%d,wc=%d\n", inode, file, current, minor,
 	       inode->i_writecount);
 	*/
@@ -2342,9 +2342,9 @@
 
 	kfree(minor_table);
 
-	drbd_unregister_blkdev(DRBD_MAJOR, DEVICE_NAME);
+	drbd_unregister_blkdev(DRBD_MAJOR, "drbd");
 
-	printk(KERN_INFO DEVICE_NAME": module cleanup done.\n");
+	printk(KERN_INFO "drbd: module cleanup done.\n");
 }
 
 struct drbd_conf *drbd_new_device(int minor)
@@ -2379,7 +2379,7 @@
 	disk->major = DRBD_MAJOR;
 	disk->first_minor = minor;
 	disk->fops = &drbd_ops;
-	sprintf(disk->disk_name, DEVICE_NAME "%d", minor);
+	sprintf(disk->disk_name, "drbd%d", minor);
 	disk->private_data = mdev;
 	add_disk(disk);
 
@@ -2428,15 +2428,15 @@
 
 	/* FIXME should be a compile time assert */
 	if (sizeof(struct Drbd_HandShake_Packet) != 80) {
-		printk(KERN_ERR DEVICE_NAME
-		       ": never change the size or layout "
+		printk(KERN_ERR
+		       "drbd: never change the size or layout "
 		       "of the HandShake packet.\n");
 		return -EINVAL;
 	}
 
 	if (1 > minor_count || minor_count > 255) {
-		printk(KERN_ERR DEVICE_NAME
-			": invalid minor_count (%d)\n", minor_count);
+		printk(KERN_ERR
+			"drbd: invalid minor_count (%d)\n", minor_count);
 #ifdef MODULE
 		return -EINVAL;
 #else
@@ -2448,10 +2448,10 @@
 	if (err)
 		return err;
 
-	err = register_blkdev(DRBD_MAJOR, DEVICE_NAME);
+	err = register_blkdev(DRBD_MAJOR, "drbd");
 	if (err) {
-		printk(KERN_ERR DEVICE_NAME
-		       ": unable to register block device major %d\n",
+		printk(KERN_ERR
+		       "drbd: unable to register block device major %d\n",
 		       DRBD_MAJOR);
 		return err;
 	}
@@ -2482,7 +2482,7 @@
 	drbd_proc = create_proc_entry("drbd",  S_IFREG | S_IRUGO , &proc_root);
 
 	if (!drbd_proc)	{
-		printk(KERN_ERR DEVICE_NAME": unable to register proc file\n");
+		printk(KERN_ERR "drbd: unable to register proc file\n");
 		goto Enomem;
 	}
 
@@ -2492,13 +2492,13 @@
 # error "Currently drbd depends on the proc file system (CONFIG_PROC_FS)"
 #endif
 
-	printk(KERN_INFO DEVICE_NAME ": initialised. "
+	printk(KERN_INFO "drbd: initialised. "
 	       "Version: " REL_VERSION " (api:%d/proto:%d)\n",
 	       API_VERSION, PRO_VERSION);
-	printk(KERN_INFO DEVICE_NAME ": %s\n", drbd_buildtag());
-	printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n",
+	printk(KERN_INFO "drbd: %s\n", drbd_buildtag());
+	printk(KERN_INFO "drbd: registered as block device major %d\n",
 		DRBD_MAJOR);
-	printk(KERN_INFO DEVICE_NAME": minor_table @ 0x%p\n", minor_table);
+	printk(KERN_INFO "drbd: minor_table @ 0x%p\n", minor_table);
 
 	return 0; /* Success! */
 
@@ -2506,9 +2506,9 @@
 	drbd_cleanup();
 	if (err == -ENOMEM)
 		/* currently always the case */
-		printk(KERN_ERR DEVICE_NAME ": ran out of memory\n");
+		printk(KERN_ERR "drbd: ran out of memory\n");
 	else
-		printk(KERN_ERR DEVICE_NAME ": initialization failure\n");
+		printk(KERN_ERR "drbd: initialization failure\n");
 	return err;
 }
 

Modified: branches/drbd-8.1/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_nl.c	2007-08-27 09:01:12 UTC (rev 3024)
+++ branches/drbd-8.1/drbd/drbd_nl.c	2007-08-27 10:12:02 UTC (rev 3025)
@@ -144,7 +144,7 @@
 	struct cn_msg *req = data;
 	struct drbd_nl_cfg_req *nlp = (struct drbd_nl_cfg_req *)req->data;
 
-	printk(KERN_INFO DEVICE_NAME "%d: "
+	printk(KERN_INFO "drbd%d: "
 	       "Netlink: << %s (%d) - seq: %x, ack: %x, len: %x\n",
 	       nlp->drbd_minor,
 	       nl_packet_name(nlp->packet_type),
@@ -157,7 +157,7 @@
 	struct cn_msg *req = data;
 	struct drbd_nl_cfg_reply *nlp = (struct drbd_nl_cfg_reply *)req->data;
 
-	printk(KERN_INFO DEVICE_NAME "%d: "
+	printk(KERN_INFO "drbd%d: "
 	       "Netlink: >> %s (%d) - seq: %x, ack: %x, len: %x\n",
 	       nlp->minor,
 	       nlp->packet_type == P_nl_after_last_packet?
@@ -1625,7 +1625,7 @@
 		+ sizeof(short int);
 
 	if (!try_module_get(THIS_MODULE)) {
-		printk(KERN_ERR DEVICE_NAME "try_module_get() failed!\n");
+		printk(KERN_ERR "drbd: try_module_get() failed!\n");
 		return;
 	}
 
@@ -1670,7 +1670,7 @@
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
 	if (rr && rr != -ESRCH)
-		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n", rr);
+		printk(KERN_INFO "drbd: cn_netlink_send()=%d\n", rr);
 
 	kfree(cn_reply);
 	module_put(THIS_MODULE);
@@ -1824,7 +1824,7 @@
 #endif
 	err = cn_add_callback(&cn_id_drbd, "cn_drbd", &drbd_connector_callback);
 	if (err) {
-		printk(KERN_ERR DEVICE_NAME "cn_drbd failed to register\n");
+		printk(KERN_ERR "drbd: cn_drbd failed to register\n");
 		return err;
 	}
 
@@ -1866,6 +1866,6 @@
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
 	if (rr && rr != -ESRCH)
-		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n", rr);
+		printk(KERN_INFO "drbd: cn_netlink_send()=%d\n", rr);
 }
 

Modified: branches/drbd-8.1/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.1/drbd/drbd_wrappers.h	2007-08-27 09:01:12 UTC (rev 3024)
+++ branches/drbd-8.1/drbd/drbd_wrappers.h	2007-08-27 10:12:02 UTC (rev 3025)
@@ -118,8 +118,8 @@
 	bio->bi_rw = rw;
 
 	if (!bio->bi_bdev) {
-		printk(KERN_ERR DEVICE_NAME
-		       "%d: drbd_generic_make_request: bio->bi_bdev == NULL\n",
+		printk(KERN_ERR "drbd%d: drbd_generic_make_request: "
+				"bio->bi_bdev == NULL\n",
 		       mdev_to_minor(mdev));
 		dump_stack();
 		bio_endio(bio, bio->bi_size, -ENODEV);
@@ -190,7 +190,7 @@
 {
 	int ret = unregister_blkdev(major,name);
 	if (ret)
-		printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
+		printk(KERN_ERR "drbd: unregister of device failed\n");
 }
 #else
 #define drbd_unregister_blkdev unregister_blkdev



More information about the drbd-cvs mailing list