LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/7] fs/ntfs3: Refactor header includes
@ 2021-08-31 14:14 Kari Argillander
  2021-08-31 14:14 ` [PATCH 1/7] fs/ntfs3: Add missing header files to ntfs.h Kari Argillander
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

Right now header includes are big mess with ntfs3 imo. We cannot example
include ntfs3 headers without need of punch of includes to source file.
This patch set try to address that. When this patch series is applied we
can include any header file without need of include anything else. This
does not mean source file should rely what header file includes. Instead
it should include them by self also if it needs them.

When some include is added I have write why this is needed to commit
message. Hopefully this will help when someone wants to correct them
again. I have also just delete unnecessary headers from some .c files
and not added what is needed. Usually deleted headers where there
because ntfs_fs.h need them not file itself. When file was simple enough
I added all necessary linux headers.

I did not add linux/headers to all files yet. That is big job. This is
good starting point. I did try to build every file itself so this will
build like it should.

Please do not hesitate to tell if there is something wrong with this
series or somethings could be done better.

Kari Argillander (7):
  fs/ntfs3: Add missing header files to ntfs.h
  fs/ntfs3: Add missing headers and forward declarations to ntfs_fs.h
  fs/ntfs3: Add missing header and guards to lib/ headers
  fs/ntfs3: Change right headers to bitfunc.c
  fs/ntfs3: Change right headers to upcase.c
  fs/ntfs3: Change right headers to lznt.c
  fs/ntfs3: Remove unneeded header files from c files

 fs/ntfs3/attrib.c                |  5 -----
 fs/ntfs3/attrlist.c              |  3 ---
 fs/ntfs3/bitfunc.c               |  7 +------
 fs/ntfs3/bitmap.c                |  3 ---
 fs/ntfs3/dir.c                   |  3 ---
 fs/ntfs3/file.c                  |  1 -
 fs/ntfs3/frecord.c               |  3 ---
 fs/ntfs3/fslog.c                 |  4 ----
 fs/ntfs3/fsntfs.c                |  1 -
 fs/ntfs3/index.c                 |  1 -
 fs/ntfs3/inode.c                 |  2 --
 fs/ntfs3/lib/decompress_common.h |  5 +++++
 fs/ntfs3/lib/lib.h               |  6 ++++++
 fs/ntfs3/lznt.c                  | 10 +++++-----
 fs/ntfs3/namei.c                 |  4 ----
 fs/ntfs3/ntfs.h                  |  9 +++++++++
 fs/ntfs3/ntfs_fs.h               | 31 +++++++++++++++++++++++++++++++
 fs/ntfs3/record.c                |  3 ---
 fs/ntfs3/run.c                   |  2 --
 fs/ntfs3/super.c                 |  2 --
 fs/ntfs3/upcase.c                |  8 ++------
 fs/ntfs3/xattr.c                 |  3 ---
 22 files changed, 59 insertions(+), 57 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/7] fs/ntfs3: Add missing header files to ntfs.h
  2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
@ 2021-08-31 14:14 ` Kari Argillander
  2021-08-31 14:14 ` [PATCH 2/7] fs/ntfs3: Add missing headers and forward declarations to ntfs_fs.h Kari Argillander
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

We do not have header files at all in this file. Add following headers
and there is also explanation which for it was added. Note that
explanation might not be complete, but it just proofs it is needed.

<linux/blkdev.h> // SECTOR_SHIFT
<linux/build_bug.h> // static_assert()
<linux/kernel.h> // cpu_to_le64, cpu_to_le32, ALIGN
<linux/stddef.h> // offsetof()
<linux/string.h> // memcmp()
<linux/types.h> //__le32, __le16

"debug.h" // PtrOffset(), Add2Ptr()

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/ntfs.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h
index 0fd7bffb98d4..778be353ffe6 100644
--- a/fs/ntfs3/ntfs.h
+++ b/fs/ntfs3/ntfs.h
@@ -10,6 +10,15 @@
 #ifndef _LINUX_NTFS3_NTFS_H
 #define _LINUX_NTFS3_NTFS_H
 
+#include <linux/blkdev.h>
+#include <linux/build_bug.h>
+#include <linux/kernel.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
+
+#include "debug.h"
+
 /* TODO: Check 4K MFT record and 512 bytes cluster. */
 
 /* Activate this define to use binary search in indexes. */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/7] fs/ntfs3: Add missing headers and forward declarations to ntfs_fs.h
  2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
  2021-08-31 14:14 ` [PATCH 1/7] fs/ntfs3: Add missing header files to ntfs.h Kari Argillander
