[PATCH 1/1] affs: AFFS_NO_TRUNCATE added to Kconfig

Fabian Frederick
2014-03-03T18:20:56Z

Filename truncate process is defined in affs.h.

This patch exports current define to Kconfig and removes
AFFS_MAX_PREALLOC which is never used.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/affs/Kconfig | 12 ++++++++++++
fs/affs/affs.h | 9 ---------
fs/affs/amigaffs.c | 2 +-
3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/fs/affs/Kconfig b/fs/affs/Kconfig
index a04d9e8..4db24d9 100644
--- a/fs/affs/Kconfig
+++ b/fs/affs/Kconfig
@@ -19,3 +19,15 @@ config AFFS_FS

To compile this file system support as a module, choose M here: the
module will be called affs. If unsure, say N.
+
+config AFFS_NO_TRUNCATE
+ bool "Amiga FFS no filename truncate"
+ depends on AFFS_FS
+ default n
+ help
+ If you say Y here, creating filesystem objects with longer names than
+ 30 characters (standard limit) will result in an error (ENAMETOOLONG).
+
+ By default this option is disabled and filenames are automatically
+ truncated.
+
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index 3952121..128ae5d 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -5,14 +5,6 @@
#include <linux/mutex.h>
#include <linux/workqueue.h>

-/* AmigaOS allows file names with up to 30 characters length.
- * Names longer than that will be silently truncated. If you
- * want to disallow this, comment out the following #define.
- * Creating filesystem objects with longer names will then
- * result in an error (ENAMETOOLONG).
- */
-/*#define AFFS_NO_TRUNCATE */
-
/* Ugly macros make the code more pretty. */

#define GET_END_PTR(st,p,sz) ((st *)((char *)(p)+((sz)-sizeof(st))))
@@ -28,7 +20,6 @@

#define AFFS_CACHE_SIZE PAGE_SIZE

-#define AFFS_MAX_PREALLOC 32
#define AFFS_LC_SIZE (AFFS_CACHE_SIZE/sizeof(u32)/2)
#define AFFS_AC_SIZE (AFFS_CACHE_SIZE/sizeof(struct affs_ext_key)/2)
#define AFFS_AC_MASK (AFFS_AC_SIZE-1)
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index d9a4367..6e7b4cd 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -479,7 +479,7 @@ affs_check_name(const unsigned char *name, int len)
int i;

if (len > 30)
-#ifdef AFFS_NO_TRUNCATE
+#ifdef CONFIG_AFFS_NO_TRUNCATE
return -ENAMETOOLONG;
#else
len = 30;
--
1.8.1.4