#include "virstring.h"
#include "node_device_conf.h"
#include "device_conf.h"
-#include "dirname.h"
#include "virxml.h"
#include "virbuffer.h"
#include "viruuid.h"
VIR_DEBUG("Checking if '%s' is an FC remote port", scsi_target->name);
/* /sys/devices/[...]/host0/rport-0:0-0/target0:0:0 -> rport-0:0-0 */
- if (!(dir = mdir_name(sysfsPath)))
- return -1;
+ dir = g_path_get_dirname(sysfsPath);
rport = g_path_get_basename(dir);
#include <sanlock_resource.h>
#include <sanlock_admin.h>
-#include "dirname.h"
#include "lock_driver.h"
#include "virlog.h"
#include "virerror.h"
int perms = 0600;
VIR_DEBUG("Lockspace %s does not yet exist", path);
- if (!(dir = mdir_name(path))) {
- virReportOOMError();
- goto error;
- }
+ dir = g_path_get_dirname(path);
if (stat(dir, &st) < 0 || !S_ISDIR(st.st_mode)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unable to create lockspace %s: parent directory"
#include "vircgroup.h"
#include "virperf.h"
#include "virnuma.h"
-#include "dirname.h"
#include "netdev_bandwidth_conf.h"
#include "virqemu.h"
#include "virdomainsnapshotobjlist.h"
(int)cfg->group);
goto error;
}
- if (!(channeldir = mdir_name(cfg->channelTargetDir))) {
- virReportOOMError();
- goto error;
- }
+ channeldir = g_path_get_dirname(cfg->channelTargetDir);
+
if (chown(channeldir, cfg->user, cfg->group) < 0) {
virReportSystemError(errno,
_("unable to set ownership of '%s' to %d:%d"),
#include "virstring.h"
#include "virpidfile.h"
#include "configmake.h"
-#include "dirname.h"
#include "qemu_tpm.h"
#include "virtpm.h"
#include "secret_util.h"
}
-/*
- * virtTPMGetTPMStorageDir:
- *
- * @storagepath: directory for swtpm's persistent state
- *
- * Derive the 'TPMStorageDir' from the storagepath by searching
- * for the last '/'.
- */
-static char *
-qemuTPMGetTPMStorageDir(const char *storagepath)
-{
- char *ret = mdir_name(storagepath);
-
- if (!ret)
- virReportOOMError();
-
- return ret;
-}
-
-
/*
* qemuTPMEmulatorInitStorage
*
gid_t swtpm_group)
{
int ret = -1;
- char *swtpmStorageDir = qemuTPMGetTPMStorageDir(storagepath);
-
- if (!swtpmStorageDir)
- return -1;
+ char *swtpmStorageDir = g_path_get_dirname(storagepath);
if (qemuTPMEmulatorInitStorage(swtpmStorageDir) < 0)
goto cleanup;
static void
qemuTPMDeleteEmulatorStorage(virDomainTPMDefPtr tpm)
{
- char *path = qemuTPMGetTPMStorageDir(tpm->data.emulator.storagepath);
+ g_autofree char *path = g_path_get_dirname(tpm->data.emulator.storagepath);
- if (path) {
- ignore_value(virFileDeleteTree(path));
- VIR_FREE(path);
- }
+ ignore_value(virFileDeleteTree(path));
}
#include "viralloc.h"
#include "vircommand.h"
#include "virlog.h"
-#include "dirname.h"
#include "driver.h"
#include "security_driver.h"
*/
pathdir = g_strdup(path);
while (!virFileExists(pathdir)) {
- if ((pathtmp = mdir_name(pathdir)) == NULL)
- goto cleanup;
+ pathtmp = g_path_get_dirname(pathdir);
VIR_FREE(pathdir);
pathdir = g_steal_pointer(&pathtmp);
}
#endif
#include <unistd.h>
#include <dirent.h>
-#include <dirname.h>
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
# include <mntent.h>
#endif
int ret;
struct stat sb1, sb2;
- if (!(parent = mdir_name(file))) {
- virReportOOMError();
- return -1;
- }
+ parent = g_path_get_dirname(file);
VIR_DEBUG("Comparing '%s' to '%s'", file, parent);
#include "virstring.h"
#include "virutil.h"
#include "viruri.h"
-#include "dirname.h"
#include "virbuffer.h"
#include "virjson.h"
#include "virstorageencryption.h"
if (nameIsFile && virStorageSourceIsLocalStorage(chain)) {
if (*parent && virStorageSourceIsLocalStorage(*parent))
- parentDir = mdir_name((*parent)->path);
+ parentDir = g_path_get_dirname((*parent)->path);
else
parentDir = g_strdup(".");
- if (!parentDir) {
- virReportOOMError();
- goto error;
- }
-
int result = virFileRelLinkPointsTo(parentDir, name,
chain->path);
/* store relative name */
def->relPath = g_strdup(rel);
- if (!(dirname = mdir_name(parent->path))) {
- virReportOOMError();
- return NULL;
- }
+ dirname = g_path_get_dirname(parent->path);
if (STRNEQ(dirname, "/")) {
def->path = g_strdup_printf("%s/%s", dirname, rel);
#include "vircommand.h"
#include "cpu/cpu.h"
-#include "dirname.h"
#include "viralloc.h"
#include "virfile.h"
#include "viruuid.h"
char *bin = NULL;
char *vmwarePath = NULL;
- if ((vmwarePath = mdir_name(driver->vmrun)) == NULL)
- goto cleanup;
+ vmwarePath = g_path_get_dirname(driver->vmrun);
switch (driver->type) {
case VMWARE_DRIVER_PLAYER:
char *tmp = NULL;
int pid_value = -1;
- if ((vmxDir = mdir_name(vmxPath)) == NULL)
- goto cleanup;
+ vmxDir = g_path_get_dirname(vmxPath);
logFilePath = g_strdup_printf("%s/vmware.log", vmxDir);