summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/xattr.h
Commit message (Collapse)AuthorAgeFilesLines
* btrfs: move btrfs_xattr_handlers to .rodataWedson Almeida Filho2023-10-091-1/+1
| | | | | | | | | | | | | This makes it harder for accidental or malicious changes to btrfs_xattr_handlers at runtime. Cc: Chris Mason <clm@fb.com> Cc: Josef Bacik <josef@toxicpanda.com> Cc: David Sterba <dsterba@suse.com> Cc: linux-btrfs@vger.kernel.org Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com> Link: https://lore.kernel.org/r/20230930050033.41174-6-wedsonaf@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
* btrfs: cleanup btrfs_setxattr_trans and drop transaction parameterAnand Jain2019-04-291-3/+2
| | | | | | | | | | Previous patch made sure that btrfs_setxattr_trans() is called only when transaction NULL. Clean up btrfs_setxattr_trans() and drop the parameter. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: export btrfs_setxattrAnand Jain2019-04-291-0/+2
| | | | | | | | | | | Preparatory patch, as we are going split the calls with and without transaction to use the respective btrfs_setxattr() and btrfs_setxattr_trans() functions. Export btrfs_setxattr() for calls outside of xattr.c. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: rename btrfs_setxattr to btrfs_setxattr_transAnand Jain2019-04-291-1/+1
| | | | | | | | | | Rename btrfs_setxattr() to btrfs_setxattr_trans(), so that do_setxattr() can be renamed to btrfs_setxattr(). Preparatory patch, no functional changes. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: replace GPL boilerplate by SPDX -- headersDavid Sterba2018-04-121-17/+4
| | | | | | | | | | Remove GPL boilerplate text (long, short, one-line) and keep the rest, ie. personal, company or original source copyright statements. Add the SPDX header. Unify the include protection macros to match the file names. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: move btrfs_listxattr prototype to xattr.hDavid Sterba2018-03-261-0/+1
| | | | | | | There's a proper header for xattr handlers. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: adjust return type of btrfs_getxattrDavid Sterba2018-03-261-1/+1
| | | | | | | | The xattr_handler::get prototype returns int, use it. The only ssize_t exception is the per-inode listxattr handler. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: drop extern from function declarationsDavid Sterba2018-03-261-3/+3
| | | | | | | | Extern for functions does not make any difference, there are only a few so let's remove them before it's too late. Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: drop underscores from exported xattr functionsDavid Sterba2018-03-261-2/+2
| | | | | Reviewed-by: Nikolay Borisov <nborisov@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs: Switch to generic xattr handlersAndreas Gruenbacher2016-05-171-3/+0
| | | | | | | | | | | | | | | | The btrfs_{set,remove}xattr inode operations check for a read-only root (btrfs_root_readonly) before calling into generic_{set,remove}xattr. If this check is moved into __btrfs_setxattr, we can get rid of btrfs_{set,remove}xattr. This patch applies to mainline, I would like to keep it together with the other xattr cleanups if possible, though. Could you please review? Thanks, Andreas Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* btrfs: Use xattr handler infrastructureAndreas Gruenbacher2015-12-061-2/+0
| | | | | | | | | Use the VFS xattr handler infrastructure and get rid of similar code in the filesystem. Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* btrfs: use generic posix ACL infrastructureChristoph Hellwig2014-01-251-2/+0
| | | | | | | | Also don't bother to set up a .get_acl method for symlinks as we do not support access control (ACLs or even mode bits) for symlinks in Linux. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* fs/vfs/security: pass last path component to LSM on inode creationEric Paris2011-02-011-1/+2
| | | | | | | | | | | | | | | | | | | SELinux would like to implement a new labeling behavior of newly created inodes. We currently label new inodes based on the parent and the creating process. This new behavior would also take into account the name of the new object when deciding the new label. This is not the (supposed) full path, just the last component of the path. This is very useful because creating /etc/shadow is different than creating /etc/passwd but the kernel hooks are unable to differentiate these operations. We currently require that userspace realize it is doing some difficult operation like that and than userspace jumps through SELinux hoops to get things set up correctly. This patch does not implement new behavior, that is obviously contained in a seperate SELinux patch, but it does pass the needed name down to the correct LSM hook. If no such name exists it is fine to pass NULL. Signed-off-by: Eric Paris <eparis@redhat.com>
* btrfs: constify xattr_handlerStephen Hemminger2010-05-211-3/+3
| | | | | Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
* Btrfs: Pass transaction handle to security and ACL initialization functionsYan, Zheng2009-12-171-4/+5
| | | | | | | | Pass transaction handle down to security and ACL initialization functions, so we can avoid starting nested transactions Signed-off-by: Yan Zheng <zheng.yan@oracle.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* Btrfs: selinux supportJim Owens2009-02-041-0/+2
| | | | | | | | | | | Add call to LSM security initialization and save resulting security xattr for new inodes. Add xattr support to symlink inode ops. Set inode->i_op for existing special files. Signed-off-by: jim owens <jowens@hp.com>
* Btrfs: optimize btrget/set/removexattrChristoph Hellwig2008-09-251-21/+10
| | | | | | | | | | | | btrfs actually stores the whole xattr name, including the prefix ondisk, so using the generic resolver that strips off the prefix is not very helpful. Instead do the real ondisk xattrs manually and only use the generic resolver for synthetic xattrs like ACLs. (Sorry Josef for guiding you towards the wrong direction here intially) Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* btrfs: optmize listxattrChristoph Hellwig2008-09-251-8/+0
| | | | | | | | | | | | | The ->list handler is really not useful at all, because we always call btrfs_xattr_generic_list anyway. After this is done find_btrfs_xattr_handler becomes unused, and it becomes obvious that the temporary name buffer allocation isn't needed but we can directly copy into the supplied buffer. Tested with various getfattr -d calls on varying xattr lists. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Chris Mason <chris.mason@oracle.com>
* xattr support for btrfsJosef Bacik2008-09-251-0/+58
Signed-off-by: Chris Mason <chris.mason@oracle.com>