Blame view

fs/reiserfs/acl.h 1.81 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
  #include <linux/init.h>
  #include <linux/posix_acl.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
5
6
7
  
  #define REISERFS_ACL_VERSION	0x0001
  
  typedef struct {
bd4c625c0   Linus Torvalds   reiserfs: run scr...
8
9
10
  	__le16 e_tag;
  	__le16 e_perm;
  	__le32 e_id;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
12
13
  } reiserfs_acl_entry;
  
  typedef struct {
bd4c625c0   Linus Torvalds   reiserfs: run scr...
14
15
  	__le16 e_tag;
  	__le16 e_perm;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
17
18
  } reiserfs_acl_entry_short;
  
  typedef struct {
bd4c625c0   Linus Torvalds   reiserfs: run scr...
19
  	__le32 a_version;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
  } reiserfs_acl_header;
  
  static inline size_t reiserfs_acl_size(int count)
  {
  	if (count <= 4) {
  		return sizeof(reiserfs_acl_header) +
bd4c625c0   Linus Torvalds   reiserfs: run scr...
26
  		    count * sizeof(reiserfs_acl_entry_short);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
27
28
  	} else {
  		return sizeof(reiserfs_acl_header) +
bd4c625c0   Linus Torvalds   reiserfs: run scr...
29
30
  		    4 * sizeof(reiserfs_acl_entry_short) +
  		    (count - 4) * sizeof(reiserfs_acl_entry);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  	}
  }
  
  static inline int reiserfs_acl_count(size_t size)
  {
  	ssize_t s;
  	size -= sizeof(reiserfs_acl_header);
  	s = size - 4 * sizeof(reiserfs_acl_entry_short);
  	if (s < 0) {
  		if (size % sizeof(reiserfs_acl_entry_short))
  			return -1;
  		return size / sizeof(reiserfs_acl_entry_short);
  	} else {
  		if (s % sizeof(reiserfs_acl_entry))
  			return -1;
  		return s / sizeof(reiserfs_acl_entry) + 4;
  	}
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
49
  #ifdef CONFIG_REISERFS_FS_POSIX_ACL
bd4c625c0   Linus Torvalds   reiserfs: run scr...
50
  struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
47f70d08f   Christoph Hellwig   reiserfs: use gen...
51
  int reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
bd4c625c0   Linus Torvalds   reiserfs: run scr...
52
  int reiserfs_acl_chmod(struct inode *inode);
0ab2621eb   Jeff Mahoney   reiserfs: journal...
53
54
  int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
  				 struct inode *dir, struct dentry *dentry,
bd4c625c0   Linus Torvalds   reiserfs: run scr...
55
56
  				 struct inode *inode);
  int reiserfs_cache_default_acl(struct inode *dir);
cfe14677f   Alexey Dobriyan   [PATCH] reiserfs:...
57

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
58
  #else
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
59
  #define reiserfs_cache_default_acl(inode) 0
4e34e719e   Christoph Hellwig   fs: take the ACL ...
60
  #define reiserfs_get_acl NULL
47f70d08f   Christoph Hellwig   reiserfs: use gen...
61
  #define reiserfs_set_acl NULL
bc5e483da   Andrew Morton   [PATCH] reiserfs_...
62

bd4c625c0   Linus Torvalds   reiserfs: run scr...
63
  static inline int reiserfs_acl_chmod(struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64
  {
bd4c625c0   Linus Torvalds   reiserfs: run scr...
65
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
66
67
68
  }
  
  static inline int
77e465867   Alexander Beregalov   reiserfs: fix bui...
69
70
  reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
  			     const struct inode *dir, struct dentry *dentry,
bd4c625c0   Linus Torvalds   reiserfs: run scr...
71
  			     struct inode *inode)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
72
  {
bd4c625c0   Linus Torvalds   reiserfs: run scr...
73
  	return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
75
  #endif