From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DDA5220C028 for ; Mon, 26 May 2025 15:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748271713; cv=none; b=Pc+EGWaH7t9hle8aeNYrL9VH9nCBwdefwKYmhOjQdkJAOYgi6kuwr+dxtDLsnSD6bBVKgv9YspCEC3AFVA7Qg0IBTL7Ea9kc90cC2Bp/2+AkR25TaTNh4lRZ/VPpGJ1tRljBg28ssIfxAvgfhQSZo1vigw4d9YR3WUa61MbGTF0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748271713; c=relaxed/simple; bh=Q/2BsgKz24Vtl8wIJjkgERERw7Spq2sdcAdXYaotMo4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=mJxBpRhVKbFks0EQMQCYC8k8ddw+gBpxU4hoZUMi/rVxyPjLtBH+d+3RXse7MklTkB+/xOvMeUTXiWGgscEtZC+Dc+lfOJ4wiqSnPuqlq/DgxX/LUBA5VmMTLUb9xQXiU4h9S0bc1XG8FhtaXNQJermyGLIhZGFNNgCj759Ey7M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--bqe.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rXpMXMNC; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--bqe.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="rXpMXMNC" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-43ea256f039so18437455e9.0 for ; Mon, 26 May 2025 08:01:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1748271710; x=1748876510; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=SQP6Td3kWKuKqRj2KRN0QM8NzsKBYR8G0PzCVMLQtO0=; b=rXpMXMNCRtVViQQQRMQzlPtVX83D2sQySp8RhV4IFmLEePQCctFa56rCyH360pRzrR iSWOuZyVnUX5bEgVKIAgDdcOGxqfdJJBZDsuWDaPut/5azKJx3aKoDgQPlituOJjfYv7 oQCay5O39mI8dkBY1Tuw70Lcu4Yfa4F7c3CQbvLrNtLc/Ipjknbnmg0MyXNjSiLVQHZf XJsr16sJJ7GKyzBUcLsfAhLevkmUfimA8gqrVkddKEIgZPKTLy2LwFXoHOIbWLjJWUPY Z2c1Kg8VDi97RPpyUrnwchuUSFFIKVYkgZD7zHOw14EHLfn2dnO/8O2+kemAipFRfsM8 8LVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748271710; x=1748876510; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SQP6Td3kWKuKqRj2KRN0QM8NzsKBYR8G0PzCVMLQtO0=; b=rjSlzYm3ohDRuzy9Qded+FRVRnYkQ6XGTRR9DgeVcO6mELL1Ud/SQntpgqI00rd3u5 nGKb491Ap+/CQFgggE0ejY47tezasVaMvpE2akaIxT6PE+yDNOPk54VQZpWelOrsjcNF kpWucEa5UWswyxm9yKXv5g4w92x8aXxplBwnP1Dsmz5obSWsg+s/Iv86o2w6x2+po8ii elbv0bCfqpuz2WxU4Y/4A+vZ6JAmmjUnVejHVht3javRTZS2zbYCFaConb3KmDx5413v 7pUtoAHor4Ovg0oTN9e8AnmPw7R9jSRKnqNwsZxREnkdebwZdY7NGkACn/wDDIMtr3X0 bENA== X-Forwarded-Encrypted: i=1; AJvYcCUUL+SVMk30+nvg0lNj9xQkUsPCdSHlze0FPqxQpP6VB4B4sHnhPMOjMAw4ybfZzvOt3K1wzxAC+wPovTrhGw==@vger.kernel.org X-Gm-Message-State: AOJu0YyUBylBReJfgcGBkECpp51CUXlqwnXBFECQiJa3zH6TTErAk9FH Yl9yqH7+OwqcBi10EgedxuqcMRKjABAKAChl7njhScOQPrqPBaMaLDfoPM//nE+tWEyzmw== X-Google-Smtp-Source: AGHT+IG7bMDz+nyV21aR+cR9rz6T4gu5RRq0QfvbqOxOM4k37bGT04jZzRz8bA5euIEZI5NyPC9+hsM= X-Received: from wmrn43.prod.google.com ([2002:a05:600c:502b:b0:43c:ef1f:48d3]) (user=bqe job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:5396:b0:43c:f63c:babb with SMTP id 5b1f17b1804b1-44c91607264mr72968455e9.1.1748271708454; Mon, 26 May 2025 08:01:48 -0700 (PDT) Date: Mon, 26 May 2025 15:01:31 +0000 In-Reply-To: <20250526150141.3407433-1-bqe@google.com> Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250526150141.3407433-1-bqe@google.com> X-Mailer: git-send-email 2.49.0.1151.ga128411c76-goog Message-ID: <20250526150141.3407433-3-bqe@google.com> Subject: [PATCH v9 2/5] rust: add bindings for bitops.h From: Burak Emir To: Yury Norov , Kees Cook Cc: Burak Emir , Rasmus Villemoes , Viresh Kumar , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , "Gustavo A . R . Silva" , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Makes atomic set_bit and clear_bit inline functions as well as the non-atomic variants __set_bit and __clear_bit available to Rust. Adds a new MAINTAINERS section BITOPS API BINDINGS [RUST]. Suggested-by: Alice Ryhl Suggested-by: Yury Norov Signed-off-by: Burak Emir Acked-by: Yury Norov [NVIDIA] --- MAINTAINERS | 5 +++++ rust/helpers/bitops.c | 23 +++++++++++++++++++++++ rust/helpers/helpers.c | 1 + 3 files changed, 29 insertions(+) create mode 100644 rust/helpers/bitops.c diff --git a/MAINTAINERS b/MAINTAINERS index 86cae0ca5287..04d6727e944c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4141,6 +4141,11 @@ F: include/linux/bitops.h F: lib/test_bitops.c F: tools/*/bitops* +BITOPS API BINDINGS [RUST] +M: Yury Norov +S: Maintained +F: rust/helpers/bitops.c + BLINKM RGB LED DRIVER M: Jan-Simon Moeller S: Maintained diff --git a/rust/helpers/bitops.c b/rust/helpers/bitops.c new file mode 100644 index 000000000000..1fe9e3b23a39 --- /dev/null +++ b/rust/helpers/bitops.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include + +void rust_helper___set_bit(unsigned int nr, unsigned long *addr) +{ + __set_bit(nr, addr); +} + +void rust_helper___clear_bit(unsigned int nr, unsigned long *addr) +{ + __clear_bit(nr, addr); +} + +void rust_helper_set_bit(unsigned int nr, volatile unsigned long *addr) +{ + set_bit(nr, addr); +} + +void rust_helper_clear_bit(unsigned int nr, volatile unsigned long *addr) +{ + clear_bit(nr, addr); +} diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c index 92721d165e35..4de8ac390241 100644 --- a/rust/helpers/helpers.c +++ b/rust/helpers/helpers.c @@ -8,6 +8,7 @@ */ #include "bitmap.c" +#include "bitops.c" #include "blk.c" #include "bug.c" #include "build_assert.c" -- 2.49.0.1151.ga128411c76-goog