2 * Wrapper functions for accessing the file_struct fd array.
8 extern void __fput(struct file
*);
11 * Check whether the specified task has the fd open. Since the task
12 * may not have a files_struct, we must test for p->files != NULL.
14 extern inline struct file
* fcheck_task(struct task_struct
*p
, unsigned int fd
)
16 struct file
* file
= NULL
;
18 if (p
->files
&& fd
< p
->files
->max_fds
)
19 file
= p
->files
->fd
[fd
];
24 * Check whether the specified fd has an open file.
26 extern inline struct file
* fcheck(unsigned int fd
)
28 struct file
* file
= NULL
;
30 if (fd
< current
->files
->max_fds
)
31 file
= current
->files
->fd
[fd
];
35 extern inline struct file
* fget(unsigned int fd
)
37 struct file
* file
= fcheck(fd
);
45 * Install a file pointer in the fd array.
47 extern inline void fd_install(unsigned int fd
, struct file
* file
)
49 current
->files
->fd
[fd
] = file
;
53 * 23/12/1998 Marcin Dalecki <dalecki@cs.net.pl>:
55 * Since those functions where calling other functions, it was compleatly
56 * bogous to make them all "extern inline".
58 * The removal of this pseudo optimization saved me scandaleous:
62 * precious bytes from my kernel, even without counting all the code compiled
65 * I suspect there are many other similar "optimizations" across the
68 extern void fput(struct file
*);
69 extern void put_filp(struct file
*);
71 #endif /* __LINUX_FILE_H */