* [PATCH 0/2] ubifs: Get rid of some ifdefs
@ 2019-03-26 7:52 Sascha Hauer
2019-03-26 7:52 ` [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION Sascha Hauer
2019-03-26 7:52 ` [PATCH 2/2] ubifs: Remove ifdefs around CONFIG_UBIFS_ATIME_SUPPORT Sascha Hauer
0 siblings, 2 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-03-26 7:52 UTC (permalink / raw)
To: linux-mtd
Cc: Richard Weinberger, linux-fscrypt, Theodore Y . Ts'o,
Sascha Hauer, kernel
This series gets rid of some ifdefs in the UBFIS code. fscrypt folks are
on Cc because I introduce a static inline wrapper for setting the
super_block.s_cop ops so that filesystems do not have to add a
#ifdef CONFIG_FS_ENCRYPTION around setting the ops. I can do this as an
extra patch if that's desired.
Sascha
Sascha Hauer (2):
ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
ubifs: Remove ifdefs around CONFIG_UBIFS_ATIME_SUPPORT
fs/ubifs/dir.c | 2 --
fs/ubifs/file.c | 16 +++++++---------
fs/ubifs/ioctl.c | 11 +----------
fs/ubifs/sb.c | 7 ++++---
fs/ubifs/super.c | 20 +++++++++-----------
fs/ubifs/ubifs.h | 2 --
include/linux/fscrypt.h | 11 +++++++++++
7 files changed, 32 insertions(+), 37 deletions(-)
--
2.20.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
2019-03-26 7:52 [PATCH 0/2] ubifs: Get rid of some ifdefs Sascha Hauer
@ 2019-03-26 7:52 ` Sascha Hauer
2019-05-08 3:19 ` Eric Biggers
2019-03-26 7:52 ` [PATCH 2/2] ubifs: Remove ifdefs around CONFIG_UBIFS_ATIME_SUPPORT Sascha Hauer
1 sibling, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2019-03-26 7:52 UTC (permalink / raw)
To: linux-mtd
Cc: Richard Weinberger, linux-fscrypt, Theodore Y . Ts'o,
Sascha Hauer, kernel
ifdefs reduce readablity and compile coverage. This removes the ifdefs
around CONFIG_FS_ENCRYPTION by using IS_ENABLED and relying on static
inline wrappers. A new static inline wrapper for setting sb->s_cop is
introduced to allow filesystems to unconditionally compile in their
s_cop operations.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/ubifs/ioctl.c | 11 +----------
fs/ubifs/sb.c | 7 ++++---
fs/ubifs/super.c | 4 +---
include/linux/fscrypt.h | 11 +++++++++++
4 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
index 82e4e6a30b04..6b05b3ec500e 100644
--- a/fs/ubifs/ioctl.c
+++ b/fs/ubifs/ioctl.c
@@ -193,7 +193,6 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return err;
}
case FS_IOC_SET_ENCRYPTION_POLICY: {
-#ifdef CONFIG_FS_ENCRYPTION
struct ubifs_info *c = inode->i_sb->s_fs_info;
err = ubifs_enable_encryption(c);
@@ -201,17 +200,9 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return err;
return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
-#else
- return -EOPNOTSUPP;
-#endif
}
- case FS_IOC_GET_ENCRYPTION_POLICY: {
-#ifdef CONFIG_FS_ENCRYPTION
+ case FS_IOC_GET_ENCRYPTION_POLICY:
return fscrypt_ioctl_get_policy(file, (void __user *)arg);
-#else
- return -EOPNOTSUPP;
-#endif
- }
default:
return -ENOTTY;
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 67fac1e8adfb..2afc8b1d4c3b 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -748,14 +748,12 @@ int ubifs_read_superblock(struct ubifs_info *c)
goto out;
}
-#ifndef CONFIG_FS_ENCRYPTION
- if (c->encrypted) {
+ if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION) && c->encrypted) {
ubifs_err(c, "file system contains encrypted files but UBIFS"
" was built without crypto support.");
err = -EINVAL;
goto out;
}
-#endif
/* Automatically increase file system size to the maximum size */
c->old_leb_cnt = c->leb_cnt;
@@ -943,6 +941,9 @@ int ubifs_enable_encryption(struct ubifs_info *c)
int err;
struct ubifs_sb_node *sup = c->sup_node;
+ if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION))
+ return -EOPNOTSUPP;
+
if (c->encrypted)
return 0;
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 8dc2818fdd84..e6da7fc0e2a4 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -2146,9 +2146,7 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent)
#ifdef CONFIG_UBIFS_FS_XATTR
sb->s_xattr = ubifs_xattr_handlers;
#endif
-#ifdef CONFIG_FS_ENCRYPTION
- sb->s_cop = &ubifs_crypt_operations;
-#endif
+ fscrypt_set_ops(sb, &ubifs_crypt_operations);
mutex_lock(&c->umount_mutex);
err = mount_ubifs(c);
diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h
index e5194fc3983e..9a5792dac16a 100644
--- a/include/linux/fscrypt.h
+++ b/include/linux/fscrypt.h
@@ -230,6 +230,11 @@ extern int __fscrypt_encrypt_symlink(struct inode *inode, const char *target,
extern const char *fscrypt_get_symlink(struct inode *inode, const void *caddr,
unsigned int max_size,
struct delayed_call *done);
+static inline void fscrypt_set_ops(struct super_block *sb,
+ const struct fscrypt_operations *s_cop)
+{
+ sb->s_cop = s_cop;
+}
#else /* !CONFIG_FS_ENCRYPTION */
static inline bool fscrypt_has_encryption_key(const struct inode *inode)
@@ -446,6 +451,12 @@ static inline const char *fscrypt_get_symlink(struct inode *inode,
{
return ERR_PTR(-EOPNOTSUPP);
}
+
+static inline void fscrypt_set_ops(struct super_block *sb,
+ const struct fscrypt_operations *s_cop)
+{
+}
+
#endif /* !CONFIG_FS_ENCRYPTION */
/**
--
2.20.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ubifs: Remove ifdefs around CONFIG_UBIFS_ATIME_SUPPORT
2019-03-26 7:52 [PATCH 0/2] ubifs: Get rid of some ifdefs Sascha Hauer
2019-03-26 7:52 ` [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION Sascha Hauer
@ 2019-03-26 7:52 ` Sascha Hauer
1 sibling, 0 replies; 7+ messages in thread
From: Sascha Hauer @ 2019-03-26 7:52 UTC (permalink / raw)
To: linux-mtd
Cc: Richard Weinberger, linux-fscrypt, Theodore Y . Ts'o,
Sascha Hauer, kernel
ifdefs reduce readability and compile coverage. This removes the ifdefs
around CONFIG_UBIFS_ATIME_SUPPORT by replacing them with IS_ENABLED()
where applicable. The fs layer would fall back to generic_update_time()
when .update_time doesn't exist. We do this fallback explicitly now.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/ubifs/dir.c | 2 --
fs/ubifs/file.c | 16 +++++++---------
fs/ubifs/super.c | 16 ++++++++--------
fs/ubifs/ubifs.h | 2 --
4 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c
index 5767b373a8ff..cb286fd075fc 100644
--- a/fs/ubifs/dir.c
+++ b/fs/ubifs/dir.c
@@ -1652,9 +1652,7 @@ const struct inode_operations ubifs_dir_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr,
#endif
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
.update_time = ubifs_update_time,
-#endif
.tmpfile = ubifs_tmpfile,
};
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index 5d2ffb1a45fc..512e7d9c60cd 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -1375,7 +1375,6 @@ static inline int mctime_update_needed(const struct inode *inode,
return 0;
}
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
/**
* ubifs_update_time - update time of inode.
* @inode: inode to update
@@ -1392,6 +1391,9 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
int iflags = I_DIRTY_TIME;
int err, release;
+ if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
+ return generic_update_time(inode, time, flags);
+
err = ubifs_budget_space(c, &req);
if (err)
return err;
@@ -1414,7 +1416,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time,
ubifs_release_budget(c, &req);
return 0;
}
-#endif
/**
* update_mctime - update mtime and ctime of an inode.
@@ -1623,9 +1624,10 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
if (err)
return err;
vma->vm_ops = &ubifs_file_vm_ops;
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
- file_accessed(file);
-#endif
+
+ if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
+ file_accessed(file);
+
return 0;
}
@@ -1663,9 +1665,7 @@ const struct inode_operations ubifs_file_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr,
#endif
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
.update_time = ubifs_update_time,
-#endif
};
const struct inode_operations ubifs_symlink_inode_operations = {
@@ -1675,9 +1675,7 @@ const struct inode_operations ubifs_symlink_inode_operations = {
#ifdef CONFIG_UBIFS_FS_XATTR
.listxattr = ubifs_listxattr,
#endif
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
.update_time = ubifs_update_time,
-#endif
};
const struct file_operations ubifs_file_operations = {
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index e6da7fc0e2a4..2c647d66e48e 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -129,9 +129,10 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
goto out_ino;
inode->i_flags |= S_NOCMTIME;
-#ifndef CONFIG_UBIFS_ATIME_SUPPORT
- inode->i_flags |= S_NOATIME;
-#endif
+
+ if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
+ inode->i_flags |= S_NOATIME;
+
set_nlink(inode, le32_to_cpu(ino->nlink));
i_uid_write(inode, le32_to_cpu(ino->uid));
i_gid_write(inode, le32_to_cpu(ino->gid));
@@ -2248,11 +2249,10 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags,
goto out_deact;
/* We do not support atime */
sb->s_flags |= SB_ACTIVE;
-#ifndef CONFIG_UBIFS_ATIME_SUPPORT
- sb->s_flags |= SB_NOATIME;
-#else
- ubifs_msg(c, "full atime support is enabled.");
-#endif
+ if (IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT))
+ ubifs_msg(c, "full atime support is enabled.");
+ else
+ sb->s_flags |= SB_NOATIME;
}
/* 'fill_super()' opens ubi again so we must close it here */
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 1ae12900e01d..69dfd64d3d00 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1996,9 +1996,7 @@ int ubifs_calc_dark(const struct ubifs_info *c, int spc);
/* file.c */
int ubifs_fsync(struct file *file, loff_t start, loff_t end, int datasync);
int ubifs_setattr(struct dentry *dentry, struct iattr *attr);
-#ifdef CONFIG_UBIFS_ATIME_SUPPORT
int ubifs_update_time(struct inode *inode, struct timespec64 *time, int flags);
-#endif
/* dir.c */
struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir,
--
2.20.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
2019-03-26 7:52 ` [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION Sascha Hauer
@ 2019-05-08 3:19 ` Eric Biggers
2019-05-08 6:49 ` Richard Weinberger
0 siblings, 1 reply; 7+ messages in thread
From: Eric Biggers @ 2019-05-08 3:19 UTC (permalink / raw)
To: Sascha Hauer, Richard Weinberger
Cc: Theodore Y . Ts'o, linux-fscrypt, linux-mtd, kernel
On Tue, Mar 26, 2019 at 08:52:31AM +0100, Sascha Hauer wrote:
> ifdefs reduce readablity and compile coverage. This removes the ifdefs
> around CONFIG_FS_ENCRYPTION by using IS_ENABLED and relying on static
> inline wrappers. A new static inline wrapper for setting sb->s_cop is
> introduced to allow filesystems to unconditionally compile in their
> s_cop operations.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> fs/ubifs/ioctl.c | 11 +----------
> fs/ubifs/sb.c | 7 ++++---
> fs/ubifs/super.c | 4 +---
> include/linux/fscrypt.h | 11 +++++++++++
> 4 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
> index 82e4e6a30b04..6b05b3ec500e 100644
> --- a/fs/ubifs/ioctl.c
> +++ b/fs/ubifs/ioctl.c
> @@ -193,7 +193,6 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> return err;
> }
> case FS_IOC_SET_ENCRYPTION_POLICY: {
> -#ifdef CONFIG_FS_ENCRYPTION
> struct ubifs_info *c = inode->i_sb->s_fs_info;
>
> err = ubifs_enable_encryption(c);
> @@ -201,17 +200,9 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> return err;
>
> return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
> -#else
> - return -EOPNOTSUPP;
> -#endif
> }
> - case FS_IOC_GET_ENCRYPTION_POLICY: {
> -#ifdef CONFIG_FS_ENCRYPTION
> + case FS_IOC_GET_ENCRYPTION_POLICY:
> return fscrypt_ioctl_get_policy(file, (void __user *)arg);
> -#else
> - return -EOPNOTSUPP;
> -#endif
> - }
>
> default:
> return -ENOTTY;
> diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
> index 67fac1e8adfb..2afc8b1d4c3b 100644
> --- a/fs/ubifs/sb.c
> +++ b/fs/ubifs/sb.c
> @@ -748,14 +748,12 @@ int ubifs_read_superblock(struct ubifs_info *c)
> goto out;
> }
>
> -#ifndef CONFIG_FS_ENCRYPTION
> - if (c->encrypted) {
> + if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION) && c->encrypted) {
> ubifs_err(c, "file system contains encrypted files but UBIFS"
> " was built without crypto support.");
> err = -EINVAL;
> goto out;
> }
A bit late, but I noticed this in ubifs/linux-next. This needs to use
CONFIG_FS_ENCRYPTION here, not CONFIG_UBIFS_FS_ENCRYPTION, as the latter no
longer exists.
> -#endif
>
> /* Automatically increase file system size to the maximum size */
> c->old_leb_cnt = c->leb_cnt;
> @@ -943,6 +941,9 @@ int ubifs_enable_encryption(struct ubifs_info *c)
> int err;
> struct ubifs_sb_node *sup = c->sup_node;
>
> + if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION))
> + return -EOPNOTSUPP;
> +
Same here.
- Eric
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
2019-05-08 3:19 ` Eric Biggers
@ 2019-05-08 6:49 ` Richard Weinberger
2019-05-13 19:56 ` Eric Biggers
0 siblings, 1 reply; 7+ messages in thread
From: Richard Weinberger @ 2019-05-08 6:49 UTC (permalink / raw)
To: Eric Biggers; +Cc: tytso, Sascha Hauer, linux-mtd, linux-fscrypt, kernel
Eric,
----- Ursprüngliche Mail -----
> Von: "Eric Biggers" <ebiggers@kernel.org>
> An: "Sascha Hauer" <s.hauer@pengutronix.de>, "richard" <richard@nod.at>
> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, linux-fscrypt@vger.kernel.org, "tytso" <tytso@mit.edu>, "kernel"
> <kernel@pengutronix.de>
> Gesendet: Mittwoch, 8. Mai 2019 05:19:55
> Betreff: Re: [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
> On Tue, Mar 26, 2019 at 08:52:31AM +0100, Sascha Hauer wrote:
>> ifdefs reduce readablity and compile coverage. This removes the ifdefs
>> around CONFIG_FS_ENCRYPTION by using IS_ENABLED and relying on static
>> inline wrappers. A new static inline wrapper for setting sb->s_cop is
>> introduced to allow filesystems to unconditionally compile in their
>> s_cop operations.
>>
>> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>> ---
>> fs/ubifs/ioctl.c | 11 +----------
>> fs/ubifs/sb.c | 7 ++++---
>> fs/ubifs/super.c | 4 +---
>> include/linux/fscrypt.h | 11 +++++++++++
>> 4 files changed, 17 insertions(+), 16 deletions(-)
>>
>> diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
>> index 82e4e6a30b04..6b05b3ec500e 100644
>> --- a/fs/ubifs/ioctl.c
>> +++ b/fs/ubifs/ioctl.c
>> @@ -193,7 +193,6 @@ long ubifs_ioctl(struct file *file, unsigned int cmd,
>> unsigned long arg)
>> return err;
>> }
>> case FS_IOC_SET_ENCRYPTION_POLICY: {
>> -#ifdef CONFIG_FS_ENCRYPTION
>> struct ubifs_info *c = inode->i_sb->s_fs_info;
>>
>> err = ubifs_enable_encryption(c);
>> @@ -201,17 +200,9 @@ long ubifs_ioctl(struct file *file, unsigned int cmd,
>> unsigned long arg)
>> return err;
>>
>> return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
>> -#else
>> - return -EOPNOTSUPP;
>> -#endif
>> }
>> - case FS_IOC_GET_ENCRYPTION_POLICY: {
>> -#ifdef CONFIG_FS_ENCRYPTION
>> + case FS_IOC_GET_ENCRYPTION_POLICY:
>> return fscrypt_ioctl_get_policy(file, (void __user *)arg);
>> -#else
>> - return -EOPNOTSUPP;
>> -#endif
>> - }
>>
>> default:
>> return -ENOTTY;
>> diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
>> index 67fac1e8adfb..2afc8b1d4c3b 100644
>> --- a/fs/ubifs/sb.c
>> +++ b/fs/ubifs/sb.c
>> @@ -748,14 +748,12 @@ int ubifs_read_superblock(struct ubifs_info *c)
>> goto out;
>> }
>>
>> -#ifndef CONFIG_FS_ENCRYPTION
>> - if (c->encrypted) {
>> + if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION) && c->encrypted) {
>> ubifs_err(c, "file system contains encrypted files but UBIFS"
>> " was built without crypto support.");
>> err = -EINVAL;
>> goto out;
>> }
>
> A bit late, but I noticed this in ubifs/linux-next. This needs to use
> CONFIG_FS_ENCRYPTION here, not CONFIG_UBIFS_FS_ENCRYPTION, as the latter no
> longer exists.
Thanks for spotting. I'll fit it myself in -next.
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
2019-05-08 6:49 ` Richard Weinberger
@ 2019-05-13 19:56 ` Eric Biggers
2019-05-13 21:39 ` Richard Weinberger
0 siblings, 1 reply; 7+ messages in thread
From: Eric Biggers @ 2019-05-13 19:56 UTC (permalink / raw)
To: Richard Weinberger; +Cc: tytso, Sascha Hauer, linux-mtd, linux-fscrypt, kernel
On Wed, May 08, 2019 at 08:49:18AM +0200, Richard Weinberger wrote:
> Eric,
>
> ----- Ursprüngliche Mail -----
> > Von: "Eric Biggers" <ebiggers@kernel.org>
> > An: "Sascha Hauer" <s.hauer@pengutronix.de>, "richard" <richard@nod.at>
> > CC: "linux-mtd" <linux-mtd@lists.infradead.org>, linux-fscrypt@vger.kernel.org, "tytso" <tytso@mit.edu>, "kernel"
> > <kernel@pengutronix.de>
> > Gesendet: Mittwoch, 8. Mai 2019 05:19:55
> > Betreff: Re: [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
>
> > On Tue, Mar 26, 2019 at 08:52:31AM +0100, Sascha Hauer wrote:
> >> ifdefs reduce readablity and compile coverage. This removes the ifdefs
> >> around CONFIG_FS_ENCRYPTION by using IS_ENABLED and relying on static
> >> inline wrappers. A new static inline wrapper for setting sb->s_cop is
> >> introduced to allow filesystems to unconditionally compile in their
> >> s_cop operations.
> >>
> >> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> >> ---
> >> fs/ubifs/ioctl.c | 11 +----------
> >> fs/ubifs/sb.c | 7 ++++---
> >> fs/ubifs/super.c | 4 +---
> >> include/linux/fscrypt.h | 11 +++++++++++
> >> 4 files changed, 17 insertions(+), 16 deletions(-)
> >>
> >> diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c
> >> index 82e4e6a30b04..6b05b3ec500e 100644
> >> --- a/fs/ubifs/ioctl.c
> >> +++ b/fs/ubifs/ioctl.c
> >> @@ -193,7 +193,6 @@ long ubifs_ioctl(struct file *file, unsigned int cmd,
> >> unsigned long arg)
> >> return err;
> >> }
> >> case FS_IOC_SET_ENCRYPTION_POLICY: {
> >> -#ifdef CONFIG_FS_ENCRYPTION
> >> struct ubifs_info *c = inode->i_sb->s_fs_info;
> >>
> >> err = ubifs_enable_encryption(c);
> >> @@ -201,17 +200,9 @@ long ubifs_ioctl(struct file *file, unsigned int cmd,
> >> unsigned long arg)
> >> return err;
> >>
> >> return fscrypt_ioctl_set_policy(file, (const void __user *)arg);
> >> -#else
> >> - return -EOPNOTSUPP;
> >> -#endif
> >> }
> >> - case FS_IOC_GET_ENCRYPTION_POLICY: {
> >> -#ifdef CONFIG_FS_ENCRYPTION
> >> + case FS_IOC_GET_ENCRYPTION_POLICY:
> >> return fscrypt_ioctl_get_policy(file, (void __user *)arg);
> >> -#else
> >> - return -EOPNOTSUPP;
> >> -#endif
> >> - }
> >>
> >> default:
> >> return -ENOTTY;
> >> diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
> >> index 67fac1e8adfb..2afc8b1d4c3b 100644
> >> --- a/fs/ubifs/sb.c
> >> +++ b/fs/ubifs/sb.c
> >> @@ -748,14 +748,12 @@ int ubifs_read_superblock(struct ubifs_info *c)
> >> goto out;
> >> }
> >>
> >> -#ifndef CONFIG_FS_ENCRYPTION
> >> - if (c->encrypted) {
> >> + if (!IS_ENABLED(CONFIG_UBIFS_FS_ENCRYPTION) && c->encrypted) {
> >> ubifs_err(c, "file system contains encrypted files but UBIFS"
> >> " was built without crypto support.");
> >> err = -EINVAL;
> >> goto out;
> >> }
> >
> > A bit late, but I noticed this in ubifs/linux-next. This needs to use
> > CONFIG_FS_ENCRYPTION here, not CONFIG_UBIFS_FS_ENCRYPTION, as the latter no
> > longer exists.
>
> Thanks for spotting. I'll fit it myself in -next.
>
> Thanks,
> //richard
This was merged to mainline and it's still broken. This breaks UBIFS encryption
entirely, BTW. Do you not run xfstests before sending pull requests?
- Eric
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION
2019-05-13 19:56 ` Eric Biggers
@ 2019-05-13 21:39 ` Richard Weinberger
0 siblings, 0 replies; 7+ messages in thread
From: Richard Weinberger @ 2019-05-13 21:39 UTC (permalink / raw)
To: Eric Biggers; +Cc: tytso, Sascha Hauer, linux-mtd, linux-fscrypt, kernel
----- Ursprüngliche Mail -----
> This was merged to mainline and it's still broken. This breaks UBIFS encryption
> entirely, BTW. Do you not run xfstests before sending pull requests?
The simple answer is, not this time because my Laptops' filesystem broke
and I was kind of busy with recovery.
The issue is known, we have a patch and fixup will be sent to Linus
very soon. Nobody got hurt.
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-05-13 21:39 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 7:52 [PATCH 0/2] ubifs: Get rid of some ifdefs Sascha Hauer
2019-03-26 7:52 ` [PATCH 1/2] ubifs: Remove #ifdef around CONFIG_FS_ENCRYPTION Sascha Hauer
2019-05-08 3:19 ` Eric Biggers
2019-05-08 6:49 ` Richard Weinberger
2019-05-13 19:56 ` Eric Biggers
2019-05-13 21:39 ` Richard Weinberger
2019-03-26 7:52 ` [PATCH 2/2] ubifs: Remove ifdefs around CONFIG_UBIFS_ATIME_SUPPORT Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).