mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Reduce scope of some variables
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
3a983573fb
commit
92047567cf
@ -1352,8 +1352,6 @@ virConnectSetKeepAlive(virConnectPtr conn,
|
|||||||
int interval,
|
int interval,
|
||||||
unsigned int count)
|
unsigned int count)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
|
||||||
|
|
||||||
VIR_DEBUG("conn=%p, interval=%d, count=%u", conn, interval, count);
|
VIR_DEBUG("conn=%p, interval=%d, count=%u", conn, interval, count);
|
||||||
|
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
@ -1361,7 +1359,7 @@ virConnectSetKeepAlive(virConnectPtr conn,
|
|||||||
virCheckConnectReturn(conn, -1);
|
virCheckConnectReturn(conn, -1);
|
||||||
|
|
||||||
if (conn->driver->connectSetKeepAlive) {
|
if (conn->driver->connectSetKeepAlive) {
|
||||||
ret = conn->driver->connectSetKeepAlive(conn, interval, count);
|
int ret = conn->driver->connectSetKeepAlive(conn, interval, count);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -747,7 +747,6 @@ nodeDeviceCreateXML(virConnectPtr conn,
|
|||||||
g_autoptr(virNodeDeviceDef) def = NULL;
|
g_autoptr(virNodeDeviceDef) def = NULL;
|
||||||
g_autofree char *wwnn = NULL;
|
g_autofree char *wwnn = NULL;
|
||||||
g_autofree char *wwpn = NULL;
|
g_autofree char *wwpn = NULL;
|
||||||
int parent_host = -1;
|
|
||||||
virNodeDevicePtr device = NULL;
|
virNodeDevicePtr device = NULL;
|
||||||
const char *virt_type = NULL;
|
const char *virt_type = NULL;
|
||||||
|
|
||||||
@ -765,6 +764,8 @@ nodeDeviceCreateXML(virConnectPtr conn,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (nodeDeviceHasCapability(def, VIR_NODE_DEV_CAP_SCSI_HOST)) {
|
if (nodeDeviceHasCapability(def, VIR_NODE_DEV_CAP_SCSI_HOST)) {
|
||||||
|
int parent_host;
|
||||||
|
|
||||||
if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
|
if (virNodeDeviceGetWWNs(def, &wwnn, &wwpn) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -151,13 +151,12 @@ static int
|
|||||||
virStorageBackendCreateVols(virStoragePoolObjPtr pool,
|
virStorageBackendCreateVols(virStoragePoolObjPtr pool,
|
||||||
struct dm_names *names)
|
struct dm_names *names)
|
||||||
{
|
{
|
||||||
int is_mpath = 0;
|
|
||||||
uint32_t minor = -1;
|
uint32_t minor = -1;
|
||||||
uint32_t next;
|
uint32_t next;
|
||||||
g_autofree char *map_device = NULL;
|
g_autofree char *map_device = NULL;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
is_mpath = virStorageBackendIsMultipath(names->name);
|
int is_mpath = virStorageBackendIsMultipath(names->name);
|
||||||
|
|
||||||
if (is_mpath < 0)
|
if (is_mpath < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -2416,7 +2416,6 @@ virStorageBackendVolUploadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
char *target_path = vol->target.path;
|
char *target_path = vol->target.path;
|
||||||
int has_snap = 0;
|
|
||||||
bool sparse = flags & VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM;
|
bool sparse = flags & VIR_STORAGE_VOL_UPLOAD_SPARSE_STREAM;
|
||||||
g_autofree char *path = NULL;
|
g_autofree char *path = NULL;
|
||||||
|
|
||||||
@ -2427,7 +2426,7 @@ virStorageBackendVolUploadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED,
|
|||||||
* when volUpload is fully finished. */
|
* when volUpload is fully finished. */
|
||||||
if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
|
if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
|
||||||
/* Fail if the volume contains snapshots or we failed to check it.*/
|
/* Fail if the volume contains snapshots or we failed to check it.*/
|
||||||
has_snap = storageBackendPloopHasSnapshots(vol->target.path);
|
int has_snap = storageBackendPloopHasSnapshots(vol->target.path);
|
||||||
if (has_snap < 0) {
|
if (has_snap < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!has_snap) {
|
} else if (!has_snap) {
|
||||||
@ -2456,13 +2455,12 @@ virStorageBackendVolDownloadLocal(virStoragePoolObjPtr pool G_GNUC_UNUSED,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
char *target_path = vol->target.path;
|
char *target_path = vol->target.path;
|
||||||
int has_snap = 0;
|
|
||||||
bool sparse = flags & VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM;
|
bool sparse = flags & VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM;
|
||||||
g_autofree char *path = NULL;
|
g_autofree char *path = NULL;
|
||||||
|
|
||||||
virCheckFlags(VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM, -1);
|
virCheckFlags(VIR_STORAGE_VOL_DOWNLOAD_SPARSE_STREAM, -1);
|
||||||
if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
|
if (vol->target.format == VIR_STORAGE_FILE_PLOOP) {
|
||||||
has_snap = storageBackendPloopHasSnapshots(vol->target.path);
|
int has_snap = storageBackendPloopHasSnapshots(vol->target.path);
|
||||||
if (has_snap < 0) {
|
if (has_snap < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!has_snap) {
|
} else if (!has_snap) {
|
||||||
|
@ -1583,7 +1583,6 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
virStoragePoolInfo info;
|
virStoragePoolInfo info;
|
||||||
virStoragePoolPtr pool;
|
virStoragePoolPtr pool;
|
||||||
int autostart = 0;
|
int autostart = 0;
|
||||||
int persistent = 0;
|
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
bool bytes = false;
|
bool bytes = false;
|
||||||
char uuid[VIR_UUID_STRING_BUFLEN];
|
char uuid[VIR_UUID_STRING_BUFLEN];
|
||||||
@ -1601,6 +1600,8 @@ cmdPoolInfo(vshControl *ctl, const vshCmd *cmd)
|
|||||||
if (virStoragePoolGetInfo(pool, &info) == 0) {
|
if (virStoragePoolGetInfo(pool, &info) == 0) {
|
||||||
double val;
|
double val;
|
||||||
const char *unit;
|
const char *unit;
|
||||||
|
int persistent;
|
||||||
|
|
||||||
vshPrint(ctl, "%-15s %s\n", _("State:"),
|
vshPrint(ctl, "%-15s %s\n", _("State:"),
|
||||||
virshStoragePoolStateToString(info.state));
|
virshStoragePoolStateToString(info.state));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user