aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hpfs')
-rw-r--r--fs/hpfs/dir.c2
-rw-r--r--fs/hpfs/hpfs_fn.h11
-rw-r--r--fs/hpfs/inode.c1
-rw-r--r--fs/hpfs/name.c33
-rw-r--r--fs/hpfs/namei.c3
-rw-r--r--fs/hpfs/super.c32
6 files changed, 7 insertions, 75 deletions
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index b3d7c0ddb609..208f3d7769d5 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -250,8 +250,6 @@ struct dentry *hpfs_lookup(struct inode *dir, struct dentry *dentry, struct name
250 hpfs_result = hpfs_i(result); 250 hpfs_result = hpfs_i(result);
251 if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino; 251 if (!de->directory) hpfs_result->i_parent_dir = dir->i_ino;
252 252
253 hpfs_decide_conv(result, name, len);
254
255 if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) { 253 if (de->has_acl || de->has_xtd_perm) if (!(dir->i_sb->s_flags & MS_RDONLY)) {
256 hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures"); 254 hpfs_error(result->i_sb, "ACLs or XPERM found. This is probably HPFS386. This driver doesn't support it now. Send me some info on these structures");
257 goto bail1; 255 goto bail1;
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index 860d09f199b2..d10108690ed0 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -51,7 +51,6 @@ struct hpfs_inode_info {
51 unsigned i_disk_sec; /* (files) minimalist cache of alloc info */ 51 unsigned i_disk_sec; /* (files) minimalist cache of alloc info */
52 unsigned i_n_secs; /* (files) minimalist cache of alloc info */ 52 unsigned i_n_secs; /* (files) minimalist cache of alloc info */
53 unsigned i_ea_size; /* size of extended attributes */ 53 unsigned i_ea_size; /* size of extended attributes */
54 unsigned i_conv : 2; /* (files) crlf->newline hackery */
55 unsigned i_ea_mode : 1; /* file's permission is stored in ea */ 54 unsigned i_ea_mode : 1; /* file's permission is stored in ea */
56 unsigned i_ea_uid : 1; /* file's uid is stored in ea */ 55 unsigned i_ea_uid : 1; /* file's uid is stored in ea */
57 unsigned i_ea_gid : 1; /* file's gid is stored in ea */ 56 unsigned i_ea_gid : 1; /* file's gid is stored in ea */
@@ -73,7 +72,6 @@ struct hpfs_sb_info {
73 uid_t sb_uid; /* uid from mount options */ 72 uid_t sb_uid; /* uid from mount options */
74 gid_t sb_gid; /* gid from mount options */ 73 gid_t sb_gid; /* gid from mount options */
75 umode_t sb_mode; /* mode from mount options */ 74 umode_t sb_mode; /* mode from mount options */
76 unsigned sb_conv : 2; /* crlf->newline hackery */
77 unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */ 75 unsigned sb_eas : 2; /* eas: 0-ignore, 1-ro, 2-rw */
78 unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */ 76 unsigned sb_err : 2; /* on errs: 0-cont, 1-ro, 2-panic */
79 unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */ 77 unsigned sb_chk : 2; /* checks: 0-no, 1-normal, 2-strict */
@@ -90,14 +88,6 @@ struct hpfs_sb_info {
90 int sb_timeshift; 88 int sb_timeshift;
91}; 89};
92 90
93/*
94 * conv= options
95 */
96
97#define CONV_BINARY 0 /* no conversion */
98#define CONV_TEXT 1 /* crlf->newline */
99#define CONV_AUTO 2 /* decide based on file contents */
100
101/* Four 512-byte buffers and the 2k block obtained by concatenating them */ 91/* Four 512-byte buffers and the 2k block obtained by concatenating them */
102 92
103struct quad_buffer_head { 93struct quad_buffer_head {
@@ -298,7 +288,6 @@ int hpfs_compare_names(struct super_block *, const unsigned char *, unsigned,
298 const unsigned char *, unsigned, int); 288 const unsigned char *, unsigned, int);
299int hpfs_is_name_long(const unsigned char *, unsigned); 289int hpfs_is_name_long(const unsigned char *, unsigned);
300void hpfs_adjust_length(const unsigned char *, unsigned *); 290void hpfs_adjust_length(const unsigned char *, unsigned *);
301void hpfs_decide_conv(struct inode *, const unsigned char *, unsigned);
302 291
303/* namei.c */ 292/* namei.c */
304 293
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index 29cf0508d271..3b8eeb1693ae 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -17,7 +17,6 @@ void hpfs_init_inode(struct inode *i)
17 i->i_uid = hpfs_sb(sb)->sb_uid; 17 i->i_uid = hpfs_sb(sb)->sb_uid;
18 i->i_gid = hpfs_sb(sb)->sb_gid; 18 i->i_gid = hpfs_sb(sb)->sb_gid;
19 i->i_mode = hpfs_sb(sb)->sb_mode; 19 i->i_mode = hpfs_sb(sb)->sb_mode;
20 hpfs_inode->i_conv = hpfs_sb(sb)->sb_conv;
21 i->i_size = -1; 20 i->i_size = -1;
22 i->i_blocks = -1; 21 i->i_blocks = -1;
23 22
diff --git a/fs/hpfs/name.c b/fs/hpfs/name.c
index f24736d7a439..9acdf338def0 100644
--- a/fs/hpfs/name.c
+++ b/fs/hpfs/name.c
@@ -8,39 +8,6 @@
8 8
9#include "hpfs_fn.h" 9#include "hpfs_fn.h"
10 10
11static const char *text_postfix[]={
12".ASM", ".BAS", ".BAT", ".C", ".CC", ".CFG", ".CMD", ".CON", ".CPP", ".DEF",
13".DOC", ".DPR", ".ERX", ".H", ".HPP", ".HTM", ".HTML", ".JAVA", ".LOG", ".PAS",
14".RC", ".TEX", ".TXT", ".Y", ""};
15
16static const char *text_prefix[]={
17"AUTOEXEC.", "CHANGES", "COPYING", "CONFIG.", "CREDITS", "FAQ", "FILE_ID.DIZ",
18"MAKEFILE", "READ.ME", "README", "TERMCAP", ""};
19
20void hpfs_decide_conv(struct inode *inode, const unsigned char *name, unsigned len)
21{
22 struct hpfs_inode_info *hpfs_inode = hpfs_i(inode);
23 int i;
24 if (hpfs_inode->i_conv != CONV_AUTO) return;
25 for (i = 0; *text_postfix[i]; i++) {
26 int l = strlen(text_postfix[i]);
27 if (l <= len)
28 if (!hpfs_compare_names(inode->i_sb, text_postfix[i], l, name + len - l, l, 0))
29 goto text;
30 }
31 for (i = 0; *text_prefix[i]; i++) {
32 int l = strlen(text_prefix[i]);
33 if (l <= len)
34 if (!hpfs_compare_names(inode->i_sb, text_prefix[i], l, name, l, 0))
35 goto text;
36 }
37 hpfs_inode->i_conv = CONV_BINARY;
38 return;
39 text:
40 hpfs_inode->i_conv = CONV_TEXT;
41 return;
42}
43
44static inline int not_allowed_char(unsigned char c) 11static inline int not_allowed_char(unsigned char c)
45{ 12{
46 return c<' ' || c=='"' || c=='*' || c=='/' || c==':' || c=='<' || 13 return c<' ' || c=='"' || c=='*' || c=='/' || c==':' || c=='<' ||
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 8c9f91537195..9c66f0ec8f8e 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -151,7 +151,6 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, int mode, struc
151 result->i_op = &hpfs_file_iops; 151 result->i_op = &hpfs_file_iops;
152 result->i_fop = &hpfs_file_ops; 152 result->i_fop = &hpfs_file_ops;
153 result->i_nlink = 1; 153 result->i_nlink = 1;
154 hpfs_decide_conv(result, name, len);
155 hpfs_i(result)->i_parent_dir = dir->i_ino; 154 hpfs_i(result)->i_parent_dir = dir->i_ino;
156 result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date); 155 result->i_ctime.tv_sec = result->i_mtime.tv_sec = result->i_atime.tv_sec = local_to_gmt(dir->i_sb, dee.creation_date);
157 result->i_ctime.tv_nsec = 0; 156 result->i_ctime.tv_nsec = 0;
@@ -616,8 +615,6 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
616 mark_buffer_dirty(bh); 615 mark_buffer_dirty(bh);
617 brelse(bh); 616 brelse(bh);
618 } 617 }
619 hpfs_i(i)->i_conv = hpfs_sb(i->i_sb)->sb_conv;
620 hpfs_decide_conv(i, new_name, new_len);
621end1: 618end1:
622 hpfs_unlock(i->i_sb); 619 hpfs_unlock(i->i_sb);
623 return err; 620 return err;
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 6493377cbef5..4858ff882d09 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -219,7 +219,6 @@ static void destroy_inodecache(void)
219 219
220enum { 220enum {
221 Opt_help, Opt_uid, Opt_gid, Opt_umask, Opt_case_lower, Opt_case_asis, 221 Opt_help, Opt_uid, Opt_gid, Opt_umask, Opt_case_lower, Opt_case_asis,
222 Opt_conv_binary, Opt_conv_text, Opt_conv_auto,
223 Opt_check_none, Opt_check_normal, Opt_check_strict, 222 Opt_check_none, Opt_check_normal, Opt_check_strict,
224 Opt_err_cont, Opt_err_ro, Opt_err_panic, 223 Opt_err_cont, Opt_err_ro, Opt_err_panic,
225 Opt_eas_no, Opt_eas_ro, Opt_eas_rw, 224 Opt_eas_no, Opt_eas_ro, Opt_eas_rw,
@@ -234,9 +233,6 @@ static const match_table_t tokens = {
234 {Opt_umask, "umask=%o"}, 233 {Opt_umask, "umask=%o"},
235 {Opt_case_lower, "case=lower"}, 234 {Opt_case_lower, "case=lower"},
236 {Opt_case_asis, "case=asis"}, 235 {Opt_case_asis, "case=asis"},
237 {Opt_conv_binary, "conv=binary"},
238 {Opt_conv_text, "conv=text"},
239 {Opt_conv_auto, "conv=auto"},
240 {Opt_check_none, "check=none"}, 236 {Opt_check_none, "check=none"},
241 {Opt_check_normal, "check=normal"}, 237 {Opt_check_normal, "check=normal"},
242 {Opt_check_strict, "check=strict"}, 238 {Opt_check_strict, "check=strict"},
@@ -254,7 +250,7 @@ static const match_table_t tokens = {
254}; 250};
255 251
256static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask, 252static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask,
257 int *lowercase, int *conv, int *eas, int *chk, int *errs, 253 int *lowercase, int *eas, int *chk, int *errs,
258 int *chkdsk, int *timeshift) 254 int *chkdsk, int *timeshift)
259{ 255{
260 char *p; 256 char *p;
@@ -296,15 +292,6 @@ static int parse_opts(char *opts, uid_t *uid, gid_t *gid, umode_t *umask,
296 case Opt_case_asis: 292 case Opt_case_asis:
297 *lowercase = 0; 293 *lowercase = 0;
298 break; 294 break;
299 case Opt_conv_binary:
300 *conv = CONV_BINARY;
301 break;
302 case Opt_conv_text:
303 *conv = CONV_TEXT;
304 break;
305 case Opt_conv_auto:
306 *conv = CONV_AUTO;
307 break;
308 case Opt_check_none: 295 case Opt_check_none:
309 *chk = 0; 296 *chk = 0;
310 break; 297 break;
@@ -371,9 +358,6 @@ HPFS filesystem options:\n\
371 umask=xxx set mode of files that don't have mode specified in eas\n\ 358 umask=xxx set mode of files that don't have mode specified in eas\n\
372 case=lower lowercase all files\n\ 359 case=lower lowercase all files\n\
373 case=asis do not lowercase files (default)\n\ 360 case=asis do not lowercase files (default)\n\
374 conv=binary do not convert CR/LF -> LF (default)\n\
375 conv=auto convert only files with known text extensions\n\
376 conv=text convert all files\n\
377 check=none no fs checks - kernel may crash on corrupted filesystem\n\ 361 check=none no fs checks - kernel may crash on corrupted filesystem\n\
378 check=normal do some checks - it should not crash (default)\n\ 362 check=normal do some checks - it should not crash (default)\n\
379 check=strict do extra time-consuming checks, used for debugging\n\ 363 check=strict do extra time-consuming checks, used for debugging\n\
@@ -395,7 +379,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
395 uid_t uid; 379 uid_t uid;
396 gid_t gid; 380 gid_t gid;
397 umode_t umask; 381 umode_t umask;
398 int lowercase, conv, eas, chk, errs, chkdsk, timeshift; 382 int lowercase, eas, chk, errs, chkdsk, timeshift;
399 int o; 383 int o;
400 struct hpfs_sb_info *sbi = hpfs_sb(s); 384 struct hpfs_sb_info *sbi = hpfs_sb(s);
401 char *new_opts = kstrdup(data, GFP_KERNEL); 385 char *new_opts = kstrdup(data, GFP_KERNEL);
@@ -406,11 +390,11 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
406 lock_super(s); 390 lock_super(s);
407 uid = sbi->sb_uid; gid = sbi->sb_gid; 391 uid = sbi->sb_uid; gid = sbi->sb_gid;
408 umask = 0777 & ~sbi->sb_mode; 392 umask = 0777 & ~sbi->sb_mode;
409 lowercase = sbi->sb_lowercase; conv = sbi->sb_conv; 393 lowercase = sbi->sb_lowercase;
410 eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk; 394 eas = sbi->sb_eas; chk = sbi->sb_chk; chkdsk = sbi->sb_chkdsk;
411 errs = sbi->sb_err; timeshift = sbi->sb_timeshift; 395 errs = sbi->sb_err; timeshift = sbi->sb_timeshift;
412 396
413 if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase, &conv, 397 if (!(o = parse_opts(data, &uid, &gid, &umask, &lowercase,
414 &eas, &chk, &errs, &chkdsk, &timeshift))) { 398 &eas, &chk, &errs, &chkdsk, &timeshift))) {
415 printk("HPFS: bad mount options.\n"); 399 printk("HPFS: bad mount options.\n");
416 goto out_err; 400 goto out_err;
@@ -428,7 +412,7 @@ static int hpfs_remount_fs(struct super_block *s, int *flags, char *data)
428 412
429 sbi->sb_uid = uid; sbi->sb_gid = gid; 413 sbi->sb_uid = uid; sbi->sb_gid = gid;
430 sbi->sb_mode = 0777 & ~umask; 414 sbi->sb_mode = 0777 & ~umask;
431 sbi->sb_lowercase = lowercase; sbi->sb_conv = conv; 415 sbi->sb_lowercase = lowercase;
432 sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk; 416 sbi->sb_eas = eas; sbi->sb_chk = chk; sbi->sb_chkdsk = chkdsk;
433 sbi->sb_err = errs; sbi->sb_timeshift = timeshift; 417 sbi->sb_err = errs; sbi->sb_timeshift = timeshift;
434 418
@@ -472,7 +456,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
472 uid_t uid; 456 uid_t uid;
473 gid_t gid; 457 gid_t gid;
474 umode_t umask; 458 umode_t umask;
475 int lowercase, conv, eas, chk, errs, chkdsk, timeshift; 459 int lowercase, eas, chk, errs, chkdsk, timeshift;
476 460
477 dnode_secno root_dno; 461 dnode_secno root_dno;
478 struct hpfs_dirent *de = NULL; 462 struct hpfs_dirent *de = NULL;
@@ -498,14 +482,13 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
498 gid = current_gid(); 482 gid = current_gid();
499 umask = current_umask(); 483 umask = current_umask();
500 lowercase = 0; 484 lowercase = 0;
501 conv = CONV_BINARY;
502 eas = 2; 485 eas = 2;
503 chk = 1; 486 chk = 1;
504 errs = 1; 487 errs = 1;
505 chkdsk = 1; 488 chkdsk = 1;
506 timeshift = 0; 489 timeshift = 0;
507 490
508 if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase, &conv, 491 if (!(o = parse_opts(options, &uid, &gid, &umask, &lowercase,
509 &eas, &chk, &errs, &chkdsk, &timeshift))) { 492 &eas, &chk, &errs, &chkdsk, &timeshift))) {
510 printk("HPFS: bad mount options.\n"); 493 printk("HPFS: bad mount options.\n");
511 goto bail0; 494 goto bail0;
@@ -558,7 +541,6 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
558 sbi->sb_n_free = -1; 541 sbi->sb_n_free = -1;
559 sbi->sb_n_free_dnodes = -1; 542 sbi->sb_n_free_dnodes = -1;
560 sbi->sb_lowercase = lowercase; 543 sbi->sb_lowercase = lowercase;
561 sbi->sb_conv = conv;
562 sbi->sb_eas = eas; 544 sbi->sb_eas = eas;
563 sbi->sb_chk = chk; 545 sbi->sb_chk = chk;
564 sbi->sb_chkdsk = chkdsk; 546 sbi->sb_chkdsk = chkdsk;