[libvirt] [PATCH 04/14] Remove bogus const return values in storage file APIs

Daniel P. Berrange berrange at redhat.com
Tue Dec 11 20:41:38 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

virStorageFileGetLVMKey and virStorageFileGetSCSIKey
both return heap allocated strings, so the return value
should not be marked const.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/util/storage_file.c | 8 ++++----
 src/util/storage_file.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 776d4f2..ea2a1bc 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -1192,7 +1192,7 @@ int virStorageFileIsClusterFS(const char *path)
 }
 
 #ifdef LVS
-const char *virStorageFileGetLVMKey(const char *path)
+char *virStorageFileGetLVMKey(const char *path)
 {
     /*
      *  # lvs --noheadings --unbuffered --nosuffix --options "uuid" LVNAME
@@ -1244,7 +1244,7 @@ cleanup:
     return key;
 }
 #else
-const char *virStorageFileGetLVMKey(const char *path)
+char *virStorageFileGetLVMKey(const char *path)
 {
     virReportSystemError(ENOSYS, _("Unable to get LVM key for %s"), path);
     return NULL;
@@ -1252,7 +1252,7 @@ const char *virStorageFileGetLVMKey(const char *path)
 #endif
 
 #ifdef HAVE_UDEV
-const char *virStorageFileGetSCSIKey(const char *path)
+char *virStorageFileGetSCSIKey(const char *path)
 {
     char *key = NULL;
     int status;
@@ -1289,7 +1289,7 @@ cleanup:
     return key;
 }
 #else
-const char *virStorageFileGetSCSIKey(const char *path)
+char *virStorageFileGetSCSIKey(const char *path)
 {
     virReportSystemError(ENOSYS, _("Unable to get SCSI key for %s"), path);
     return NULL;
diff --git a/src/util/storage_file.h b/src/util/storage_file.h
index abfaca9..9e4516e 100644
--- a/src/util/storage_file.h
+++ b/src/util/storage_file.h
@@ -101,7 +101,7 @@ int virStorageFileIsClusterFS(const char *path);
 int virStorageFileIsSharedFSType(const char *path,
                                  int fstypes);
 
-const char *virStorageFileGetLVMKey(const char *path);
-const char *virStorageFileGetSCSIKey(const char *path);
+char *virStorageFileGetLVMKey(const char *path);
+char *virStorageFileGetSCSIKey(const char *path);
 
 #endif /* __VIR_STORAGE_FILE_H__ */
-- 
1.7.11.7




More information about the libvir-list mailing list