@ 2021-08-31 14:14 ` Kari Argillander
  2021-08-31 14:14 ` [PATCH 3/7] fs/ntfs3: Add missing header and guards to lib/ headers Kari Argillander
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

We do not have headers at all in this file. We should have them so that
not every .c file needs to include all of the stuff which this file need
for building. This way we can remove some headers from other files and
get better picture what is needed. This can save some compilation time.
And this can help if we sometimes want to separate this one big header.

Also use forward declarations for structs and enums when it not included
straight with include and it is used in function declarations input.
This will prevent possible compiler warning:
  xxx declared inside parameter list will not be visible
  outside of this definition or declaration

Here is list which I made when parsing this. There is not necessarily
all example from this header file, but this just proofs we need it.

<linux/blkdev.h> SECTOR_SHIFT
<linux/buffer_head.h> sb_bread(), put_bh
<linux/cleancache.h> put_page()
<linux/fs.h> struct inode (Just struct ntfs_inode need it)
<linux/highmem.h> kunmap(), kmap()
<linux/kernel.h> cpu_to_leXX() ALIGN
<linux/mm.h> kvfree()
<linux/mutex.h> struct mutex, mutex_(un/try)lock()
<linux/page-flags.h> PageError()
<linux/pagemap.h> read_mapping_page()
<linux/rbtree.h> struct rb_root
<linux/rwsem.h> struct rw_semaphore
<linux/slab.h> krfree(), kzalloc()
<linux/string.h> memset()
<linux/time64.h> struct timespec64
<linux/types.h> uXX, __leXX
<linux/uidgid.h> kuid_t, kgid_t
<asm/div64.h> do_div()
<asm/page.h> PAGE_SIZE

"debug.h" ntfs_err() (Just one entry. Maybe we can drop this)
"ntfs.h" Do you even ask?

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/ntfs_fs.h | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 64ef92e16363..a39055cf9822 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -9,6 +9,37 @@
 #ifndef _LINUX_NTFS3_NTFS_FS_H
 #define _LINUX_NTFS3_NTFS_FS_H
 
+#include <linux/blkdev.h>
+#include <linux/buffer_head.h>
+#include <linux/cleancache.h>
+#include <linux/fs.h>
+#include <linux/highmem.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/mutex.h>
+#include <linux/page-flags.h>
+#include <linux/pagemap.h>
+#include <linux/rbtree.h>
+#include <linux/rwsem.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/time64.h>
+#include <linux/types.h>
+#include <linux/uidgid.h>
+#include <asm/div64.h>
+#include <asm/page.h>
+
+#include "debug.h"
+#include "ntfs.h"
+
+struct dentry;
+struct fiemap_extent_info;
+struct user_namespace;
+struct page;
+struct writeback_control;
+enum utf16_endian;
+
+
 #define MINUS_ONE_T			((size_t)(-1))
 /* Biggest MFT / smallest cluster */
 #define MAXIMUM_BYTES_PER_MFT		4096
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/7] fs/ntfs3: Add missing header and guards to lib/ headers
  2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
  2021-08-31 14:14 ` [PATCH 1/7] fs/ntfs3: Add missing header files to ntfs.h Kari Argillander
  2021-08-31 14:14 ` [PATCH 2/7] fs/ntfs3: Add missing headers and forward declarations to ntfs_fs.h Kari Argillander
