Blame view

fs/ext4/xattr_user.c 1.23 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  // SPDX-License-Identifier: GPL-2.0
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
2
  /*
617ba13b3   Mingming Cao   [PATCH] ext4: ren...
3
   * linux/fs/ext4/xattr_user.c
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
4
5
6
7
   * Handler for extended user attributes.
   *
   * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
   */
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
8
9
  #include <linux/string.h>
  #include <linux/fs.h>
3dcf54515   Christoph Hellwig   ext4: move header...
10
11
  #include "ext4_jbd2.h"
  #include "ext4.h"
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
12
  #include "xattr.h"
764a5c6b1   Andreas Gruenbacher   xattr handlers: S...
13
14
  static bool
  ext4_xattr_user_list(struct dentry *dentry)
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
15
  {
764a5c6b1   Andreas Gruenbacher   xattr handlers: S...
16
  	return test_opt(dentry->d_sb, XATTR_USER);
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
17
18
19
  }
  
  static int
d9a82a040   Andreas Gruenbacher   xattr handlers: P...
20
  ext4_xattr_user_get(const struct xattr_handler *handler,
b296821a7   Al Viro   xattr_handler: pa...
21
  		    struct dentry *unused, struct inode *inode,
3484eba91   Mark Salyzyn   FROMLIST: Add fla...
22
  		    const char *name, void *buffer, size_t size, int flags)
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
23
  {
b296821a7   Al Viro   xattr_handler: pa...
24
  	if (!test_opt(inode->i_sb, XATTR_USER))
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
25
  		return -EOPNOTSUPP;
b296821a7   Al Viro   xattr_handler: pa...
26
  	return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER,
431547b3c   Christoph Hellwig   sanitize xattr ha...
27
  			      name, buffer, size);
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
28
29
30
  }
  
  static int
d9a82a040   Andreas Gruenbacher   xattr handlers: P...
31
  ext4_xattr_user_set(const struct xattr_handler *handler,
593012268   Al Viro   switch xattr_hand...
32
33
34
  		    struct dentry *unused, struct inode *inode,
  		    const char *name, const void *value,
  		    size_t size, int flags)
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
35
  {
593012268   Al Viro   switch xattr_hand...
36
  	if (!test_opt(inode->i_sb, XATTR_USER))
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
37
  		return -EOPNOTSUPP;
593012268   Al Viro   switch xattr_hand...
38
  	return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER,
431547b3c   Christoph Hellwig   sanitize xattr ha...
39
  			      name, value, size, flags);
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
40
  }
11e275280   Stephen Hemminger   ext4: constify xa...
41
  const struct xattr_handler ext4_xattr_user_handler = {
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
42
  	.prefix	= XATTR_USER_PREFIX,
617ba13b3   Mingming Cao   [PATCH] ext4: ren...
43
44
45
  	.list	= ext4_xattr_user_list,
  	.get	= ext4_xattr_user_get,
  	.set	= ext4_xattr_user_set,
ac27a0ec1   Dave Kleikamp   [PATCH] ext4: ini...
46
  };