diff options
| author | Daniel Rosenberg <drosen@google.com> | 2016-04-26 23:05:23 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2016-04-26 23:05:23 +0000 |
| commit | d4f91171bd5c2b60bd19adc882244a60cc3b2f6c (patch) | |
| tree | a6ad60949000c191211ac97a3b20834eb34bbbd0 /sdcard | |
| parent | 023dc9ab5ce6fae8f0abb0053fe971a70cbafa96 (diff) | |
| parent | 2abee9e063d1549fb006853b27f378c7d22192af (diff) | |
| download | system_core-d4f91171bd5c2b60bd19adc882244a60cc3b2f6c.tar.gz system_core-d4f91171bd5c2b60bd19adc882244a60cc3b2f6c.tar.bz2 system_core-d4f91171bd5c2b60bd19adc882244a60cc3b2f6c.zip | |
Add support for FUSE_CANONICAL_PATH
am: 2abee9e
* commit '2abee9e063d1549fb006853b27f378c7d22192af':
Add support for FUSE_CANONICAL_PATH
Change-Id: I47a41bc0b5b3a013e59932cbf66ae6852e15b1c3
Diffstat (limited to 'sdcard')
| -rw-r--r-- | sdcard/sdcard.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/sdcard/sdcard.c b/sdcard/sdcard.c index e2e8ed0c4..27e91c11f 100644 --- a/sdcard/sdcard.c +++ b/sdcard/sdcard.c @@ -48,6 +48,9 @@ #include <private/android_filesystem_config.h> +/* FUSE_CANONICAL_PATH is not currently upstreamed */ +#define FUSE_CANONICAL_PATH 2016 + /* README * * What is this? @@ -1472,6 +1475,35 @@ static int handle_init(struct fuse* fuse, struct fuse_handler* handler, return NO_STATUS; } +static int handle_canonical_path(struct fuse* fuse, struct fuse_handler* handler, + const struct fuse_in_header *hdr) +{ + struct node* node; + char path[PATH_MAX]; + int len; + + pthread_mutex_lock(&fuse->global->lock); + node = lookup_node_and_path_by_id_locked(fuse, hdr->nodeid, + path, sizeof(path)); + TRACE("[%d] CANONICAL_PATH @ %" PRIx64 " (%s)\n", handler->token, hdr->nodeid, + node ? node->name : "?"); + pthread_mutex_unlock(&fuse->global->lock); + + if (!node) { + return -ENOENT; + } + if (!check_caller_access_to_node(fuse, hdr, node, R_OK)) { + return -EACCES; + } + len = strlen(path); + if (len + 1 > PATH_MAX) + len = PATH_MAX - 1; + path[PATH_MAX - 1] = 0; + fuse_reply(fuse, hdr->unique, path, len + 1); + return NO_STATUS; +} + + static int handle_fuse_request(struct fuse *fuse, struct fuse_handler* handler, const struct fuse_in_header *hdr, const void *data, size_t data_len) { @@ -1587,6 +1619,10 @@ static int handle_fuse_request(struct fuse *fuse, struct fuse_handler* handler, return handle_init(fuse, handler, hdr, req); } + case FUSE_CANONICAL_PATH: { /* nodeid -> bytez[] */ + return handle_canonical_path(fuse, handler, hdr); + } + default: { TRACE("[%d] NOTIMPL op=%d uniq=%"PRIx64" nid=%"PRIx64"\n", handler->token, hdr->opcode, hdr->unique, hdr->nodeid); |
