patch-2.1.90 linux/include/linux/file.h
Next file: linux/include/linux/hfs_fs.h
Previous file: linux/include/linux/coda_linux.h
Back to the patch index
Back to the overall index
- Lines: 64
- Date:
Tue Mar 10 13:28:04 1998
- Orig file:
v2.1.89/linux/include/linux/file.h
- Orig date:
Tue Mar 10 10:03:35 1998
diff -u --recursive --new-file v2.1.89/linux/include/linux/file.h linux/include/linux/file.h
@@ -1,19 +1,41 @@
+/*
+ * Wrapper functions for accessing the file_struct fd array.
+ */
+
#ifndef __LINUX_FILE_H
#define __LINUX_FILE_H
-extern inline struct file * fget(unsigned long fd)
+extern int __fput(struct file *);
+extern void insert_file_free(struct file *file);
+
+/*
+ * Check whether the specified fd has an open file.
+ */
+extern inline struct file * fcheck(unsigned int fd)
{
struct file * file = NULL;
- if (fd < NR_OPEN) {
+
+ if (fd < NR_OPEN)
file = current->files->fd[fd];
- if (file)
- file->f_count++;
- }
return file;
}
-extern int __fput(struct file *);
-extern void insert_file_free(struct file *file);
+extern inline struct file * fget(unsigned int fd)
+{
+ struct file * file = fcheck(fd);
+
+ if (file)
+ file->f_count++;
+ return file;
+}
+
+/*
+ * Install a file pointer in the fd array.
+ */
+extern inline void fd_install(unsigned int fd, struct file *file)
+{
+ current->files->fd[fd] = file;
+}
/* It does not matter which list it is on. */
extern inline void remove_filp(struct file *file)
@@ -45,14 +67,6 @@
remove_filp(file);
insert_file_free(file);
}
-}
-
-/*
- * Install a file pointer in the files structure.
- */
-extern inline void fd_install(unsigned long fd, struct file *file)
-{
- current->files->fd[fd] = file;
}
#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov