goto cleanup;
tmp = disk->backingChain;
- while (tmp && tmp->backingStoreIsFile) {
+ while (tmp && virStorageIsFile(tmp->backingStore)) {
if (!ignoreOpenFailure && !tmp->backingMeta) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unable to visit backing chain file %s"),
*backingStore = meta->backingStore;
meta->backingStore = NULL;
if (meta->backingStoreFormat == VIR_STORAGE_FILE_AUTO &&
- meta->backingStoreIsFile) {
+ virStorageIsFile(*backingStore)) {
if ((ret = virStorageFileProbeFormat(*backingStore, -1, -1)) < 0) {
/* If the backing file is currently unavailable, only log an error,
* but continue. Returning -1 here would disable the whole storage
return false;
}
-static bool
-virBackingStoreIsFile(const char *backing)
+bool
+virStorageIsFile(const char *backing)
{
- char *colon = strchr(backing, ':');
- char *slash = strchr(backing, '/');
+ char *colon;
+ char *slash;
+
+ if (!backing)
+ return false;
+
+ colon = strchr(backing, ':');
+ slash = strchr(backing, '/');
/* Reject anything that looks like a protocol (such as nbd: or
* rbd:); if someone really does want a relative file name that
VIR_FREE(backing);
goto cleanup;
}
- if (virBackingStoreIsFile(backing)) {
+ if (virStorageIsFile(backing)) {
meta->backingStoreIsFile = true;
meta->backingStoreRaw = meta->backingStore;
meta->backingStore = NULL;
if (virHashAddEntry(cycle, canonPath, (void *)1) < 0)
return -1;
- if (virBackingStoreIsFile(path)) {
+ if (virStorageIsFile(path)) {
if ((fd = virFileOpenAs(canonPath, O_RDONLY, 0, uid, gid, 0)) < 0) {
virReportSystemError(-fd, _("Failed to open file '%s'"), path);
return -1;
if (!cycle)
return NULL;
- if (virBackingStoreIsFile(path)) {
+ if (virStorageIsFile(path)) {
if (!(canonPath = canonicalize_file_name(path))) {
virReportSystemError(errno, _("unable to resolve '%s'"), path);
goto cleanup;