ubifs: Constify struct inode pointer in ubifs_crypt_is_encrypted()
[linux-2.6-block.git] / fs / ubifs / crypto.c
CommitLineData
d475a507
RW
1#include "ubifs.h"
2
3static int ubifs_crypt_get_context(struct inode *inode, void *ctx, size_t len)
4{
5 return ubifs_xattr_get(inode, UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT,
6 ctx, len);
7}
8
9static int ubifs_crypt_set_context(struct inode *inode, const void *ctx,
10 size_t len, void *fs_data)
11{
12 return ubifs_xattr_set(inode, UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT,
13 ctx, len, 0);
14}
15
16static bool ubifs_crypt_empty_dir(struct inode *inode)
17{
18 return ubifs_check_dir_empty(inode) == 0;
19}
20
21static unsigned int ubifs_crypt_max_namelen(struct inode *inode)
22{
23 if (S_ISLNK(inode->i_mode))
24 return UBIFS_MAX_INO_DATA;
25 else
26 return UBIFS_MAX_NLEN;
27}
28
29static int ubifs_key_prefix(struct inode *inode, u8 **key)
30{
31 static char prefix[] = "ubifs:";
32
33 *key = prefix;
34
35 return sizeof(prefix) - 1;
36}
37
38struct fscrypt_operations ubifs_crypt_operations = {
39 .flags = FS_CFLG_INPLACE_ENCRYPTION,
40 .get_context = ubifs_crypt_get_context,
41 .set_context = ubifs_crypt_set_context,
1ee77870 42 .is_encrypted = __ubifs_crypt_is_encrypted,
d475a507
RW
43 .empty_dir = ubifs_crypt_empty_dir,
44 .max_namelen = ubifs_crypt_max_namelen,
45 .key_prefix = ubifs_key_prefix,
46};