diff options
-rw-r--r-- | Android.mk | 20 | ||||
-rwxr-xr-x | lib/Android.mk | 30 | ||||
-rw-r--r-- | lib/buffer.c | 19 | ||||
-rw-r--r-- | lib/fuse.c | 6 | ||||
-rw-r--r-- | lib/fuse_loop_mt.c | 2 | ||||
-rw-r--r-- | lib/fuse_lowlevel.c | 10 | ||||
-rw-r--r-- | lib/fuse_mt.c | 2 | ||||
-rw-r--r-- | lib/fuse_opt.c | 2 |
8 files changed, 64 insertions, 27 deletions
diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..a75a53c --- /dev/null +++ b/Android.mk @@ -0,0 +1,20 @@ +# +# Copyright (C) 2008 The Android Open Source Project +# Copyright (C) 2015 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LOCAL_PATH := $(call my-dir) + +include $(call first-makefiles-under,$(LOCAL_PATH)) diff --git a/lib/Android.mk b/lib/Android.mk index ba06023..fd191ec 100755 --- a/lib/Android.mk +++ b/lib/Android.mk @@ -14,10 +14,7 @@ # LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := \ - ../android/statvfs.c \ +common_src_files := \ buffer.c \ cuse_lowlevel.c \ fuse.c \ @@ -33,19 +30,38 @@ LOCAL_SRC_FILES := \ mount_util.c \ ulockmgr.c -LOCAL_C_INCLUDES := \ +common_c_includes := \ external/fuse/android \ external/fuse/include -LOCAL_SHARED_LIBRARIES := \ +common_shared_libraries := \ libutils -LOCAL_CFLAGS := \ +common_cflags := \ -D_FILE_OFFSET_BITS=64 \ -DFUSE_USE_VERSION=26 \ -fno-strict-aliasing +common_ldflags := \ + -Wl,--version-script,$(LOCAL_PATH)/fuse_versionscript + +include $(CLEAR_VARS) LOCAL_MODULE := libfuse LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := $(common_src_files) +LOCAL_C_INCLUDES := $(common_c_includes) +LOCAL_SHARED_LIBRARIES := $(common_shared_libraries) +LOCAL_CFLAGS := $(common_cflags) -fPIC +LOCAL_LDFLAGS := $(common_ldflags) +LOCAL_CLANG := true +include $(BUILD_SHARED_LIBRARY) +include $(CLEAR_VARS) +LOCAL_MODULE := libfuse_static +LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := $(common_src_files) +LOCAL_C_INCLUDES := $(common_c_includes) +LOCAL_STATIC_LIBRARIES := $(common_shared_libraries) +LOCAL_CFLAGS := $(common_cflags) +LOCAL_CLANG := true include $(BUILD_STATIC_LIBRARY) diff --git a/lib/buffer.c b/lib/buffer.c index 6fa55c9..b2dd47c 100644 --- a/lib/buffer.c +++ b/lib/buffer.c @@ -45,10 +45,10 @@ static ssize_t fuse_buf_write(const struct fuse_buf *dst, size_t dst_off, while (len) { if (dst->flags & FUSE_BUF_FD_SEEK) { - res = pwrite64(dst->fd, src->mem + src_off, len, + res = pwrite64(dst->fd, (const intptr_t *)src->mem + src_off, len, dst->pos + dst_off); } else { - res = write(dst->fd, src->mem + src_off, len); + res = write(dst->fd, (const intptr_t *)src->mem + src_off, len); } if (res == -1) { if (!copied) @@ -79,10 +79,10 @@ static ssize_t fuse_buf_read(const struct fuse_buf *dst, size_t dst_off, while (len) { if (src->flags & FUSE_BUF_FD_SEEK) { - res = pread(src->fd, dst->mem + dst_off, len, + res = pread(src->fd, (intptr_t *)dst->mem + dst_off, len, src->pos + src_off); } else { - res = read(src->fd, dst->mem + dst_off, len); + res = read(src->fd, (intptr_t *)dst->mem + dst_off, len); } if (res == -1) { if (!copied) @@ -119,7 +119,7 @@ static ssize_t fuse_buf_fd_to_fd(const struct fuse_buf *dst, size_t dst_off, tmp.mem = buf; while (len) { - size_t this_len = min_size(tmp.size, len); + ssize_t this_len = min_size(tmp.size, len); size_t read_len; res = fuse_buf_read(&tmp, 0, src, src_off, this_len); @@ -229,11 +229,12 @@ static ssize_t fuse_buf_copy_one(const struct fuse_buf *dst, size_t dst_off, int dst_is_fd = dst->flags & FUSE_BUF_IS_FD; if (!src_is_fd && !dst_is_fd) { - void *dstmem = dst->mem + dst_off; - void *srcmem = src->mem + src_off; + void *dstmem = (intptr_t *)dst->mem + dst_off; + void *srcmem = (intptr_t *)src->mem + src_off; if (dstmem != srcmem) { - if (dstmem + len <= srcmem || srcmem + len <= dstmem) + if ((intptr_t *)dstmem + len <= (intptr_t *)srcmem + || (intptr_t *)srcmem + len <= (intptr_t *)dstmem) memcpy(dstmem, srcmem, len); else memmove(dstmem, srcmem, len); @@ -288,7 +289,7 @@ ssize_t fuse_buf_copy(struct fuse_bufvec *dstv, struct fuse_bufvec *srcv, const struct fuse_buf *dst = fuse_bufvec_current(dstv); size_t src_len; size_t dst_len; - size_t len; + ssize_t len; ssize_t res; if (src == NULL || dst == NULL) @@ -1771,7 +1771,7 @@ int fuse_fs_read_buf(struct fuse_fs *fs, const char *path, { fuse_get_context()->private_data = fs->user_data; if (fs->op.read || fs->op.read_buf) { - int res; + ssize_t res; if (fs->debug) fprintf(stderr, @@ -1808,7 +1808,7 @@ int fuse_fs_read_buf(struct fuse_fs *fs, const char *path, (unsigned long long) fi->fh, fuse_buf_size(*bufp), (unsigned long long) off); - if (res >= 0 && fuse_buf_size(*bufp) > (int) size) + if (res >= 0 && fuse_buf_size(*bufp) > size) fprintf(stderr, "fuse: read too many bytes\n"); if (res < 0) @@ -4578,7 +4578,7 @@ static int node_table_init(struct node_table *t) return 0; } -static void thread_exit_handler(int sig) +static void thread_exit_handler(int sig __unused) { pthread_exit(0); } diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c index 90fc1e6..09d8681 100644 --- a/lib/fuse_loop_mt.c +++ b/lib/fuse_loop_mt.c @@ -63,7 +63,7 @@ static void list_del_worker(struct fuse_worker *w) static int fuse_loop_start_thread(struct fuse_mt *mt); -static void thread_exit_handler(int sig) +static void thread_exit_handler(int sig __unused) { pthread_exit(0); } diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 5f223c9..97dd678 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -2303,12 +2303,12 @@ static const char *opname(enum fuse_opcode opcode) static int fuse_ll_copy_from_pipe(struct fuse_bufvec *dst, struct fuse_bufvec *src) { - int res = fuse_buf_copy(dst, src, 0); + ssize_t res = fuse_buf_copy(dst, src, 0); if (res < 0) { fprintf(stderr, "fuse: copy from pipe: %s\n", strerror(-res)); return res; } - if (res < fuse_buf_size(dst)) { + if (res < (ssize_t)fuse_buf_size(dst)) { fprintf(stderr, "fuse: copy from pipe: short read\n"); return -1; } @@ -2423,7 +2423,7 @@ static void fuse_ll_process_buf(void *data, const struct fuse_buf *buf, mbuf = newmbuf; tmpbuf = FUSE_BUFVEC_INIT(buf->size - write_header_size); - tmpbuf.buf[0].mem = mbuf + write_header_size; + tmpbuf.buf[0].mem = (intptr_t *)mbuf + write_header_size; res = fuse_ll_copy_from_pipe(&tmpbuf, &bufv); err = -res; @@ -2778,7 +2778,7 @@ int fuse_req_getgroups(fuse_req_t req, int size, gid_t list[]) char *buf; size_t bufsize = 1024; char path[128]; - int ret; + ssize_t ret; int fd; unsigned long pid = req->ctx.pid; char *s; @@ -2802,7 +2802,7 @@ retry: goto out_free; } - if (ret == bufsize) { + if (ret == (ssize_t)bufsize) { free(buf); bufsize *= 4; goto retry; diff --git a/lib/fuse_mt.c b/lib/fuse_mt.c index fd5ac23..4db7e78 100644 --- a/lib/fuse_mt.c +++ b/lib/fuse_mt.c @@ -50,7 +50,7 @@ static int mt_session_exited(void *data) return fuse_session_exited(pd->prevse); } -static int mt_chan_receive(struct fuse_chan **chp, char *buf, size_t size) +static int mt_chan_receive(struct fuse_chan **chp, char *buf, size_t size __unused) { struct fuse_cmd *cmd; struct procdata *pd = (struct procdata *) fuse_chan_data(*chp); diff --git a/lib/fuse_opt.c b/lib/fuse_opt.c index a2118ce..c793edf 100644 --- a/lib/fuse_opt.c +++ b/lib/fuse_opt.c @@ -233,7 +233,7 @@ static int process_opt(struct fuse_opt_context *ctx, if (call_proc(ctx, arg, opt->value, iso) == -1) return -1; } else { - void *var = ctx->data + opt->offset; + void *var = (intptr_t *)ctx->data + opt->offset; if (sep && opt->templ[sep + 1]) { const char *param = arg + sep; if (opt->templ[sep] == '=') |