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

Contents of /fat-epoc/trunk/fat-epoc-2.6.0.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 281 - (show annotations)
Fri Nov 18 21:23:28 2005 UTC (19 years ago) by frodo
File size: 4602 byte(s)
(Frodo) Initial Import

1 diff -u2 -r kernel-source-2.6.0-clean/fs/fat/dir.c kernel-source-2.6.0/fs/fat/dir.c
2 --- kernel-source-2.6.0-clean/fs/fat/dir.c 2003-10-08 21:24:01.000000000 +0200
3 +++ kernel-source-2.6.0/fs/fat/dir.c 2004-02-01 15:23:28.000000000 +0100
4 @@ -194,4 +194,5 @@
5 int chl, i, j, last_u, res = 0;
6 loff_t i_pos, cpos = 0;
7 + int epoc = MSDOS_SB(sb)->options.epoc;
8
9 while(1) {
10 @@ -200,4 +201,6 @@
11 parse_record:
12 long_slots = 0;
13 + if (epoc && (de->name[0] == EOD_FLAG))
14 + goto EODir;
15 if (de->name[0] == DELETED_FLAG)
16 continue;
17 @@ -259,4 +262,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 @@ -363,4 +368,6 @@
25 loff_t i_pos, cpos;
26 int ret = 0;
27 + int epoc = MSDOS_SB(sb)->options.epoc;
28 + int last_entry = 0;
29
30 lock_kernel();
31 @@ -391,4 +398,8 @@
32 if (fat_get_entry(inode,&cpos,&bh,&de,&i_pos) == -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 @@ -459,4 +470,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 @@ -689,4 +704,20 @@
50 }
51
52 +/* Set the first character of the next entry to zero. */
53 +void fat_write_zero_entry(struct inode *dir, loff_t curr)
54 +{
55 + struct msdos_dir_entry *de = NULL;
56 + struct buffer_head *bh = NULL;
57 + loff_t ipos,pos;
58 +
59 + pos = curr;
60 + if (fat_get_entry(dir,&pos,&bh,&de,&ipos) < 0)
61 + return;
62 +
63 + de->name[0] = EOD_FLAG;
64 + mark_buffer_dirty(bh);
65 + brelse(bh);
66 +}
67 +
68 /* This assumes that size of cluster is above the 32*slots */
69
70 @@ -698,4 +729,6 @@
71 int row;
72 struct buffer_head *new_bh;
73 + int epoc = MSDOS_SB(dir->i_sb)->options.epoc;
74 + int last_entry = 0;
75
76 offset = curr = 0;
77 @@ -709,7 +742,12 @@
78 }
79
80 - if (IS_FREE((*de)->name)) {
81 - if (++row == slots)
82 + if ((epoc && ((*de)->name[0] == EOD_FLAG)))
83 + last_entry = 1;
84 + if (last_entry || IS_FREE((*de)->name)) {
85 + if (++row == slots) {
86 + if (last_entry)
87 + fat_write_zero_entry(dir,curr);
88 return offset;
89 + }
90 } else {
91 row = 0;
92 @@ -730,4 +768,6 @@
93 }
94
95 +
96 +
97 int fat_new_dir(struct inode *dir, struct inode *parent, int is_vfat)
98 {
99 @@ -769,5 +809,9 @@
100 struct msdos_dir_entry **de, loff_t *i_pos)
101 {
102 + int epoc = MSDOS_SB(dir->i_sb)->options.epoc;
103 +
104 while (fat_get_entry(dir, pos, bh, de, i_pos) >= 0) {
105 + if (epoc && ((*de)->name[0] == EOD_FLAG))
106 + return -ENOENT;
107 /* free entry or long name entry or volume label */
108 if (!IS_FREE((*de)->name) && !((*de)->attr & ATTR_VOLUME))
109 diff -u2 -r kernel-source-2.6.0-clean/fs/fat/inode.c kernel-source-2.6.0/fs/fat/inode.c
110 --- kernel-source-2.6.0-clean/fs/fat/inode.c 2003-11-24 08:13:12.000000000 +0100
111 +++ kernel-source-2.6.0/fs/fat/inode.c 2004-02-01 13:48:46.000000000 +0100
112 @@ -255,4 +255,5 @@
113 Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes,
114 Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes,
115 + Opt_epoc,
116 Opt_obsolate, Opt_err,
117 };
118 @@ -276,4 +277,5 @@
119 {Opt_debug, "debug"},
120 {Opt_immutable, "sys_immutable"},
121 + {Opt_epoc, "epoc"},
122 {Opt_obsolate, "conv=binary"},
123 {Opt_obsolate, "conv=text"},
124 @@ -427,4 +429,8 @@
125 opts->codepage = option;
126 break;
127 + case Opt_epoc:
128 + opts->epoc = 1;
129 + break;
130 +
131
132 /* msdos specific */
133 diff -u2 -r kernel-source-2.6.0-clean/include/linux/msdos_fs.h kernel-source-2.6.0/include/linux/msdos_fs.h
134 --- kernel-source-2.6.0-clean/include/linux/msdos_fs.h 2003-08-09 10:12:03.000000000 +0200
135 +++ kernel-source-2.6.0/include/linux/msdos_fs.h 2004-02-01 13:48:46.000000000 +0100
136 @@ -45,4 +45,5 @@
137
138 #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */
139 +#define EOD_FLAG 0x00 /* marks end of directory when in name[0] for old fats */
140 #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG)
141
142 diff -u2 -r kernel-source-2.6.0-clean/include/linux/msdos_fs_sb.h kernel-source-2.6.0/include/linux/msdos_fs_sb.h
143 --- kernel-source-2.6.0-clean/include/linux/msdos_fs_sb.h 2003-07-27 19:01:58.000000000 +0200
144 +++ kernel-source-2.6.0/include/linux/msdos_fs_sb.h 2004-02-01 13:48:46.000000000 +0100
145 @@ -24,5 +24,6 @@
146 numtail:1, /* Does first alias have a numeric '~1' type tail? */
147 atari:1, /* Use Atari GEMDOS variation of MS-DOS fs */
148 - nocase:1; /* Does this need case conversion? 0=need case conversion*/
149 + nocase:1, /* Does this need case conversion? 0=need case conversion*/
150 + epoc:1; /* Filename starting with 0x00 marks end of dir? */
151 };
152

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