[PATCH 07/11] sadump: Allow disk set configuration with arbirary number of disks

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

 



Real sadump limits the number of disks that can be configured at the
same time upto 16, but software side can easily permit more if machine
resource is enough. So this patch remove the limitation.

Signed-off-by: HATAYAMA Daisuke <d.hatayama@xxxxxxxxxxxxxx>
---

 sadump.c |   38 ++++++++++++++++++++++++++++----------
 sadump.h |    2 +-
 2 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/sadump.c b/sadump.c
index 8572596..3482e85 100644
--- a/sadump.c
+++ b/sadump.c
@@ -86,6 +86,7 @@ sadump_cleanup_sadump_data(void)
 	free(sd->block_table);
 	if (sd->sd_list[0])
 		free(sd->sd_list[0]);
+	free(sd->sd_list);
 
 	memset(&sadump_data, 0, sizeof(sadump_data));
 
@@ -374,16 +375,6 @@ restart:
 		goto err;
 	}
 
-	if (flags & SADUMP_DISKSET) {
-
-		sd_list_len_0 = malloc(sizeof(struct sadump_diskset_data));
-		if (!sd_list_len_0) {
-			error(INFO, "sadump: cannot allocate diskset data buffer\n");
-			goto err;
-		}
-
-	}
-
 	sd->filename = file;
 	sd->flags = flags;
 
@@ -417,11 +408,26 @@ restart:
 	sd->page_buf = page_buf;
 
 	if (flags & SADUMP_DISKSET) {
+
+		sd_list_len_0 = malloc(sizeof(struct sadump_diskset_data));
+		if (!sd_list_len_0) {
+			error(INFO,
+			      "sadump: cannot allocate diskset data buffer\n");
+			goto err;
+		}
+
 		sd_list_len_0->filename = sd->filename;
 		sd_list_len_0->dfd = sd->dfd;
 		sd_list_len_0->header = sd->header;
 		sd_list_len_0->data_offset = sd->data_offset;
 
+		sd->sd_list = malloc(sizeof(struct sadump_diskset_data *));
+		if (!sd->sd_list) {
+			error(INFO,
+			      "sadump: cannot allocate diskset list buffer\n");
+			goto err;
+		}
+
 		sd->sd_list_len = 1;
 		sd->sd_list[0] = sd_list_len_0;
 	}
@@ -451,6 +457,8 @@ err:
 	free(page_buf);
 	free(sd_list_len_0);
 
+	free(sd->sd_list);
+
 	return FALSE;
 }
 
@@ -603,6 +611,16 @@ open_disk(char *file)
 		return FALSE;
 	}
 
+	sd->sd_list = realloc(sd->sd_list,
+			      sd->sd_list_len *
+			      sizeof(struct sadump_diskset_data *));
+	if (!sd->sd_list) {
+		if (CRASHDEBUG(1)) {
+			error(INFO, "sadump: cannot malloc diskset list buffer\n");
+		}
+		return FALSE;
+	}
+
 	this_disk = malloc(sizeof(struct sadump_diskset_data));
 	if (!this_disk) {
 		if (CRASHDEBUG(1)) {
diff --git a/sadump.h b/sadump.h
index c5e3591..9adffde 100644
--- a/sadump.h
+++ b/sadump.h
@@ -200,7 +200,7 @@ struct sadump_data {
 	ulong *block_table;
 
 	int sd_list_len;
-	struct sadump_diskset_data *sd_list[SADUMP_MAX_DISK_SET_NUM];
+	struct sadump_diskset_data **sd_list;
 };
 
 struct sadump_data *sadump_get_sadump_data(void);
--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux