Skip to content

Commit

Permalink
fscrypt: move fscrypt_is_dot_dotdot() to fs/crypto/fname.c
Browse files Browse the repository at this point in the history
Only fs/crypto/fname.c cares about treating the "." and ".." filenames
specially with regards to encryption, so move fscrypt_is_dot_dotdot()
from fscrypt.h to there.

Signed-off-by: Eric Biggers <[email protected]>
Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
ebiggers authored and tytso committed Jan 12, 2018
1 parent bb8179e commit dcf0db9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
11 changes: 11 additions & 0 deletions fs/crypto/fname.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
#include <linux/ratelimit.h>
#include "fscrypt_private.h"

static inline bool fscrypt_is_dot_dotdot(const struct qstr *str)
{
if (str->len == 1 && str->name[0] == '.')
return true;

if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.')
return true;

return false;
}

/**
* fname_encrypt() - encrypt a filename
*
Expand Down
11 changes: 0 additions & 11 deletions include/linux/fscrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ struct fscrypt_name {
/* Maximum value for the third parameter of fscrypt_operations.set_context(). */
#define FSCRYPT_SET_CONTEXT_MAX_SIZE 28

static inline bool fscrypt_is_dot_dotdot(const struct qstr *str)
{
if (str->len == 1 && str->name[0] == '.')
return true;

if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.')
return true;

return false;
}

#if __FS_HAS_ENCRYPTION
#include <linux/fscrypt_supp.h>
#else
Expand Down

0 comments on commit dcf0db9

Please sign in to comment.