xattr.c (0bee82fb4b8d49541fe474ed460d2b917f329568) xattr.c (b65917dd2700b7d12e25e2e0bbfd58eb3c932158)
1#include <linux/ceph/ceph_debug.h>
2
3#include "super.h"
4#include "mds_client.h"
5
6#include <linux/ceph/decode.h>
7
8#include <linux/xattr.h>

--- 643 unchanged lines hidden (view full) ---

652list_xattr:
653 /*
654 * Start with virtual dir xattr names (if any) (including
655 * terminating '\0' characters for each).
656 */
657 vir_namelen = ceph_vxattrs_name_size(vxattrs);
658
659 /* adding 1 byte per each variable due to the null termination */
1#include <linux/ceph/ceph_debug.h>
2
3#include "super.h"
4#include "mds_client.h"
5
6#include <linux/ceph/decode.h>
7
8#include <linux/xattr.h>

--- 643 unchanged lines hidden (view full) ---

652list_xattr:
653 /*
654 * Start with virtual dir xattr names (if any) (including
655 * terminating '\0' characters for each).
656 */
657 vir_namelen = ceph_vxattrs_name_size(vxattrs);
658
659 /* adding 1 byte per each variable due to the null termination */
660 namelen = vir_namelen + ci->i_xattrs.names_size + ci->i_xattrs.count;
660 namelen = ci->i_xattrs.names_size + ci->i_xattrs.count;
661 err = -ERANGE;
661 err = -ERANGE;
662 if (size && namelen > size)
662 if (size && vir_namelen + namelen > size)
663 goto out;
664
663 goto out;
664
665 err = namelen;
665 err = namelen + vir_namelen;
666 if (size == 0)
667 goto out;
668
669 names = __copy_xattr_names(ci, names);
670
671 /* virtual xattr names, too */
666 if (size == 0)
667 goto out;
668
669 names = __copy_xattr_names(ci, names);
670
671 /* virtual xattr names, too */
672 if (vxattrs)
672 err = namelen;
673 if (vxattrs) {
673 for (i = 0; vxattrs[i].name; i++) {
674 for (i = 0; vxattrs[i].name; i++) {
674 len = sprintf(names, "%s", vxattrs[i].name);
675 names += len + 1;
675 if (!vxattrs[i].hidden &&
676 !(vxattrs[i].exists_cb &&
677 !vxattrs[i].exists_cb(ci))) {
678 len = sprintf(names, "%s", vxattrs[i].name);
679 names += len + 1;
680 err += len + 1;
681 }
676 }
682 }
683 }
677
678out:
679 spin_unlock(&ci->i_ceph_lock);
680 return err;
681}
682
683static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
684 const char *value, size_t size, int flags)

--- 257 unchanged lines hidden ---
684
685out:
686 spin_unlock(&ci->i_ceph_lock);
687 return err;
688}
689
690static int ceph_sync_setxattr(struct dentry *dentry, const char *name,
691 const char *value, size_t size, int flags)

--- 257 unchanged lines hidden ---