Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp1311048lkv; Thu, 29 Apr 2021 03:07:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQijZBSLP+OnklQAllKnnFzP57gZtvaEh5WJT+yXpoDIJEnmbzbNGexsri/PQaRlv7W6wi X-Received: by 2002:a65:558a:: with SMTP id j10mr19136410pgs.404.1619690843672; Thu, 29 Apr 2021 03:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619690843; cv=none; d=google.com; s=arc-20160816; b=FsGyiS9w6e2P49phRpjB6E1V+WVEu+HLwXPCM/v8ED12BaL4BwnNm0o8oiaYhYO1zz 7OMnshPsOPgLEdlJROLLIDPPzDUjtA2LiMQ4sKE2qcc6gltiGp8XMkUqFFgoajFitNbc 2+9Yi2RRCRwnqKSOpsXvFzsacbidqzQk0QOpR9KwMe8N+c9pyYjxQfFU/QN+HO9DyUP4 W4Dl1yEzF5XKTSwhjhWBay21aT9r9HDvL5M5NhCb5XR0jaqrYnz/dVKlwwEaXjeKhbQ+ d8VtMSVriIlSQi8PpcwmWZNkBvexKeD22L7EyGL1tu3rfjMvJSOVv9PagndpgcDbuzMI 5tWw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ki2wf9DmLdX2Q6qva6YDgJ7fC9WLJfqchVvEdO1eEaU=; b=GCEAbJuQ0n8yMuUSMcyWmKU6ka18Q/7qIsTQawbvIy/OMx2/k5LLA/UC6XpziFsE1i ZsZpV8L3rJ0dfkMq/lYr44j2dCITPkMskSAGrMonI4agesB5YF2FutSK36FDGtxzUylD fr1S8Wkng6DHRZEamBaTFoBV/hdPRnb8QHVIg9Iz98ZG/q5SxNGsj2crW20IY6lLHXdG 51OqkowA2y/8rLgPzdLtWxtjHaYFZ10aHpqj9uNHBtvSUngnI4IRuS4gPgpN1/KfVvrW +CzyB23dFV/3LAln6H5mDoD0G45xMsyzaRGmboCeqHtYpSuBqdSm0jstcaw3NWLx79X7 U7Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bLXOyZU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l10si2633270pgb.331.2021.04.29.03.07.10; Thu, 29 Apr 2021 03:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bLXOyZU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239890AbhD2KF7 (ORCPT + 99 others); Thu, 29 Apr 2021 06:05:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:38826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232258AbhD2KF6 (ORCPT ); Thu, 29 Apr 2021 06:05:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3C0766142A; Thu, 29 Apr 2021 10:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1619690711; bh=B4U6INbbFuXS+8tIhj+PBopurtIGvEU38c61RE6Eub0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bLXOyZU9r4x90zJaCqHW5KIYgp0EHTxJB/k2ST7qXSsJZNBYfx3gvIspOCwv+1vz3 yqtAkzvhxz936nWSSn2FGTU7aq2bTvLl5HDGx3Qvzqz9F6OIAlx7lP6DfpCs3iAnBW f4U/VDleEEXsl/sRT7bOUs7Yfa8NxccafswaPOck= Date: Thu, 29 Apr 2021 12:05:08 +0200 From: Greg KH To: Fabio Aiuto Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: module parameters permission Message-ID: References: <20210429095819.GE1409@agape.jhs> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210429095819.GE1409@agape.jhs> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 29, 2021 at 11:58:20AM +0200, Fabio Aiuto wrote: > Hi all, > > I'm trying to declare module parameters this way: > > > params: { > scull_major: i32 { > default: 0, > permissions: bindings::S_IRUGO as i32, > description: b"Major number", > }, > scull_minor: i32 { > default: 0, > permissions: bindings::S_IRUGO as i32, > description: b"Minor number", > }, > > i.e. using S_IRUGO macro exposed by bindgen. But I have the > following compiler error: > > error: proc macro panicked > --> samples/rust/rust_scull.rs:12:1 > | > 12 | / module! { > 13 | | type: RustScull, > 14 | | name: b"rust_scull", > 15 | | author: b"Alessandro Rubini, Jonathan Corbet", > ... | > 44 | | }, > 45 | | } > | |_^ > | > = help: message: Expected Literal > > the same if I remove as i32 casts. > > if I write permissions as in samples/rust/rust_module_parameters.rs > > params: { > my_bool: bool { > default: true, > permissions: 0, > description: b"Example of bool", > }, > my_i32: i32 { > default: 42, > permissions: 0o644, <------- > description: b"Example of i32", > }, > > I get no error. > > What's the right way to use S_I*UGO macros? Not at all, use the octal values instead please. That's the way that we have declared a while ago, and I think checkpatch.pl will even catch if you try to do this in any new code. Please don't force us to deal with S_* defines in rust code as well. thanks, greg k-h