RE: [PATCH] makedumpfile: Remove duplicated variable declarations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> Thanks for the review, and yes it's definitely OK to change the patch
> in this way. I just took a brief look at the code, and modified it in
> the way that actually change nothing. And after a second look, indeed
> they are never used as variable, only used as parameters of sizeof().
> 
> So actually can we just get rid of them, and use sizeof(struct
> parallel_info) and sizeof(struct splitting_info) instead? It may be
> even simpler.

Yes, let's do it.  I thought to take the original intention and make the
patch simpler, but thinking it again, each of them is used only two times,
and as you say, it would be simpler.

I will apply this:

--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -10954,7 +10954,7 @@ check_param_for_reassembling_dumpfile(int argc, char *argv[])
 		return FALSE;
 
 	if ((info->splitting_info
-	    = malloc(sizeof(splitting_info_t) * info->num_dumpfile))
+	    = malloc(sizeof(struct splitting_info) * info->num_dumpfile))
 	    == NULL) {
 		MSG("Can't allocate memory for splitting_info.\n");
 		return FALSE;
@@ -11042,7 +11042,7 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
 			return FALSE;
 		}
 		if ((info->splitting_info
-		    = malloc(sizeof(splitting_info_t) * info->num_dumpfile))
+		    = malloc(sizeof(struct splitting_info) * info->num_dumpfile))
 		    == NULL) {
 			MSG("Can't allocate memory for splitting_info.\n");
 			return FALSE;
@@ -11077,13 +11077,13 @@ check_param_for_creating_dumpfile(int argc, char *argv[])
 
 	if (info->num_threads) {
 		if ((info->parallel_info =
-		     malloc(sizeof(parallel_info_t) * info->num_threads))
+		     malloc(sizeof(struct parallel_info) * info->num_threads))
 		    == NULL) {
 			MSG("Can't allocate memory for parallel_info.\n");
 			return FALSE;
 		}
 
-		memset(info->parallel_info, 0, sizeof(parallel_info_t)
+		memset(info->parallel_info, 0, sizeof(struct parallel_info)
 							* info->num_threads);
 	}
 
diff --git a/makedumpfile.h b/makedumpfile.h
index 68d9691..7217407 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -1262,7 +1262,7 @@ struct splitting_info {
 	mdf_pfn_t		end_pfn;
 	off_t			offset_eraseinfo;
 	unsigned long		size_eraseinfo;
-} splitting_info_t;
+};
 
 struct parallel_info {
 	int			fd_memory;
@@ -1275,7 +1275,7 @@ struct parallel_info {
 #ifdef USELZO
 	lzo_bytep		wrkmem;
 #endif
-} parallel_info_t;
+};
 
 struct ppc64_vmemmap {
 	unsigned long		phys;
@@ -2006,8 +2006,8 @@ struct memory_range {
 };
 
 #define CRASH_RESERVED_MEM_NR   8
-struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
-int crash_reserved_mem_nr;
+extern struct memory_range crash_reserved_mem[CRASH_RESERVED_MEM_NR];
+extern int crash_reserved_mem_nr;
 
 unsigned long read_vmcoreinfo_symbol(char *str_symbol);
 int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);

_______________________________________________
kexec mailing list
kexec@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/kexec



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux