projects
/
platform
/
kernel
/
linux-amlogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5fcf329
)
file: add fput() cleanup helper
author
Christian Brauner
<brauner@kernel.org>
Fri, 19 Jul 2024 11:41:51 +0000
(13:41 +0200)
committer
Christian Brauner
<brauner@kernel.org>
Fri, 9 Aug 2024 10:44:50 +0000
(12:44 +0200)
Add a simple helper to put a file reference.
Link:
https://lore.kernel.org/r/20240719-work-mount-namespace-v1-4-834113cab0d2@kernel.org
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
include/linux/file.h
patch
|
blob
|
history
diff --git
a/include/linux/file.h
b/include/linux/file.h
index 237931f20739f3840fecdfcce122a5984b81e8cd..d1e768b06069ff922c689b05c8e3ea4feeb1fafd 100644
(file)
--- a/
include/linux/file.h
+++ b/
include/linux/file.h
@@
-11,6
+11,7
@@
#include <linux/posix_types.h>
#include <linux/errno.h>
#include <linux/cleanup.h>
+#include <linux/err.h>
struct file;
@@
-96,6
+97,7
@@
extern void put_unused_fd(unsigned int fd);
DEFINE_CLASS(get_unused_fd, int, if (_T >= 0) put_unused_fd(_T),
get_unused_fd_flags(flags), unsigned flags)
+DEFINE_FREE(fput, struct file *, if (!IS_ERR_OR_NULL(_T)) fput(_T))
/*
* take_fd() will take care to set @fd to -EBADF ensuring that