@ 2021-08-31 14:14 ` Kari Argillander
  2021-08-31 14:14 ` [PATCH 4/7] fs/ntfs3: Change right headers to bitfunc.c Kari Argillander
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

size_t needs header. Add missing header guards so that compiler will
only include these ones.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/lib/decompress_common.h | 5 +++++
 fs/ntfs3/lib/lib.h               | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/fs/ntfs3/lib/decompress_common.h b/fs/ntfs3/lib/decompress_common.h
index 66297f398403..a2a858d4bf35 100644
--- a/fs/ntfs3/lib/decompress_common.h
+++ b/fs/ntfs3/lib/decompress_common.h
@@ -19,6 +19,9 @@
  * this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifndef _LINUX_NTFS3_LIB_DECOMPRESS_COMMON_H
+#define _LINUX_NTFS3_LIB_DECOMPRESS_COMMON_H
+
 #include <linux/string.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
@@ -350,3 +353,5 @@ static forceinline u8 *lz_copy(u8 *dst, u32 length, u32 offset, const u8 *bufend
 
 	return dst;
 }
+
+#endif /* _LINUX_NTFS3_LIB_DECOMPRESS_COMMON_H */
diff --git a/fs/ntfs3/lib/lib.h b/fs/ntfs3/lib/lib.h
index f508fbad2e71..90309a5ae59c 100644
--- a/fs/ntfs3/lib/lib.h
+++ b/fs/ntfs3/lib/lib.h
@@ -7,6 +7,10 @@
  * - linux kernel code style
  */
 
+#ifndef _LINUX_NTFS3_LIB_LIB_H
+#define _LINUX_NTFS3_LIB_LIB_H
+
+#include <linux/types.h>
 
 /* globals from xpress_decompress.c */
 struct xpress_decompressor *xpress_allocate_decompressor(void);
@@ -24,3 +28,5 @@ int lzx_decompress(struct lzx_decompressor *__restrict d,
 		   const void *__restrict compressed_data,
 		   size_t compressed_size, void *__restrict uncompressed_data,
 		   size_t uncompressed_size);
+
+#endif /* _LINUX_NTFS3_LIB_LIB_H */
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/7] fs/ntfs3: Change right headers to bitfunc.c
  2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
                   ` (2 preceding siblings ...)
  2021-08-31 14:14 ` [PATCH 3/7] fs/ntfs3: Add missing header and guards to lib/ headers Kari Argillander
@ 2021-08-31 14:14 ` Kari Argillander
  2021-08-31 14:14 ` [PATCH 5/7] fs/ntfs3: Change right headers to upcase.c Kari Argillander
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

We only need linux/types.h for types like u8 etc. So we can remove rest
and help compiler a little bit.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/bitfunc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/fs/ntfs3/bitfunc.c b/fs/ntfs3/bitfunc.c
index ce304d40b5e1..bf10e2da5c6e 100644
--- a/fs/ntfs3/bitfunc.c
+++ b/fs/ntfs3/bitfunc.c
@@ -5,13 +5,8 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
-#include <linux/fs.h>
-#include <linux/nls.h>
+#include <linux/types.h>
 
-#include "debug.h"
-#include "ntfs.h"
 #include "ntfs_fs.h"
 
 #define BITS_IN_SIZE_T (sizeof(size_t) * 8)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/7] fs/ntfs3: Change right headers to upcase.c
  2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
                   ` (3 preceding siblings ...)
  2021-08-31 14:14 ` [PATCH 4/7] fs/ntfs3: Change right headers to bitfunc.c Kari Argillander
