/[public]/fat-epoc/trunk/fat-epoc-2.6.12.diff
ViewVC logotype

Diff of /fat-epoc/trunk/fat-epoc-2.6.12.diff

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 283 Revision 284
1diff -u2 -r linux-source-2.6.12.unpatched/fs/fat/dir.c linux-source-2.6.12/fs/fat/dir.c 1diff -r2 -u linux-source-2.6.12.unpatched/fs/fat/dir.c linux-source-2.6.12/fs/fat/dir.c
2--- linux-source-2.6.12.unpatched/fs/fat/dir.c 2005-06-17 21:48:29.000000000 +0200 2--- linux-source-2.6.12.unpatched/fs/fat/dir.c 2005-06-17 21:48:29.000000000 +0200
3+++ linux-source-2.6.12/fs/fat/dir.c 2005-11-20 22:36:26.000000000 +0100 3+++ linux-source-2.6.12/fs/fat/dir.c 2005-11-21 21:00:07.000000000 +0100
4@@ -221,4 +221,5 @@ 4@@ -221,4 +221,5 @@
5 loff_t cpos = 0; 5 loff_t cpos = 0;
6 int chl, i, j, last_u, err; 6 int chl, i, j, last_u, err;
7+ int epoc = sbi->options.epoc; 7+ int epoc = sbi->options.epoc;
8 8
69 *i_pos = fat_make_i_pos(dir->i_sb, *bh, *de); 69 *i_pos = fat_make_i_pos(dir->i_sb, *bh, *de);
70@@ -1135,4 +1156,25 @@ 70@@ -1135,4 +1156,25 @@
71 } 71 }
72 72
73+/* Set the first character of the next entry to zero. */ 73+/* Set the first character of the next entry to zero. */
74+void fat_write_zero_entry(struct inode *dir, loff_t curr) 74+int fat_write_zero_entry(struct inode *dir, loff_t curr)
75+{ 75+{
76+ struct msdos_dir_entry *de = NULL; 76+ struct msdos_dir_entry *de = NULL;
77+ struct buffer_head *bh = NULL; 77+ struct buffer_head *bh = NULL;
78+ loff_t pos; 78+ loff_t pos;
79+ int err; 79+ int err = 0;
80+ 80+
81+ pos = curr; 81+ pos = curr;
82+ if (fat_get_entry(dir,&pos,&bh,&de) < 0) 82+ if (fat_get_entry(dir,&pos,&bh,&de) < 0)
83+ return; 83+ return 0;
84+ 84+
85+ de->name[0] = EOD_FLAG; 85+ de->name[0] = EOD_FLAG;
86+ mark_buffer_dirty(bh); 86+ mark_buffer_dirty(bh);
87+ if (IS_DIRSYNC(dir)) 87+ if (IS_DIRSYNC(dir))
88+ /* We should handle the error condition here! */
89+ err = sync_dirty_buffer(bh); 88+ err = sync_dirty_buffer(bh);
90+ brelse(bh); 89+ brelse(bh);
90+ return err;
91+} 91+}
92+ 92+
93+ 93+
94 int fat_add_entries(struct inode *dir, void *slots, int nr_slots, 94 int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
95 struct fat_slot_info *sinfo) 95 struct fat_slot_info *sinfo)
109+ last_entry = 1; 109+ last_entry = 1;
110+ 110+
111+ if (last_entry || IS_FREE(de->name)) { 111+ if (last_entry || IS_FREE(de->name)) {
112 if (prev != bh) { 112 if (prev != bh) {
113 get_bh(bh); 113 get_bh(bh);
114@@ -1222,4 +1270,8 @@ 114@@ -1185,6 +1233,18 @@
115 } 115 found:
116 116 err = 0;
117+
118 pos -= free_slots * sizeof(*de);
119 nr_slots -= free_slots;
120+
117+ /* We need to write an end-of-directory slot */ 121+ /* We need to write an end-of-directory slot. And we do it first,
122+ * because we want to keep the directory in a readble state.
123+ * Note that there is no need to remove it on error, as it is beyond
124+ * the visible end of directory anyway.
125+ */
118+ if (epoc && !nr_slots && last_entry) 126+ if (epoc && !nr_slots && last_entry)
119+ fat_write_zero_entry(dir, pos + free_slots * sizeof(*de)); 127+ err = fat_write_zero_entry(dir, pos + free_slots * sizeof(*de));
128+ if (err)
129+ goto error;
120+ 130+
121 if (nr_slots) { 131 if (free_slots) {
122 int cluster, nr_cluster; 132 /*
123diff -u2 -r linux-source-2.6.12.unpatched/fs/fat/inode.c linux-source-2.6.12/fs/fat/inode.c 133diff -r2 -u linux-source-2.6.12.unpatched/fs/fat/inode.c linux-source-2.6.12/fs/fat/inode.c
124--- linux-source-2.6.12.unpatched/fs/fat/inode.c 2005-06-17 21:48:29.000000000 +0200 134--- linux-source-2.6.12.unpatched/fs/fat/inode.c 2005-06-17 21:48:29.000000000 +0200
125+++ linux-source-2.6.12/fs/fat/inode.c 2005-11-20 20:45:29.000000000 +0100 135+++ linux-source-2.6.12/fs/fat/inode.c 2005-11-20 20:45:29.000000000 +0100
126@@ -756,4 +756,5 @@ 136@@ -756,4 +756,5 @@
127 Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, 137 Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
128 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, 138 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
142+ opts->epoc = 1; 152+ opts->epoc = 1;
143+ break; 153+ break;
144+ 154+
145 155
146 /* msdos specific */ 156 /* msdos specific */
147diff -u2 -r linux-source-2.6.12.unpatched/include/linux/msdos_fs.h linux-source-2.6.12/include/linux/msdos_fs.h 157diff -r2 -u linux-source-2.6.12.unpatched/include/linux/msdos_fs.h linux-source-2.6.12/include/linux/msdos_fs.h
148--- linux-source-2.6.12.unpatched/include/linux/msdos_fs.h 2005-06-17 21:48:29.000000000 +0200 158--- linux-source-2.6.12.unpatched/include/linux/msdos_fs.h 2005-06-17 21:48:29.000000000 +0200
149+++ linux-source-2.6.12/include/linux/msdos_fs.h 2005-11-20 20:45:29.000000000 +0100 159+++ linux-source-2.6.12/include/linux/msdos_fs.h 2005-11-20 20:45:29.000000000 +0100
150@@ -45,4 +45,5 @@ 160@@ -45,4 +45,5 @@
151 161
152 #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ 162 #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */

Legend:
Removed from v.283  
changed lines
  Added in v.284

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26