1 /*
2 * linux/fs/umsdos/file.c
3 *
4 * Written 1993 by Jacques Gelinas
5 * inspired from linux/fs/msdos/file.c Werner Almesberger
6 *
7 * Extended MS-DOS regular file handling primitives
8 */
9
10 #include <asm/segment.h>
11 #include <asm/system.h>
12
13 #include <linux/sched.h>
14 #include <linux/fs.h>
15 #include <linux/msdos_fs.h>
16 #include <linux/errno.h>
17 #include <linux/fcntl.h>
18 #include <linux/stat.h>
19 #include <linux/msdos_fs.h>
20 #include <linux/umsdos_fs.h>
21
22
23 #define PRINTK(x)
24 #define Printk(x) printk x
25 /*
26 Read a file into user space memory
27 */
28 static int UMSDOS_file_read(
/* ![[previous]](../icons/n_left.png)
![[next]](../icons/right.png)
![[first]](../icons/n_first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
29 struct inode *inode,
30 struct file *filp,
31 char *buf,
32 int count)
33 {
34 /* We have to set the access time because msdos don't care */
35 int ret = msdos_file_read(inode,filp,buf,count);
36 inode->i_atime = CURRENT_TIME;
37 inode->i_dirt = 1;
38 return ret;
39 }
40 /*
41 Write a file from user space memory
42 */
43 static int UMSDOS_file_write(
/* ![[previous]](../icons/left.png)
![[next]](../icons/right.png)
![[first]](../icons/first.png)
![[last]](../icons/last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
44 struct inode *inode,
45 struct file *filp,
46 char *buf,
47 int count)
48 {
49 return msdos_file_write(inode,filp,buf,count);
50 }
51 /*
52 Truncate a file to 0 length.
53 */
54 static void UMSDOS_truncate(struct inode *inode)
/* ![[previous]](../icons/left.png)
![[next]](../icons/n_right.png)
![[first]](../icons/first.png)
![[last]](../icons/n_last.png)
![[top]](../icons/top.png)
![[bottom]](../icons/bottom.png)
![[index]](../icons/index.png)
*/
55 {
56 PRINTK (("UMSDOS_truncate\n"));
57 msdos_truncate (inode);
58 inode->i_ctime = inode->i_mtime = CURRENT_TIME;
59 inode->i_dirt = 1;
60 }
61 /*
62 See inode.c
63
64 Some entry point are filled dynamically with function pointers
65 from the msdos file_operations and file_inode_operations.
66
67 The idea is to have the code as independent as possible from
68 the msdos file system.
69 */
70
71 struct file_operations umsdos_file_operations = {
72 NULL, /* lseek - default */
73 UMSDOS_file_read, /* read */
74 UMSDOS_file_write, /* write */
75 NULL, /* readdir - bad */
76 NULL, /* select - default */
77 NULL, /* ioctl - default */
78 generic_mmap, /* mmap */
79 NULL, /* no special open is needed */
80 NULL, /* release */
81 file_fsync /* fsync */
82 };
83
84 struct inode_operations umsdos_file_inode_operations = {
85 &umsdos_file_operations, /* default file operations */
86 NULL, /* create */
87 NULL, /* lookup */
88 NULL, /* link */
89 NULL, /* unlink */
90 NULL, /* symlink */
91 NULL, /* mkdir */
92 NULL, /* rmdir */
93 NULL, /* mknod */
94 NULL, /* rename */
95 NULL, /* readlink */
96 NULL, /* follow_link */
97 NULL, /* bmap */
98 UMSDOS_truncate,/* truncate */
99 NULL, /* permission */
100 msdos_smap /* smap */
101 };
102
103