summaryrefslogtreecommitdiffstats
path: root/libblkid/src/probe.c
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak)2013-02-11 22:22:12 +0100
committerKarel Zak2013-02-14 12:11:34 +0100
commitfafe46bc266b65ca524909b43701a3d06825d0a8 (patch)
treef76dd96274aacb8bb51f7d3409db1bf187c3d2f4 /libblkid/src/probe.c
parentlibblkid: Don't keep reading same sector of ISO (diff)
downloadkernel-qcow2-util-linux-fafe46bc266b65ca524909b43701a3d06825d0a8.tar.gz
kernel-qcow2-util-linux-fafe46bc266b65ca524909b43701a3d06825d0a8.tar.xz
kernel-qcow2-util-linux-fafe46bc266b65ca524909b43701a3d06825d0a8.zip
libblkid: Expose more ISO9660 headers
In order to kill libosinfo's infamous udev rule[1], we need to make blkid report the following information as udev properties on IS09660 media so that libosinfo can make use of that for detection: 1. Volume ID (already exposed as label). 2. System ID. 3. Publisher ID. 4. Application ID. 5. Boot record's boot system ID, (almost always 'EL TORITO SPECIFICATION' if boot record is present). Example use: $ blkid -p -o udev Fedora-17-x86_64-DVD.iso ID_FS_SYSTEM_ID=LINUX ID_FS_APPLICATION_ID=GENISOIMAGE ISO 9660/HFS FILESYSTEM CREATOR (C) 1993 E.YOUNGDALE ID_FS_UUID=2012-05-22-20-55-32-00 ID_FS_UUID_ENC=2012-05-22-20-55-32-00 ID_FS_BOOT_SYSTEM_ID=EL TORITO SPECIFICATION ID_FS_LABEL=Fedora_17_x86_64 ID_FS_LABEL_ENC=Fedora\x2017\x20x86_64 ID_FS_TYPE=iso9660 ID_PART_TABLE_TYPE=dos [1] https://fedorahosted.org/libosinfo/ticket/1 [kzak@redhat.com: - add blkid_ltrim_whitespace() and use it together with blkid_rtrim_whitespace() to trim white spaces - enlarge blkid values to 128 bytes - add generic blkid_probe_set_id_label() function - always terminate all _ID with \0 - don't export the _IDs to blkid cache] Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libblkid/src/probe.c')
-rw-r--r--libblkid/src/probe.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
index 9e3f8f690..dd3ebcade 100644
--- a/libblkid/src/probe.c
+++ b/libblkid/src/probe.c
@@ -1659,6 +1659,24 @@ size_t blkid_rtrim_whitespace(unsigned char *str)
return i;
}
+/* Removes whitespace from the left-hand side of a string.
+ *
+ * Returns size of the new string (without \0).
+ */
+size_t blkid_ltrim_whitespace(unsigned char *str)
+{
+ size_t len;
+ unsigned char *p;
+
+ for (p = str; p && isspace(*p); p++);
+
+ len = strlen((char *) p);
+
+ if (len && p > str)
+ memmove(str, p, len + 1);
+
+ return len;
+}
/*
* Some mkfs-like utils wipe some parts (usually begin) of the device.
* For example LVM (pvcreate) or mkswap(8). This information could be used