Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3485022rwb; Fri, 16 Dec 2022 16:03:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf66CMCO+523TBKdZ9o40xeNi2BNiurLX2cJayBx9/oauMw6sgV87hjMsoKFa9f0yAR5CaKI X-Received: by 2002:a17:906:ae56:b0:7c0:b569:8efe with SMTP id lf22-20020a170906ae5600b007c0b5698efemr27226164ejb.60.1671235383956; Fri, 16 Dec 2022 16:03:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671235383; cv=none; d=google.com; s=arc-20160816; b=ooK7MfQYjtGSf45YGIqycdtzyaUHOPISet1D1omyyWcHYdSso2eJq7Q5AjnbcT48WT UFTDzbFhwLer+nyjjz2tJWFroHH8s3jYkMZ81OABimp2AW+c3niqrT7rvK5fp3xmvK49 /HYcQTdjLWyJKLEiBTW84itvBnsKSTm+ECp3Qe9Yv9foGMwWCucIAUECwvBkHcsGWkvU f7FrMe6XSkcTXeVk+SJ+I8OxZcF2Yt3MAj9icFxyIerImdp/b01PHRHwRNNYY/hVCw7j AIHkuRtRj2tTOWXuZRhh7+e6lSpiLx83OiGbr6bvFkaueR5ph8G4a4Y8VfhxFKuKq3rh XmAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=pBsUm8iDTB+c2THpWnNDO3v6zfDYGcvFBEzQEwB5p+Q=; b=F7XZd3KzUk8DLTIXdugu9vMt1M4c8dPxs9WfnzeJSH8OYN3MV9z9jT+o0aVx5h+QGd BRmhamgqtPryzbx1R/zJ7aSCL6ETQ3tm+tgz1Xo633r6MnagChE1DRJq4IKc13cpyiRS xM69hH3MSVc0CghIRXHgFg1kR70vifaSRyz0WjJabf44q36g2luj8mAQA+DPctP/VFZX 49k85IpQV0+OyvF8oRM+hb7gJpSD7T5K3mV1KFNs66IiHWMIwL8Ok7OWJPVMf5hlXzCC r52laHnYgFBYL3k0atYsqqZoius92tKH/mizo8sF9NfoD6JAi+qX5vU+6xJrsvQnpKaG 4R1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ho34-20020a1709070ea200b007ae2368c8b7si3808643ejc.138.2022.12.16.16.02.46; Fri, 16 Dec 2022 16:03:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbiLPXPW (ORCPT + 68 others); Fri, 16 Dec 2022 18:15:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229948AbiLPXPR (ORCPT ); Fri, 16 Dec 2022 18:15:17 -0500 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4451563A1; Fri, 16 Dec 2022 15:15:15 -0800 (PST) Received: by mail-wm1-f42.google.com with SMTP id o5-20020a05600c510500b003d21f02fbaaso5104181wms.4; Fri, 16 Dec 2022 15:15:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pBsUm8iDTB+c2THpWnNDO3v6zfDYGcvFBEzQEwB5p+Q=; b=2TDXOIWSJhk3wAeCu4qMaFNwMz6v+33DlY4AlnalYCk3TUHKjcvD1w2te8BZOyg1X0 xMwXLHHwpJjpBf01A+wY3kZO8S1TUZbHhFLxW1pyAwmHOZTrga2erJyTzpforX2RLkqS zOgKCZOECUPtpPotXVJr9Qgkg97RmOz9yoKZpbxRrM05C1ZLOpBtY7KHZAd0pQotKsEr fHJddQnDQa6/yTvLqmqmc08Crun0M8At8GKj3PFw2ZGc6S0wTpd/8bwV/x/mcuAzp4J8 ZKW7fBrv3hppw0vWObrATQo2pX4SPKcYNtNGGsVym5NYNVcx3jCyhq59IurgK+/0oJD0 ZazA== X-Gm-Message-State: ANoB5pmh5Wn7xypf4e7brTxCqHZSTlbrUXiAHNYUkls65E2UUPzELYRH GkzGKDxVgQ4m3nSjz/3zarAW24zrHHY= X-Received: by 2002:a05:600c:21c1:b0:3cf:8833:1841 with SMTP id x1-20020a05600c21c100b003cf88331841mr26926497wmj.39.1671232513890; Fri, 16 Dec 2022 15:15:13 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id x33-20020a05600c18a100b003d1cc0464a2sm3681803wmp.8.2022.12.16.15.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 15:15:13 -0800 (PST) Date: Fri, 16 Dec 2022 23:15:11 +0000 From: Wei Liu To: Wedson Almeida Filho Cc: Wei Liu , rust-for-linux@vger.kernel.org, Linux Kernel List , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron Subject: Re: [PATCH] rust: kernel: drop repetition in offset_of macro Message-ID: References: <20221216174927.1008629-1-wei.liu@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 16, 2022 at 06:26:57PM +0000, Wedson Almeida Filho wrote: > On Fri, 16 Dec 2022 at 17:49, Wei Liu wrote: > > > > It doesn't make sense to allow multiple fields to be specified in > > offset_of. > > Why do you say it doesn't make sense? > > Here's what I had in mind: > ``` > struct Y { > z: u32 > } > struct X { > y: Y > } > offset_of!(X, y.z) > ``` > > Which is something very plausible. > > > No functional change. > > > > Signed-off-by: Wei Liu > > --- > > Cc: Miguel Ojeda > > Cc: Alex Gaynor > > Cc: Wedson Almeida Filho > > Cc: Boqun Feng > > Cc: Gary Guo > > Cc: Bj?rn Roy Baron > > --- > > rust/kernel/lib.rs | 10 ++++++---- > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs > > index 6a322effa60c..2f3601e4e27e 100644 > > --- a/rust/kernel/lib.rs > > +++ b/rust/kernel/lib.rs > > @@ -208,7 +208,7 @@ impl<'a> Drop for KParamGuard<'a> { > > /// ``` > > #[macro_export] > > macro_rules! offset_of { > > - ($type:ty, $($f:tt)*) => {{ Shouldn't this be + instead of *? offset_of!(X,) is valid according to this pattern. Thanks, Wei.