[libvirt] [PATCH 1/4] Allow probing of image formats without version information

2010-11-22 Thread Adam Litke
Disk image formats that wish to opt-out of version validation are supposed to
set versionOffset to -1 in their fileTypeInfo entry.

By unconditionally returning False for these formats,
virStorageFileMatchesVersion() incorrectly reports a version mismatch when the
test was actually skipped.  The correct behavior is to return True so these
formats can be successfully probed using the magic bytes alone.

Signed-off-by: Adam Litke a...@us.ibm.com
Acked-by: Eric Blake ebl...@redhat.com
---
 src/util/storage_file.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 4098383..f8ab168 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -478,7 +478,7 @@ virStorageFileMatchesVersion(int format,
 
 /* Validate version number info */
 if (fileTypeInfo[format].versionOffset == -1)
-return false;
+return true;
 
 if ((fileTypeInfo[format].versionOffset + 4)  buflen)
 return false;
-- 
1.7.3.2.164.g6f10c

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 1/4] Allow probing of image formats without version information

2010-11-19 Thread Adam Litke
Disk image formats that wish to opt-out of version validation are supposed to
set versionOffset to -1 in their fileTypeInfo entry.

By unconditionally returning False for these formats,
virStorageFileMatchesVersion() incorrectly reports a version mismatch when the
test was actually skipped.  The correct behavior is to return True so these
formats can be successfully probed using the magic bytes alone.

Signed-off-by: Adam Litke a...@us.ibm.com
---
 src/util/storage_file.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 4098383..f8ab168 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -478,7 +478,7 @@ virStorageFileMatchesVersion(int format,
 
 /* Validate version number info */
 if (fileTypeInfo[format].versionOffset == -1)
-return false;
+return true;
 
 if ((fileTypeInfo[format].versionOffset + 4)  buflen)
 return false;
-- 
1.7.3.2.164.g6f10c

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 1/4] Allow probing of image formats without version information

2010-11-19 Thread Eric Blake
On 11/19/2010 09:18 AM, Adam Litke wrote:
 Disk image formats that wish to opt-out of version validation are supposed to
 set versionOffset to -1 in their fileTypeInfo entry.
 
 By unconditionally returning False for these formats,
 virStorageFileMatchesVersion() incorrectly reports a version mismatch when the
 test was actually skipped.  The correct behavior is to return True so these
 formats can be successfully probed using the magic bytes alone.
 
 Signed-off-by: Adam Litke a...@us.ibm.com
 ---
  src/util/storage_file.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
 
 diff --git a/src/util/storage_file.c b/src/util/storage_file.c
 index 4098383..f8ab168 100644
 --- a/src/util/storage_file.c
 +++ b/src/util/storage_file.c
 @@ -478,7 +478,7 @@ virStorageFileMatchesVersion(int format,
  
  /* Validate version number info */
  if (fileTypeInfo[format].versionOffset == -1)
 -return false;
 +return true;

ACK.

-- 
Eric Blake   ebl...@redhat.com+1-801-349-2682
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list