X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=extras%2Fvolume_id%2Flib%2Fvolume_id.c;h=b247fe2ddbc0211afd165a2f59ae1d108153743c;hb=726687ad48bdececed1e7e44387c50e009e28208;hp=59303d5bffce2f2e8228f33980bf7a385151d3ee;hpb=b10941c08db89f52038e19ee8a29f26d7808a448;p=elogind.git diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 59303d5bf..b247fe2dd 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -70,11 +70,14 @@ static const struct prober prober_filesystem[] = { { volume_id_probe_hpfs, { "hpfs", } }, { volume_id_probe_sysv, { "sysv", "xenix", } }, { volume_id_probe_minix, { "minix", } }, + { volume_id_probe_gfs, { "gfs", } }, + { volume_id_probe_gfs2, { "gfs2", } }, { volume_id_probe_ocfs1, { "ocfs1", } }, { volume_id_probe_ocfs2, { "ocfs2", } }, { volume_id_probe_vxfs, { "vxfs", } }, { volume_id_probe_squashfs, { "squashfs", } }, { volume_id_probe_netware, { "netware", } }, + { volume_id_probe_oracleasm, { "oracleasm", } }, }; /* the user can overwrite this log function */ @@ -86,7 +89,7 @@ static void default_log(int priority, const char *file, int line, const char *fo volume_id_log_fn_t volume_id_log_fn = default_log; /** - * volume_id_get_label: + * volume_id_get_prober_by_type: * @type: Type string. * * Lookup the probing function for a specific type. @@ -330,6 +333,14 @@ err: return 0; } +/* run only once into a timeout for unreadable devices */ +static int device_is_readable(struct volume_id *id, uint64_t off) +{ + if (volume_id_get_buffer(id, off, 0x200) != NULL) + return 1; + return 0; +} + /** * volume_id_probe_raid: * @id: Probing context. @@ -347,7 +358,10 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; - info("probing at offset 0x%llx, size 0x%llx", + if (!device_is_readable(id, off)) + return -1; + + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); for (i = 0; i < ARRAY_SIZE(prober_raid); i++) @@ -378,7 +392,10 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (id == NULL) return -EINVAL; - info("probing at offset 0x%llx, size 0x%llx", + if (!device_is_readable(id, off)) + return -1; + + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) @@ -407,6 +424,9 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; + if (!device_is_readable(id, off)) + return -1; + /* probe for raid first, because fs probes may be successful on raid members */ if (volume_id_probe_raid(id, off, size) == 0) return 0; @@ -476,7 +496,7 @@ struct volume_id *volume_id_open_node(const char *path) fd = open(path, O_RDONLY); if (fd < 0) { - dbg("unable to open '%s'", path); + dbg("unable to open '%s'\n", path); return NULL; }