2.6 fatx patch

Ask questions regarding Gentoox, Gentoo and Linux in general in these forums and we'll do our best to help you!
Post Reply
mpoos
Newbie
Posts: 1
Joined: Fri Sep 15, 2006 1:41 am

2.6 fatx patch

Post by mpoos »

found something the other day re fatx 2.6 driver whilst building a 2.6 kernel (there was a compile warning) which could make things go wrong on delete. patch follows. kernel still doesnt run but thats another issue altogether.
If someone has a good way to test if this makes any difference to the corruption issue I would be appreciated.
cheers

Code: Select all

--- linux-2.6.16.28/fs/fatx/dir.c.orig  2006-09-14 11:19:24.000000000 +1000
+++ linux-2.6.16.28/fs/fatx/dir.c       2006-09-14 11:20:00.000000000 +1000
@@ -286,21 +286,23 @@
        struct super_block *sb = dir->i_sb;
        struct buffer_head *bh;
        struct fatx_dir_entry *de, *endp;
-       int err = 0, nr_slots;
+       int err = 0;
 
        bh = NULL;
+       de = NULL;
        if (fatx_get_entry(dir, &pos, &bh, &de) < 0) {
                err = -EIO;
        }
 
-       endp = (struct fatx_dir_entry *)(bh->b_data + sb->s_blocksize);
-       de->name_length = DELETED_FLAG;
-       de++;
-       nr_slots--;
-       mark_buffer_dirty(bh);
-       if (IS_DIRSYNC(dir))
-               err = sync_dirty_buffer(bh);
-       brelse(bh);
+       if ((bh != NULL) && (de != NULL)) {
+               endp = (struct fatx_dir_entry *)(bh->b_data + sb->s_blocksize);
+               de->name_length = DELETED_FLAG;
+               de++;
+               mark_buffer_dirty(bh);
+               if (IS_DIRSYNC(dir))
+                       err = sync_dirty_buffer(bh);
+               brelse(bh);
+       }
 
        return err;
 }
gnif
Novice
Posts: 42
Joined: Wed Sep 13, 2006 2:07 pm

Post by gnif »

Excellent work!!! :D

I am currently working at getting the 2.6.17 kernel to boot... but when I get a chance I will have a look at this.
Post Reply