Unverified Commit 55fb177d authored by Amir Goldstein's avatar Amir Goldstein Committed by Christian Brauner
Browse files

fs: add helpers name_is_dot{,dot,_dotdot}



Rename the helper is_dot_dotdot() into the name_ namespace
and add complementary helpers to check for dot and dotdot
names individually.

Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Link: https://patch.msgid.link/20260128132406.23768-3-amir73il@gmail.com


Reviewed-by: default avatarEric Biggers <ebiggers@kernel.org>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 1992330d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ struct fscrypt_nokey_name {

static inline bool fscrypt_is_dot_dotdot(const struct qstr *str)
{
	return is_dot_dotdot(str->name, str->len);
	return name_is_dot_dotdot(str->name, str->len);
}

/**
+1 −1
Original line number Diff line number Diff line
@@ -1904,7 +1904,7 @@ int ecryptfs_decode_and_decrypt_filename(char **plaintext_name,

	if ((mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) &&
	    !(mount_crypt_stat->flags & ECRYPTFS_ENCRYPTED_VIEW_ENABLED)) {
		if (is_dot_dotdot(name, name_size)) {
		if (name_is_dot_dotdot(name, name_size)) {
			rc = ecryptfs_copy_filename(plaintext_name,
						    plaintext_name_size,
						    name, name_size);
+2 −1
Original line number Diff line number Diff line
@@ -253,7 +253,8 @@ static bool filldir_one(struct dir_context *ctx, const char *name, int len,
		container_of(ctx, struct getdents_callback, ctx);

	buf->sequence++;
	if (buf->ino == ino && len <= NAME_MAX && !is_dot_dotdot(name, len)) {
	if (buf->ino == ino && len <= NAME_MAX &&
	    !name_is_dot_dotdot(name, len)) {
		memcpy(buf->name, name, len);
		buf->name[len] = '\0';
		buf->found = 1;
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ int f2fs_init_casefolded_name(const struct inode *dir,
	int len;

	if (IS_CASEFOLDED(dir) &&
	    !is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) {
	    !name_is_dot_dotdot(fname->usr_fname->name, fname->usr_fname->len)) {
		buf = f2fs_kmem_cache_alloc(f2fs_cf_name_slab,
					    GFP_NOFS, false, F2FS_SB(sb));
		if (!buf)
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ void f2fs_hash_filename(const struct inode *dir, struct f2fs_filename *fname)

	WARN_ON_ONCE(!name);

	if (is_dot_dotdot(name, len)) {
	if (name_is_dot_dotdot(name, len)) {
		fname->hash = 0;
		return;
	}
Loading