From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752826AbbEDLky (ORCPT ); Mon, 4 May 2015 07:40:54 -0400 Received: from ip4-83-240-67-251.cust.nbox.cz ([83.240.67.251]:50905 "EHLO ip4-83-240-18-248.cust.nbox.cz" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752488AbbEDLk2 (ORCPT ); Mon, 4 May 2015 07:40:28 -0400 From: Jiri Slaby To: live-patching@vger.kernel.org Cc: jpoimboe@redhat.com, sjenning@redhat.com, jkosina@suse.cz, vojtech@suse.cz, mingo@redhat.com, linux-kernel@vger.kernel.org, Jiri Slaby Subject: [RFC kgr on klp 3/9] livepatch: add klp_*_to_patch helpers Date: Mon, 4 May 2015 13:40:19 +0200 Message-Id: <1430739625-4658-3-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.3.5 In-Reply-To: <1430739625-4658-1-git-send-email-jslaby@suse.cz> References: <1430739625-4658-1-git-send-email-jslaby@suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will be used in the kGraft-like patching. Signed-off-by: Jiri Slaby --- include/linux/livepatch.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index 31db7a05dd36..fabb067a3f1d 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h @@ -129,6 +129,16 @@ struct klp_patch { #define klp_for_each_func(obj, func) \ for (func = obj->funcs; func->old_name; func++) +static inline struct klp_patch *klp_func_to_patch(struct klp_func *func) +{ + return container_of(func->kobj.parent->parent, struct klp_patch, kobj); +} + +static inline struct klp_patch *klp_object_to_patch(struct klp_object *obj) +{ + return container_of(obj->kobj.parent, struct klp_patch, kobj); +} + int klp_register_patch(struct klp_patch *); int klp_unregister_patch(struct klp_patch *); int klp_enable_patch(struct klp_patch *); -- 2.3.5