From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbBFh-0003O1-R3 for qemu-devel@nongnu.org; Thu, 26 Mar 2015 13:07:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YbBFd-0006Ai-3Z for qemu-devel@nongnu.org; Thu, 26 Mar 2015 13:07:29 -0400 Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:35731) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YbBFc-0006AO-TZ for qemu-devel@nongnu.org; Thu, 26 Mar 2015 13:07:25 -0400 Received: by pacwz10 with SMTP id wz10so17521384pac.2 for ; Thu, 26 Mar 2015 10:07:24 -0700 (PDT) Sender: Lin Ma From: Lin Ma Date: Fri, 27 Mar 2015 01:07:04 +0800 Message-Id: <1427389626-23487-1-git-send-email-lma@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] =?utf-8?q?_=5BPATCH_v3_0/2=5D_Add_generic_can=5Fbe?= =?utf-8?q?=5Fdeleted_to_UserCreatableClass=2E?= List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: imammedo@redhat.com, afaerber@suse.de, peter.crosthwaite@xilinx.com, pbonzini@redhat.com Cc: qemu-devel@nongnu.org, Lin Ma The patchset adds a generic can_be_deleted callback to UserCreatableClass. It prevents removing a usercreatable object if the callback returns false. Backends could implement the callback if it shoudn't be removed while it's in use. Thank Peter Crosthwaite, Paolo Bonzini, Andreas Färber and Igor Mammedov for helping review. ChangeLog: V3: Move the callback to the correct place: UserCreatableClass. Move the backend callback implementation to hostmem.c. V2: Make it generic, add the can_be_deleted callback to TypeInfo and TypeImpl. Implement the callback in hostmem-file.c and hostmem-ram.c. V1: Initial version, hard coded in object_del to prevent removing an in-use host memory backend. Lin Ma (2): qom: Add can_be_deleted callback to UserCreatableClass hostmem: Prevent removing an in-use memory backend object backends/hostmem.c | 14 ++++++++++++++ include/qom/object_interfaces.h | 3 +++ qmp.c | 13 +++++++++++++ 3 files changed, 30 insertions(+) -- 2.1.4