lkml.org 
[lkml]   [2021]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectmodule parameters permission
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?

my includes are:

// SPDX-License-Identifier: GPL-2.0

//! Scull driver sample

#![no_std]
#![feature(allocator_api, global_asm)]

use kernel::prelude::*;
use kernel::{chrdev, cstr};
use crate::bindings;

thank you,

fabio


\
 
 \ /
  Last update: 2021-04-29 11:58    [W:0.045 / U:1.416 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site