Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp982440imm; Wed, 17 Oct 2018 11:18:53 -0700 (PDT) X-Google-Smtp-Source: ACcGV60vh4CwqST/bBY9gPVIvreY7Kih62o//AY7mroiUhepJK7B2LOO/eiw/HKUK/JHKgzxhEqk X-Received: by 2002:a17:902:4c85:: with SMTP id b5-v6mr17264622ple.126.1539800333401; Wed, 17 Oct 2018 11:18:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539800333; cv=none; d=google.com; s=arc-20160816; b=vbr8KUTtBXQjyTV7R6PXd+DVhssajkPDDHkG8UyHdc4crvaAgPuqpdBey9IJAsYRDV sEny9wwfdB6ZyTvfofWpQi1mpYD58Vzf9YDhIVtgyvaBHVtanT9t0YBdT513N99F5wAx CqxC5ofeQEO9rrB1RA644UdiJw4b8Nvsho1hH6c9XgoLNHi/5wbJ5TAGFOQVK788aJRt VeqTKqofuzLInffkCbW/WEtqMpU4w3n1XX5FEzTfrgWoSzLeo+7rWKpJVAK7+iErx7hw uKg/D/UMfIYKWjCYSbNnDg+hanqPMhyk88EccYHC0/G2aBS0Sbkfun8dqSOZXsvU/wRu /6Dw== 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=SbTSSbisEysWZoroIZp/WA/GdYklOdh4i7OWHT9TFBk=; b=bQYfbY71xjCDkbtEnn53myjkAk1wGMP0eSAtJSMRq9wYN/ASeExE2R9TEDKh5d3q8N tmhmc6ijpFzv0Xfv/tV0j6hceReyUUANfIzkNVJhPKxD6FfBRFjwv5j9aO38/PJ4Rk5d kBB8JObpYOLHyvgvUni+F+zK8JKbWE1/mQnwLxcaq/ap5NdH+eKiIhDVIeGePU2lSDOD qzQgYtPNebhfilaa4Btswlpytnhvzd+ZNISMHtWRddEhBWgLw5HHP/mRuUuwAldH0kQK 0Zx4t1+2AUqA2eSFAczG0+dNotAMhD0RaIVJnnbYk+0RWN0V4ni4+bOcmfow6/5dkjjO cGVA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si18382059plh.63.2018.10.17.11.18.37; Wed, 17 Oct 2018 11:18:53 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728173AbeJRCOz (ORCPT + 99 others); Wed, 17 Oct 2018 22:14:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45950 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbeJRCOz (ORCPT ); Wed, 17 Oct 2018 22:14:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 44B2A3082A41; Wed, 17 Oct 2018 18:18:03 +0000 (UTC) Received: from treble (ovpn-122-46.rdu2.redhat.com [10.10.122.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E4347BE3A; Wed, 17 Oct 2018 18:17:58 +0000 (UTC) Date: Wed, 17 Oct 2018 13:17:56 -0500 From: Josh Poimboeuf To: Petr Mladek 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: <20181017181756.cy65ujygmf3ulmiz@treble> References: <20181015123713.25868-1-pmladek@suse.com> <20181015123713.25868-3-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181015123713.25868-3-pmladek@suse.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 17 Oct 2018 18:18:03 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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. -- Josh