Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1779240imm; Thu, 18 Oct 2018 04:12:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV63DCJ3lUvBeIjihrVLQbC4uFzWkfe1q5ss4SpTHb2dIHFqVqlBYRT4BTCkM9K3oDul+QO6k X-Received: by 2002:a63:1302:: with SMTP id i2-v6mr28651980pgl.380.1539861152167; Thu, 18 Oct 2018 04:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539861152; cv=none; d=google.com; s=arc-20160816; b=lRZZq2wDFGH9v1vJgTDvOwI/IteDnJ5AUinhUc6KQzUhU2ZqlYtVyOGjktbqd5tZZ2 DvDagA5etVLmacVK36X4G6M/8iQ7IsiQqmaSVsUE9nHUyqAoA+gFqOiCdyL3qiG7zQKV FfBM6Ix66J5TdoQ0Skyv/Rfs+KirdZJOoK5nInOoH7M/uGtEmcDM0B3Au07ApKRAFo/a jzBaK7piGnbvfH7AKpu8rW8D0Nd7jVvgpiW5lOQHxm5cOWG35sbilIsTlHpHqq+S/IGf lWbuAIRQHxMIJT5FUYS/7NRMuN6Mv5Pz6ACWzkda/8PJsGUVU1uqwbTU7f+r1a5VCqKC 0imw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=fSCYfjqWad/LTTqlauFFY2RtYceZv1KkjFnIxRp1R8o=; b=QXp7ATG05pM/tkCnOH16Euv9cDyeN0DA0PygB3J5FqwG3Oxfq+MuQbZGljTtABJ3s2 wAywuOzUcnRtf1auotIuDA1RHEjWG2rPp4yvshI1B2UwwxgIYOo0rVRVGvZL0KvFVLPZ 2bYsWuME82gk9/cw59kOZjUh8AZE47meXYh61ZIW/tWaPdJ7ZQqBLpPW5wTXtfJzBvL/ ikVP6AKBa9JZn2zhD9ei/a7PgmMwZLLt3r9xvYEqdqXs52vU38nFQ/v7BcwoNHzpRRii 4mYxA6rrtCk/CIFL6dQupFeaf54StWWwZqkHVLLiO797jhxRtO6LnpguMQm+EiThOgqn CAgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31-v6si22024471plc.423.2018.10.18.04.12.15; Thu, 18 Oct 2018 04:12:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727695AbeJRTM0 (ORCPT + 99 others); Thu, 18 Oct 2018 15:12:26 -0400 Received: from mx2.suse.de ([195.135.220.15]:41952 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726173AbeJRTMZ (ORCPT ); Thu, 18 Oct 2018 15:12:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 0B46AAFDB; Thu, 18 Oct 2018 11:11:54 +0000 (UTC) Date: Thu, 18 Oct 2018 13:11:53 +0200 From: Petr Mladek To: Josh Poimboeuf Cc: Jiri Kosina , Miroslav Benes , Jason Baron , Joe Lawrence , Evgenii Shatokhin , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v13 02/12] livepatch: Helper macros to define livepatch structures Message-ID: <20181018111153.qcmvidttifi57u45@pathway.suse.cz> References: <20181015123713.25868-1-pmladek@suse.com> <20181015123713.25868-3-pmladek@suse.com> <20181017181756.cy65ujygmf3ulmiz@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181017181756.cy65ujygmf3ulmiz@treble> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2018-10-17 13:17:56, Josh Poimboeuf wrote: > On Mon, Oct 15, 2018 at 02:37:03PM +0200, Petr Mladek wrote: > > The definition of struct klp_func might be a bit confusing. > > The original function is defined by name as a string. > > The new function is defined by name as a function pointer > > casted to unsigned long. > > > > This patch adds helper macros that hide the different types. > > The functions are defined just by the name. For example: > > On one hand, these macros are kind of nice, because they do the function > pointer casting for the user. > > On the other hand, they hide the field names, which hurts readability a > bit. For example, it would be easy to accidentally assign the wrong > callback function. I am not a big fan of the macros either. > Also, it's unfortunate that these macros are needed in the first place. > > What if we just change new_addr (and old_addr) to be 'void *'? Then the > macros wouldn't be as useful, and we could just get rid of them. Hmm, I wonder if any change make sense then. The above proposal might just exchange one confusion with another one: + I would expect that a variable called addr is of the type unsigned long + we would need casting when calling ftrace API + .new_addr = function_xxx looks a bit weird and it will be used many times in all livepatch sources. That said I could live with any solution. The livepatch code is complicated from other reasons. This is only small detail from my (today's ;-) point of view. Best Regards, Petr