Thread (5 messages) 5 messages, 4 authors, 2024-10-02

Re: [PATCH] Update core.c

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2024-10-02 22:21:47
Also in: lkml

On Wed, Oct 02, 2024 at 06:27:51AM -0700, Jakub Kicinski wrote:
On Mon, 30 Sep 2024 23:20:45 +0100 Conor Dooley wrote:
quoted
(do netdev folks even want scoped cleanup?),
Since I have it handy... :)

Quoting documentation:

  Using device-managed and cleanup.h constructs
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  
  Netdev remains skeptical about promises of all "auto-cleanup" APIs,
  including even ``devm_`` helpers, historically. They are not the preferred
  style of implementation, merely an acceptable one.
  
  Use of ``guard()`` is discouraged within any function longer than 20 lines,
  ``scoped_guard()`` is considered more readable. Using normal lock/unlock is
  still (weakly) preferred.
  
  Low level cleanup constructs (such as ``__free()``) can be used when building
  APIs and helpers, especially scoped iterators. However, direct use of
  ``__free()`` within networking core and drivers is discouraged.
  Similar guidance applies to declaring variables mid-function.
  
See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs
Bravo.  Mind if that gets stolen for VFS as well?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help