public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW lib/device/dev-cache.c
Date: Wed, 21 Dec 2011 13:14:00 -0000	[thread overview]
Message-ID: <20111221131455.8685.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-12-21 13:14:54

Modified files:
	.              : WHATS_NEW 
	lib/device     : dev-cache.c 

Log message:
	Always zalloc device structure
	
	Since there is zalloc behind the macro, put 'z' into the name.
	Make the 'use_malloc' code path also using zalloc() call,
	so it also give zeroed area.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2209&r2=1.2210
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67

--- LVM2/WHATS_NEW	2011/12/21 13:03:06	1.2209
+++ LVM2/WHATS_NEW	2011/12/21 13:14:54	1.2210
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Always zalloc device structure during initialization.
   Fix missing thread list manipulation protection in dmeventd.
   Do not derefence lv pointer in _percent_run() function before NULL check.
   Allow empty strings for description and creation_host config fields.
--- LVM2/lib/device/dev-cache.c	2011/08/30 14:55:16	1.66
+++ LVM2/lib/device/dev-cache.c	2011/12/21 13:14:54	1.67
@@ -48,7 +48,7 @@
 
 } _cache;
 
-#define _alloc(x) dm_pool_zalloc(_cache.mem, (x))
+#define _zalloc(x) dm_pool_zalloc(_cache.mem, (x))
 #define _free(x) dm_pool_free(_cache.mem, (x))
 #define _strdup(x) dm_pool_strdup(_cache.mem, (x))
 
@@ -61,11 +61,11 @@
 
 	if (allocate) {
 		if (use_malloc) {
-			if (!(dev = dm_malloc(sizeof(*dev)))) {
+			if (!(dev = dm_zalloc(sizeof(*dev)))) {
 				log_error("struct device allocation failed");
 				return NULL;
 			}
-			if (!(alias = dm_malloc(sizeof(*alias)))) {
+			if (!(alias = dm_zalloc(sizeof(*alias)))) {
 				log_error("struct str_list allocation failed");
 				dm_free(dev);
 				return NULL;
@@ -78,11 +78,11 @@
 			}
 			dev->flags = DEV_ALLOCED;
 		} else {
-			if (!(dev = _alloc(sizeof(*dev)))) {
+			if (!(dev = _zalloc(sizeof(*dev)))) {
 				log_error("struct device allocation failed");
 				return NULL;
 			}
-			if (!(alias = _alloc(sizeof(*alias)))) {
+			if (!(alias = _zalloc(sizeof(*alias)))) {
 				log_error("struct str_list allocation failed");
 				_free(dev);
 				return NULL;
@@ -118,7 +118,7 @@
 {
 	struct device *dev;
 
-	if (!(dev = _alloc(sizeof(*dev)))) {
+	if (!(dev = _zalloc(sizeof(*dev)))) {
 		log_error("struct device allocation failed");
 		return NULL;
 	}
@@ -303,7 +303,7 @@
 
 static int _add_alias(struct device *dev, const char *path)
 {
-	struct str_list *sl = _alloc(sizeof(*sl));
+	struct str_list *sl = _zalloc(sizeof(*sl));
 	struct str_list *strl;
 	const char *oldpath;
 	int prefer_old = 1;
@@ -788,7 +788,7 @@
 		return 1;
 	}
 
-	if (!(dl = _alloc(sizeof(*dl) + strlen(path) + 1))) {
+	if (!(dl = _zalloc(sizeof(*dl) + strlen(path) + 1))) {
 		log_error("dir_list allocation failed");
 		return 0;
 	}
@@ -814,7 +814,7 @@
 		return 1;
 	}
 
-	if (!(dl = _alloc(sizeof(*dl) + strlen(path) + 1))) {
+	if (!(dl = _zalloc(sizeof(*dl) + strlen(path) + 1))) {
 		log_error("dir_list allocation failed for file");
 		return 0;
 	}


             reply	other threads:[~2011-12-21 13:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 13:14 zkabelac [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-04-11  9:12 prajnoha
2011-12-21 13:21 zkabelac
2011-12-21 13:17 zkabelac
2011-01-17 15:16 zkabelac
2010-05-24 22:53 agk
2005-03-21 14:51 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111221131455.8685.qmail@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).