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 * Read a file into user space memory
25 static ssize_t
UMSDOS_file_read (
32 struct dentry
*dentry
= filp
->f_dentry
;
33 struct inode
*inode
= dentry
->d_inode
;
35 int ret
= fat_file_read (filp
, buf
, count
, ppos
);
37 /* We have to set the access time because msdos don't care */
38 if (!IS_RDONLY (inode
)) {
39 inode
->i_atime
= CURRENT_TIME
;
40 mark_inode_dirty(inode
);
47 * Write a file from user space memory
49 static ssize_t
UMSDOS_file_write (
55 return fat_file_write (filp
, buf
, count
, ppos
);
60 * Truncate a file to 0 length.
62 static void UMSDOS_truncate (struct inode
*inode
)
64 Printk (("UMSDOS_truncate\n"));
65 if (!IS_RDONLY (inode
)) {
67 inode
->i_ctime
= inode
->i_mtime
= CURRENT_TIME
;
68 mark_inode_dirty(inode
);
72 /* Function for normal file system (512 bytes hardware sector size) */
73 struct file_operations umsdos_file_operations
=
75 NULL
, /* lseek - default */
76 UMSDOS_file_read
, /* read */
77 UMSDOS_file_write
, /* write */
78 NULL
, /* readdir - bad */
79 NULL
, /* poll - default */
80 NULL
, /* ioctl - default */
81 generic_file_mmap
, /* mmap */
82 NULL
, /* no special open is needed */
85 file_fsync
/* fsync */
88 struct inode_operations umsdos_file_inode_operations
=
90 &umsdos_file_operations
, /* default file operations */
101 NULL
, /* follow_link */
102 fat_bmap
, /* get_block */
103 block_read_full_page
, /* readpage */
104 NULL
, /* writepage */
105 NULL
, /* flushpage */
106 UMSDOS_truncate
, /* truncate */
107 NULL
, /* permission */
109 NULL
/* revalidate */
112 /* For other with larger and unaligned file system */
113 struct file_operations umsdos_file_operations_no_bmap
=
115 NULL
, /* lseek - default */
116 UMSDOS_file_read
, /* read */
117 UMSDOS_file_write
, /* write */
118 NULL
, /* readdir - bad */
119 NULL
, /* poll - default */
120 NULL
, /* ioctl - default */
122 NULL
, /* no special open is needed */
125 file_fsync
/* fsync */
128 struct inode_operations umsdos_file_inode_operations_no_bmap
=
130 &umsdos_file_operations_no_bmap
, /* default file operations */
141 NULL
, /* follow link */
142 NULL
, /* get_block */
144 NULL
, /* writepage */
145 NULL
, /* flushpage */
146 UMSDOS_truncate
, /* truncate */
147 NULL
, /* permission */
149 NULL
/* revalidate */
152 /* For other with larger and unaligned file system with readpage */
153 struct file_operations umsdos_file_operations_readpage
=
155 NULL
, /* lseek - default */
156 UMSDOS_file_read
, /* read */
157 UMSDOS_file_write
, /* write */
158 NULL
, /* readdir - bad */
159 NULL
, /* poll - default */
160 NULL
, /* ioctl - default */
161 generic_file_mmap
, /* mmap */
162 NULL
, /* no special open is needed */
165 file_fsync
/* fsync */
168 struct inode_operations umsdos_file_inode_operations_readpage
=
170 &umsdos_file_operations_readpage
, /* default file operations */
181 NULL
, /* follow link */
182 NULL
, /* get_block */
183 fat_readpage
, /* readpage */
184 NULL
, /* writepage */
185 NULL
, /* flushpage */
186 UMSDOS_truncate
, /* truncate */
187 NULL
, /* permission */
189 NULL
/* revalidate */