@ 2021-08-31 14:14 ` Kari Argillander
  2021-08-31 14:14 ` [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c Kari Argillander
  2021-08-31 14:14 ` [PATCH 7/7] fs/ntfs3: Remove unneeded header files from c files Kari Argillander
  6 siblings, 0 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

There is no headers. They will be included through ntfs_fs.c, but that
is not right thing to do. Let's include headers what this file need
straight away.

types.h is needed for __le16, u8 etc.
kernel.h is needed for le16_to_cpu()

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/upcase.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/fs/ntfs3/upcase.c b/fs/ntfs3/upcase.c
index eb65bbd939e8..eb815609fd0b 100644
--- a/fs/ntfs3/upcase.c
+++ b/fs/ntfs3/upcase.c
@@ -5,13 +5,9 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
-#include <linux/module.h>
-#include <linux/nls.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
 
-#include "debug.h"
-#include "ntfs.h"
 #include "ntfs_fs.h"
 
 static inline u16 upcase_unicode_char(const u16 *upcase, u16 chr)
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c
  2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
                   ` (4 preceding siblings ...)
  2021-08-31 14:14 ` [PATCH 5/7] fs/ntfs3: Change right headers to upcase.c Kari Argillander
@ 2021-08-31 14:14 ` Kari Argillander
  2021-08-31 17:54   ` kernel test robot
  2021-09-01  0:45   ` kernel test robot
  2021-08-31 14:14 ` [PATCH 7/7] fs/ntfs3: Remove unneeded header files from c files Kari Argillander
  6 siblings, 2 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

There is lot of headers which we do not need in this file. Delete them
and add what we really need. Here is list which identify why we need
this header.

<linux/kernel.h> // min()
<linux/slab.h> // kzalloc()
<linux/stddef.h> // offsetof()
<linux/string.h> // memcpy(), memset()
<linux/types.h> // u8, size_t, etc.

"debug.h" // PtrOffset()

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/lznt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/fs/ntfs3/lznt.c b/fs/ntfs3/lznt.c
index 3acf0d9f0b15..0bd3dd61d784 100644
--- a/fs/ntfs3/lznt.c
+++ b/fs/ntfs3/lznt.c
@@ -5,13 +5,13 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
-#include <linux/fs.h>
-#include <linux/nls.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/stddef.h>
+#include <linux/string.h>
+#include <linux/types.h>
 
 #include "debug.h"
-#include "ntfs.h"
 #include "ntfs_fs.h"
 
 // clang-format off
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 7/7] fs/ntfs3: Remove unneeded header files from c files
  2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
                   ` (5 preceding siblings ...)
  2021-08-31 14:14 ` [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c Kari Argillander
@ 2021-08-31 14:14 ` Kari Argillander
  6 siblings, 0 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 14:14 UTC (permalink / raw)
  To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel

We have lot of unnecessary headers in these files. Remove them so that
we help compiler a little bit.

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/attrib.c   | 5 -----
 fs/ntfs3/attrlist.c | 3 ---
 fs/ntfs3/bitmap.c   | 3 ---
 fs/ntfs3/dir.c      | 3 ---
 fs/ntfs3/file.c     | 1 -
 fs/ntfs3/frecord.c  | 3 ---
 fs/ntfs3/fslog.c    | 4 ----
 fs/ntfs3/fsntfs.c   | 1 -
 fs/ntfs3/index.c    | 1 -
 fs/ntfs3/inode.c    | 2 --
 fs/ntfs3/namei.c    | 4 ----
 fs/ntfs3/record.c   | 3 ---
 fs/ntfs3/run.c      | 2 --
 fs/ntfs3/super.c    | 2 --
 fs/ntfs3/xattr.c    | 3 ---
 15 files changed, 40 deletions(-)

diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
index 4b285f704e62..b4290b4f996d 100644
--- a/fs/ntfs3/attrib.c
+++ b/fs/ntfs3/attrib.c
@@ -6,12 +6,7 @@
  * TODO: Merge attr_set_size/attr_data_get_block/attr_allocate_frame?
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/hash.h>
-#include <linux/nls.h>
-#include <linux/ratelimit.h>
 #include <linux/slab.h>
 
 #include "debug.h"
diff --git a/fs/ntfs3/attrlist.c b/fs/ntfs3/attrlist.c
index 32ca990af64b..4d1bb695e650 100644
--- a/fs/ntfs3/attrlist.c
+++ b/fs/ntfs3/attrlist.c
@@ -5,10 +5,7 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/nls.h>
 
 #include "debug.h"
 #include "ntfs.h"
diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c
index 06ae38adb8ad..01c639865132 100644
--- a/fs/ntfs3/bitmap.c
+++ b/fs/ntfs3/bitmap.c
@@ -10,12 +10,9 @@
  *
  */
 
-#include <linux/blkdev.h>
 #include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/nls.h>
 
-#include "debug.h"
 #include "ntfs.h"
 #include "ntfs_fs.h"
 
diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c
index 93f6d485564e..76697ec3c146 100644
--- a/fs/ntfs3/dir.c
+++ b/fs/ntfs3/dir.c
@@ -7,10 +7,7 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/iversion.h>
 #include <linux/nls.h>
 
 #include "debug.h"
diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 26346771d9dc..bf3b7b666423 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -13,7 +13,6 @@
 #include <linux/falloc.h>
 #include <linux/fiemap.h>
 #include <linux/msdos_fs.h> /* FAT_IOCTL_XXX */
-#include <linux/nls.h>
 
 #include "debug.h"
 #include "ntfs.h"
diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c
index 9d374827750b..50c185da8fbb 100644
--- a/fs/ntfs3/frecord.c
+++ b/fs/ntfs3/frecord.c
@@ -5,11 +5,8 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fiemap.h>
 #include <linux/fs.h>
-#include <linux/nls.h>
 #include <linux/vmalloc.h>
 
 #include "debug.h"
diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
index 6f6057129fdd..38235c1c60a2 100644
--- a/fs/ntfs3/fslog.c
+++ b/fs/ntfs3/fslog.c
@@ -6,12 +6,8 @@
  */
 
 #include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/hash.h>
-#include <linux/nls.h>
 #include <linux/random.h>
-#include <linux/ratelimit.h>
 #include <linux/slab.h>
 
 #include "debug.h"
diff --git a/fs/ntfs3/fsntfs.c b/fs/ntfs3/fsntfs.c
index 0edb95ed9717..3eec44671a71 100644
--- a/fs/ntfs3/fsntfs.c
+++ b/fs/ntfs3/fsntfs.c
@@ -8,7 +8,6 @@
 #include <linux/blkdev.h>
 #include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/nls.h>
 
 #include "debug.h"
 #include "ntfs.h"
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index 70ef59455b72..fec1e72206e8 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -8,7 +8,6 @@
 #include <linux/blkdev.h>
 #include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/nls.h>
 
 #include "debug.h"
 #include "ntfs.h"
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index b86ec7dd731c..00ce4c40b3fc 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -5,10 +5,8 @@
  *
  */
 
-#include <linux/blkdev.h>
 #include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/iversion.h>
 #include <linux/mpage.h>
 #include <linux/namei.h>
 #include <linux/nls.h>
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index f79a399bd015..67cb541a5b12 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -5,11 +5,7 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/iversion.h>
-#include <linux/namei.h>
 #include <linux/nls.h>
 
 #include "debug.h"
diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
index d48a5e6c5045..ff09ff2714fc 100644
--- a/fs/ntfs3/record.c
+++ b/fs/ntfs3/record.c
@@ -5,10 +5,7 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/nls.h>
 
 #include "debug.h"
 #include "ntfs.h"
diff --git a/fs/ntfs3/run.c b/fs/ntfs3/run.c
index 26ed2b64345e..a8fec651f973 100644
--- a/fs/ntfs3/run.c
+++ b/fs/ntfs3/run.c
@@ -7,10 +7,8 @@
  */
 
 #include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
 #include <linux/log2.h>
-#include <linux/nls.h>
 
 #include "debug.h"
 #include "ntfs.h"
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 2fbab8a931ee..1934c273ee1d 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -23,12 +23,10 @@
  *
  */
 
-#include <linux/backing-dev.h>
 #include <linux/blkdev.h>
 #include <linux/buffer_head.h>
 #include <linux/exportfs.h>
 #include <linux/fs.h>
-#include <linux/iversion.h>
 #include <linux/log2.h>
 #include <linux/module.h>
 #include <linux/nls.h>
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index b4c921e4bc1a..b84d15e8d3a2 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -5,10 +5,7 @@
  *
  */
 
-#include <linux/blkdev.h>
-#include <linux/buffer_head.h>
 #include <linux/fs.h>
-#include <linux/nls.h>
 #include <linux/posix_acl.h>
 #include <linux/posix_acl_xattr.h>
 #include <linux/xattr.h>
-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c
  2021-08-31 14:14 ` [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c Kari Argillander
@ 2021-08-31 17:54   ` kernel test robot
  2021-08-31 18:43     ` Kari Argillander
  2021-09-01  0:45   ` kernel test robot
  1 sibling, 1 reply; 11+ messages in thread
From: kernel test robot @ 2021-08-31 17:54 UTC (permalink / raw)
  To: Kari Argillander, Konstantin Komarov, ntfs3
  Cc: kbuild-all, Kari Argillander, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3789 bytes --]

