diff options
Diffstat (limited to 'xlators/mount/fuse/src')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 8 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.h | 2 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-helpers.c | 14 |
3 files changed, 19 insertions, 5 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 6dfc334bee1..9bf07bf18b9 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2425,9 +2425,11 @@ fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, char *buf = NULL; gf_dirent_t *entry = NULL; struct fuse_dirent *fde = NULL; + fuse_private_t *priv = NULL; state = frame->root->state; finh = state->finh; + priv = state->this->private; if (op_ret < 0) { gf_log ("glusterfs-fuse", GF_LOG_WARNING, @@ -2459,11 +2461,7 @@ fuse_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, size = 0; list_for_each_entry (entry, &entries->list, list) { fde = (struct fuse_dirent *)(buf + size); - fde->ino = entry->d_ino; - fde->off = entry->d_off; - fde->type = entry->d_type; - fde->namelen = strlen (entry->d_name); - strncpy (fde->name, entry->d_name, fde->namelen); + gf_fuse_fill_dirent (entry, fde, priv->enable_ino32); size += FUSE_DIRENT_SIZE (fde); } diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h index 22097f57ab9..c700554f9be 100644 --- a/xlators/mount/fuse/src/fuse-bridge.h +++ b/xlators/mount/fuse/src/fuse-bridge.h @@ -416,6 +416,8 @@ fuse_state_t *get_fuse_state (xlator_t *this, fuse_in_header_t *finh); void free_fuse_state (fuse_state_t *state); void gf_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa, gf_boolean_t enable_ino32); +void gf_fuse_fill_dirent (gf_dirent_t *entry, struct fuse_dirent *fde, + gf_boolean_t enable_ino32); uint64_t inode_to_fuse_nodeid (inode_t *inode); xlator_t *fuse_active_subvol (xlator_t *fuse); inode_t *fuse_ino_to_inode (uint64_t ino, xlator_t *fuse); diff --git a/xlators/mount/fuse/src/fuse-helpers.c b/xlators/mount/fuse/src/fuse-helpers.c index 461f74865c5..577be2fef4e 100644 --- a/xlators/mount/fuse/src/fuse-helpers.c +++ b/xlators/mount/fuse/src/fuse-helpers.c @@ -465,6 +465,20 @@ gf_fuse_stat2attr (struct iatt *st, struct fuse_attr *fa, gf_boolean_t enable_in #endif } +void +gf_fuse_fill_dirent (gf_dirent_t *entry, struct fuse_dirent *fde, gf_boolean_t enable_ino32) +{ + if (enable_ino32) + fde->ino = GF_FUSE_SQUASH_INO(entry->d_ino); + else + fde->ino = entry->d_ino; + + fde->off = entry->d_off; + fde->type = entry->d_type; + fde->namelen = strlen (entry->d_name); + strncpy (fde->name, entry->d_name, fde->namelen); +} + static int fuse_do_flip_xattr_ns (char *okey, const char *nns, char **nkey) { |