summaryrefslogtreecommitdiff
path: root/extra/sshfs
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-12-11 16:04:20 -0800
committerMichael Forney <mforney@mforney.org>2016-12-13 23:10:30 -0800
commit293f5a93b77d92fd65db7f3d0df654f102e46cfb (patch)
tree6ecd1170e3dd793862dd852814dc1b4cd5e44260 /extra/sshfs
parent9a506a6834df01a26795cea222b410f206efa9fa (diff)
Move to flat package hierarchy
Note to self: never try to move submodules again To migrate your existing submodules (more or less): set -x set -e mkdir .git/modules/pkg for old in */*/src ; do new="pkg/${old#*/}" if ! [ -f "$old/.git" ] || [ "${old%%/*}" = pkg ] ; then continue fi git -C ".git/modules/$old" config core.worktree "../../../../../$new" rmdir "$new" mv "$old" "$new" sed -e "s,$old,$new," "$new/.git" > "$new/.git.tmp" mv "$new/.git.tmp" "$new/.git" mkdir ".git/modules/${new%/src}" mv ".git/modules/$old" ".git/modules/$new" rm "${old%/src}"/*.ninja mv "${old%/src}"/*.tar.{gz,xz,bz2} "${new%/src}/" rmdir "${old%/src}" || true done sed -e 's,^\[submodule "[^/]*/,[submodule "pkg/,' .git/config > .git/config.tmp mv .git/config.tmp .git/config
Diffstat (limited to 'extra/sshfs')
-rw-r--r--extra/sshfs/config.h11
-rw-r--r--extra/sshfs/gen.rc15
-rw-r--r--extra/sshfs/patch/0001-Add-nocache.c-stub.patch113
-rw-r--r--extra/sshfs/patch/0002-Use-a-compact-array-and-free-list-for-requests.patch292
-rw-r--r--extra/sshfs/patch/0003-Use-bool-instead-of-gboolean.patch33
-rw-r--r--extra/sshfs/patch/0004-Use-struct-list_head-instead-of-GList.patch62
-rw-r--r--extra/sshfs/patch/0005-Use-standard-C-functions.patch277
-rw-r--r--extra/sshfs/patch/0006-Add-missing-includes.patch34
-rw-r--r--extra/sshfs/patch/0007-Disable-uidmap-and-gidmap-support.patch127
-rw-r--r--extra/sshfs/patch/0008-Remove-remaining-uses-of-glib.patch36
-rw-r--r--extra/sshfs/rev1
m---------extra/sshfs/src0
12 files changed, 0 insertions, 1001 deletions
diff --git a/extra/sshfs/config.h b/extra/sshfs/config.h
deleted file mode 100644
index 9c23d485..00000000
--- a/extra/sshfs/config.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#define IDMAP_DEFAULT "none"
-
-#define PACKAGE "sshfs"
-#define PACKAGE_BUGREPORT ""
-#define PACKAGE_NAME "sshfs"
-#define PACKAGE_STRING "sshfs 2.8"
-#define PACKAGE_TARNAME "sshfs"
-#define PACKAGE_URL ""
-#define PACKAGE_VERSION "2.8"
-/* #undef SSH_NODELAY_WORKAROUND */
-#define VERSION "2.8"
diff --git a/extra/sshfs/gen.rc b/extra/sshfs/gen.rc
deleted file mode 100644
index 07cc8249..00000000
--- a/extra/sshfs/gen.rc
+++ /dev/null
@@ -1,15 +0,0 @@
-cflags\
- -D '_FILE_OFFSET_BITS=64' \
- -D 'FUSE_USE_VERSION=26' \
- -isystem extra/libfuse/src/include\
- -I '$dir'
-
-build '$outdir'/sshfs.1 sed '$srcdir'/sshfs.1.in ; with\
- expr 's,__UNMOUNT_COMMAND__,''fusermount -u'','
-
-exe sshfs -d '$builddir'/extra/libfuse/fetch.stamp\
- sshfs.c nocache.c '$builddir'/extra/libfuse/libfuse.a
-file bin/sshfs '$outdir'/sshfs 755
-file share/man/man1/sshfs.1 '$outdir'/sshfs.1 644
-
-fetch git
diff --git a/extra/sshfs/patch/0001-Add-nocache.c-stub.patch b/extra/sshfs/patch/0001-Add-nocache.c-stub.patch
deleted file mode 100644
index 3f6669d6..00000000
--- a/extra/sshfs/patch/0001-Add-nocache.c-stub.patch
+++ /dev/null
@@ -1,113 +0,0 @@
-From d58fbf8ca4a9a72ad8d72c7a6a4d765b419122f6 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 17:13:58 -0700
-Subject: [PATCH] Add nocache.c stub
-
----
- nocache.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 94 insertions(+)
- create mode 100644 nocache.c
-
-diff --git a/nocache.c b/nocache.c
-new file mode 100644
-index 0000000..58d7528
---- /dev/null
-+++ b/nocache.c
-@@ -0,0 +1,94 @@
-+#include "cache.h"
-+
-+struct cache {
-+ struct fuse_cache_operations *next_oper;
-+};
-+
-+static struct cache cache;
-+
-+struct fuse_cache_dirhandle {
-+ fuse_dirh_t h;
-+ fuse_dirfil_t filler;
-+};
-+
-+void cache_invalidate(const char *path)
-+{
-+}
-+
-+void cache_add_attr(const char *path, const struct stat *stbuf, uint64_t wrctr)
-+{
-+}
-+
-+uint64_t cache_get_write_ctr(void)
-+{
-+ return 0;
-+}
-+
-+static int cache_unity_dirfill(fuse_cache_dirh_t ch, const char *name,
-+ const struct stat *stbuf)
-+{
-+ (void) stbuf;
-+ return ch->filler(ch->h, name, 0, 0);
-+}
-+
-+static int cache_unity_getdir(const char *path, fuse_dirh_t h,
-+ fuse_dirfil_t filler)
-+{
-+ struct fuse_cache_dirhandle ch;
-+ ch.h = h;
-+ ch.filler = filler;
-+ return cache.next_oper->cache_getdir(path, &ch, cache_unity_dirfill);
-+}
-+
-+static void cache_unity_fill(struct fuse_cache_operations *oper,
-+ struct fuse_operations *cache_oper)
-+{
-+#if FUSE_VERSION >= 23
-+ cache_oper->init = oper->oper.init;
-+#endif
-+ cache_oper->getattr = oper->oper.getattr;
-+ cache_oper->access = oper->oper.access;
-+ cache_oper->readlink = oper->oper.readlink;
-+ cache_oper->getdir = cache_unity_getdir;
-+ cache_oper->mknod = oper->oper.mknod;
-+ cache_oper->mkdir = oper->oper.mkdir;
-+ cache_oper->symlink = oper->oper.symlink;
-+ cache_oper->unlink = oper->oper.unlink;
-+ cache_oper->rmdir = oper->oper.rmdir;
-+ cache_oper->rename = oper->oper.rename;
-+ cache_oper->link = oper->oper.link;
-+ cache_oper->chmod = oper->oper.chmod;
-+ cache_oper->chown = oper->oper.chown;
-+ cache_oper->truncate = oper->oper.truncate;
-+ cache_oper->utime = oper->oper.utime;
-+ cache_oper->open = oper->oper.open;
-+ cache_oper->read = oper->oper.read;
-+ cache_oper->write = oper->oper.write;
-+ cache_oper->flush = oper->oper.flush;
-+ cache_oper->release = oper->oper.release;
-+ cache_oper->fsync = oper->oper.fsync;
-+ cache_oper->statfs = oper->oper.statfs;
-+ cache_oper->setxattr = oper->oper.setxattr;
-+ cache_oper->getxattr = oper->oper.getxattr;
-+ cache_oper->listxattr = oper->oper.listxattr;
-+ cache_oper->removexattr = oper->oper.removexattr;
-+#if FUSE_VERSION >= 25
-+ cache_oper->create = oper->oper.create;
-+ cache_oper->ftruncate = oper->oper.ftruncate;
-+ cache_oper->fgetattr = oper->oper.fgetattr;
-+#endif
-+}
-+
-+struct fuse_operations *cache_init(struct fuse_cache_operations *oper)
-+{
-+ static struct fuse_operations cache_oper;
-+ cache.next_oper = oper;
-+
-+ cache_unity_fill(oper, &cache_oper);
-+ return &cache_oper;
-+}
-+
-+int cache_parse_options(struct fuse_args *args)
-+{
-+ return 0;
-+}
---
-2.9.0
-
diff --git a/extra/sshfs/patch/0002-Use-a-compact-array-and-free-list-for-requests.patch b/extra/sshfs/patch/0002-Use-a-compact-array-and-free-list-for-requests.patch
deleted file mode 100644
index 43128eb2..00000000
--- a/extra/sshfs/patch/0002-Use-a-compact-array-and-free-list-for-requests.patch
+++ /dev/null
@@ -1,292 +0,0 @@
-From 820d2b71f49667fe5459f5cb4be8240c3ce5ae8a Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 17:25:36 -0700
-Subject: [PATCH] Use a compact array and free list for requests
-
----
- sshfs.c | 125 +++++++++++++++++++++++++++++++++++++++++-----------------------
- 1 file changed, 80 insertions(+), 45 deletions(-)
-
-diff --git a/sshfs.c b/sshfs.c
-index f41d987..32db6f4 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -171,6 +171,17 @@ struct request {
- struct list_head list;
- };
-
-+union request_entry {
-+ struct request *req;
-+ uintptr_t next;
-+};
-+
-+struct request_table {
-+ union request_entry *entries;
-+ int len, cap;
-+ uint32_t free;
-+};
-+
- struct sshfs_io {
- int num_reqs;
- pthread_cond_t finished;
-@@ -245,7 +256,7 @@ struct sshfs {
- int slave;
- char *host;
- char *base_path;
-- GHashTable *reqtab;
-+ struct request_table reqtab;
- pthread_mutex_t lock;
- pthread_mutex_t lock_write;
- int processing_thread_started;
-@@ -1241,12 +1252,6 @@ static int do_write(struct iovec *iov, size_t count)
- return 0;
- }
-
--static uint32_t sftp_get_id(void)
--{
-- static uint32_t idctr;
-- return idctr++;
--}
--
- static void buf_to_iov(const struct buffer *buf, struct iovec *iov)
- {
- iov->iov_base = buf->p;
-@@ -1339,6 +1344,43 @@ static void request_free(struct request *req)
- g_free(req);
- }
-
-+static int request_table_insert(struct request_table *reqtab, struct request *req)
-+{
-+ union request_entry *entries;
-+ size_t cap;
-+
-+ if (reqtab->free) {
-+ req->id = reqtab->free;
-+ reqtab->free = reqtab->entries[req->id-1].next >> 1;
-+ } else {
-+ if (reqtab->len == reqtab->cap) {
-+ cap = reqtab->cap * 2 + 1;
-+ entries = realloc(reqtab->entries, cap * sizeof(reqtab->entries[0]));
-+ if (!entries)
-+ return -1;
-+ reqtab->cap = cap;
-+ reqtab->entries = entries;
-+ }
-+ req->id = ++reqtab->len;
-+ }
-+
-+ reqtab->entries[req->id-1].req = req;
-+ return 0;
-+}
-+
-+static struct request *request_table_lookup(struct request_table *reqtab, uint32_t id)
-+{
-+ if (reqtab->entries[id-1].next & 1)
-+ return NULL;
-+ return reqtab->entries[id-1].req;
-+}
-+
-+static void request_table_remove(struct request_table *reqtab, uint32_t id)
-+{
-+ reqtab->entries[id-1].next = (reqtab->free << 1) | 1;
-+ reqtab->free = id;
-+}
-+
- static void chunk_free(struct read_chunk *chunk)
- {
- while (!list_empty(&chunk->reqs)) {
-@@ -1368,21 +1410,6 @@ static void chunk_put_locked(struct read_chunk *chunk)
- pthread_mutex_unlock(&sshfs.lock);
- }
-
--static int clean_req(void *key_, struct request *req)
--{
-- (void) key_;
--
-- req->error = -EIO;
-- if (req->want_reply)
-- sem_post(&req->ready);
-- else {
-- if (req->end_func)
-- req->end_func(req);
-- request_free(req);
-- }
-- return TRUE;
--}
--
- static int process_one_request(void)
- {
- int res;
-@@ -1399,8 +1426,7 @@ static int process_one_request(void)
- return -1;
-
- pthread_mutex_lock(&sshfs.lock);
-- req = (struct request *)
-- g_hash_table_lookup(sshfs.reqtab, GUINT_TO_POINTER(id));
-+ req = request_table_lookup(&sshfs.reqtab, id);
- if (req == NULL)
- fprintf(stderr, "request %i not found\n", id);
- else {
-@@ -1412,7 +1438,7 @@ static int process_one_request(void)
- sshfs.outstanding_len <= sshfs.max_outstanding_len) {
- pthread_cond_broadcast(&sshfs.outstanding_cond);
- }
-- g_hash_table_remove(sshfs.reqtab, GUINT_TO_POINTER(id));
-+ request_table_remove(&sshfs.reqtab, id);
- }
- pthread_mutex_unlock(&sshfs.lock);
- if (req != NULL) {
-@@ -1473,6 +1499,9 @@ static void close_conn(void)
-
- static void *process_requests(void *data_)
- {
-+ int i;
-+ struct request *req;
-+
- (void) data_;
-
- while (1) {
-@@ -1483,7 +1512,20 @@ static void *process_requests(void *data_)
- pthread_mutex_lock(&sshfs.lock);
- sshfs.processing_thread_started = 0;
- close_conn();
-- g_hash_table_foreach_remove(sshfs.reqtab, (GHRFunc) clean_req, NULL);
-+ for (i = 0; i < sshfs.reqtab.len; ++i) {
-+ if (sshfs.reqtab.entries[i].next & 1)
-+ continue;
-+ req = sshfs.reqtab.entries[i].req;
-+ req->error = -EIO;
-+ if (req->want_reply)
-+ sem_post(&req->ready);
-+ else {
-+ if (req->end_func)
-+ req->end_func(req);
-+ request_free(req);
-+ }
-+ request_table_remove(&sshfs.reqtab, i + 1);
-+ }
- sshfs.connver ++;
- sshfs.outstanding_len = 0;
- pthread_cond_broadcast(&sshfs.outstanding_cond);
-@@ -1631,7 +1673,6 @@ static int sftp_error_to_errno(uint32_t error)
- static void sftp_detect_uid()
- {
- int flags;
-- uint32_t id = sftp_get_id();
- uint32_t replid;
- uint8_t type;
- struct buffer buf;
-@@ -1641,7 +1682,7 @@ static void sftp_detect_uid()
- buf_init(&buf, 5);
- buf_add_string(&buf, ".");
- buf_to_iov(&buf, &iov[0]);
-- if (sftp_send_iov(SSH_FXP_STAT, id, iov, 1) == -1)
-+ if (sftp_send_iov(SSH_FXP_STAT, 0, iov, 1) == -1)
- goto out;
- buf_clear(&buf);
- if (sftp_read(&type, &buf) == -1)
-@@ -1652,7 +1693,7 @@ static void sftp_detect_uid()
- }
- if (buf_get_uint32(&buf, &replid) == -1)
- goto out;
-- if (replid != id) {
-+ if (replid != 0) {
- fprintf(stderr, "bad reply ID\n");
- goto out;
- }
-@@ -1689,7 +1730,6 @@ out:
- static int sftp_check_root(const char *base_path)
- {
- int flags;
-- uint32_t id = sftp_get_id();
- uint32_t replid;
- uint8_t type;
- struct buffer buf;
-@@ -1701,7 +1741,7 @@ static int sftp_check_root(const char *base_path)
- buf_init(&buf, 0);
- buf_add_string(&buf, remote_dir);
- buf_to_iov(&buf, &iov[0]);
-- if (sftp_send_iov(SSH_FXP_LSTAT, id, iov, 1) == -1)
-+ if (sftp_send_iov(SSH_FXP_LSTAT, 0, iov, 1) == -1)
- goto out;
- buf_clear(&buf);
- if (sftp_read(&type, &buf) == -1)
-@@ -1712,7 +1752,7 @@ static int sftp_check_root(const char *base_path)
- }
- if (buf_get_uint32(&buf, &replid) == -1)
- goto out;
-- if (replid != id) {
-+ if (replid != 0) {
- fprintf(stderr, "bad reply ID\n");
- goto out;
- }
-@@ -1903,7 +1943,6 @@ static int sftp_request_send(uint8_t type, struct iovec *iov, size_t count,
- struct request **reqp)
- {
- int err;
-- uint32_t id;
- struct request *req = g_new0(struct request, 1);
-
- req->want_reply = want_reply;
-@@ -1914,8 +1953,6 @@ static int sftp_request_send(uint8_t type, struct iovec *iov, size_t count,
- pthread_mutex_lock(&sshfs.lock);
- if (begin_func)
- begin_func(req);
-- id = sftp_get_id();
-- req->id = id;
- err = start_processing_thread();
- if (err) {
- pthread_mutex_unlock(&sshfs.lock);
-@@ -1926,21 +1963,24 @@ static int sftp_request_send(uint8_t type, struct iovec *iov, size_t count,
- while (sshfs.outstanding_len > sshfs.max_outstanding_len)
- pthread_cond_wait(&sshfs.outstanding_cond, &sshfs.lock);
-
-- g_hash_table_insert(sshfs.reqtab, GUINT_TO_POINTER(id), req);
-+ if (request_table_insert(&sshfs.reqtab, req) < 0)
-+ abort();
- if (sshfs.debug) {
- gettimeofday(&req->start, NULL);
- sshfs.num_sent++;
- sshfs.bytes_sent += req->len;
- }
-- DEBUG("[%05i] %s\n", id, type_name(type));
-+ DEBUG("[%05i] %s\n", req->id, type_name(type));
- pthread_mutex_unlock(&sshfs.lock);
-
- err = -EIO;
-- if (sftp_send_iov(type, id, iov, count) == -1) {
-+ if (sftp_send_iov(type, req->id, iov, count) == -1) {
- gboolean rmed;
-
- pthread_mutex_lock(&sshfs.lock);
-- rmed = g_hash_table_remove(sshfs.reqtab, GUINT_TO_POINTER(id));
-+ rmed = !!request_table_lookup(&sshfs.reqtab, req->id);
-+ if (rmed)
-+ request_table_remove(&sshfs.reqtab, req->id);
- pthread_mutex_unlock(&sshfs.lock);
-
- if (!rmed && !want_reply) {
-@@ -2130,7 +2170,7 @@ static int sftp_readdir_send(struct request **req, struct buffer *handle)
-
- static int sshfs_req_pending(struct request *req)
- {
-- if (g_hash_table_lookup(sshfs.reqtab, GUINT_TO_POINTER(req->id)))
-+ if (request_table_lookup(&sshfs.reqtab, req->id))
- return 1;
- else
- return 0;
-@@ -3336,11 +3376,6 @@ static int processing_init(void)
- pthread_mutex_init(&sshfs.lock, NULL);
- pthread_mutex_init(&sshfs.lock_write, NULL);
- pthread_cond_init(&sshfs.outstanding_cond, NULL);
-- sshfs.reqtab = g_hash_table_new(NULL, NULL);
-- if (!sshfs.reqtab) {
-- fprintf(stderr, "failed to create hash table\n");
-- return -1;
-- }
- return 0;
- }
-
---
-2.9.0
-
diff --git a/extra/sshfs/patch/0003-Use-bool-instead-of-gboolean.patch b/extra/sshfs/patch/0003-Use-bool-instead-of-gboolean.patch
deleted file mode 100644
index 39d1e544..00000000
--- a/extra/sshfs/patch/0003-Use-bool-instead-of-gboolean.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From b8324473e35fbcfec302955456f545572521872b Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 17:28:40 -0700
-Subject: [PATCH] Use bool instead of gboolean
-
----
- sshfs.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/sshfs.c b/sshfs.c
-index 32db6f4..f43ae5a 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -16,6 +16,7 @@
- # include <fuse_darwin.h>
- #endif
- #include <assert.h>
-+#include <stdbool.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
-@@ -1975,7 +1976,7 @@ static int sftp_request_send(uint8_t type, struct iovec *iov, size_t count,
-
- err = -EIO;
- if (sftp_send_iov(type, req->id, iov, count) == -1) {
-- gboolean rmed;
-+ bool rmed;
-
- pthread_mutex_lock(&sshfs.lock);
- rmed = !!request_table_lookup(&sshfs.reqtab, req->id);
---
-2.9.0
-
diff --git a/extra/sshfs/patch/0004-Use-struct-list_head-instead-of-GList.patch b/extra/sshfs/patch/0004-Use-struct-list_head-instead-of-GList.patch
deleted file mode 100644
index d028a336..00000000
--- a/extra/sshfs/patch/0004-Use-struct-list_head-instead-of-GList.patch
+++ /dev/null
@@ -1,62 +0,0 @@
-From 7b8c2f9e7484db2031ff1190b85be085524dfe2b Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 17:30:20 -0700
-Subject: [PATCH] Use struct list_head instead of GList
-
----
- sshfs.c | 16 +++++++---------
- 1 file changed, 7 insertions(+), 9 deletions(-)
-
-diff --git a/sshfs.c b/sshfs.c
-index f43ae5a..14adca5 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -2180,13 +2180,13 @@ static int sshfs_req_pending(struct request *req)
- static int sftp_readdir_async(struct buffer *handle, fuse_cache_dirh_t h,
- fuse_cache_dirfil_t filler)
- {
-+ int done = 0;
- int err = 0;
- int outstanding = 0;
- int max = READDIR_START;
-- GList *list = NULL;
--
-- int done = 0;
-+ struct list_head list;
-
-+ list_init(&list);
- while (!done || outstanding) {
- struct request *req;
- struct buffer name;
-@@ -2201,16 +2201,14 @@ static int sftp_readdir_async(struct buffer *handle, fuse_cache_dirh_t h,
- break;
- }
-
-- list = g_list_append(list, req);
-+ list_add(&req->list, &list);
- outstanding++;
- }
-
- if (outstanding) {
-- GList *first;
- /* wait for response to next request */
-- first = g_list_first(list);
-- req = first->data;
-- list = g_list_delete_link(list, first);
-+ req = list_entry(list.prev, struct request, list);
-+ list_del(&req->list);
- outstanding--;
-
- if (done) {
-@@ -2244,7 +2242,7 @@ static int sftp_readdir_async(struct buffer *handle, fuse_cache_dirh_t h,
- }
- }
- }
-- assert(list == NULL);
-+ assert(list_empty(&list));
-
- return err;
- }
---
-2.9.0
-
diff --git a/extra/sshfs/patch/0005-Use-standard-C-functions.patch b/extra/sshfs/patch/0005-Use-standard-C-functions.patch
deleted file mode 100644
index e58cc29a..00000000
--- a/extra/sshfs/patch/0005-Use-standard-C-functions.patch
+++ /dev/null
@@ -1,277 +0,0 @@
-From 4714c177e2fde09cfa76609ccaf9c72d62f39bfd Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 17:42:29 -0700
-Subject: [PATCH] Use standard C functions
-
----
- sshfs.c | 101 ++++++++++++++++++++++++++++++++++++++--------------------------
- 1 file changed, 60 insertions(+), 41 deletions(-)
-
-diff --git a/sshfs.c b/sshfs.c
-index 14adca5..4f3bfe4 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -637,25 +637,25 @@ static inline void buf_add_path(struct buffer *buf, const char *path)
- if (sshfs.base_path[0]) {
- if (path[1]) {
- if (sshfs.base_path[strlen(sshfs.base_path)-1] != '/') {
-- realpath = g_strdup_printf("%s/%s",
-- sshfs.base_path,
-- path + 1);
-+ if (asprintf(&realpath, "%s/%s", sshfs.base_path, path + 1) < 0)
-+ abort();
- } else {
-- realpath = g_strdup_printf("%s%s",
-- sshfs.base_path,
-- path + 1);
-+ if (asprintf(&realpath, "%s%s", sshfs.base_path, path + 1) < 0)
-+ abort();
- }
- } else {
-- realpath = g_strdup(sshfs.base_path);
-+ realpath = strdup(sshfs.base_path);
- }
- } else {
- if (path[1])
-- realpath = g_strdup(path + 1);
-+ realpath = strdup(path + 1);
- else
-- realpath = g_strdup(".");
-+ realpath = strdup(".");
- }
-+ if (!realpath)
-+ abort();
- buf_add_string(buf, realpath);
-- g_free(realpath);
-+ free(realpath);
- }
-
- static int buf_check_get(struct buffer *buf, size_t len)
-@@ -948,10 +948,9 @@ nobundle:
- pathok:
- #endif
-
-- newpreload = g_strdup_printf("%s%s%s",
-- oldpreload ? oldpreload : "",
-- oldpreload ? " " : "",
-- sopath);
-+ if (asprintf(&newpreload, "%s%s%s",
-+ oldpreload ? oldpreload : "", oldpreload ? " " : "", sopath) < 0)
-+ abort();
-
- #ifdef __APPLE__
- if (!newpreload || setenv("DYLD_INSERT_LIBRARIES", newpreload, 1) == -1)
-@@ -962,7 +961,7 @@ pathok:
- "for ssh nodelay workaround\n");
- }
- #endif /* __APPLE__ */
-- g_free(newpreload);
-+ free(newpreload);
- return 0;
- }
- #endif
-@@ -1342,7 +1341,7 @@ static void request_free(struct request *req)
- {
- buf_free(&req->reply);
- sem_destroy(&req->ready);
-- g_free(req);
-+ free(req);
- }
-
- static int request_table_insert(struct request_table *reqtab, struct request *req)
-@@ -1390,9 +1389,9 @@ static void chunk_free(struct read_chunk *chunk)
- rreq = list_entry(chunk->reqs.prev, struct read_req, list);
- list_del(&rreq->list);
- buf_free(&rreq->data);
-- g_free(rreq);
-+ free(rreq);
- }
-- g_free(chunk);
-+ free(chunk);
- }
-
- static void chunk_put(struct read_chunk *chunk)
-@@ -1944,8 +1943,10 @@ static int sftp_request_send(uint8_t type, struct iovec *iov, size_t count,
- struct request **reqp)
- {
- int err;
-- struct request *req = g_new0(struct request, 1);
-+ struct request *req = calloc(1, sizeof(struct request));
-
-+ if (!req)
-+ return -ENOMEM;
- req->want_reply = want_reply;
- req->end_func = end_func;
- req->data = data;
-@@ -2586,7 +2587,9 @@ static int sshfs_open_common(const char *path, mode_t mode,
- if (fi->flags & O_TRUNC)
- pflags |= SSH_FXF_TRUNC;
-
-- sf = g_new0(struct sshfs_file, 1);
-+ sf = calloc(1, sizeof(struct sshfs_file));
-+ if (!sf)
-+ return -ENOMEM;
- list_init(&sf->write_reqs);
- pthread_cond_init(&sf->write_finished, NULL);
- /* Assume random read after open */
-@@ -2628,7 +2631,7 @@ static int sshfs_open_common(const char *path, mode_t mode,
- fi->fh = (unsigned long) sf;
- } else {
- cache_invalidate(path);
-- g_free(sf);
-+ free(sf);
- }
- buf_free(&buf);
- return err;
-@@ -2701,7 +2704,7 @@ static void sshfs_file_put(struct sshfs_file *sf)
- {
- sf->refs--;
- if (!sf->refs)
-- g_free(sf);
-+ free(sf);
- }
-
- static void sshfs_file_get(struct sshfs_file *sf)
-@@ -2771,9 +2774,11 @@ static void sshfs_read_begin(struct request *req)
- static struct read_chunk *sshfs_send_read(struct sshfs_file *sf, size_t size,
- off_t offset)
- {
-- struct read_chunk *chunk = g_new0(struct read_chunk, 1);
-+ struct read_chunk *chunk = calloc(1, sizeof(struct read_chunk));
- struct buffer *handle = &sf->handle;
-
-+ if (!chunk)
-+ abort();
- pthread_cond_init(&chunk->sio.finished, NULL);
- list_init(&chunk->reqs);
- chunk->size = size;
-@@ -2787,7 +2792,9 @@ static struct read_chunk *sshfs_send_read(struct sshfs_file *sf, size_t size,
- struct read_req *rreq;
- size_t bsize = size < sshfs.max_read ? size : sshfs.max_read;
-
-- rreq = g_new0(struct read_req, 1);
-+ rreq = calloc(1, sizeof(struct read_req));
-+ if (!rreq)
-+ abort();
- rreq->sio = &chunk->sio;
- rreq->size = bsize;
- buf_init(&rreq->data, 0);
-@@ -2858,7 +2865,7 @@ static int wait_chunk(struct read_chunk *chunk, char *buf, size_t size)
- size -= rreq->res;
- list_del(&rreq->list);
- buf_free(&rreq->data);
-- g_free(rreq);
-+ free(rreq);
- }
- }
-
-@@ -3513,9 +3520,10 @@ static int sshfs_opt_proc(void *data, const char *arg, int key,
- switch (key) {
- case FUSE_OPT_KEY_OPT:
- if (is_ssh_opt(arg)) {
-- tmp = g_strdup_printf("-o%s", arg);
-+ if (asprintf(&tmp, "-o%s", arg) < 0)
-+ abort();
- ssh_add_arg(tmp);
-- g_free(tmp);
-+ free(tmp);
- return 0;
- }
- return 1;
-@@ -3528,9 +3536,10 @@ static int sshfs_opt_proc(void *data, const char *arg, int key,
- return 1;
-
- case KEY_PORT:
-- tmp = g_strdup_printf("-oPort=%s", arg + 2);
-+ if (asprintf(&tmp, "-oPort=%s", arg + 2) < 0)
-+ abort();
- ssh_add_arg(tmp);
-- g_free(tmp);
-+ free(tmp);
- return 0;
-
- case KEY_COMPRESS:
-@@ -3538,9 +3547,10 @@ static int sshfs_opt_proc(void *data, const char *arg, int key,
- return 0;
-
- case KEY_CONFIGFILE:
-- tmp = g_strdup_printf("-F%s", arg + 2);
-+ if (asprintf(&tmp, "-F%s", arg + 2) < 0)
-+ abort();
- ssh_add_arg(tmp);
-- g_free(tmp);
-+ free(tmp);
- return 0;
-
- case KEY_HELP:
-@@ -3755,17 +3765,19 @@ static void fsname_remove_commas(char *fsname)
- #if FUSE_VERSION >= 27
- static char *fsname_escape_commas(char *fsnameold)
- {
-- char *fsname = g_malloc(strlen(fsnameold) * 2 + 1);
-+ char *fsname = malloc(strlen(fsnameold) * 2 + 1);
- char *d = fsname;
- char *s;
-
-+ if (!fsname)
-+ abort();
- for (s = fsnameold; *s; s++) {
- if (*s == '\\' || *s == ',')
- *d++ = '\\';
- *d++ = *s;
- }
- *d = '\0';
-- g_free(fsnameold);
-+ free(fsnameold);
-
- return fsname;
- }
-@@ -4081,15 +4093,20 @@ int main(int argc, char *argv[])
- exit(1);
- }
-
-- fsname = g_strdup(sshfs.host);
-- sshfs.base_path = g_strdup(find_base_path());
-+ fsname = strdup(sshfs.host);
-+ if (!fsname)
-+ abort();
-+ sshfs.base_path = strdup(find_base_path());
-+ if (!sshfs.base_path)
-+ abort();
-
- if (sshfs.ssh_command)
- set_ssh_command();
-
-- tmp = g_strdup_printf("-%i", sshfs.ssh_ver);
-+ if (asprintf(&tmp, "-%i", sshfs.ssh_ver) < 0)
-+ abort();
- ssh_add_arg(tmp);
-- g_free(tmp);
-+ free(tmp);
- ssh_add_arg(sshfs.host);
- if (sshfs.sftp_server)
- sftp_server = sshfs.sftp_server;
-@@ -4125,14 +4142,16 @@ int main(int argc, char *argv[])
- fsname = fsname_escape_commas(fsname);
- else
- fsname_remove_commas(fsname);
-- tmp = g_strdup_printf("-osubtype=sshfs,fsname=%s", fsname);
-+ if (asprintf(&tmp, "-osubtype=sshfs,fsname=%s", fsname) < 0)
-+ abort();
- #else
- fsname_remove_commas(fsname);
-- tmp = g_strdup_printf("-ofsname=sshfs#%s", fsname);
-+ if (asprintf(&tmp, "-ofsname=sshfs#%s", fsname) < 0)
-+ abort();
- #endif
- fuse_opt_insert_arg(&args, 1, tmp);
-- g_free(tmp);
-- g_free(fsname);
-+ free(tmp);
-+ free(fsname);
- check_large_read(&args);
-
- #if FUSE_VERSION >= 26
---
-2.9.0
-
diff --git a/extra/sshfs/patch/0006-Add-missing-includes.patch b/extra/sshfs/patch/0006-Add-missing-includes.patch
deleted file mode 100644
index 968d8186..00000000
--- a/extra/sshfs/patch/0006-Add-missing-includes.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-From e969e57612df9b24df2ac16ac545466fca0989f1 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 18:21:02 -0700
-Subject: [PATCH] Add missing includes
-
-stddef.h for offsetof
-sys/param.h for MIN
----
- sshfs.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/sshfs.c b/sshfs.c
-index 4f3bfe4..cd6abf6 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -17,6 +17,7 @@
- #endif
- #include <assert.h>
- #include <stdbool.h>
-+#include <stddef.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
-@@ -37,6 +38,7 @@
- #include <sys/socket.h>
- #include <sys/utsname.h>
- #include <sys/mman.h>
-+#include <sys/param.h>
- #include <sys/poll.h>
- #include <netinet/in.h>
- #include <netinet/tcp.h>
---
-2.9.0
-
diff --git a/extra/sshfs/patch/0007-Disable-uidmap-and-gidmap-support.patch b/extra/sshfs/patch/0007-Disable-uidmap-and-gidmap-support.patch
deleted file mode 100644
index 1a232a7d..00000000
--- a/extra/sshfs/patch/0007-Disable-uidmap-and-gidmap-support.patch
+++ /dev/null
@@ -1,127 +0,0 @@
-From d12abc4b94f24c52637bcb19f6ac7819cf66af10 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 18:24:16 -0700
-Subject: [PATCH] Disable uidmap and gidmap support
-
----
- sshfs.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/sshfs.c b/sshfs.c
-index cd6abf6..9af8814 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -242,10 +242,12 @@ struct sshfs {
- int disable_hardlink;
- char *uid_file;
- char *gid_file;
-+#if 0
- GHashTable *uid_map;
- GHashTable *gid_map;
- GHashTable *r_uid_map;
- GHashTable *r_gid_map;
-+#endif
- unsigned max_read;
- unsigned max_write;
- unsigned ssh_ver;
-@@ -366,7 +368,9 @@ enum {
- enum {
- IDMAP_NONE,
- IDMAP_USER,
-+#if 0
- IDMAP_FILE,
-+#endif
- };
-
- enum {
-@@ -387,7 +391,9 @@ static struct fuse_opt sshfs_opts[] = {
- SSHFS_OPT("workaround=%s", workarounds, 0),
- SSHFS_OPT("idmap=none", idmap, IDMAP_NONE),
- SSHFS_OPT("idmap=user", idmap, IDMAP_USER),
-+#if 0
- SSHFS_OPT("idmap=file", idmap, IDMAP_FILE),
-+#endif
- SSHFS_OPT("uidfile=%s", uid_file, 0),
- SSHFS_OPT("gidfile=%s", gid_file, 0),
- SSHFS_OPT("nomap=ignore", nomap, NOMAP_IGNORE),
-@@ -520,6 +526,7 @@ static int list_empty(const struct list_head *head)
- return head->next == head;
- }
-
-+#if 0
- /* given a pointer to the uid/gid, and the mapping table, remap the
- * uid/gid, if necessary */
- static inline int translate_id(uint32_t *id, GHashTable *map)
-@@ -537,6 +544,7 @@ static inline int translate_id(uint32_t *id, GHashTable *map)
- abort();
- }
- }
-+#endif
-
- static inline void buf_init(struct buffer *buf, size_t size)
- {
-@@ -784,12 +792,14 @@ static int buf_get_attrs(struct buffer *buf, struct stat *stbuf, int *flagsp)
- if (sshfs.remote_uid_detected && uid == sshfs.remote_uid)
- uid = sshfs.local_uid;
- #endif /* __APPLE__ */
-+#if 0
- if (sshfs.idmap == IDMAP_FILE && sshfs.uid_map)
- if (translate_id(&uid, sshfs.uid_map) == -1)
- return -EPERM;
- if (sshfs.idmap == IDMAP_FILE && sshfs.gid_map)
- if (translate_id(&gid, sshfs.gid_map) == -1)
- return -EPERM;
-+#endif
-
- memset(stbuf, 0, sizeof(struct stat));
- stbuf->st_mode = mode;
-@@ -2486,12 +2496,14 @@ static int sshfs_chown(const char *path, uid_t uid, gid_t gid)
- if (sshfs.remote_uid_detected && uid == sshfs.local_uid)
- uid = sshfs.remote_uid;
- #endif /* __APPLE__ */
-+#if 0
- if (sshfs.idmap == IDMAP_FILE && sshfs.r_uid_map)
- if(translate_id(&uid, sshfs.r_uid_map) == -1)
- return -EPERM;
- if (sshfs.idmap == IDMAP_FILE && sshfs.r_gid_map)
- if (translate_id(&gid, sshfs.r_gid_map) == -1)
- return -EPERM;
-+#endif
-
- buf_init(&buf, 0);
- buf_add_path(&buf, path);
-@@ -3805,6 +3817,7 @@ static int ssh_connect(void)
- return 0;
- }
-
-+#if 0
- /* number of ':' separated fields in a passwd/group file that we care
- * about */
- #define IDMAP_FIELDS 3
-@@ -3979,6 +3992,7 @@ static inline void load_gid_map(void)
- {
- read_id_map(sshfs.gid_file, &groupname_to_gid, "gid", &sshfs.gid_map, &sshfs.r_gid_map);
- }
-+#endif
-
- #ifdef __APPLE__
- int main(int argc, char *argv[], __unused char *envp[], char **exec_path)
-@@ -4046,6 +4060,7 @@ int main(int argc, char *argv[])
-
- if (sshfs.idmap == IDMAP_USER)
- sshfs.detect_uid = 1;
-+#if 0
- else if (sshfs.idmap == IDMAP_FILE) {
- sshfs.uid_map = NULL;
- sshfs.gid_map = NULL;
-@@ -4060,6 +4075,7 @@ int main(int argc, char *argv[])
- if (sshfs.gid_file)
- load_gid_map();
- }
-+#endif
- free(sshfs.uid_file);
- free(sshfs.gid_file);
-
---
-2.9.0
-
diff --git a/extra/sshfs/patch/0008-Remove-remaining-uses-of-glib.patch b/extra/sshfs/patch/0008-Remove-remaining-uses-of-glib.patch
deleted file mode 100644
index b21b5d34..00000000
--- a/extra/sshfs/patch/0008-Remove-remaining-uses-of-glib.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 4d8a47a8754e549dc75d5201547762718de8ce52 Mon Sep 17 00:00:00 2001
-From: Michael Forney <mforney@mforney.org>
-Date: Sun, 5 Jun 2016 18:24:31 -0700
-Subject: [PATCH] Remove remaining uses of glib
-
----
- sshfs.c | 5 -----
- 1 file changed, 5 deletions(-)
-
-diff --git a/sshfs.c b/sshfs.c
-index 9af8814..44c13d1 100644
---- a/sshfs.c
-+++ b/sshfs.c
-@@ -42,7 +42,6 @@
- #include <sys/poll.h>
- #include <netinet/in.h>
- #include <netinet/tcp.h>
--#include <glib.h>
- #include <pwd.h>
- #include <grp.h>
- #include <limits.h>
-@@ -4011,11 +4010,7 @@ int main(int argc, char *argv[])
- if (!realpath(*exec_path, sshfs_program_path)) {
- memset(sshfs_program_path, 0, PATH_MAX);
- }
--
-- /* Until this gets fixed somewhere else. */
-- g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, TRUE);
- #endif /* __APPLE__ */
-- g_thread_init(NULL);
-
- sshfs.blksize = 4096;
- /* SFTP spec says all servers should allow at least 32k I/O */
---
-2.9.0
-
diff --git a/extra/sshfs/rev b/extra/sshfs/rev
deleted file mode 100644
index d00491fd..00000000
--- a/extra/sshfs/rev
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/extra/sshfs/src b/extra/sshfs/src
deleted file mode 160000
-Subproject b2fa7593586b141298e6159f40f521d2b0f4f89