aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-07 16:35:17 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-12-07 16:35:17 -0500
commit21b4e736922f546e0f1aa7b9d6c442f309a2444a (patch)
treee1be8645297f8ebe87445251743ebcc52081a20d /fs/hpfs
parent34161db6b14d984fb9b06c735b7b42f8803f6851 (diff)
parent68380b581383c028830f79ec2670f4a193854aa6 (diff)
Merge branch 'master' of /home/trondmy/kernel/linux-2.6/ into merge_linus
Diffstat (limited to 'fs/hpfs')
-rw-r--r--fs/hpfs/dir.c10
-rw-r--r--fs/hpfs/dnode.c13
-rw-r--r--fs/hpfs/ea.c5
-rw-r--r--fs/hpfs/hpfs_fn.h3
-rw-r--r--fs/hpfs/inode.c5
-rw-r--r--fs/hpfs/map.c20
-rw-r--r--fs/hpfs/super.c29
7 files changed, 51 insertions, 34 deletions
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c
index ecc9180645ae..594f9c428fc2 100644
--- a/fs/hpfs/dir.c
+++ b/fs/hpfs/dir.c
@@ -84,7 +84,8 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
84 } 84 }
85 if (!fno->dirflag) { 85 if (!fno->dirflag) {
86 e = 1; 86 e = 1;
87 hpfs_error(inode->i_sb, "not a directory, fnode %08x",inode->i_ino); 87 hpfs_error(inode->i_sb, "not a directory, fnode %08lx",
88 (unsigned long)inode->i_ino);
88 } 89 }
89 if (hpfs_inode->i_dno != fno->u.external[0].disk_secno) { 90 if (hpfs_inode->i_dno != fno->u.external[0].disk_secno) {
90 e = 1; 91 e = 1;
@@ -144,8 +145,11 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
144 } 145 }
145 if (de->first || de->last) { 146 if (de->first || de->last) {
146 if (hpfs_sb(inode->i_sb)->sb_chk) { 147 if (hpfs_sb(inode->i_sb)->sb_chk) {
147 if (de->first && !de->last && (de->namelen != 2 || de ->name[0] != 1 || de->name[1] != 1)) hpfs_error(inode->i_sb, "hpfs_readdir: bad ^A^A entry; pos = %08x", old_pos); 148 if (de->first && !de->last && (de->namelen != 2
148 if (de->last && (de->namelen != 1 || de ->name[0] != 255)) hpfs_error(inode->i_sb, "hpfs_readdir: bad \\377 entry; pos = %08x", old_pos); 149 || de ->name[0] != 1 || de->name[1] != 1))
150 hpfs_error(inode->i_sb, "hpfs_readdir: bad ^A^A entry; pos = %08lx", old_pos);
151 if (de->last && (de->namelen != 1 || de ->name[0] != 255))
152 hpfs_error(inode->i_sb, "hpfs_readdir: bad \\377 entry; pos = %08lx", old_pos);
149 } 153 }
150 hpfs_brelse4(&qbh); 154 hpfs_brelse4(&qbh);
151 goto again; 155 goto again;
diff --git a/fs/hpfs/dnode.c b/fs/hpfs/dnode.c
index 229ff2fb1809..fe83c2b7d2d8 100644
--- a/fs/hpfs/dnode.c
+++ b/fs/hpfs/dnode.c
@@ -533,10 +533,13 @@ static void delete_empty_dnode(struct inode *i, dnode_secno dno)
533 struct buffer_head *bh; 533 struct buffer_head *bh;
534 struct dnode *d1; 534 struct dnode *d1;
535 struct quad_buffer_head qbh1; 535 struct quad_buffer_head qbh1;
536 if (hpfs_sb(i->i_sb)->sb_chk) if (up != i->i_ino) { 536 if (hpfs_sb(i->i_sb)->sb_chk)
537 hpfs_error(i->i_sb, "bad pointer to fnode, dnode %08x, pointing to %08x, should be %08x", dno, up, i->i_ino); 537 if (up != i->i_ino) {
538 hpfs_error(i->i_sb,
539 "bad pointer to fnode, dnode %08x, pointing to %08x, should be %08lx",
540 dno, up, (unsigned long)i->i_ino);
538 return; 541 return;
539 } 542 }
540 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) { 543 if ((d1 = hpfs_map_dnode(i->i_sb, down, &qbh1))) {
541 d1->up = up; 544 d1->up = up;
542 d1->root_dnode = 1; 545 d1->root_dnode = 1;
@@ -851,7 +854,9 @@ struct hpfs_dirent *map_pos_dirent(struct inode *inode, loff_t *posp,
851 /* Going to the next dirent */ 854 /* Going to the next dirent */
852 if ((d = de_next_de(de)) < dnode_end_de(dnode)) { 855 if ((d = de_next_de(de)) < dnode_end_de(dnode)) {
853 if (!(++*posp & 077)) { 856 if (!(++*posp & 077)) {
854 hpfs_error(inode->i_sb, "map_pos_dirent: pos crossed dnode boundary; pos = %08x", *posp); 857 hpfs_error(inode->i_sb,
858 "map_pos_dirent: pos crossed dnode boundary; pos = %08llx",
859 (unsigned long long)*posp);
855 goto bail; 860 goto bail;
856 } 861 }
857 /* We're going down the tree */ 862 /* We're going down the tree */
diff --git a/fs/hpfs/ea.c b/fs/hpfs/ea.c
index 66339dc030e4..547a8384571f 100644
--- a/fs/hpfs/ea.c
+++ b/fs/hpfs/ea.c
@@ -243,8 +243,9 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, char *key, char *data
243 fnode->ea_offs = 0xc4; 243 fnode->ea_offs = 0xc4;
244 } 244 }
245 if (fnode->ea_offs < 0xc4 || fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200) { 245 if (fnode->ea_offs < 0xc4 || fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200) {
246 hpfs_error(s, "fnode %08x: ea_offs == %03x, ea_size_s == %03x", 246 hpfs_error(s, "fnode %08lx: ea_offs == %03x, ea_size_s == %03x",
247 inode->i_ino, fnode->ea_offs, fnode->ea_size_s); 247 (unsigned long)inode->i_ino,
248 fnode->ea_offs, fnode->ea_size_s);
248 return; 249 return;
249 } 250 }
250 if ((fnode->ea_size_s || !fnode->ea_size_l) && 251 if ((fnode->ea_size_s || !fnode->ea_size_l) &&
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h
index 32ab51e42b96..1c07aa82d327 100644
--- a/fs/hpfs/hpfs_fn.h
+++ b/fs/hpfs/hpfs_fn.h
@@ -317,7 +317,8 @@ static inline struct hpfs_sb_info *hpfs_sb(struct super_block *sb)
317 317
318/* super.c */ 318/* super.c */
319 319
320void hpfs_error(struct super_block *, char *, ...); 320void hpfs_error(struct super_block *, const char *, ...)
321 __attribute__((format (printf, 2, 3)));
321int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *); 322int hpfs_stop_cycles(struct super_block *, int, int *, int *, char *);
322unsigned hpfs_count_one_bitmap(struct super_block *, secno); 323unsigned hpfs_count_one_bitmap(struct super_block *, secno);
323 324
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c
index 7faef8544f32..85d3e1d9ac00 100644
--- a/fs/hpfs/inode.c
+++ b/fs/hpfs/inode.c
@@ -251,7 +251,10 @@ void hpfs_write_inode_nolock(struct inode *i)
251 de->file_size = 0; 251 de->file_size = 0;
252 hpfs_mark_4buffers_dirty(&qbh); 252 hpfs_mark_4buffers_dirty(&qbh);
253 hpfs_brelse4(&qbh); 253 hpfs_brelse4(&qbh);
254 } else hpfs_error(i->i_sb, "directory %08x doesn't have '.' entry", i->i_ino); 254 } else
255 hpfs_error(i->i_sb,
256 "directory %08lx doesn't have '.' entry",
257 (unsigned long)i->i_ino);
255 } 258 }
256 mark_buffer_dirty(bh); 259 mark_buffer_dirty(bh);
257 brelse(bh); 260 brelse(bh);
diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c
index 0fecdac22e4e..c4724589b2eb 100644
--- a/fs/hpfs/map.c
+++ b/fs/hpfs/map.c
@@ -126,32 +126,40 @@ struct fnode *hpfs_map_fnode(struct super_block *s, ino_t ino, struct buffer_hea
126 struct extended_attribute *ea; 126 struct extended_attribute *ea;
127 struct extended_attribute *ea_end; 127 struct extended_attribute *ea_end;
128 if (fnode->magic != FNODE_MAGIC) { 128 if (fnode->magic != FNODE_MAGIC) {
129 hpfs_error(s, "bad magic on fnode %08x", ino); 129 hpfs_error(s, "bad magic on fnode %08lx",
130 (unsigned long)ino);
130 goto bail; 131 goto bail;
131 } 132 }
132 if (!fnode->dirflag) { 133 if (!fnode->dirflag) {
133 if ((unsigned)fnode->btree.n_used_nodes + (unsigned)fnode->btree.n_free_nodes != 134 if ((unsigned)fnode->btree.n_used_nodes + (unsigned)fnode->btree.n_free_nodes !=
134 (fnode->btree.internal ? 12 : 8)) { 135 (fnode->btree.internal ? 12 : 8)) {
135 hpfs_error(s, "bad number of nodes in fnode %08x", ino); 136 hpfs_error(s,
137 "bad number of nodes in fnode %08lx",
138 (unsigned long)ino);
136 goto bail; 139 goto bail;
137 } 140 }
138 if (fnode->btree.first_free != 141 if (fnode->btree.first_free !=
139 8 + fnode->btree.n_used_nodes * (fnode->btree.internal ? 8 : 12)) { 142 8 + fnode->btree.n_used_nodes * (fnode->btree.internal ? 8 : 12)) {
140 hpfs_error(s, "bad first_free pointer in fnode %08x", ino); 143 hpfs_error(s,
144 "bad first_free pointer in fnode %08lx",
145 (unsigned long)ino);
141 goto bail; 146 goto bail;
142 } 147 }
143 } 148 }
144 if (fnode->ea_size_s && ((signed int)fnode->ea_offs < 0xc4 || 149 if (fnode->ea_size_s && ((signed int)fnode->ea_offs < 0xc4 ||
145 (signed int)fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200)) { 150 (signed int)fnode->ea_offs + fnode->acl_size_s + fnode->ea_size_s > 0x200)) {
146 hpfs_error(s, "bad EA info in fnode %08x: ea_offs == %04x ea_size_s == %04x", 151 hpfs_error(s,
147 ino, fnode->ea_offs, fnode->ea_size_s); 152 "bad EA info in fnode %08lx: ea_offs == %04x ea_size_s == %04x",
153 (unsigned long)ino,
154 fnode->ea_offs, fnode->ea_size_s);
148 goto bail; 155 goto bail;
149 } 156 }
150 ea = fnode_ea(fnode); 157 ea = fnode_ea(fnode);
151 ea_end = fnode_end_ea(fnode); 158 ea_end = fnode_end_ea(fnode);
152 while (ea != ea_end) { 159 while (ea != ea_end) {
153 if (ea > ea_end) { 160 if (ea > ea_end) {
154 hpfs_error(s, "bad EA in fnode %08x", ino); 161 hpfs_error(s, "bad EA in fnode %08lx",
162 (unsigned long)ino);
155 goto bail; 163 goto bail;
156 } 164 }
157 ea = next_ea(ea); 165 ea = next_ea(ea);
diff --git a/fs/hpfs/super.c b/fs/hpfs/super.c
index 450b5e0b4785..d4abc1a1d566 100644
--- a/fs/hpfs/super.c
+++ b/fs/hpfs/super.c
@@ -46,21 +46,17 @@ static void unmark_dirty(struct super_block *s)
46} 46}
47 47
48/* Filesystem error... */ 48/* Filesystem error... */
49static char err_buf[1024];
49 50
50#define ERR_BUF_SIZE 1024 51void hpfs_error(struct super_block *s, const char *fmt, ...)
51
52void hpfs_error(struct super_block *s, char *m,...)
53{ 52{
54 char *buf; 53 va_list args;
55 va_list l; 54
56 va_start(l, m); 55 va_start(args, fmt);
57 if (!(buf = kmalloc(ERR_BUF_SIZE, GFP_KERNEL))) 56 vsnprintf(err_buf, sizeof(err_buf), fmt, args);
58 printk("HPFS: No memory for error message '%s'\n",m); 57 va_end(args);
59 else if (vsprintf(buf, m, l) >= ERR_BUF_SIZE) 58
60 printk("HPFS: Grrrr... Kernel memory corrupted ... going on, but it'll crash very soon :-(\n"); 59 printk("HPFS: filesystem error: %s", err_buf);
61 printk("HPFS: filesystem error: ");
62 if (buf) printk("%s", buf);
63 else printk("%s\n",m);
64 if (!hpfs_sb(s)->sb_was_error) { 60 if (!hpfs_sb(s)->sb_was_error) {
65 if (hpfs_sb(s)->sb_err == 2) { 61 if (hpfs_sb(s)->sb_err == 2) {
66 printk("; crashing the system because you wanted it\n"); 62 printk("; crashing the system because you wanted it\n");
@@ -76,7 +72,6 @@ void hpfs_error(struct super_block *s, char *m,...)
76 } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n"); 72 } else if (s->s_flags & MS_RDONLY) printk("; going on - but anything won't be destroyed because it's read-only\n");
77 else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n"); 73 else printk("; corrupted filesystem mounted read/write - your computer will explode within 20 seconds ... but you wanted it so!\n");
78 } else printk("\n"); 74 } else printk("\n");
79 kfree(buf);
80 hpfs_sb(s)->sb_was_error = 1; 75 hpfs_sb(s)->sb_was_error = 1;
81} 76}
82 77
@@ -160,12 +155,12 @@ static int hpfs_statfs(struct dentry *dentry, struct kstatfs *buf)
160 return 0; 155 return 0;
161} 156}
162 157
163static kmem_cache_t * hpfs_inode_cachep; 158static struct kmem_cache * hpfs_inode_cachep;
164 159
165static struct inode *hpfs_alloc_inode(struct super_block *sb) 160static struct inode *hpfs_alloc_inode(struct super_block *sb)
166{ 161{
167 struct hpfs_inode_info *ei; 162 struct hpfs_inode_info *ei;
168 ei = (struct hpfs_inode_info *)kmem_cache_alloc(hpfs_inode_cachep, SLAB_NOFS); 163 ei = (struct hpfs_inode_info *)kmem_cache_alloc(hpfs_inode_cachep, GFP_NOFS);
169 if (!ei) 164 if (!ei)
170 return NULL; 165 return NULL;
171 ei->vfs_inode.i_version = 1; 166 ei->vfs_inode.i_version = 1;
@@ -177,7 +172,7 @@ static void hpfs_destroy_inode(struct inode *inode)
177 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode)); 172 kmem_cache_free(hpfs_inode_cachep, hpfs_i(inode));
178} 173}
179 174
180static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 175static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
181{ 176{
182 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo; 177 struct hpfs_inode_info *ei = (struct hpfs_inode_info *) foo;
183 178