Browse Source

probe: stop handling name property

In the full liblkid there is no tag called "NAME" and the name value reported
by libblkid-tiny was just the kind of uuid passed to blkid_probe_set_uuid_as().

Strip any handling of this property to allow removing it from libblkid-tiny.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Jo-Philipp Wich 7 years ago
parent
commit
e5f83dcc1b
3 changed files with 4 additions and 16 deletions
  1. 3 10
      probe-libblkid.c
  2. 1 5
      probe.c
  3. 0 1
      probe.h

+ 3 - 10
probe-libblkid.c

@@ -55,9 +55,9 @@ probe_path_libblkid(const char *path)
 {
 	blkid_probe pr;
 	struct probe_info *info = NULL;
-	size_t type_len, uuid_len, label_len, name_len, version_len;
-	char *dev_ptr, *type_ptr, *uuid_ptr, *label_ptr, *name_ptr, *version_ptr;
-	const char *type_val, *uuid_val, *label_val, *name_val, *version_val;
+	size_t type_len, uuid_len, label_len, version_len;
+	char *dev_ptr, *type_ptr, *uuid_ptr, *label_ptr, *version_ptr;
+	const char *type_val, *uuid_val, *label_val, *version_val;
 
 	if (!load_libblkid())
 		return NULL;
@@ -77,9 +77,6 @@ probe_path_libblkid(const char *path)
 		if (libblkid.lookup(pr, "LABEL", &label_val, &label_len))
 			label_len = 0;
 
-		if (libblkid.lookup(pr, "NAME", &name_val, &name_len))
-			name_len = 0;
-
 		if (libblkid.lookup(pr, "VERSION", &version_val, &version_len))
 			version_len = 0;
 
@@ -89,7 +86,6 @@ probe_path_libblkid(const char *path)
 			                &type_ptr,    type_len,
 			                &uuid_ptr,    uuid_len,
 			                &label_ptr,   label_len,
-			                &name_ptr,    name_len,
 			                &version_ptr, version_len);
 
 			if (info) {
@@ -102,9 +98,6 @@ probe_path_libblkid(const char *path)
 				if (label_len)
 					info->label = strcpy(label_ptr, label_val);
 
-				if (name_len)
-					info->name = strcpy(name_ptr, name_val);
-
 				if (version_len)
 					info->version = strcpy(version_ptr, version_val);
 			}

+ 1 - 5
probe.c

@@ -22,7 +22,7 @@ probe_path_tiny(const char *path)
 {
 	struct probe_info *info = NULL;
 	struct blkid_struct_probe pr = { };
-	char *type, *dev, *uuid, *label, *name, *version;
+	char *type, *dev, *uuid, *label, *version;
 
 	if (probe_block((char *)path, &pr) == 0 && pr.id && !pr.err) {
 		info = calloc_a(sizeof(*info),
@@ -30,7 +30,6 @@ probe_path_tiny(const char *path)
 		                &dev,     strlen(pr.dev)      + 1,
 		                &uuid,    strlen(pr.uuid)     + 1,
 		                &label,   strlen(pr.label)    + 1,
-		                &name,    strlen(pr.name)     + 1,
 		                &version, strlen(pr.version)  + 1);
 
 		if (info) {
@@ -45,9 +44,6 @@ probe_path_tiny(const char *path)
 			if (pr.label[0])
 				info->label = strcpy(label, pr.label);
 
-			if (pr.name[0])
-				info->name = strcpy(name, pr.name);
-
 			if (pr.version[0])
 				info->version = strcpy(version, pr.version);
 		}

+ 0 - 1
probe.h

@@ -23,7 +23,6 @@ struct probe_info {
 	char *dev;
 	char *uuid;
 	char *label;
-	char *name;
 	char *version;
 };