diff options
Diffstat (limited to 'package/mountd/patches')
-rw-r--r-- | package/mountd/patches/010-uci_rename_history_to_delta.patch | 27 | ||||
-rw-r--r-- | package/mountd/patches/020-handle_timeout.patch | 32 | ||||
-rw-r--r-- | package/mountd/patches/030-ext4_support.patch | 85 | ||||
-rw-r--r-- | package/mountd/patches/040-optional-daemonize.patch | 13 |
4 files changed, 157 insertions, 0 deletions
diff --git a/package/mountd/patches/010-uci_rename_history_to_delta.patch b/package/mountd/patches/010-uci_rename_history_to_delta.patch new file mode 100644 index 000000000..65b2f8434 --- /dev/null +++ b/package/mountd/patches/010-uci_rename_history_to_delta.patch @@ -0,0 +1,27 @@ +--- + lib/uci.c | 2 +- + lib/ucix.c | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +--- a/lib/uci.c ++++ b/lib/uci.c +@@ -28,7 +28,7 @@ struct uci_package *p = NULL; + struct uci_context* uci_init(char *config_file) + { + struct uci_context *ctx = uci_alloc_context(); +- uci_add_history_path(ctx, "/var/state"); ++ uci_add_delta_path(ctx, "/var/state"); + if(uci_load(ctx, config_file, &p) != UCI_OK) + { + log_printf("/etc/config/%s is missing or corrupt\n", config_file); +--- a/lib/ucix.c ++++ b/lib/ucix.c +@@ -18,7 +18,7 @@ static inline int ucix_get_ptr(struct uc + struct uci_context* ucix_init(const char *config_file) + { + struct uci_context *ctx = uci_alloc_context(); +- uci_add_history_path(ctx, "/var/state"); ++ uci_add_delta_path(ctx, "/var/state"); + if(uci_load(ctx, config_file, NULL) != UCI_OK) + { + printf("%s/%s is missing or corrupt\n", ctx->savedir, config_file); diff --git a/package/mountd/patches/020-handle_timeout.patch b/package/mountd/patches/020-handle_timeout.patch new file mode 100644 index 000000000..badf40fe4 --- /dev/null +++ b/package/mountd/patches/020-handle_timeout.patch @@ -0,0 +1,32 @@ +--- a/lib/autofs.c ++++ b/lib/autofs.c +@@ -140,6 +140,7 @@ static int fullread(void *ptr, size_t le + + static int autofs_in(union autofs_v5_packet_union *pkt) + { ++ int res; + struct pollfd fds[1]; + + fds[0].fd = fdout; +@@ -147,15 +148,19 @@ static int autofs_in(union autofs_v5_pac + + while(1) + { +- if(poll(fds, 2, 1000) == -1) ++ res = poll(fds, 1, -1); ++ ++ if (res == -1) + { + if (errno == EINTR) + continue; + log_printf("failed while trying to read packet from kernel\n"); + return -1; + } +- if(fds[0].revents & POLLIN) ++ else if ((res > 0) && (fds[0].revents & POLLIN)) ++ { + return fullread(pkt, sizeof(*pkt)); ++ } + } + } + diff --git a/package/mountd/patches/030-ext4_support.patch b/package/mountd/patches/030-ext4_support.patch new file mode 100644 index 000000000..7bbaf14ac --- /dev/null +++ b/package/mountd/patches/030-ext4_support.patch @@ -0,0 +1,85 @@ +diff -ruN mountd-0.1.orig/include/fs.h mountd-0.1/include/fs.h +--- mountd-0.1.orig/include/fs.h 2009-10-02 22:57:04.000000000 +0200 ++++ mountd-0.1/include/fs.h 2012-07-08 18:42:32.000000000 +0200 +@@ -7,5 +7,6 @@ + #define EFI 7 + #define NTFS 8 + #define EXTENDED 9 ++#define EXT4 10 + + int detect_fs(char *device); +diff -ruN mountd-0.1.orig/lib/fs.c mountd-0.1/lib/fs.c +--- mountd-0.1.orig/lib/fs.c 2009-10-02 23:26:22.000000000 +0200 ++++ mountd-0.1/lib/fs.c 2012-07-08 19:28:08.000000000 +0200 +@@ -91,9 +91,14 @@ + goto out; + if(get_le_short(buffer + 56) == 0xEF53) + { +- if((get_le_long(buffer + 96) & 0x0008) +- || (get_le_long(buffer + 92) & 0x0004)) +- ret = EXT3; ++ if(get_le_long(buffer + 92) & 0x0004) ++ { ++ if ((get_le_long(buffer + 96) < 0x0000040) ++ && (get_le_long(buffer + 100) < 0x0000008)) ++ ret = EXT3; ++ else ++ ret = EXT4; ++ } + else + ret = EXT2; + } +diff -ruN mountd-0.1.orig/lib/mount.c mountd-0.1/lib/mount.c +--- mountd-0.1.orig/lib/mount.c 2009-10-03 12:54:57.000000000 +0200 ++++ mountd-0.1/lib/mount.c 2012-07-08 19:04:29.000000000 +0200 +@@ -53,7 +53,10 @@ + "EXT3", + "FAT", + "HFSPLUS", +- "NTFS" ++ "", ++ "NTFS", ++ "", ++ "EXT4" + }; + + #define MAX_MOUNTED 32 +@@ -93,7 +96,7 @@ + ucix_add_option(ctx, mountd, q->serial, "rev", q->rev); + snprintf(t, 64, "size%d", atoi(&q->dev[3])); + ucix_add_option(ctx, mountd, q->serial, t, q->size); +- if(q->fs > MBR && q->fs <= NTFS) ++ if(q->fs > MBR && q->fs <= EXT4) + { + snprintf(t, 64, "fs%d", atoi(&q->dev[3])); + ucix_add_option(ctx, mountd, q->serial, t, fs_names[q->fs]); +@@ -131,7 +134,7 @@ + { + struct mount *mount; + char tmp[64], tmp2[64]; +- if(fs <= MBR || fs > NTFS) ++ if(fs <= MBR || fs > EXT4) + return; + mount = malloc(sizeof(struct mount)); + INIT_LIST_HEAD(&mount->list); +@@ -147,7 +150,7 @@ + mount->mounted = 0; + mount->fs = fs; + list_add(&mount->list, &mounts); +- if((!mount->ignore) && (mount->fs > MBR) && (mount->fs <= NTFS)) ++ if((!mount->ignore) && (mount->fs > MBR) && (mount->fs <= EXT4)) + { + log_printf("new mount : %s -> %s (%s)\n", name, dev, fs_names[mount->fs]); + snprintf(tmp, 64, "%s%s", uci_path, name); +@@ -226,6 +229,11 @@ + log_printf("mount -t vfat -o rw,uid=1000,gid=1000 /dev/%s %s", mount->dev, tmp); + ret = system_printf("mount -t vfat -o rw,uid=1000,gid=1000 /dev/%s %s", mount->dev, tmp); + } ++ if(mount->fs == EXT4) ++ { ++ log_printf("mount -t ext4 -o rw,defaults /dev/%s %s", mount->dev, tmp); ++ ret = system_printf("mount -t ext4 -o rw,defaults /dev/%s %s", mount->dev, tmp); ++ } + if(mount->fs == EXT3) + { + log_printf("mount -t ext3 -o rw,defaults /dev/%s %s", mount->dev, tmp); diff --git a/package/mountd/patches/040-optional-daemonize.patch b/package/mountd/patches/040-optional-daemonize.patch new file mode 100644 index 000000000..4d159ec66 --- /dev/null +++ b/package/mountd/patches/040-optional-daemonize.patch @@ -0,0 +1,13 @@ +--- a/main.c ++++ b/main.c +@@ -13,7 +13,9 @@ + + int main(int argc, char *argv[]) + { +- daemon(0,0); ++ if ((argc < 2) || strcmp(argv[1], "-f")) ++ daemon(0,0); ++ + daemonize = 1; + log_start(); + log_printf("Starting OpenWrt (auto)mountd V1\n"); |