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

Annotation of /fat-epoc/trunk/fat-epoc-2.6.15.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 311 - (hide annotations)
Fri Nov 9 12:29:00 2007 UTC (16 years, 11 months ago) by frodo
File size: 5373 byte(s)
(Frodo) Now also the 2.6.15 upto 2.6.18 solution.

1 frodo 311 diff -r -u2 -p linux-2.6.15.vanilla/fs/fat/dir.c linux-2.6.15/fs/fat/dir.c
2     --- linux-2.6.15.vanilla/fs/fat/dir.c 2007-11-09 12:06:40.000000000 +0100
3     +++ linux-2.6.15/fs/fat/dir.c 2007-11-09 13:14:08.000000000 +0100
4     @@ -241,4 +241,5 @@ static int fat_parse_long(struct inode *
5 frodo 298 struct msdos_dir_slot *ds;
6     unsigned char id, slot, slots, alias_checksum;
7     + int epoc = MSDOS_SB(dir->i_sb)->options.epoc;
8    
9     if (!*unicode) {
10 frodo 311 @@ -287,4 +288,8 @@ parse_long:
11 frodo 298 if ((*de)->name[0] == DELETED_FLAG)
12     return PARSE_INVALID;
13 frodo 311 + if (epoc && ((*de)->name[0] == EOD_FLAG)) {
14     + while (fat_get_entry(dir, pos, bh, de) >= 0);
15 frodo 298 + return PARSE_EOF;
16 frodo 311 + }
17 frodo 298 if ((*de)->attr == ATTR_EXT)
18     goto parse_long;
19 frodo 311 @@ -320,4 +325,5 @@ int fat_search_long(struct inode *inode,
20 frodo 298 loff_t cpos = 0;
21     int chl, i, j, last_u, err;
22     + int epoc = sbi->options.epoc;
23    
24     err = -ENOENT;
25 frodo 311 @@ -329,4 +335,8 @@ parse_record:
26 frodo 298 if (de->name[0] == DELETED_FLAG)
27     continue;
28 frodo 311 + if (epoc && (de->name[0] == EOD_FLAG)) {
29     + while (fat_get_entry(inode, &cpos, &bh, &de) >= 0);
30 frodo 298 + goto EODir;
31 frodo 311 + }
32 frodo 298 if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))
33     continue;
34 frodo 311 @@ -456,4 +466,6 @@ static int __fat_readdir(struct inode *i
35 frodo 298 loff_t cpos;
36     int ret = 0;
37     + int epoc = MSDOS_SB(sb)->options.epoc;
38     +
39    
40     lock_kernel();
41 frodo 311 @@ -486,4 +498,8 @@ parse_record:
42 frodo 298 long_slots = 0;
43     /* Check for long filename entry */
44 frodo 311 + if (epoc && (de->name[0] == EOD_FLAG)) {
45     + while (fat_get_entry(inode, &cpos, &bh, &de) >= 0);
46 frodo 298 + goto EODir;
47 frodo 311 + }
48 frodo 298 if (isvfat) {
49     if (de->name[0] == DELETED_FLAG)
50 frodo 311 @@ -753,5 +769,10 @@ static int fat_get_short_entry(struct in
51 frodo 298 struct msdos_dir_entry **de)
52     {
53     + int epoc = MSDOS_SB(dir->i_sb)->options.epoc;
54     while (fat_get_entry(dir, pos, bh, de) >= 0) {
55 frodo 311 + if (epoc && ((*de)->name[0] == EOD_FLAG)) {
56     + while (fat_get_entry(dir, pos, bh, de) >= 0);
57 frodo 298 + return -ENOENT;
58 frodo 311 + }
59 frodo 298 /* free entry or long name entry or volume label */
60     if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME))
61 frodo 311 @@ -1131,4 +1152,23 @@ error:
62 frodo 298 }
63    
64     +int fat_write_zero_entry(struct inode *dir, loff_t curr)
65     +{
66     + struct msdos_dir_entry *de = NULL;
67     + struct buffer_head *bh = NULL;
68     + loff_t pos;
69     + int err = 0;
70     +
71     + pos = curr;
72     + if (fat_get_entry(dir,&pos,&bh,&de) < 0)
73     + return 0;
74     +
75     + de->name[0] = EOD_FLAG;
76     + mark_buffer_dirty(bh);
77     + if (IS_DIRSYNC(dir))
78     + err = sync_dirty_buffer(bh);
79     + brelse(bh);
80     + return err;
81     +}
82     +
83     int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
84     struct fat_slot_info *sinfo)
85 frodo 311 @@ -1140,4 +1180,6 @@ int fat_add_entries(struct inode *dir, v
86 frodo 298 int err, free_slots, i, nr_bhs;
87     loff_t pos, i_pos;
88     + int epoc = sbi->options.epoc;
89     + int last_entry = 0;
90    
91     sinfo->nr_slots = nr_slots;
92 frodo 311 @@ -1153,5 +1195,7 @@ int fat_add_entries(struct inode *dir, v
93 frodo 298 goto error;
94    
95     - if (IS_FREE(de->name)) {
96     + if (epoc && (de->name[0] == EOD_FLAG))
97     + last_entry = 1;
98     + if (last_entry || IS_FREE(de->name)) {
99     if (prev != bh) {
100     get_bh(bh);
101 frodo 311 @@ -1183,4 +1227,15 @@ found:
102 frodo 298 pos -= free_slots * sizeof(*de);
103     nr_slots -= free_slots;
104     +
105     + /* We need to write an end-of-directory slot. And we do it first,
106     + * because we want to keep the directory in a readble state.
107     + * Note that there is no need to remove it on error, as it is beyond
108     + * the visible end of directory anyway.
109     + */
110     + if (epoc && !nr_slots && last_entry)
111     + err = fat_write_zero_entry(dir, pos + free_slots * sizeof(*de));
112     + if (err)
113     + goto error;
114     +
115     if (free_slots) {
116     /*
117 frodo 311 diff -r -u2 -p linux-2.6.15.vanilla/fs/fat/inode.c linux-2.6.15/fs/fat/inode.c
118     --- linux-2.6.15.vanilla/fs/fat/inode.c 2007-11-09 12:06:40.000000000 +0100
119     +++ linux-2.6.15/fs/fat/inode.c 2007-11-09 13:17:33.000000000 +0100
120     @@ -777,4 +777,5 @@ enum {
121 frodo 298 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
122 frodo 311 Opt_obsolate, Opt_err,
123 frodo 298 + Opt_epoc,
124     };
125    
126 frodo 311 @@ -797,4 +798,5 @@ static match_table_t fat_tokens = {
127 frodo 298 {Opt_debug, "debug"},
128     {Opt_immutable, "sys_immutable"},
129     + {Opt_epoc, "epoc"},
130     {Opt_obsolate, "conv=binary"},
131     {Opt_obsolate, "conv=text"},
132 frodo 311 @@ -949,4 +951,7 @@ static int parse_options(char *options,
133 frodo 298 opts->codepage = option;
134     break;
135     + case Opt_epoc:
136     + opts->epoc = 1;
137     + break;
138    
139     /* msdos specific */
140 frodo 311 @@ -1002,4 +1007,5 @@ static int parse_options(char *options,
141     break;
142 frodo 298
143 frodo 311 +
144     /* obsolete mount options */
145     case Opt_obsolate:
146     diff -r -u2 -p linux-2.6.15.vanilla/include/linux/msdos_fs.h linux-2.6.15/include/linux/msdos_fs.h
147     --- linux-2.6.15.vanilla/include/linux/msdos_fs.h 2007-11-09 12:06:42.000000000 +0100
148     +++ linux-2.6.15/include/linux/msdos_fs.h 2007-11-09 13:14:08.000000000 +0100
149     @@ -45,4 +45,5 @@
150    
151 frodo 298 #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
152     +#define EOD_FLAG 0x00 /* marks end of directory when in name[0] for old fats */
153     #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
154    
155 frodo 311 @@ -204,5 +205,6 @@ struct fat_mount_options {
156 frodo 298 numtail:1, /* Does first alias have a numeric '~1' type tail? */
157     atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
158     - nocase:1; /* Does this need case conversion? 0=need case conversion*/
159     + nocase:1, /* Does this need case conversion? 0=need case conversion*/
160 frodo 311 + epoc:1; /* Filename starting with 0x00 marks end of dir? */
161 frodo 298 };
162    

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