aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2020-09-08 16:54:32 -0700
committerXin Li <delphij@google.com>2020-09-08 16:54:32 -0700
commitf8c3b42c8c41adc2644b2d6097f0e7cb99aa271b (patch)
tree63b964d135660673642fe4c363577d95d7232f52
parent4db6b5519adceb891de3e05324565faa24e56e2d (diff)
parent2d75168371f758c64c3424b1b88ca1fb6f876b17 (diff)
downloadlibfuse-f8c3b42c8c41adc2644b2d6097f0e7cb99aa271b.tar.gz
Merge Android R
Bug: 168057903 Merged-In: I070a2d768d31c9c1875f41ca103bed44ec4d2853 Change-Id: Ifeaab5f137e99540299ebcec69dd1c30a2a5bce0
-rw-r--r--Android.bp6
-rw-r--r--Android.patch112
l---------NOTICE2
-rw-r--r--include/fuse_kernel.h3
-rw-r--r--include/fuse_lowlevel.h24
-rw-r--r--lib/fuse_lowlevel.c18
-rw-r--r--lib/fuse_versionscript1
7 files changed, 163 insertions, 3 deletions
diff --git a/Android.bp b/Android.bp
index e07f2b8..8bc193c 100644
--- a/Android.bp
+++ b/Android.bp
@@ -16,6 +16,7 @@ cc_defaults {
],
clang: true,
+ sdk_version: "current",
ldflags: [
],
@@ -27,10 +28,12 @@ cc_library {
"libfuse_default_flags",
],
- export_include_dirs: ["include"],
+ export_include_dirs: ["include", "lib"],
version_script: "lib/fuse_versionscript",
+ vendor_available: true,
+
srcs: [
"lib/buffer.c",
"lib/cuse_lowlevel.c",
@@ -42,7 +45,6 @@ cc_library {
"lib/fuse_opt.c",
"lib/fuse_signals.c",
"lib/helper.c",
- // "lib/mount_bsd.c",
"lib/modules/subdir.c",
"lib/modules/iconv.c",
"lib/mount.c",
diff --git a/Android.patch b/Android.patch
new file mode 100644
index 0000000..fb792cc
--- /dev/null
+++ b/Android.patch
@@ -0,0 +1,112 @@
+diff --git a/Android.patch b/Android.patch
+new file mode 100644
+index 0000000..e69de29
+diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
+index 2971d29..8a45f42 100644
+--- a/include/fuse_kernel.h
++++ b/include/fuse_kernel.h
+@@ -425,6 +425,9 @@ enum fuse_opcode {
+
+ /* CUSE specific operations */
+ CUSE_INIT = 4096,
++
++ /* Android specific operations */
++ FUSE_CANONICAL_PATH = 2016,
+ };
+
+ enum fuse_notify_code {
+diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
+index 18c6363..e81c282 100644
+--- a/include/fuse_lowlevel.h
++++ b/include/fuse_lowlevel.h
+@@ -317,6 +317,18 @@ struct fuse_lowlevel_ops {
+ */
+ void (*readlink) (fuse_req_t req, fuse_ino_t ino);
+
++ /**
++ * Return canonical path for inotify
++ *
++ * Valid replies:
++ * fuse_reply_canonical_path
++ * fuse_reply_err
++ *
++ * @param req request handle
++ * @param ino the inode number
++ */
++ void (*canonical_path) (fuse_req_t req, fuse_ino_t ino);
++
+ /**
+ * Create file node
+ *
+@@ -1337,6 +1349,18 @@ int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
+ */
+ int fuse_reply_readlink(fuse_req_t req, const char *link);
+
++/**
++ * Reply with the canonical path for inotify
++ *
++ * Possible requests:
++ * canonical_path
++ *
++ * @param req request handle
++ * @param path to canonicalize
++ * @return zero for success, -errno for failure to send reply
++ */
++int fuse_reply_canonical_path(fuse_req_t req, const char *path);
++
+ /**
+ * Reply with open parameters
+ *
+diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
+index f2d7038..334b497 100644
+--- a/lib/fuse_lowlevel.c
++++ b/lib/fuse_lowlevel.c
+@@ -450,6 +450,11 @@ int fuse_reply_readlink(fuse_req_t req, const char *linkname)
+ return send_reply_ok(req, linkname, strlen(linkname));
+ }
+
++int fuse_reply_canonical_path(fuse_req_t req, const char *path)
++{
++ return send_reply_ok(req, path, strlen(path));
++}
++
+ int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *f)
+ {
+ struct fuse_open_out arg;
+@@ -1202,6 +1207,16 @@ static void do_readlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+ fuse_reply_err(req, ENOSYS);
+ }
+
++static void do_canonical_path(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
++{
++ (void) inarg;
++
++ if (req->se->op.canonical_path)
++ req->se->op.canonical_path(req, nodeid);
++ else
++ fuse_reply_err(req, ENOSYS);
++}
++
+ static void do_mknod(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+ {
+ struct fuse_mknod_in *arg = (struct fuse_mknod_in *) inarg;
+@@ -2456,6 +2471,7 @@ static struct {
+ [FUSE_GETATTR] = { do_getattr, "GETATTR" },
+ [FUSE_SETATTR] = { do_setattr, "SETATTR" },
+ [FUSE_READLINK] = { do_readlink, "READLINK" },
++ [FUSE_CANONICAL_PATH] = { do_canonical_path, "CANONICAL_PATH" },
+ [FUSE_SYMLINK] = { do_symlink, "SYMLINK" },
+ [FUSE_MKNOD] = { do_mknod, "MKNOD" },
+ [FUSE_MKDIR] = { do_mkdir, "MKDIR" },
+diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript
+index d18ba29..4c075a3 100644
+--- a/lib/fuse_versionscript
++++ b/lib/fuse_versionscript
+@@ -163,6 +163,7 @@ FUSE_3.7 {
+ global:
+ fuse_set_log_func;
+ fuse_log;
++ fuse_reply_canonical_path;
+ } FUSE_3.3;
+
+ # Local Variables:
diff --git a/NOTICE b/NOTICE
index 7a694c9..43e933d 120000
--- a/NOTICE
+++ b/NOTICE
@@ -1 +1 @@
-LICENSE \ No newline at end of file
+LGPL2.txt \ No newline at end of file
diff --git a/include/fuse_kernel.h b/include/fuse_kernel.h
index 2971d29..8a45f42 100644
--- a/include/fuse_kernel.h
+++ b/include/fuse_kernel.h
@@ -425,6 +425,9 @@ enum fuse_opcode {
/* CUSE specific operations */
CUSE_INIT = 4096,
+
+ /* Android specific operations */
+ FUSE_CANONICAL_PATH = 2016,
};
enum fuse_notify_code {
diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h
index 18c6363..e81c282 100644
--- a/include/fuse_lowlevel.h
+++ b/include/fuse_lowlevel.h
@@ -317,6 +317,18 @@ struct fuse_lowlevel_ops {
*/
void (*readlink) (fuse_req_t req, fuse_ino_t ino);
+ /**
+ * Return canonical path for inotify
+ *
+ * Valid replies:
+ * fuse_reply_canonical_path
+ * fuse_reply_err
+ *
+ * @param req request handle
+ * @param ino the inode number
+ */
+ void (*canonical_path) (fuse_req_t req, fuse_ino_t ino);
+
/**
* Create file node
*
@@ -1338,6 +1350,18 @@ int fuse_reply_attr(fuse_req_t req, const struct stat *attr,
int fuse_reply_readlink(fuse_req_t req, const char *link);
/**
+ * Reply with the canonical path for inotify
+ *
+ * Possible requests:
+ * canonical_path
+ *
+ * @param req request handle
+ * @param path to canonicalize
+ * @return zero for success, -errno for failure to send reply
+ */
+int fuse_reply_canonical_path(fuse_req_t req, const char *path);
+
+/**
* Reply with open parameters
*
* currently the following members of 'fi' are used:
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index f2d7038..fc76b7c 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -450,6 +450,13 @@ int fuse_reply_readlink(fuse_req_t req, const char *linkname)
return send_reply_ok(req, linkname, strlen(linkname));
}
+int fuse_reply_canonical_path(fuse_req_t req, const char *path)
+{
+ // The kernel expects a buffer containing the null terminator for this op
+ // So we add the null terminator size to strlen
+ return send_reply_ok(req, path, strlen(path) + 1);
+}
+
int fuse_reply_open(fuse_req_t req, const struct fuse_file_info *f)
{
struct fuse_open_out arg;
@@ -1202,6 +1209,16 @@ static void do_readlink(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
+static void do_canonical_path(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
+{
+ (void) inarg;
+
+ if (req->se->op.canonical_path)
+ req->se->op.canonical_path(req, nodeid);
+ else
+ fuse_reply_err(req, ENOSYS);
+}
+
static void do_mknod(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
{
struct fuse_mknod_in *arg = (struct fuse_mknod_in *) inarg;
@@ -2456,6 +2473,7 @@ static struct {
[FUSE_GETATTR] = { do_getattr, "GETATTR" },
[FUSE_SETATTR] = { do_setattr, "SETATTR" },
[FUSE_READLINK] = { do_readlink, "READLINK" },
+ [FUSE_CANONICAL_PATH] = { do_canonical_path, "CANONICAL_PATH" },
[FUSE_SYMLINK] = { do_symlink, "SYMLINK" },
[FUSE_MKNOD] = { do_mknod, "MKNOD" },
[FUSE_MKDIR] = { do_mkdir, "MKDIR" },
diff --git a/lib/fuse_versionscript b/lib/fuse_versionscript
index d18ba29..4c075a3 100644
--- a/lib/fuse_versionscript
+++ b/lib/fuse_versionscript
@@ -163,6 +163,7 @@ FUSE_3.7 {
global:
fuse_set_log_func;
fuse_log;
+ fuse_reply_canonical_path;
} FUSE_3.3;
# Local Variables: