aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksii Samorukov <samm@FreeBSD.org>2021-11-24 20:53:27 +0000
committerOleksii Samorukov <samm@FreeBSD.org>2021-11-24 20:56:11 +0000
commitd30a15797673e67199fe8a3fcbf437c5235237a9 (patch)
tree7927757da6349f07f133e75a0dc220f17dd8f8af
parenta951bc69d95cc5ff85005af2ad3d524e3ae0f7c5 (diff)
downloadports-d30a15797673e67199fe8a3fcbf437c5235237a9.tar.gz
ports-d30a15797673e67199fe8a3fcbf437c5235237a9.zip
sysutils/fusefs-exfat: Pass "automounted" option into kernel and remove user option
Based on upstream patches from the project repository PR: 255213 Reported by: fbsd@any.com.ru
-rw-r--r--sysutils/fusefs-exfat/Makefile1
-rw-r--r--sysutils/fusefs-exfat/files/patch-fuse_main.c25
-rw-r--r--sysutils/fusefs-exfat/files/patch-libexfat_exfat.h10
-rw-r--r--sysutils/fusefs-exfat/files/patch-libexfat_mount.c42
-rw-r--r--sysutils/fusefs-exfat/files/patch-libexfat_utils.c18
5 files changed, 96 insertions, 0 deletions
diff --git a/sysutils/fusefs-exfat/Makefile b/sysutils/fusefs-exfat/Makefile
index 9f874866eb38..8c9f4d9df17c 100644
--- a/sysutils/fusefs-exfat/Makefile
+++ b/sysutils/fusefs-exfat/Makefile
@@ -3,6 +3,7 @@
PORTNAME= exfat
DISTVERSIONPREFIX= v
DISTVERSION= 1.3.0
+PORTREVISION= 1
CATEGORIES= sysutils
PKGNAMEPREFIX= fusefs-
diff --git a/sysutils/fusefs-exfat/files/patch-fuse_main.c b/sysutils/fusefs-exfat/files/patch-fuse_main.c
new file mode 100644
index 000000000000..aa2e853d16dd
--- /dev/null
+++ b/sysutils/fusefs-exfat/files/patch-fuse_main.c
@@ -0,0 +1,25 @@
+--- fuse/main.c.orig 2021-11-24 20:45:02 UTC
++++ fuse/main.c
+@@ -451,7 +451,7 @@ static char* add_ro_option(char* options, bool ro)
+ return ro ? add_option(options, "ro", NULL) : options;
+ }
+
+-#if defined(__linux__) || defined(__FreeBSD__)
++#if defined(__linux__)
+ static char* add_user_option(char* options)
+ {
+ struct passwd* pw;
+@@ -492,12 +492,10 @@ static char* add_fuse_options(char* options, const cha
+ options = add_ro_option(options, ro);
+ if (options == NULL)
+ return NULL;
+-#if defined(__linux__) || defined(__FreeBSD__)
++#if defined(__linux__)
+ options = add_user_option(options);
+ if (options == NULL)
+ return NULL;
+-#endif
+-#if defined(__linux__)
+ options = add_blksize_option(options, CLUSTER_SIZE(*ef.sb));
+ if (options == NULL)
+ return NULL;
diff --git a/sysutils/fusefs-exfat/files/patch-libexfat_exfat.h b/sysutils/fusefs-exfat/files/patch-libexfat_exfat.h
new file mode 100644
index 000000000000..2b5d7cf8473e
--- /dev/null
+++ b/sysutils/fusefs-exfat/files/patch-libexfat_exfat.h
@@ -0,0 +1,10 @@
+--- libexfat/exfat.h.orig 2018-09-15 05:03:24 UTC
++++ libexfat/exfat.h
+@@ -201,6 +201,7 @@ le16_t exfat_calc_name_hash(const struct exfat* ef, co
+ void exfat_humanize_bytes(uint64_t value, struct exfat_human_bytes* hb);
+ void exfat_print_info(const struct exfat_super_block* sb,
+ uint32_t free_clusters);
++bool exfat_match_option(const char* options, const char* option_name);
+
+ int utf16_to_utf8(char* output, const le16_t* input, size_t outsize,
+ size_t insize);
diff --git a/sysutils/fusefs-exfat/files/patch-libexfat_mount.c b/sysutils/fusefs-exfat/files/patch-libexfat_mount.c
new file mode 100644
index 000000000000..66d6096e3131
--- /dev/null
+++ b/sysutils/fusefs-exfat/files/patch-libexfat_mount.c
@@ -0,0 +1,42 @@
+--- libexfat/mount.c.orig 2018-09-15 05:03:24 UTC
++++ libexfat/mount.c
+@@ -79,18 +79,6 @@ static int get_int_option(const char* options, const c
+ return strtol(p, NULL, base);
+ }
+
+-static bool match_option(const char* options, const char* option_name)
+-{
+- const char* p;
+- size_t length = strlen(option_name);
+-
+- for (p = strstr(options, option_name); p; p = strstr(p + 1, option_name))
+- if ((p == options || p[-1] == ',') &&
+- (p[length] == ',' || p[length] == '\0'))
+- return true;
+- return false;
+-}
+-
+ static void parse_options(struct exfat* ef, const char* options)
+ {
+ int opt_umask;
+@@ -102,7 +90,7 @@ static void parse_options(struct exfat* ef, const char
+ ef->uid = get_int_option(options, "uid", 10, geteuid());
+ ef->gid = get_int_option(options, "gid", 10, getegid());
+
+- ef->noatime = match_option(options, "noatime");
++ ef->noatime = exfat_match_option(options, "noatime");
+
+ switch (get_int_option(options, "repair", 10, 0))
+ {
+@@ -205,9 +193,9 @@ int exfat_mount(struct exfat* ef, const char* spec, co
+
+ parse_options(ef, options);
+
+- if (match_option(options, "ro"))
++ if (exfat_match_option(options, "ro"))
+ mode = EXFAT_MODE_RO;
+- else if (match_option(options, "ro_fallback"))
++ else if (exfat_match_option(options, "ro_fallback"))
+ mode = EXFAT_MODE_ANY;
+ else
+ mode = EXFAT_MODE_RW;
diff --git a/sysutils/fusefs-exfat/files/patch-libexfat_utils.c b/sysutils/fusefs-exfat/files/patch-libexfat_utils.c
new file mode 100644
index 000000000000..0bb23430d4a9
--- /dev/null
+++ b/sysutils/fusefs-exfat/files/patch-libexfat_utils.c
@@ -0,0 +1,18 @@
+--- libexfat/utils.c.orig 2018-09-15 05:03:24 UTC
++++ libexfat/utils.c
+@@ -178,3 +178,15 @@ void exfat_print_info(const struct exfat_super_block*
+ exfat_humanize_bytes(avail_space, &hb);
+ printf("Available space %10"PRIu64" %s\n", hb.value, hb.unit);
+ }
++
++bool exfat_match_option(const char* options, const char* option_name)
++{
++ const char* p;
++ size_t length = strlen(option_name);
++
++ for (p = strstr(options, option_name); p; p = strstr(p + 1, option_name))
++ if ((p == options || p[-1] == ',') &&
++ (p[length] == ',' || p[length] == '\0'))
++ return true;
++ return false;
++}