2 * linux/fs/umsdos/file.c
4 * Written 1993 by Jacques Gelinas
5 * inspired from linux/fs/msdos/file.c Werner Almesberger
7 * Extended MS-DOS regular file handling primitives
10 #include <linux/sched.h>
12 #include <linux/msdos_fs.h>
13 #include <linux/errno.h>
14 #include <linux/fcntl.h>
15 #include <linux/stat.h>
16 #include <linux/msdos_fs.h>
17 #include <linux/umsdos_fs.h>
19 #include <asm/uaccess.h>
20 #include <asm/system.h>
23 #define Printk(x) printk x
27 * Read a file into user space memory
29 static ssize_t
UMSDOS_file_read (
36 struct dentry
*dentry
= filp
->f_dentry
;
37 struct inode
*inode
= dentry
->d_inode
;
39 /* We have to set the access time because msdos don't care */
41 int ret
= fat_file_read (filp
, buf
, count
, ppos
);
43 if (!IS_RDONLY (inode
)) {
44 inode
->i_atime
= CURRENT_TIME
;
54 * Write a file from user space memory
56 static ssize_t
UMSDOS_file_write (
62 return fat_file_write (filp
, buf
, count
, ppos
);
67 * Truncate a file to 0 length.
69 static void UMSDOS_truncate (struct inode
*inode
)
71 Printk (("UMSDOS_truncate\n"));
73 inode
->i_ctime
= inode
->i_mtime
= CURRENT_TIME
;
75 /*FIXME inode->i_dirt = 1; */
78 /* Function for normal file system (512 bytes hardware sector size) */
79 struct file_operations umsdos_file_operations
=
81 NULL
, /* lseek - default */
82 UMSDOS_file_read
, /* read */
83 UMSDOS_file_write
, /* write */
84 NULL
, /* readdir - bad */
85 NULL
, /* poll - default */
86 NULL
, /* ioctl - default */
87 generic_file_mmap
, /* mmap */
88 NULL
, /* no special open is needed */
91 file_fsync
/* fsync */
94 struct inode_operations umsdos_file_inode_operations
=
96 &umsdos_file_operations
, /* default file operations */
107 NULL
, /* follow_link */
108 generic_readpage
, /* readpage */
109 NULL
, /* writepage */
111 UMSDOS_truncate
, /* truncate */
112 NULL
, /* permission */
116 /* For other with larger and unaligned file system */
117 struct file_operations umsdos_file_operations_no_bmap
=
119 NULL
, /* lseek - default */
120 UMSDOS_file_read
, /* read */
121 UMSDOS_file_write
, /* write */
122 NULL
, /* readdir - bad */
123 NULL
, /* poll - default */
124 NULL
, /* ioctl - default */
126 NULL
, /* no special open is needed */
129 file_fsync
/* fsync */
132 struct inode_operations umsdos_file_inode_operations_no_bmap
=
134 &umsdos_file_operations_no_bmap
, /* default file operations */
145 NULL
, /* follow link */
147 NULL
, /* writepage */
149 UMSDOS_truncate
, /* truncate */
150 NULL
, /* permission */
154 /* For other with larger and unaligned file system with readpage */
155 struct file_operations umsdos_file_operations_readpage
=
157 NULL
, /* lseek - default */
158 UMSDOS_file_read
, /* read */
159 UMSDOS_file_write
, /* write */
160 NULL
, /* readdir - bad */
161 NULL
, /* poll - default */
162 NULL
, /* ioctl - default */
163 generic_file_mmap
, /* mmap */
164 NULL
, /* no special open is needed */
167 file_fsync
/* fsync */
170 struct inode_operations umsdos_file_inode_operations_readpage
=
172 &umsdos_file_operations_readpage
, /* default file operations */
183 NULL
, /* follow link */
184 fat_readpage
, /* readpage */
185 NULL
, /* writepage */
187 UMSDOS_truncate
, /* truncate */
188 NULL
, /* permission */