Import 2.3.6
[davej-history.git] / include / linux / file.h
blob0125f9087e95635184bc75e52cd666bf41a41ac6
1 /*
2 * Wrapper functions for accessing the file_struct fd array.
3 */
5 #ifndef __LINUX_FILE_H
6 #define __LINUX_FILE_H
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];
20 return file;
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];
32 return file;
35 extern inline struct file * fget(unsigned int fd)
37 struct file * file = fcheck(fd);
39 if (file)
40 file->f_count++;
41 return file;
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:
60 * 3756 (i386 arch)
62 * precious bytes from my kernel, even without counting all the code compiled
63 * as module!
65 * I suspect there are many other similar "optimizations" across the
66 * kernel...
68 extern void fput(struct file *);
69 extern void put_filp(struct file *);
71 #endif /* __LINUX_FILE_H */