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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 283 - (hide annotations)
Sun Nov 20 22:16:12 2005 UTC (15 years, 2 months ago) by frodo
File size: 5221 byte(s)
(Frodo) Added support for 2.6.12+ kernels (must be tested more thoroughly!)

1 frodo 283 diff -u2 -r 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
3     +++ linux-source-2.6.12/fs/fat/dir.c 2005-11-20 22:36:26.000000000 +0100
4     @@ -221,4 +221,5 @@
5     loff_t cpos = 0;
6     int chl, i, j, last_u, err;
7     + int epoc = sbi->options.epoc;
8    
9     err = -ENOENT;
10     @@ -230,4 +231,6 @@
11     if (de->name[0] == DELETED_FLAG)
12     continue;
13     + if (epoc && (de->name[0] == EOD_FLAG))
14     + goto EODir;
15     if (de->attr != ATTR_EXT && (de->attr & ATTR_VOLUME))
16     continue;
17     @@ -287,4 +290,6 @@
18     goto parse_long;
19     }
20     + if (epoc && (de->name[0] == EOD_FLAG))
21     + goto EODir;
22     if (de->name[0] == DELETED_FLAG)
23     continue;
24     @@ -395,4 +400,6 @@
25     unsigned char long_slots;
26     const char *fill_name;
27     + int epoc = MSDOS_SB(sb)->options.epoc;
28     + int last_entry = 0;
29     int fill_len;
30     wchar_t bufuname[14];
31     @@ -437,4 +444,8 @@
32     if (fat_get_entry(inode, &cpos, &bh, &de) == -1)
33     goto EODir;
34     + if (epoc && (de->name[0] == EOD_FLAG))
35     + last_entry = 1;
36     + if (last_entry)
37     + goto RecEnd;
38     /* Check for long filename entry */
39     if (isvfat) {
40     @@ -504,4 +515,8 @@
41     goto ParseLong;
42     }
43     + if (epoc && (de->name[0] == EOD_FLAG)) {
44     + last_entry = 1;
45     + goto RecEnd;
46     + }
47     if (de->name[0] == DELETED_FLAG)
48     goto RecEnd;
49     @@ -757,5 +772,8 @@
50     struct msdos_dir_entry **de)
51     {
52     + int epoc = MSDOS_SB(dir->i_sb)->options.epoc;
53     while (fat_get_entry(dir, pos, bh, de) >= 0) {
54     + if (epoc && ((*de)->name[0] == EOD_FLAG))
55     + return -ENOENT;
56     /* free entry or long name entry or volume label */
57     if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME))
58     @@ -773,8 +791,11 @@
59     {
60     loff_t offset;
61     + int epoc = MSDOS_SB(dir->i_sb)->options.epoc;
62    
63     offset = 0;
64     *bh = NULL;
65     while (fat_get_short_entry(dir, &offset, bh, de) >= 0) {
66     + if (epoc && ((*de)->name[0] == EOD_FLAG))
67     + return -ENOENT;
68     if (!strncmp((*de)->name, MSDOS_DOTDOT, MSDOS_NAME)) {
69     *i_pos = fat_make_i_pos(dir->i_sb, *bh, *de);
70     @@ -1135,4 +1156,25 @@
71     }
72    
73     +/* Set the first character of the next entry to zero. */
74     +void fat_write_zero_entry(struct inode *dir, loff_t curr)
75     +{
76     + struct msdos_dir_entry *de = NULL;
77     + struct buffer_head *bh = NULL;
78     + loff_t pos;
79     + int err;
80     +
81     + pos = curr;
82     + if (fat_get_entry(dir,&pos,&bh,&de) < 0)
83     + return;
84     +
85     + de->name[0] = EOD_FLAG;
86     + mark_buffer_dirty(bh);
87     + if (IS_DIRSYNC(dir))
88     + /* We should handle the error condition here! */
89     + err = sync_dirty_buffer(bh);
90     + brelse(bh);
91     +}
92     +
93     +
94     int fat_add_entries(struct inode *dir, void *slots, int nr_slots,
95     struct fat_slot_info *sinfo)
96     @@ -1144,4 +1186,7 @@
97     int err, free_slots, i, nr_bhs;
98     loff_t pos, i_pos;
99     + int epoc = sbi->options.epoc;
100     + int last_entry = 0;
101     +
102    
103     sinfo->nr_slots = nr_slots;
104     @@ -1157,5 +1202,8 @@
105     goto error;
106    
107     - if (IS_FREE(de->name)) {
108     + if ((epoc && (de->name[0] == EOD_FLAG)))
109     + last_entry = 1;
110     +
111     + if (last_entry || IS_FREE(de->name)) {
112     if (prev != bh) {
113     get_bh(bh);
114     @@ -1222,4 +1270,8 @@
115     }
116    
117     + /* We need to write an end-of-directory slot */
118     + if (epoc && !nr_slots && last_entry)
119     + fat_write_zero_entry(dir, pos + free_slots * sizeof(*de));
120     +
121     if (nr_slots) {
122     int cluster, nr_cluster;
123     diff -u2 -r 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
125     +++ linux-source-2.6.12/fs/fat/inode.c 2005-11-20 20:45:29.000000000 +0100
126     @@ -756,4 +756,5 @@
127     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,
129     + Opt_epoc,
130     Opt_obsolate, Opt_err,
131     };
132     @@ -777,4 +778,5 @@
133     {Opt_debug, "debug"},
134     {Opt_immutable, "sys_immutable"},
135     + {Opt_epoc, "epoc"},
136     {Opt_obsolate, "conv=binary"},
137     {Opt_obsolate, "conv=text"},
138     @@ -929,4 +931,8 @@
139     opts->codepage = option;
140     break;
141     + case Opt_epoc:
142     + opts->epoc = 1;
143     + break;
144     +
145    
146     /* msdos specific */
147     diff -u2 -r 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
149     +++ linux-source-2.6.12/include/linux/msdos_fs.h 2005-11-20 20:45:29.000000000 +0100
150     @@ -45,4 +45,5 @@
151    
152     #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
153     +#define EOD_FLAG 0x00 /* marks end of directory when in name[0] for old fats */
154     #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
155    
156     @@ -204,5 +205,7 @@
157     numtail:1, /* Does first alias have a numeric '~1' type tail? */
158     atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
159     - nocase:1; /* Does this need case conversion? 0=need case conversion*/
160     + nocase:1, /* Does this need case conversion? 0=need case conversion*/
161     + epoc:1; /* Filename starting with 0x00 marks end of dir? */
162     +
163     };
164    

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