From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (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 CC6771EA7FF for ; Thu, 1 May 2025 22:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746139668; cv=none; b=c/RKh/rNqhSirTPh+qBUw6Vh14AXThhWPLdlzPBAEulsOUuMqL/+H9KIW1tjjiKonCt6jOMPG/WSBZGPK7/yJ8ekITTnL3nPzEaPDEa37oUBblrn3UNGLhGbPBnwmE/mBJruG5RCORuhugVLp4McNajhJIR5gkjHL4d5hYi4Mgg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746139668; c=relaxed/simple; bh=+sEHQ5a6ov4c05sHc/JUKrhbuajuBghx/mSe8CxfB7Y=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=qqmP/R2o660WQbRxwI/Zi42Vmg/XqMD8DSMzVM37GTr/YDUChHBEg0cjDTd9ZtnJK1TTHgMbG7Y4pSjj1Kpx1sSEeLg43m9xZaXMR5l08R6wvtuljE3dFGyR3llMnvsnTy84YxBlgTxDJEujfGrOAC64BHcc9gBDdEovMDTEc2o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--mmaurer.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=F9YeMzTX; arc=none smtp.client-ip=209.85.210.202 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--mmaurer.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="F9YeMzTX" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-73917303082so1021693b3a.3 for ; Thu, 01 May 2025 15:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1746139665; x=1746744465; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=NivNxUC2NDqVrkobtJmoapSJ3o66sFfu75Pr8p73xkE=; b=F9YeMzTXhjywf+Mc7+WWYTbvPcNWVRrQWdy2oJ44ePEqYIQ+Dm/zYJmuLzXO6A5Qyt yeNzXfVCCotnWvSjb64LcKmd/xkPFsb7H0eHPYS43z751SJ42lnV4dFHUjKfgGSe70XX JsXEfqgDHN58Y83y7nl076pxR6qLTkFY9P+5L3DaV5xpuCloi1BXu55bLEC2EX8SLVtm t0YAgFzsgFDZ/0gBmLQq9BIcRibssDXWDO1/xtbj+9HgsV1aacrI3KzYUGdIYSoxTC2C +sev0Y4l1qvtqsotDvR/PwjEPuvxWfavKPZsCQ7B7Nw7JsmheQW35trbqae790OY5nV2 Jccg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746139665; x=1746744465; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=NivNxUC2NDqVrkobtJmoapSJ3o66sFfu75Pr8p73xkE=; b=kEKOxjUgTxFFiGme+SDdBUlls7414eIS1+C3HrGC7r56fJN2BOx8PHLpWlzSHhYEp8 Wy8jrJNJgtv0beAFyZXlTUKwyRFV2yat5iENDPKrPu3Y/LUUMfeobUaP3tEoD1wEMG2e AGULR1QAhAdInKcsImcrpQQ4kno+mgtnyd+M+FLLvfcynwl95r+svteKEFNGjJHvapiL duaE6UJ9zRtADqQJplGHmO0qhbJu/1rg/i6obLv/+o9LUfNzz0QeWoqi/be9TTH9NarV Xrpu3zwoJHC/K06x7AnlCGk35khkfzBR/058WNIDzWI+30RiB0fqO+Ye1/eKT2f7v8EM l0WQ== X-Forwarded-Encrypted: i=1; AJvYcCUm083wVxfNtlO/RzHdbiExv5/0o36UXDmu/b8YrnZIgRqOsRo8KfNTZblgMf7+wa/96kkT3bqVtg7T6ZAjBg==@vger.kernel.org X-Gm-Message-State: AOJu0YxjpZpm5KdM2NjS7E+VMM7SjvcxX1u2z4c9Ty+yCsb01oegUXZ9 bfM6d21M3aYT9g6VpUE4SmP6pf9cGNw3Fb1EWhJ3SMBE01IEk7sBswzsBN7pxvi3KhE2vC9eOp6 JNqoXlw== X-Google-Smtp-Source: AGHT+IEQ7LN6nOd2RQOaDvcu0iiE3EfxbAhqLFzbuOYSZdCZwIty37mQeS1DKKhzAugu+3PL5hVpAPVxJNkz X-Received: from pfoc21.prod.google.com ([2002:aa7:8815:0:b0:739:45ba:a49a]) (user=mmaurer job=prod-delivery.src-stubby-dispatcher) by 2002:aa7:9304:0:b0:736:5438:ccc with SMTP id d2e1a72fcca58-74058a20e45mr825131b3a.9.1746139665007; Thu, 01 May 2025 15:47:45 -0700 (PDT) Date: Thu, 01 May 2025 22:47:40 +0000 Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAAz6E2gC/13M0QrCIBiG4VsZHme43za1o+4jOkj954TK0E2Ks XvPDYLW4ffB+0wkYfSYyLGaSMTskw+PMviuIqa/PhxSb8smwKBhB5DUoh5dl2gc00C5sY1RArW wNSnJM2LnXyt3vpTd+zSE+F71XC/vF1JbKNeU0Va3KIwWClR3ciG4G+5NuJNFyvBTc/ZXQ6kBp eVKNrIGvannef4ArceSdOcAAAA= X-Change-Id: 20250428-debugfs-rust-3cd5c97eb7d1 X-Developer-Key: i=mmaurer@google.com; a=ed25519; pk=2Ezhl7+fEjTOMVFpplDeak2AdQ8cjJieLRVJdNzrW+E= X-Developer-Signature: v=1; a=ed25519-sha256; t=1746139663; l=2353; i=mmaurer@google.com; s=20250429; h=from:subject:message-id; bh=+sEHQ5a6ov4c05sHc/JUKrhbuajuBghx/mSe8CxfB7Y=; b=xUdA9bF7k9AvDp1lDH/YhMaQvblGwM6xdSrhJY7APgWxQz2pHAq6oJ19paTdmACQfPXxDiIPT 73D+HSeLeEeBizWelj+x5f9Wz5Uwyp1My0XEhCY/3kChOZjN1f1nK+p X-Mailer: b4 0.14.2 Message-ID: <20250501-debugfs-rust-v3-0-850869fab672@google.com> Subject: [PATCH v3 0/4] rust: DebugFS Bindings From: Matthew Maurer To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sami Tolvanen , Timur Tabi Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Matthew Maurer Content-Type: text/plain; charset="utf-8" This series provides safe DebugFS bindings for Rust, with a sample driver using them. This series currently only supports referencing `'static` lifetime objects, because we need to know the objects outlive the DebugFS files. A subsequent series may be able to relax this. * Directories created in the root of debugfs are assumed to be owning, and will clean up after themselves when dropped. * Subdirectories are assumed non-owning, remaining alive until their containing directory is cleaned up. They can be promoted to owning variants if needed. * Files are non-owning, but can be manually removed by handle if needed. Signed-off-by: Matthew Maurer --- Changes in v3: - Split `Dir` into `Dir`/`SubDir`/`File` to improve API. - Add "." to end of all comments. - Convert INVARIANT to # Invariants on types. - Add backticks everywhere I found variables/types in my comments. - Promoted invariant comment to doc comment. - Extended sample commenting to make it clearer what is happening. - Link to v2: https://lore.kernel.org/r/20250430-debugfs-rust-v2-0-2e8d3985812b@google.com Changes in v2: - Drop support for builder / pinned bindings in initial series - Remove `ARef` usage to abstract the dentry nature of handles - Remove error handling to discourage users from caring whether DebugFS is enabled. - Support CONFIG_DEBUG_FS=n while leaving the API available - Fixed mistaken decimal/octal mixup - Doc/comment cleanup - Link to v1: https://lore.kernel.org/r/20250429-debugfs-rust-v1-0-6b6e7cb7929f@google.com --- Matthew Maurer (4): rust: debugfs: Bind DebugFS directory creation rust: debugfs: Bind file creation for long-lived Display rust: debugfs: Support format hooks rust: samples: Add debugfs sample MAINTAINERS | 2 + rust/bindings/bindings_helper.h | 1 + rust/kernel/debugfs.rs | 405 ++++++++++++++++++++++++++++++++++++++++ rust/kernel/lib.rs | 1 + samples/rust/Kconfig | 11 ++ samples/rust/Makefile | 1 + samples/rust/rust_debugfs.rs | 54 ++++++ 7 files changed, 475 insertions(+) --- base-commit: b6a7783d306baf3150ac54cd5124f6e85dd375b0 change-id: 20250428-debugfs-rust-3cd5c97eb7d1 Best regards, -- Matthew Maurer