Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
jan.koester
Linux
Commits
a5b470ba
Commit
a5b470ba
authored
12 years ago
by
Al Viro
Browse files
Options
Downloads
Patches
Plain Diff
new helpers: fdget()/fdput()
Signed-off-bs: Al Viro <viro@zeniv.linux.org.uk>
parent
2a117354
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/linux/file.h
+26
-0
26 additions, 0 deletions
include/linux/file.h
with
26 additions
and
0 deletions
include/linux/file.h
+
26
−
0
View file @
a5b470ba
...
...
@@ -26,8 +26,34 @@ static inline void fput_light(struct file *file, int fput_needed)
fput
(
file
);
}
struct
fd
{
struct
file
*
file
;
int
need_put
;
};
static
inline
void
fdput
(
struct
fd
fd
)
{
if
(
fd
.
need_put
)
fput
(
fd
.
file
);
}
extern
struct
file
*
fget
(
unsigned
int
fd
);
extern
struct
file
*
fget_light
(
unsigned
int
fd
,
int
*
fput_needed
);
static
inline
struct
fd
fdget
(
unsigned
int
fd
)
{
int
b
;
struct
file
*
f
=
fget_light
(
fd
,
&
b
);
return
(
struct
fd
){
f
,
b
};
}
static
inline
struct
fd
fdget_raw
(
unsigned
int
fd
)
{
int
b
;
struct
file
*
f
=
fget_raw_light
(
fd
,
&
b
);
return
(
struct
fd
){
f
,
b
};
}
extern
struct
file
*
fget_raw
(
unsigned
int
fd
);
extern
struct
file
*
fget_raw_light
(
unsigned
int
fd
,
int
*
fput_needed
);
extern
int
f_dupfd
(
unsigned
int
from
,
struct
file
*
file
,
unsigned
flags
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment