Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329015
b: refs/heads/master
c: a5b470b
h: refs/heads/master
i:
  329013: 28883e4
  329011: 3c140e0
  329007: 0023f2c
v: v3
  • Loading branch information
Al Viro committed Sep 27, 2012
1 parent a6bd6f9 commit 93aa4fd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2a117354b7bdfe13750a64307755e75436fb157a
refs/heads/master: a5b470ba06aa3f96999ede5feba178df6bdb134a
26 changes: 26 additions & 0 deletions trunk/include/linux/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 93aa4fd

Please sign in to comment.