Hi Kari,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20210831]
[cannot apply to linus/master v5.14 v5.14-rc7 v5.14-rc6 v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Kari-Argillander/fs-ntfs3-Refactor-header-includes/20210831-221738
base:    52c7b727581fe725f8b8a283af21fe0651c73c48
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/bb35516d85de116979ad1bbcb7a74b3a9b4eda6c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kari-Argillander/fs-ntfs3-Refactor-header-includes/20210831-221738
        git checkout bb35516d85de116979ad1bbcb7a74b3a9b4eda6c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from fs/ntfs3/lznt.c:14:
>> fs/ntfs3/debug.h:21:31: warning: 'struct super_block' declared inside parameter list will not be visible outside of this definition or declaration
      21 | void ntfs_printk(const struct super_block *sb, const char *fmt, ...);
         |                               ^~~~~~~~~~~
   fs/ntfs3/ntfs_fs.h: In function 'ntfs_bread':
>> fs/ntfs3/ntfs_fs.h:1004:18: error: passing argument 1 of 'ntfs_printk' from incompatible pointer type [-Werror=incompatible-pointer-types]
    1004 |         ntfs_err(sb, "failed to read volume at offset 0x%llx",
         |                  ^~
         |                  |
         |                  struct super_block *
   fs/ntfs3/debug.h:40:45: note: in definition of macro 'ntfs_err'
      40 | #define ntfs_err(sb, fmt, ...)  ntfs_printk(sb, KERN_ERR fmt, ##__VA_ARGS__)
         |                                             ^~
   fs/ntfs3/debug.h:21:44: note: expected 'const struct super_block *' but argument is of type 'struct super_block *'
      21 | void ntfs_printk(const struct super_block *sb, const char *fmt, ...);
         |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~^~
   cc1: some warnings being treated as errors


vim +/ntfs_printk +1004 fs/ntfs3/ntfs_fs.h

4534a70b7056fd Konstantin Komarov 2021-08-13   995  
4534a70b7056fd Konstantin Komarov 2021-08-13   996  static inline struct buffer_head *ntfs_bread(struct super_block *sb,
4534a70b7056fd Konstantin Komarov 2021-08-13   997  					     sector_t block)
4534a70b7056fd Konstantin Komarov 2021-08-13   998  {
4534a70b7056fd Konstantin Komarov 2021-08-13   999  	struct buffer_head *bh = sb_bread(sb, block);
4534a70b7056fd Konstantin Komarov 2021-08-13  1000  
4534a70b7056fd Konstantin Komarov 2021-08-13  1001  	if (bh)
4534a70b7056fd Konstantin Komarov 2021-08-13  1002  		return bh;
4534a70b7056fd Konstantin Komarov 2021-08-13  1003  
4534a70b7056fd Konstantin Komarov 2021-08-13 @1004  	ntfs_err(sb, "failed to read volume at offset 0x%llx",
4534a70b7056fd Konstantin Komarov 2021-08-13  1005  		 (u64)block << sb->s_blocksize_bits);
4534a70b7056fd Konstantin Komarov 2021-08-13  1006  	return NULL;
4534a70b7056fd Konstantin Komarov 2021-08-13  1007  }
4534a70b7056fd Konstantin Komarov 2021-08-13  1008  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55585 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c
  2021-08-31 17:54   ` kernel test robot
@ 2021-08-31 18:43     ` Kari Argillander
  0 siblings, 0 replies; 11+ messages in thread
From: Kari Argillander @ 2021-08-31 18:43 UTC (permalink / raw)
  To: kernel test robot; +Cc: Konstantin Komarov, ntfs3, kbuild-all, linux-kernel

On Wed, Sep 01, 2021 at 01:54:23AM +0800, kernel test robot wrote:
> Thank you for the patch! Yet something to improve:

Patch series should have be 8 patch long. Sorry for mistake. Good thing
robot noticed.  Will send v2 tomorrow night.

> [auto build test ERROR on next-20210831]
> [cannot apply to linus/master v5.14 v5.14-rc7 v5.14-rc6 v5.14]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch]

Will do now on.  I did not know about this.

Still if someone wants to check why this report was made and what should
have be patch 1/8.  Here it is:

[PATCH 1/8] fs/ntfs3. Add forward declarations for structs to debug.h

Add forward declarations for structs so that we can include this file
without warnings even without linux/fs.h

Signed-off-by: Kari Argillander <kari.argillander@gmail.com>
---
 fs/ntfs3/debug.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/ntfs3/debug.h b/fs/ntfs3/debug.h
index 31120569a87b..53ef7489c75f 100644
--- a/fs/ntfs3/debug.h
+++ b/fs/ntfs3/debug.h
@@ -11,6 +11,9 @@
 #ifndef _LINUX_NTFS3_DEBUG_H
 #define _LINUX_NTFS3_DEBUG_H
 
+struct super_block;
+struct inode;
+
 #ifndef Add2Ptr
 #define Add2Ptr(P, I)		((void *)((u8 *)(P) + (I)))
 #define PtrOffset(B, O)		((size_t)((size_t)(O) - (size_t)(B)))
-- 
2.25.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c
  2021-08-31 14:14 ` [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c Kari Argillander
  2021-08-31 17:54   ` kernel test robot
@ 2021-09-01  0:45   ` kernel test robot
  1 sibling, 0 replies; 11+ messages in thread
From: kernel test robot @ 2021-09-01  0:45 UTC (permalink / raw)
  To: Kari Argillander, Konstantin Komarov, ntfs3
  Cc: llvm, kbuild-all, Kari Argillander, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3795 bytes --]

Hi Kari,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20210831]
[cannot apply to linus/master v5.14 v5.14-rc7 v5.14-rc6 v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Kari-Argillander/fs-ntfs3-Refactor-header-includes/20210831-221738
base:    52c7b727581fe725f8b8a283af21fe0651c73c48
config: arm64-buildonly-randconfig-r003-20210901 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 4b1fde8a2b681dad2ce0c082a5d6422caa06b0bc)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/0day-ci/linux/commit/bb35516d85de116979ad1bbcb7a74b3a9b4eda6c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Kari-Argillander/fs-ntfs3-Refactor-header-includes/20210831-221738
        git checkout bb35516d85de116979ad1bbcb7a74b3a9b4eda6c
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from fs/ntfs3/lznt.c:14:
>> fs/ntfs3/debug.h:21:31: warning: declaration of 'struct super_block' will not be visible outside of this function [-Wvisibility]
   void ntfs_printk(const struct super_block *sb, const char *fmt, ...);
                                 ^
   In file included from fs/ntfs3/lznt.c:15:
>> fs/ntfs3/ntfs_fs.h:1004:11: error: incompatible pointer types passing 'struct super_block *' to parameter of type 'const struct super_block *' [-Werror,-Wincompatible-pointer-types]
           ntfs_err(sb, "failed to read volume at offset 0x%llx",
                    ^~
   fs/ntfs3/debug.h:40:45: note: expanded from macro 'ntfs_err'
   #define ntfs_err(sb, fmt, ...)  ntfs_printk(sb, KERN_ERR fmt, ##__VA_ARGS__)
                                               ^~
   fs/ntfs3/debug.h:21:44: note: passing argument to parameter 'sb' here
   void ntfs_printk(const struct super_block *sb, const char *fmt, ...);
                                              ^
   1 warning and 1 error generated.


vim +1004 fs/ntfs3/ntfs_fs.h

4534a70b7056fd Konstantin Komarov 2021-08-13   995  
4534a70b7056fd Konstantin Komarov 2021-08-13   996  static inline struct buffer_head *ntfs_bread(struct super_block *sb,
4534a70b7056fd Konstantin Komarov 2021-08-13   997  					     sector_t block)
4534a70b7056fd Konstantin Komarov 2021-08-13   998  {
4534a70b7056fd Konstantin Komarov 2021-08-13   999  	struct buffer_head *bh = sb_bread(sb, block);
4534a70b7056fd Konstantin Komarov 2021-08-13  1000  
4534a70b7056fd Konstantin Komarov 2021-08-13  1001  	if (bh)
4534a70b7056fd Konstantin Komarov 2021-08-13  1002  		return bh;
4534a70b7056fd Konstantin Komarov 2021-08-13  1003  
4534a70b7056fd Konstantin Komarov 2021-08-13 @1004  	ntfs_err(sb, "failed to read volume at offset 0x%llx",
4534a70b7056fd Konstantin Komarov 2021-08-13  1005  		 (u64)block << sb->s_blocksize_bits);
4534a70b7056fd Konstantin Komarov 2021-08-13  1006  	return NULL;
4534a70b7056fd Konstantin Komarov 2021-08-13  1007  }
4534a70b7056fd Konstantin Komarov 2021-08-13  1008  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 42002 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-09-01  0:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-31 14:14 [PATCH 0/7] fs/ntfs3: Refactor header includes Kari Argillander
2021-08-31 14:14 ` [PATCH 1/7] fs/ntfs3: Add missing header files to ntfs.h Kari Argillander
2021-08-31 14:14 ` [PATCH 2/7] fs/ntfs3: Add missing headers and forward declarations to ntfs_fs.h Kari Argillander
2021-08-31 14:14 ` [PATCH 3/7] fs/ntfs3: Add missing header and guards to lib/ headers Kari Argillander
2021-08-31 14:14 ` [PATCH 4/7] fs/ntfs3: Change right headers to bitfunc.c Kari Argillander
2021-08-31 14:14 ` [PATCH 5/7] fs/ntfs3: Change right headers to upcase.c Kari Argillander
2021-08-31 14:14 ` [PATCH 6/7] fs/ntfs3: Change right headers to lznt.c Kari Argillander
2021-08-31 17:54   ` kernel test robot
2021-08-31 18:43     ` Kari Argillander
2021-09-01  0:45   ` kernel test robot
2021-08-31 14:14 ` [PATCH 7/7] fs/ntfs3: Remove unneeded header files from c files Kari Argillander

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).