030-ext4_support.patch 2.6 KB

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