]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Drop virFileMakePath() and virFileMakePathWithMode()
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 26 Feb 2021 08:30:07 +0000 (09:30 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 4 Mar 2021 19:52:23 +0000 (20:52 +0100)
These functions are now unused.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/libvirt_private.syms
src/util/virfile.c
src/util/virfile.h

index 3e7de7744ed220d7bdb45c74bbaa14fd99977ac4..34a90dfe8597a2acef77457b9bb4eab4054f4b8d 100644 (file)
@@ -2201,8 +2201,6 @@ virFileLinkPointsTo;
 virFileLock;
 virFileLoopDeviceAssociate;
 virFileMakeParentPath;
-virFileMakePath;
-virFileMakePathWithMode;
 virFileMoveMount;
 virFileNBDDeviceAssociate;
 virFileOpenAs;
index 7b907de588c0018954a60e0852ac2f172d1c9561..d1da619666b631105c6c580759a1d7b960368a6f 100644 (file)
@@ -3031,69 +3031,6 @@ int virFileChownFiles(const char *name,
 }
 #endif /* WIN32 */
 
-static int
-virFileMakePathHelper(char *path, mode_t mode)
-{
-    struct stat st;
-    char *p;
-
-    VIR_DEBUG("path=%s mode=0%o", path, mode);
-
-    if (stat(path, &st) >= 0) {
-        if (S_ISDIR(st.st_mode))
-            return 0;
-
-        errno = ENOTDIR;
-        return -1;
-    }
-
-    if (errno != ENOENT)
-        return -1;
-
-    if ((p = strrchr(path, '/')) == NULL) {
-        errno = EINVAL;
-        return -1;
-    }
-
-    if (p != path) {
-        *p = '\0';
-
-        if (virFileMakePathHelper(path, mode) < 0)
-            return -1;
-
-        *p = '/';
-    }
-
-    if (g_mkdir(path, mode) < 0 && errno != EEXIST)
-        return -1;
-
-    return 0;
-}
-
-/**
- * Creates the given directory with mode 0777 if it's not already existing.
- *
- * Returns 0 on success, or -1 if an error occurred (in which case, errno
- * is set appropriately).
- */
-int
-virFileMakePath(const char *path)
-{
-    return g_mkdir_with_parents(path, 0777);
-}
-
-int
-virFileMakePathWithMode(const char *path,
-                        mode_t mode)
-{
-    g_autofree char *tmp = NULL;
-
-    tmp = g_strdup(path);
-
-    return virFileMakePathHelper(tmp, mode);
-}
-
-
 int
 virFileMakeParentPath(const char *path)
 {
@@ -3110,7 +3047,7 @@ virFileMakeParentPath(const char *path)
     }
     *p = '\0';
 
-    return virFileMakePathHelper(tmp, 0777);
+    return g_mkdir_with_parents(tmp, 0777);
 }
 
 
index f237e982900e1c54eaf9482093fa23d77954ac4f..26197cb39dac112c9326d388a10a864205e9c2fa 100644 (file)
@@ -277,9 +277,6 @@ int virDirRead(DIR *dirp, struct dirent **ent, const char *dirname)
 void virDirClose(DIR *dirp);
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(DIR, virDirClose);
 
-int virFileMakePath(const char *path) G_GNUC_WARN_UNUSED_RESULT;
-int virFileMakePathWithMode(const char *path,
-                            mode_t mode) G_GNUC_WARN_UNUSED_RESULT;
 int virFileMakeParentPath(const char *path) G_GNUC_WARN_UNUSED_RESULT;
 
 char *virFileBuildPath(const char *dir,