mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-11 00:58:38 +03:00
Drop needless variable
Instead of the following pattern: type ret; ... ret = func(); return ret; we can use: return func() directly. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
0975dd6cb9
commit
d901fd6092
@ -1392,13 +1392,7 @@ virDomainPCIAddressSetAllMulti(virDomainDefPtr def)
|
|||||||
static char*
|
static char*
|
||||||
virDomainCCWAddressAsString(virDomainDeviceCCWAddressPtr addr)
|
virDomainCCWAddressAsString(virDomainDeviceCCWAddressPtr addr)
|
||||||
{
|
{
|
||||||
char *addrstr = NULL;
|
return g_strdup_printf("%x.%x.%04x", addr->cssid, addr->ssid, addr->devno);
|
||||||
|
|
||||||
addrstr = g_strdup_printf("%x.%x.%04x",
|
|
||||||
addr->cssid,
|
|
||||||
addr->ssid,
|
|
||||||
addr->devno);
|
|
||||||
return addrstr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -31317,7 +31317,6 @@ virDomainDefGetShortName(const virDomainDef *def)
|
|||||||
{
|
{
|
||||||
wchar_t wshortname[VIR_DOMAIN_SHORT_NAME_MAX + 1] = {0};
|
wchar_t wshortname[VIR_DOMAIN_SHORT_NAME_MAX + 1] = {0};
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
char *ret = NULL;
|
|
||||||
g_autofree char *shortname = NULL;
|
g_autofree char *shortname = NULL;
|
||||||
|
|
||||||
/* No need to do the whole conversion thing when there are no multibyte
|
/* No need to do the whole conversion thing when there are no multibyte
|
||||||
@ -31326,8 +31325,8 @@ virDomainDefGetShortName(const virDomainDef *def)
|
|||||||
len = mbstowcs(NULL, def->name, 0);
|
len = mbstowcs(NULL, def->name, 0);
|
||||||
if ((len == (size_t) -1 && errno == EILSEQ) ||
|
if ((len == (size_t) -1 && errno == EILSEQ) ||
|
||||||
len == strlen(def->name)) {
|
len == strlen(def->name)) {
|
||||||
ret = g_strdup_printf("%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX, def->name);
|
return g_strdup_printf("%d-%.*s", def->id, VIR_DOMAIN_SHORT_NAME_MAX,
|
||||||
return ret;
|
def->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len == (size_t) -1) {
|
if (len == (size_t) -1) {
|
||||||
@ -31362,8 +31361,7 @@ virDomainDefGetShortName(const virDomainDef *def)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_strdup_printf("%d-%s", def->id, shortname);
|
return g_strdup_printf("%d-%s", def->id, shortname);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef VIR_DOMAIN_SHORT_NAME_MAX
|
#undef VIR_DOMAIN_SHORT_NAME_MAX
|
||||||
|
@ -2892,10 +2892,7 @@ char *
|
|||||||
virNetworkConfigFile(const char *dir,
|
virNetworkConfigFile(const char *dir,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
return g_strdup_printf("%s/%s.xml", dir, name);
|
||||||
|
|
||||||
ret = g_strdup_printf("%s/%s.xml", dir, name);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -432,10 +432,7 @@ static char *
|
|||||||
virNetworkPortDefConfigFile(const char *dir,
|
virNetworkPortDefConfigFile(const char *dir,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
return g_strdup_printf("%s/%s.xml", dir, name);
|
||||||
|
|
||||||
ret = g_strdup_printf("%s/%s.xml", dir, name);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4467,7 +4467,6 @@ char *
|
|||||||
virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
|
virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
char *ret = NULL;
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
virBufferAddLit(&buf, "<qemuCaps>\n");
|
virBufferAddLit(&buf, "<qemuCaps>\n");
|
||||||
@ -4537,9 +4536,7 @@ virQEMUCapsFormatCache(virQEMUCapsPtr qemuCaps)
|
|||||||
virBufferAdjustIndent(&buf, -2);
|
virBufferAdjustIndent(&buf, -2);
|
||||||
virBufferAddLit(&buf, "</qemuCaps>\n");
|
virBufferAddLit(&buf, "</qemuCaps>\n");
|
||||||
|
|
||||||
ret = virBufferContentAndReset(&buf);
|
return virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -251,7 +251,6 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd,
|
|||||||
static char *
|
static char *
|
||||||
qemuVirCommandGetFDSet(virCommandPtr cmd, int fd)
|
qemuVirCommandGetFDSet(virCommandPtr cmd, int fd)
|
||||||
{
|
{
|
||||||
char *result = NULL;
|
|
||||||
int idx = virCommandPassFDGetFDIndex(cmd, fd);
|
int idx = virCommandPassFDGetFDIndex(cmd, fd);
|
||||||
|
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
@ -260,8 +259,7 @@ qemuVirCommandGetFDSet(virCommandPtr cmd, int fd)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = g_strdup_printf("set=%d,fd=%d", idx, fd);
|
return g_strdup_printf("set=%d,fd=%d", idx, fd);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -278,7 +276,6 @@ qemuVirCommandGetFDSet(virCommandPtr cmd, int fd)
|
|||||||
static char *
|
static char *
|
||||||
qemuVirCommandGetDevSet(virCommandPtr cmd, int fd)
|
qemuVirCommandGetDevSet(virCommandPtr cmd, int fd)
|
||||||
{
|
{
|
||||||
char *result = NULL;
|
|
||||||
int idx = virCommandPassFDGetFDIndex(cmd, fd);
|
int idx = virCommandPassFDGetFDIndex(cmd, fd);
|
||||||
|
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
@ -287,8 +284,7 @@ qemuVirCommandGetDevSet(virCommandPtr cmd, int fd)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = g_strdup_printf("/dev/fdset/%d", idx);
|
return g_strdup_printf("/dev/fdset/%d", idx);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1429,7 +1429,6 @@ char *
|
|||||||
qemuGetSharedDeviceKey(const char *device_path)
|
qemuGetSharedDeviceKey(const char *device_path)
|
||||||
{
|
{
|
||||||
int maj, min;
|
int maj, min;
|
||||||
char *key = NULL;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((rc = virGetDeviceID(device_path, &maj, &min)) < 0) {
|
if ((rc = virGetDeviceID(device_path, &maj, &min)) < 0) {
|
||||||
@ -1439,9 +1438,7 @@ qemuGetSharedDeviceKey(const char *device_path)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = g_strdup_printf("%d:%d", maj, min);
|
return g_strdup_printf("%d:%d", maj, min);
|
||||||
|
|
||||||
return key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1706,7 +1703,6 @@ qemuGetHostdevPath(virDomainHostdevDefPtr hostdev)
|
|||||||
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
virDomainHostdevSubsysSCSIPtr scsisrc = &hostdev->source.subsys.u.scsi;
|
||||||
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
|
||||||
g_autofree char *dev_name = NULL;
|
g_autofree char *dev_name = NULL;
|
||||||
char *dev_path = NULL;
|
|
||||||
|
|
||||||
if (!(dev_name = virSCSIDeviceGetDevName(NULL,
|
if (!(dev_name = virSCSIDeviceGetDevName(NULL,
|
||||||
scsihostsrc->adapter,
|
scsihostsrc->adapter,
|
||||||
@ -1715,8 +1711,7 @@ qemuGetHostdevPath(virDomainHostdevDefPtr hostdev)
|
|||||||
scsihostsrc->unit)))
|
scsihostsrc->unit)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dev_path = g_strdup_printf("/dev/%s", dev_name);
|
return g_strdup_printf("/dev/%s", dev_name);
|
||||||
return dev_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -6837,15 +6837,12 @@ qemuDomainDefCopy(virQEMUDriverPtr driver,
|
|||||||
virDomainDefPtr src,
|
virDomainDefPtr src,
|
||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDomainDefPtr ret = NULL;
|
|
||||||
g_autofree char *xml = NULL;
|
g_autofree char *xml = NULL;
|
||||||
|
|
||||||
if (!(xml = qemuDomainDefFormatXML(driver, qemuCaps, src, flags)))
|
if (!(xml = qemuDomainDefFormatXML(driver, qemuCaps, src, flags)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
ret = qemuDomainDefFromXML(driver, qemuCaps, xml);
|
return qemuDomainDefFromXML(driver, qemuCaps, xml);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -13364,11 +13361,8 @@ qemuProcessEventFree(struct qemuProcessEvent *event)
|
|||||||
char *
|
char *
|
||||||
qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv)
|
qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
return g_strdup_printf("%s/%s.sock", priv->libDir,
|
||||||
|
qemuDomainGetManagedPRAlias());
|
||||||
ret = g_strdup_printf("%s/%s.sock", priv->libDir, qemuDomainGetManagedPRAlias());
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7439,31 +7439,25 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn,
|
|||||||
static int qemuConnectListDefinedDomains(virConnectPtr conn,
|
static int qemuConnectListDefinedDomains(virConnectPtr conn,
|
||||||
char **const names, int nnames) {
|
char **const names, int nnames) {
|
||||||
virQEMUDriverPtr driver = conn->privateData;
|
virQEMUDriverPtr driver = conn->privateData;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectListDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virDomainObjListGetInactiveNames(driver->domains, names, nnames,
|
return virDomainObjListGetInactiveNames(driver->domains, names, nnames,
|
||||||
virConnectListDefinedDomainsCheckACL,
|
virConnectListDefinedDomainsCheckACL,
|
||||||
conn);
|
conn);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qemuConnectNumOfDefinedDomains(virConnectPtr conn)
|
static int qemuConnectNumOfDefinedDomains(virConnectPtr conn)
|
||||||
{
|
{
|
||||||
virQEMUDriverPtr driver = conn->privateData;
|
virQEMUDriverPtr driver = conn->privateData;
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
if (virConnectNumOfDefinedDomainsEnsureACL(conn) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
ret = virDomainObjListNumOfDomains(driver->domains, false,
|
return virDomainObjListNumOfDomains(driver->domains, false,
|
||||||
virConnectNumOfDefinedDomainsCheckACL,
|
virConnectNumOfDefinedDomainsCheckACL,
|
||||||
conn);
|
conn);
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,11 +171,7 @@ static char *
|
|||||||
qemuTPMCreateEmulatorSocket(const char *swtpmStateDir,
|
qemuTPMCreateEmulatorSocket(const char *swtpmStateDir,
|
||||||
const char *shortName)
|
const char *shortName)
|
||||||
{
|
{
|
||||||
char *path = NULL;
|
return g_strdup_printf("%s/%s-swtpm.sock", swtpmStateDir, shortName);
|
||||||
|
|
||||||
path = g_strdup_printf("%s/%s-swtpm.sock", swtpmStateDir, shortName);
|
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -213,14 +209,11 @@ static char *
|
|||||||
qemuTPMEmulatorCreatePidFilename(const char *swtpmStateDir,
|
qemuTPMEmulatorCreatePidFilename(const char *swtpmStateDir,
|
||||||
const char *shortName)
|
const char *shortName)
|
||||||
{
|
{
|
||||||
char *pidfile = NULL;
|
|
||||||
g_autofree char *devicename = NULL;
|
g_autofree char *devicename = NULL;
|
||||||
|
|
||||||
devicename = g_strdup_printf("%s-swtpm", shortName);
|
devicename = g_strdup_printf("%s-swtpm", shortName);
|
||||||
|
|
||||||
pidfile = virPidFileBuildPath(swtpmStateDir, devicename);
|
return virPidFileBuildPath(swtpmStateDir, devicename);
|
||||||
|
|
||||||
return pidfile;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,12 +213,9 @@ static char *
|
|||||||
get_profile_name(virDomainDefPtr def)
|
get_profile_name(virDomainDefPtr def)
|
||||||
{
|
{
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
char *name = NULL;
|
|
||||||
|
|
||||||
virUUIDFormat(def->uuid, uuidstr);
|
virUUIDFormat(def->uuid, uuidstr);
|
||||||
name = g_strdup_printf("%s%s", AA_PREFIX, uuidstr);
|
return g_strdup_printf("%s%s", AA_PREFIX, uuidstr);
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* returns -1 on error or profile for libvirtd is unconfined, 0 if complain
|
/* returns -1 on error or profile for libvirtd is unconfined, 0 if complain
|
||||||
|
@ -92,9 +92,8 @@ virSecurityGetRefCountAttrName(const char *name G_GNUC_UNUSED)
|
|||||||
static char *
|
static char *
|
||||||
virSecurityGetTimestampAttrName(const char *name)
|
virSecurityGetTimestampAttrName(const char *name)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
return g_strdup_printf(XATTR_NAMESPACE ".libvirt.security.timestamp_%s",
|
||||||
ret = g_strdup_printf(XATTR_NAMESPACE ".libvirt.security.timestamp_%s", name);
|
name);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
#else /* !XATTR_NAMESPACE */
|
#else /* !XATTR_NAMESPACE */
|
||||||
static char *
|
static char *
|
||||||
@ -112,7 +111,6 @@ static char *
|
|||||||
virSecurityGetTimestamp(void)
|
virSecurityGetTimestamp(void)
|
||||||
{
|
{
|
||||||
unsigned long long boottime = 0;
|
unsigned long long boottime = 0;
|
||||||
char *ret = NULL;
|
|
||||||
|
|
||||||
if (virHostGetBootTime(&boottime) < 0) {
|
if (virHostGetBootTime(&boottime) < 0) {
|
||||||
virReportSystemError(errno, "%s",
|
virReportSystemError(errno, "%s",
|
||||||
@ -120,8 +118,7 @@ virSecurityGetTimestamp(void)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = g_strdup_printf("%llu", boottime);
|
return g_strdup_printf("%llu", boottime);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2839,11 +2839,8 @@ virStoragePoolObjBuildTempFilePath(virStoragePoolObjPtr obj,
|
|||||||
|
|
||||||
{
|
{
|
||||||
virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
|
virStoragePoolDefPtr def = virStoragePoolObjGetDef(obj);
|
||||||
char *tmp = NULL;
|
return g_strdup_printf("%s/%s.%s.secret.XXXXXX", driver->stateDir,
|
||||||
|
def->name, voldef->name);
|
||||||
tmp = g_strdup_printf("%s/%s.%s.secret.XXXXXX",
|
|
||||||
driver->stateDir, def->name, voldef->name);
|
|
||||||
return tmp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,7 +423,6 @@ virCgroupDetect(virCgroupPtr group,
|
|||||||
char *
|
char *
|
||||||
virCgroupGetBlockDevString(const char *path)
|
virCgroupGetBlockDevString(const char *path)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
if (stat(path, &sb) < 0) {
|
if (stat(path, &sb) < 0) {
|
||||||
@ -442,9 +441,7 @@ virCgroupGetBlockDevString(const char *path)
|
|||||||
|
|
||||||
/* Automatically append space after the string since all callers
|
/* Automatically append space after the string since all callers
|
||||||
* use it anyway */
|
* use it anyway */
|
||||||
ret = g_strdup_printf("%d:%d ", major(sb.st_rdev), minor(sb.st_rdev));
|
return g_strdup_printf("%d:%d ", major(sb.st_rdev), minor(sb.st_rdev));
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,7 +209,6 @@ virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
|
|||||||
g_autofree char *result_file = NULL;
|
g_autofree char *result_file = NULL;
|
||||||
g_autofree char *iommu_path = NULL;
|
g_autofree char *iommu_path = NULL;
|
||||||
g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
|
g_autofree char *dev_path = virMediatedDeviceGetSysfsPath(uuidstr);
|
||||||
char *vfio_path = NULL;
|
|
||||||
|
|
||||||
if (!dev_path)
|
if (!dev_path)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -228,9 +227,7 @@ virMediatedDeviceGetIOMMUGroupDev(const char *uuidstr)
|
|||||||
|
|
||||||
result_file = g_path_get_basename(result_path);
|
result_file = g_path_get_basename(result_path);
|
||||||
|
|
||||||
vfio_path = g_strdup_printf("/dev/vfio/%s", result_file);
|
return g_strdup_printf("/dev/vfio/%s", result_file);
|
||||||
|
|
||||||
return vfio_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -422,10 +419,7 @@ virMediatedDeviceIsUsed(virMediatedDevicePtr dev,
|
|||||||
char *
|
char *
|
||||||
virMediatedDeviceGetSysfsPath(const char *uuidstr)
|
virMediatedDeviceGetSysfsPath(const char *uuidstr)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
return g_strdup_printf(MDEV_SYSFS_DEVICES "%s", uuidstr);
|
||||||
|
|
||||||
ret = g_strdup_printf(MDEV_SYSFS_DEVICES "%s", uuidstr);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2308,8 +2308,6 @@ virResctrlDeterminePath(const char *parentpath,
|
|||||||
const char *prefix,
|
const char *prefix,
|
||||||
const char *id)
|
const char *id)
|
||||||
{
|
{
|
||||||
char *path = NULL;
|
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Resctrl ID must be set before determining resctrl "
|
_("Resctrl ID must be set before determining resctrl "
|
||||||
@ -2317,9 +2315,7 @@ virResctrlDeterminePath(const char *parentpath,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = g_strdup_printf("%s/%s-%s", parentpath, prefix, id);
|
return g_strdup_printf("%s/%s-%s", parentpath, prefix, id);
|
||||||
|
|
||||||
return path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -578,7 +578,6 @@ char *
|
|||||||
virSocketAddrGetPath(virSocketAddrPtr addr G_GNUC_UNUSED)
|
virSocketAddrGetPath(virSocketAddrPtr addr G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
char *path = NULL;
|
|
||||||
if (addr == NULL) {
|
if (addr == NULL) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||||
_("No socket address provided"));
|
_("No socket address provided"));
|
||||||
@ -591,9 +590,7 @@ virSocketAddrGetPath(virSocketAddrPtr addr G_GNUC_UNUSED)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
path = g_strndup(addr->data.un.sun_path, sizeof(addr->data.un.sun_path));
|
return g_strndup(addr->data.un.sun_path, sizeof(addr->data.un.sun_path));
|
||||||
|
|
||||||
return path;
|
|
||||||
#else
|
#else
|
||||||
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
virReportError(VIR_ERR_NO_SUPPORT, "%s",
|
||||||
_("UNIX sockets not supported on this platform"));
|
_("UNIX sockets not supported on this platform"));
|
||||||
|
@ -1420,7 +1420,6 @@ virGetUnprivSGIOSysfsPath(const char *path,
|
|||||||
const char *sysfs_dir)
|
const char *sysfs_dir)
|
||||||
{
|
{
|
||||||
int maj, min;
|
int maj, min;
|
||||||
char *sysfs_path = NULL;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((rc = virGetDeviceID(path, &maj, &min)) < 0) {
|
if ((rc = virGetDeviceID(path, &maj, &min)) < 0) {
|
||||||
@ -1430,10 +1429,9 @@ virGetUnprivSGIOSysfsPath(const char *path,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sysfs_path = g_strdup_printf("%s/%d:%d/queue/unpriv_sgio",
|
return g_strdup_printf("%s/%d:%d/queue/unpriv_sgio",
|
||||||
sysfs_dir ? sysfs_dir : SYSFS_DEV_BLOCK_PATH,
|
sysfs_dir ? sysfs_dir : SYSFS_DEV_BLOCK_PATH, maj,
|
||||||
maj, min);
|
min);
|
||||||
return sysfs_path;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -185,11 +185,7 @@ fakeStorageVolGetInfo(virStorageVolPtr vol,
|
|||||||
static char *
|
static char *
|
||||||
fakeStorageVolGetPath(virStorageVolPtr vol)
|
fakeStorageVolGetPath(virStorageVolPtr vol)
|
||||||
{
|
{
|
||||||
char *ret = NULL;
|
return g_strdup_printf("/some/%s/device/%s", vol->key, vol->name);
|
||||||
|
|
||||||
ret = g_strdup_printf("/some/%s/device/%s", vol->key, vol->name);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user