rpcd: update to git head
[openwrt.git] / package / system / mountd / patches / 030-ext4_support.patch
1 diff -ruN mountd-0.1.orig/include/fs.h mountd-0.1/include/fs.h
2 --- mountd-0.1.orig/include/fs.h        2009-10-02 22:57:04.000000000 +0200
3 +++ mountd-0.1/include/fs.h     2012-07-08 18:42:32.000000000 +0200
4 @@ -7,5 +7,6 @@
5  #define EFI                    7
6  #define NTFS           8
7  #define EXTENDED       9
8 +#define EXT4           10
9  
10  int detect_fs(char *device);
11 diff -ruN mountd-0.1.orig/lib/fs.c mountd-0.1/lib/fs.c
12 --- mountd-0.1.orig/lib/fs.c    2009-10-02 23:26:22.000000000 +0200
13 +++ mountd-0.1/lib/fs.c 2012-07-08 19:28:08.000000000 +0200
14 @@ -91,9 +91,14 @@
15                 goto out;
16         if(get_le_short(buffer + 56) == 0xEF53)
17         {
18 -               if((get_le_long(buffer + 96) & 0x0008)
19 -                       || (get_le_long(buffer + 92) & 0x0004))
20 -                       ret = EXT3;
21 +               if(get_le_long(buffer + 92) & 0x0004)
22 +               {
23 +                       if ((get_le_long(buffer + 96) < 0x0000040)
24 +                               && (get_le_long(buffer + 100) < 0x0000008))
25 +                               ret = EXT3;
26 +                       else
27 +                               ret = EXT4;
28 +               }
29                 else
30                         ret = EXT2;
31         }
32 diff -ruN mountd-0.1.orig/lib/mount.c mountd-0.1/lib/mount.c
33 --- mountd-0.1.orig/lib/mount.c 2009-10-03 12:54:57.000000000 +0200
34 +++ mountd-0.1/lib/mount.c      2012-07-08 19:04:29.000000000 +0200
35 @@ -53,7 +53,10 @@
36         "EXT3",
37         "FAT",
38         "HFSPLUS",
39 -       "NTFS"
40 +       "",
41 +       "NTFS",
42 +       "",
43 +       "EXT4"
44  };
45  
46  #define MAX_MOUNTED            32
47 @@ -93,7 +96,7 @@
48                 ucix_add_option(ctx, mountd, q->serial, "rev", q->rev);
49                 snprintf(t, 64, "size%d", atoi(&q->dev[3]));
50                 ucix_add_option(ctx, mountd, q->serial, t, q->size);
51 -               if(q->fs > MBR && q->fs <= NTFS)
52 +               if(q->fs > MBR && q->fs <= EXT4)
53                 {
54                         snprintf(t, 64, "fs%d", atoi(&q->dev[3]));
55                         ucix_add_option(ctx, mountd, q->serial, t, fs_names[q->fs]);
56 @@ -131,7 +134,7 @@
57  {
58         struct mount *mount;
59         char tmp[64], tmp2[64];
60 -       if(fs <= MBR || fs > NTFS)
61 +       if(fs <= MBR || fs > EXT4)
62                 return;
63         mount  = malloc(sizeof(struct mount));
64         INIT_LIST_HEAD(&mount->list);
65 @@ -147,7 +150,7 @@
66         mount->mounted = 0;
67         mount->fs = fs;
68         list_add(&mount->list, &mounts);
69 -       if((!mount->ignore) && (mount->fs > MBR) && (mount->fs <= NTFS))
70 +       if((!mount->ignore) && (mount->fs > MBR) && (mount->fs <= EXT4))
71         {
72                 log_printf("new mount : %s -> %s (%s)\n", name, dev, fs_names[mount->fs]);
73                 snprintf(tmp, 64, "%s%s", uci_path, name);
74 @@ -226,6 +229,11 @@
75                         log_printf("mount -t vfat -o rw,uid=1000,gid=1000 /dev/%s %s", mount->dev, tmp);
76                         ret = system_printf("mount -t vfat -o rw,uid=1000,gid=1000 /dev/%s %s", mount->dev, tmp);
77                 }
78 +               if(mount->fs == EXT4)
79 +               {
80 +                       log_printf("mount -t ext4 -o rw,defaults /dev/%s %s", mount->dev, tmp);
81 +                       ret = system_printf("mount -t ext4 -o rw,defaults /dev/%s %s", mount->dev, tmp);
82 +               }
83                 if(mount->fs == EXT3)
84                 {
85                         log_printf("mount -t ext3 -o rw,defaults /dev/%s %s", mount->dev, tmp);