This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

STABLE2 - Changes needed to stay current with libvolume_id.


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=277c247e93a10056a9ffe147a2c4c880b0f8a5f5
Commit:        277c247e93a10056a9ffe147a2c4c880b0f8a5f5
Parent:        ac3aed5d029da9f62c4c574f341951c8d5040ec6
Author:        Bob Peterson <rpeterso@redhat.com>
AuthorDate:    Wed Sep 3 13:49:41 2008 -0500
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Wed Sep 24 09:32:56 2008 +0200

Changes needed to stay current with libvolume_id.

---
 gfs2/mkfs/main_mkfs.c |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index 8aa9c39..7aeb3af 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -259,17 +259,33 @@ static void are_you_sure(struct gfs2_sbd *sdp)
 {
 	char input[32];
 	struct volume_id *vid = NULL;
-
-	vid = volume_id_open_node(sdp->device_name);
-	if (vid == NULL)
+	int fd;
+
+	fd = open(sdp->device_name, O_RDONLY);
+	if (fd < 0)
+		die("Error: device %s not found.\n", sdp->device_name);
+	vid = volume_id_open_fd(fd);
+	if (vid == NULL) {
+		close(fd);
 		die("error identifying the contents of %s: %s\n",
 		    sdp->device_name, strerror(errno));
-
+	}
 	printf("This will destroy any data on %s.\n", sdp->device_name);
-	if (volume_id_probe_all(vid, 0, sdp->device_size) == 0)
-		printf("  It appears to contain a %s %s.\n", vid->type,
-			   vid->usage_id == VOLUME_ID_OTHER? "partition" : vid->usage);
+	if (volume_id_probe_all(vid, 0, sdp->device_size) == 0) {
+		const char *fstype, *fsusage;
+		int rc;
+
+		rc = volume_id_get_type(vid, &fstype);
+		if (rc) {
+			rc = volume_id_get_usage(vid, &fsusage);
+			if (!rc || strncmp(fsusage, "other", 5) == 0)
+				fsusage = "partition";
+			printf("  It appears to contain a %s %s.\n", fstype,
+			       fsusage);
+		}
+	}
 	volume_id_close(vid);
+	close(fd);
 	printf("\nAre you sure you want to proceed? [y/n] ");
 	fgets(input, 32, stdin);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]