static int iconv_listxattr(const char *path, char *list, size_t size) { struct iconv *ic = iconv_get(); char *newpath; int err = iconv_convpath(ic, path, &newpath, 0); if (!err) { err = fuse_fs_listxattr(ic->next, newpath, list, size); free(newpath); } return err; }
static int subdir_listxattr(const char *path, char *list, size_t size) { struct subdir *d = subdir_get(); char *newpath; int err = subdir_addpath(d, path, &newpath); if (!err) { err = fuse_fs_listxattr(d->next, newpath, list, size); free(newpath); } return err; }
static int volicon_listxattr(const char *path, char *list, size_t size) { ERROR_IF_MAGIC_FILE(path, EPERM); ssize_t res = fuse_fs_listxattr(volicon_get()->next, path, list, size); if ((strcmp(path, VOLICON_ROOT_MAGIC_PATH) == 0)) { int done = 0; ssize_t sz = sizeof(XATTR_FINDERINFO_NAME); if (res == -ENOSYS) { res = 0; } if (!list) { /* size being queried */ if (res > 0) { sz += res; } return sz; } /* list is good */ if (res == -ERANGE) { return -ERANGE; } if (res > 0) { size_t len = 0; char *curr = list; do { size_t thislen = strlen(curr) + 1; if (strcmp(curr, XATTR_FINDERINFO_NAME) == 0) { done = 1; break; } curr += thislen; len += thislen; } while (len < res); } if (done) { return res; } if (size < (res + sizeof(XATTR_FINDERINFO_NAME))) { return -ERANGE; } memcpy((char *)list + res, XATTR_FINDERINFO_NAME, sizeof(XATTR_FINDERINFO_NAME)); return (res + sizeof(XATTR_FINDERINFO_NAME)); } if (res == -ENOSYS) { res = -ENOTSUP; } return res; }