qom: Remove unused errp parameter from can_be_deleted()
The errp argument is ignored by all implementations of the method, and user_creatable_del() would break if any implementation set an error (because it calls error_setg(errp) if the function returns false). Remove the unused parameter. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20170829220337.23427-1-ehabkost@redhat.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
223cd0e13f
commit
3beacfb98b
@ -215,7 +215,7 @@ bool cryptodev_backend_is_ready(CryptoDevBackend *backend)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
cryptodev_backend_can_be_deleted(UserCreatable *uc, Error **errp)
|
cryptodev_backend_can_be_deleted(UserCreatable *uc)
|
||||||
{
|
{
|
||||||
return !cryptodev_backend_is_used(CRYPTODEV_BACKEND(uc));
|
return !cryptodev_backend_is_used(CRYPTODEV_BACKEND(uc));
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
host_memory_backend_can_be_deleted(UserCreatable *uc, Error **errp)
|
host_memory_backend_can_be_deleted(UserCreatable *uc)
|
||||||
{
|
{
|
||||||
if (host_memory_backend_is_mapped(MEMORY_BACKEND(uc))) {
|
if (host_memory_backend_is_mapped(MEMORY_BACKEND(uc))) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -51,7 +51,7 @@ typedef struct UserCreatableClass {
|
|||||||
|
|
||||||
/* <public> */
|
/* <public> */
|
||||||
void (*complete)(UserCreatable *uc, Error **errp);
|
void (*complete)(UserCreatable *uc, Error **errp);
|
||||||
bool (*can_be_deleted)(UserCreatable *uc, Error **errp);
|
bool (*can_be_deleted)(UserCreatable *uc);
|
||||||
} UserCreatableClass;
|
} UserCreatableClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -68,12 +68,11 @@ void user_creatable_complete(Object *obj, Error **errp);
|
|||||||
/**
|
/**
|
||||||
* user_creatable_can_be_deleted:
|
* user_creatable_can_be_deleted:
|
||||||
* @uc: the object whose can_be_deleted() method is called if implemented
|
* @uc: the object whose can_be_deleted() method is called if implemented
|
||||||
* @errp: if an error occurs, a pointer to an area to store the error
|
|
||||||
*
|
*
|
||||||
* Wrapper to call can_be_deleted() method if one of types it's inherited
|
* Wrapper to call can_be_deleted() method if one of types it's inherited
|
||||||
* from implements USER_CREATABLE interface.
|
* from implements USER_CREATABLE interface.
|
||||||
*/
|
*/
|
||||||
bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp);
|
bool user_creatable_can_be_deleted(UserCreatable *uc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* user_creatable_add_type:
|
* user_creatable_add_type:
|
||||||
|
@ -23,13 +23,13 @@ void user_creatable_complete(Object *obj, Error **errp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool user_creatable_can_be_deleted(UserCreatable *uc, Error **errp)
|
bool user_creatable_can_be_deleted(UserCreatable *uc)
|
||||||
{
|
{
|
||||||
|
|
||||||
UserCreatableClass *ucc = USER_CREATABLE_GET_CLASS(uc);
|
UserCreatableClass *ucc = USER_CREATABLE_GET_CLASS(uc);
|
||||||
|
|
||||||
if (ucc->can_be_deleted) {
|
if (ucc->can_be_deleted) {
|
||||||
return ucc->can_be_deleted(uc, errp);
|
return ucc->can_be_deleted(uc);
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -178,7 +178,7 @@ void user_creatable_del(const char *id, Error **errp)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!user_creatable_can_be_deleted(USER_CREATABLE(obj), errp)) {
|
if (!user_creatable_can_be_deleted(USER_CREATABLE(obj))) {
|
||||||
error_setg(errp, "object '%s' is in use, can not be deleted", id);
|
error_setg(errp, "object '%s' is in use, can not be deleted", id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user