From dc61d909a950e70b10180e5b2ef6e315043a2be2 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 9 Sep 2008 12:36:00 +0200 Subject: [PATCH] blkid: blkdev size fallback Signed-off-by: Karel Zak --- libs/blkid/src/Makefile.am | 3 ++- libs/blkid/src/probe.c | 11 ++++++++--- libs/blkid/src/probers/probers.h | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/libs/blkid/src/Makefile.am b/libs/blkid/src/Makefile.am index e9b782fd..271ce69b 100644 --- a/libs/blkid/src/Makefile.am +++ b/libs/blkid/src/Makefile.am @@ -10,7 +10,8 @@ probers = prober-cramfs.c lib_LIBRARIES = libblkid.a libblkid_a_SOURCES = cache.c dev.c devname.c devno.c getsize.c llseek.c \ probe.c read.c resolve.c save.c tag.c version.c verify.c \ - blkid.h blkidP.h list.h blkid_types.h probers/probers.h + blkid.h blkidP.h list.h blkid_types.h probers/probers.h \ + $(top_srcdir)/lib/blkdev.c $(top_srcdir)/lib/linux_version.c libblkid_a_LIBADD = probers/libprobers.a libblkid_a_CFLAGS = -fPIC diff --git a/libs/blkid/src/probe.c b/libs/blkid/src/probe.c index 8f1b8ffd..4f99d088 100644 --- a/libs/blkid/src/probe.c +++ b/libs/blkid/src/probe.c @@ -30,6 +30,7 @@ #endif #include +#include "blkdev.h" #include "blkidP.h" #include "probers/probers.h" @@ -41,8 +42,8 @@ static const struct blkid_idinfo *idinfos[] = &adraid_idinfo, &ddfraid_idinfo, &iswraid_idinfo, - &jmicron_idinfo, - &lsi_idinfo, + &jmraid_idinfo, + &lsiraid_idinfo, &nvraid_idinfo, &pdcraid_idinfo, &silraid_idinfo, @@ -215,7 +216,11 @@ int blkid_probe_set_device(blkid_probe pr, int fd, pr->fd = fd; pr->off = off; - pr->size = size; + + if (!size) + blkdev_get_size(fd, (unsigned long long *) &pr->size); + else + pr->size = size; /* read SB to test if the device is readable */ if (!blkid_probe_get_buffer(pr, 0, 0x200)) diff --git a/libs/blkid/src/probers/probers.h b/libs/blkid/src/probers/probers.h index 83012b93..694672c2 100644 --- a/libs/blkid/src/probers/probers.h +++ b/libs/blkid/src/probers/probers.h @@ -21,8 +21,8 @@ extern const struct blkid_idinfo swsuspend_idinfo; extern const struct blkid_idinfo adraid_idinfo; extern const struct blkid_idinfo ddfraid_idinfo; extern const struct blkid_idinfo iswraid_idinfo; -extern const struct blkid_idinfo jmicron_idinfo; -extern const struct blkid_idinfo lsi_idinfo; +extern const struct blkid_idinfo jmraid_idinfo; +extern const struct blkid_idinfo lsiraid_idinfo; extern const struct blkid_idinfo nvraid_idinfo; extern const struct blkid_idinfo pdcraid_idinfo; extern const struct blkid_idinfo silraid_idinfo; -- 2.39.5