Files
linux-apfs/include/linux/file.h
T

75 lines
1.7 KiB
C
Raw Normal View History

2005-04-16 15:20:36 -07:00
/*
* Wrapper functions for accessing the file_struct fd array.
*/
#ifndef __LINUX_FILE_H
#define __LINUX_FILE_H
#include <linux/compiler.h>
#include <linux/types.h>
2008-04-24 07:44:08 -04:00
#include <linux/posix_types.h>
2005-04-16 15:20:36 -07:00
2008-04-24 07:44:08 -04:00
struct file;
2006-12-06 20:32:52 -08:00
extern void fput(struct file *);
2005-04-16 15:20:36 -07:00
struct file_operations;
struct vfsmount;
struct dentry;
2009-08-09 00:52:35 +04:00
struct path;
extern struct file *alloc_file(struct path *, fmode_t mode,
const struct file_operations *fop);
2005-04-16 15:20:36 -07:00
static inline void fput_light(struct file *file, int fput_needed)
{
2010-12-13 19:38:08 -05:00
if (fput_needed)
2005-04-16 15:20:36 -07:00
fput(file);
}
2012-08-27 19:55:01 -04:00
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);
2012-08-27 19:55:01 -04:00
static inline struct fd fdget(unsigned int fd)
{
int b;
struct file *f = fget_light(fd, &b);
return (struct fd){f,b};
}
2012-08-28 12:52:22 -04:00
extern struct file *fget_raw(unsigned int fd);
extern struct file *fget_raw_light(unsigned int fd, int *fput_needed);
2012-08-27 19:55:01 -04:00
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 int f_dupfd(unsigned int from, struct file *file, unsigned flags);
2012-08-21 12:11:46 -04:00
extern int replace_fd(unsigned fd, struct file *file, unsigned flags);
extern void set_close_on_exec(unsigned int fd, int flag);
extern bool get_close_on_exec(unsigned int fd);
2005-04-16 15:20:36 -07:00
extern void put_filp(struct file *);
2012-08-12 17:18:05 -04:00
extern int get_unused_fd_flags(unsigned flags);
#define get_unused_fd() get_unused_fd_flags(0)
extern void put_unused_fd(unsigned int fd);
2005-04-16 15:20:36 -07:00
extern void fd_install(unsigned int fd, struct file *file);
2005-04-16 15:20:36 -07:00
2012-06-24 09:56:45 +04:00
extern void flush_delayed_fput(void);
extern void __fput_sync(struct file *);
2005-04-16 15:20:36 -07:00
#endif /* __LINUX_FILE_H */