mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h
@ 2016-01-27 11:53 yegorslists
  2016-01-27 11:53 ` [PATCH 2/8] fs: ubifs: remove redundant macro defines yegorslists
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/ubifs.h        |  5 +----
 include/linux/pagemap.h | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 4 deletions(-)
 create mode 100644 include/linux/pagemap.h

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 2d0cd4c..d16f780 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -35,6 +35,7 @@
 #include <malloc.h>
 #include <lzo.h>
 #include <linux/fs.h>
+#include <linux/pagemap.h>
 #include <linux/ctype.h>
 #include <linux/math64.h>
 #include <linux/rbtree.h>
@@ -173,10 +174,6 @@ struct file {
  */
 #define get_seconds()		0
 
-/* 4k page size */
-#define PAGE_CACHE_SHIFT	12
-#define PAGE_CACHE_SIZE		(1 << PAGE_CACHE_SHIFT)
-
 /* Page cache limit. The filesystems should put that into their s_maxbytes
    limits, otherwise bad things can happen in VM. */
 #if BITS_PER_LONG==32
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
new file mode 100644
index 0000000..345bd40
--- /dev/null
+++ b/include/linux/pagemap.h
@@ -0,0 +1,14 @@
+#ifndef _LINUX_PAGEMAP_H
+#define _LINUX_PAGEMAP_H
+
+/*
+ * Copyright 1995 Linus Torvalds
+ */
+
+#include <common.h>
+
+#define PAGE_CACHE_SHIFT        PAGE_SHIFT
+#define PAGE_CACHE_SIZE         PAGE_SIZE
+#define PAGE_CACHE_MASK         PAGE_MASK
+
+#endif /* _LINUX_PAGEMAP_H */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/8] fs: ubifs: remove redundant macro defines
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
@ 2016-01-27 11:53 ` yegorslists
  2016-01-27 11:53 ` [PATCH 3/8] fs: use linux/fs.h for file system related definitions yegorslists
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Remove macros, that were already defined in linux/stat.h.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/ubifs.h | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index d16f780..b603c5d 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -36,6 +36,7 @@
 #include <lzo.h>
 #include <linux/fs.h>
 #include <linux/pagemap.h>
+#include <linux/stat.h>
 #include <linux/ctype.h>
 #include <linux/math64.h>
 #include <linux/rbtree.h>
@@ -227,20 +228,6 @@ struct file {
 #define S_SWAPFILE	256	/* Do not truncate: swapon got its bmaps */
 #define S_PRIVATE	512	/* Inode is fs-internal */
 
-/* include/linux/stat.h */
-
-#define S_IFMT  00170000
-#define S_IFSOCK 0140000
-#define S_IFLNK	 0120000
-#define S_IFREG  0100000
-#define S_IFBLK  0060000
-#define S_IFDIR  0040000
-#define S_IFCHR  0020000
-#define S_IFIFO  0010000
-#define S_ISUID  0004000
-#define S_ISGID  0002000
-#define S_ISVTX  0001000
-
 /* include/linux/fs.h */
 
 /*
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/8] fs: use linux/fs.h for file system related definitions
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
  2016-01-27 11:53 ` [PATCH 2/8] fs: ubifs: remove redundant macro defines yegorslists
@ 2016-01-27 11:53 ` yegorslists
  2016-01-27 11:53 ` [PATCH 4/8] fs: move pgoff_t definition to include/linux/types.h yegorslists
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/super.c   |   4 +-
 fs/ubifs/ubifs.h   |  85 ------------------------
 include/fs.h       |   5 +-
 include/linux/fs.h | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 192 insertions(+), 91 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 075b258..b45240d 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -88,7 +88,7 @@ struct inode *iget_locked(struct super_block *sb, unsigned long ino)
 		inode->i_ino = ino;
 		inode->i_sb = sb;
 		list_add(&inode->i_sb_list, &sb->s_inodes);
-		inode->i_state = I_LOCK | I_NEW;
+		inode->i_state = I_SYNC | I_NEW;
 	}
 
 	return inode;
@@ -225,7 +225,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 	}
 
 	kfree(ino);
-	inode->i_state &= ~(I_LOCK | I_NEW);
+	inode->i_state &= ~(I_SYNC | I_NEW);
 	return inode;
 
 out_invalid:
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index b603c5d..53c0813 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -175,91 +175,6 @@ struct file {
  */
 #define get_seconds()		0
 
-/* Page cache limit. The filesystems should put that into their s_maxbytes
-   limits, otherwise bad things can happen in VM. */
-#if BITS_PER_LONG==32
-#define MAX_LFS_FILESIZE	(((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
-#elif BITS_PER_LONG==64
-#define MAX_LFS_FILESIZE 	0x7fffffffffffffffUL
-#endif
-
-/*
- * These are the fs-independent mount-flags: up to 32 flags are supported
- */
-#define MS_RDONLY	 1	/* Mount read-only */
-#define MS_NOSUID	 2	/* Ignore suid and sgid bits */
-#define MS_NODEV	 4	/* Disallow access to device special files */
-#define MS_NOEXEC	 8	/* Disallow program execution */
-#define MS_SYNCHRONOUS	16	/* Writes are synced at once */
-#define MS_REMOUNT	32	/* Alter flags of a mounted FS */
-#define MS_MANDLOCK	64	/* Allow mandatory locks on an FS */
-#define MS_DIRSYNC	128	/* Directory modifications are synchronous */
-#define MS_NOATIME	1024	/* Do not update access times. */
-#define MS_NODIRATIME	2048	/* Do not update directory access times */
-#define MS_BIND		4096
-#define MS_MOVE		8192
-#define MS_REC		16384
-#define MS_VERBOSE	32768	/* War is peace. Verbosity is silence.
-				   MS_VERBOSE is deprecated. */
-#define MS_SILENT	32768
-#define MS_POSIXACL	(1<<16)	/* VFS does not apply the umask */
-#define MS_UNBINDABLE	(1<<17)	/* change to unbindable */
-#define MS_PRIVATE	(1<<18)	/* change to private */
-#define MS_SLAVE	(1<<19)	/* change to slave */
-#define MS_SHARED	(1<<20)	/* change to shared */
-#define MS_RELATIME	(1<<21)	/* Update atime relative to mtime/ctime. */
-#define MS_KERNMOUNT	(1<<22) /* this is a kern_mount call */
-#define MS_I_VERSION	(1<<23) /* Update inode I_version field */
-#define MS_ACTIVE	(1<<30)
-#define MS_NOUSER	(1<<31)
-
-#define I_NEW			8
-
-/* Inode flags - they have nothing to superblock flags now */
-
-#define S_SYNC		1	/* Writes are synced at once */
-#define S_NOATIME	2	/* Do not update access times */
-#define S_APPEND	4	/* Append-only file */
-#define S_IMMUTABLE	8	/* Immutable file */
-#define S_DEAD		16	/* removed, but still open directory */
-#define S_NOQUOTA	32	/* Inode is not counted to quota */
-#define S_DIRSYNC	64	/* Directory modifications are synchronous */
-#define S_NOCMTIME	128	/* Do not update file c/mtime */
-#define S_SWAPFILE	256	/* Do not truncate: swapon got its bmaps */
-#define S_PRIVATE	512	/* Inode is fs-internal */
-
-/* include/linux/fs.h */
-
-/*
- * File types
- *
- * NOTE! These match bits 12..15 of stat.st_mode
- * (ie "(i_mode >> 12) & 15").
- */
-#define DT_UNKNOWN	0
-#define DT_FIFO		1
-#define DT_CHR		2
-#define DT_DIR		4
-#define DT_BLK		6
-#define DT_REG		8
-#define DT_LNK		10
-#define DT_SOCK		12
-#define DT_WHT		14
-
-#define I_DIRTY_SYNC		1
-#define I_DIRTY_DATASYNC	2
-#define I_DIRTY_PAGES		4
-#define I_NEW			8
-#define I_WILL_FREE		16
-#define I_FREEING		32
-#define I_CLEAR			64
-#define __I_LOCK		7
-#define I_LOCK			(1 << __I_LOCK)
-#define __I_SYNC		8
-#define I_SYNC			(1 << __I_SYNC)
-
-#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
-
 /* linux/include/dcache.h */
 
 #define DNAME_INLINE_LEN_MIN 36
diff --git a/include/fs.h b/include/fs.h
index ee7e48b..23156ea 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -3,6 +3,7 @@
 
 #include <driver.h>
 #include <filetype.h>
+#include <linux/fs.h>
 
 #define PATH_MAX       1024        /* include/linux/limits.h */
 
@@ -122,10 +123,6 @@ int ioctl(int fd, int request, void *buf);
 ssize_t write(int fd, const void *buf, size_t count);
 ssize_t pwrite(int fd, const void *buf, size_t count, loff_t offset);
 
-#define SEEK_SET	1
-#define SEEK_CUR	2
-#define SEEK_END	3
-
 loff_t lseek(int fildes, loff_t offset, int whence);
 int mkdir (const char *pathname, mode_t mode);
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 9db334c..d0e61ba 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -5,6 +5,51 @@
 #include <linux/list.h>
 #include <linux/time.h>
 
+/* Page cache limit. The filesystems should put that into their s_maxbytes
+   limits, otherwise bad things can happen in VM. */
+#if BITS_PER_LONG==32
+#define MAX_LFS_FILESIZE	(((loff_t)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
+#elif BITS_PER_LONG==64
+#define MAX_LFS_FILESIZE 	((loff_t)0x7fffffffffffffffLL)
+#endif
+
+/*
+ * These are the fs-independent mount-flags: up to 32 flags are supported
+ */
+#define MS_RDONLY	 1	/* Mount read-only */
+#define MS_NOSUID	 2	/* Ignore suid and sgid bits */
+#define MS_NODEV	 4	/* Disallow access to device special files */
+#define MS_NOEXEC	 8	/* Disallow program execution */
+#define MS_SYNCHRONOUS	16	/* Writes are synced at once */
+#define MS_REMOUNT	32	/* Alter flags of a mounted FS */
+#define MS_MANDLOCK	64	/* Allow mandatory locks on an FS */
+#define MS_DIRSYNC	128	/* Directory modifications are synchronous */
+#define MS_NOATIME	1024	/* Do not update access times. */
+#define MS_NODIRATIME	2048	/* Do not update directory access times */
+#define MS_BIND		4096
+#define MS_MOVE		8192
+#define MS_REC		16384
+#define MS_VERBOSE	32768	/* War is peace. Verbosity is silence.
+				   MS_VERBOSE is deprecated. */
+#define MS_SILENT	32768
+#define MS_POSIXACL	(1<<16)	/* VFS does not apply the umask */
+#define MS_UNBINDABLE	(1<<17)	/* change to unbindable */
+#define MS_PRIVATE	(1<<18)	/* change to private */
+#define MS_SLAVE	(1<<19)	/* change to slave */
+#define MS_SHARED	(1<<20)	/* change to shared */
+#define MS_RELATIME	(1<<21)	/* Update atime relative to mtime/ctime. */
+#define MS_KERNMOUNT	(1<<22) /* this is a kern_mount call */
+#define MS_I_VERSION	(1<<23) /* Update inode I_version field */
+#define MS_ACTIVE	(1<<30)
+#define MS_NOUSER	(1<<31)
+
+#define SEEK_SET	0	/* seek relative to beginning of file */
+#define SEEK_CUR	1	/* seek relative to current file position */
+#define SEEK_END	2	/* seek relative to end of file */
+#define SEEK_DATA	3	/* seek to the next data */
+#define SEEK_HOLE	4	/* seek to the next hole */
+#define SEEK_MAX	SEEK_HOLE
+
 struct inode {
 	struct hlist_node	i_hash;
 	struct list_head	i_list;
@@ -130,4 +175,148 @@ struct super_block {
 	 */
 	char *s_options;
 };
+
+/*
+ * Inode flags - they have no relation to superblock flags now
+ */
+#define S_SYNC		1	/* Writes are synced at once */
+#define S_NOATIME	2	/* Do not update access times */
+#define S_APPEND	4	/* Append-only file */
+#define S_IMMUTABLE	8	/* Immutable file */
+#define S_DEAD		16	/* removed, but still open directory */
+#define S_NOQUOTA	32	/* Inode is not counted to quota */
+#define S_DIRSYNC	64	/* Directory modifications are synchronous */
+#define S_NOCMTIME	128	/* Do not update file c/mtime */
+#define S_SWAPFILE	256	/* Do not truncate: swapon got its bmaps */
+#define S_PRIVATE	512	/* Inode is fs-internal */
+#define S_IMA		1024	/* Inode has an associated IMA struct */
+#define S_AUTOMOUNT	2048	/* Automount/referral quasi-directory */
+#define S_NOSEC		4096	/* no suid or xattr security attributes */
+#ifdef CONFIG_FS_DAX
+#define S_DAX		8192	/* Direct Access, avoiding the page cache */
+#else
+#define S_DAX		0	/* Make all the DAX code disappear */
+#endif
+
+/*
+ * Note that nosuid etc flags are inode-specific: setting some file-system
+ * flags just means all the inodes inherit those flags by default. It might be
+ * possible to override it selectively if you really wanted to with some
+ * ioctl() that is not currently implemented.
+ *
+ * Exception: MS_RDONLY is always applied to the entire file system.
+ *
+ * Unfortunately, it is possible to change a filesystems flags with it mounted
+ * with files in use.  This means that all of the inodes will not have their
+ * i_flags updated.  Hence, i_flags no longer inherit the superblock mount
+ * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
+ */
+#define __IS_FLG(inode, flg)	((inode)->i_sb->s_flags & (flg))
+
+#define IS_RDONLY(inode)	((inode)->i_sb->s_flags & MS_RDONLY)
+#define IS_SYNC(inode)		(__IS_FLG(inode, MS_SYNCHRONOUS) || \
+					((inode)->i_flags & S_SYNC))
+#define IS_DIRSYNC(inode)	(__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
+					((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
+#define IS_MANDLOCK(inode)	__IS_FLG(inode, MS_MANDLOCK)
+#define IS_NOATIME(inode)	__IS_FLG(inode, MS_RDONLY|MS_NOATIME)
+#define IS_I_VERSION(inode)	__IS_FLG(inode, MS_I_VERSION)
+
+#define IS_NOQUOTA(inode)	((inode)->i_flags & S_NOQUOTA)
+#define IS_APPEND(inode)	((inode)->i_flags & S_APPEND)
+#define IS_IMMUTABLE(inode)	((inode)->i_flags & S_IMMUTABLE)
+#define IS_POSIXACL(inode)	__IS_FLG(inode, MS_POSIXACL)
+
+#define IS_DEADDIR(inode)	((inode)->i_flags & S_DEAD)
+#define IS_NOCMTIME(inode)	((inode)->i_flags & S_NOCMTIME)
+#define IS_SWAPFILE(inode)	((inode)->i_flags & S_SWAPFILE)
+#define IS_PRIVATE(inode)	((inode)->i_flags & S_PRIVATE)
+#define IS_IMA(inode)		((inode)->i_flags & S_IMA)
+#define IS_AUTOMOUNT(inode)	((inode)->i_flags & S_AUTOMOUNT)
+#define IS_NOSEC(inode)		((inode)->i_flags & S_NOSEC)
+#define IS_DAX(inode)		((inode)->i_flags & S_DAX)
+
+#define IS_WHITEOUT(inode)	(S_ISCHR(inode->i_mode) && \
+				 (inode)->i_rdev == WHITEOUT_DEV)
+
+/*
+ * Inode state bits.  Protected by inode->i_lock
+ *
+ * Three bits determine the dirty state of the inode, I_DIRTY_SYNC,
+ * I_DIRTY_DATASYNC and I_DIRTY_PAGES.
+ *
+ * Four bits define the lifetime of an inode.  Initially, inodes are I_NEW,
+ * until that flag is cleared.  I_WILL_FREE, I_FREEING and I_CLEAR are set at
+ * various stages of removing an inode.
+ *
+ * Two bits are used for locking and completion notification, I_NEW and I_SYNC.
+ *
+ * I_DIRTY_SYNC		Inode is dirty, but doesn't have to be written on
+ *			fdatasync().  i_atime is the usual cause.
+ * I_DIRTY_DATASYNC	Data-related inode changes pending. We keep track of
+ *			these changes separately from I_DIRTY_SYNC so that we
+ *			don't have to write inode on fdatasync() when only
+ *			mtime has changed in it.
+ * I_DIRTY_PAGES	Inode has dirty pages.  Inode itself may be clean.
+ * I_NEW		Serves as both a mutex and completion notification.
+ *			New inodes set I_NEW.  If two processes both create
+ *			the same inode, one of them will release its inode and
+ *			wait for I_NEW to be released before returning.
+ *			Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can
+ *			also cause waiting on I_NEW, without I_NEW actually
+ *			being set.  find_inode() uses this to prevent returning
+ *			nearly-dead inodes.
+ * I_WILL_FREE		Must be set when calling write_inode_now() if i_count
+ *			is zero.  I_FREEING must be set when I_WILL_FREE is
+ *			cleared.
+ * I_FREEING		Set when inode is about to be freed but still has dirty
+ *			pages or buffers attached or the inode itself is still
+ *			dirty.
+ * I_CLEAR		Added by clear_inode().  In this state the inode is
+ *			clean and can be destroyed.  Inode keeps I_FREEING.
+ *
+ *			Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
+ *			prohibited for many purposes.  iget() must wait for
+ *			the inode to be completely released, then create it
+ *			anew.  Other functions will just ignore such inodes,
+ *			if appropriate.  I_NEW is used for waiting.
+ *
+ * I_SYNC		Writeback of inode is running. The bit is set during
+ *			data writeback, and cleared with a wakeup on the bit
+ *			address once it is done. The bit is also used to pin
+ *			the inode in memory for flusher thread.
+ *
+ * I_REFERENCED		Marks the inode as recently references on the LRU list.
+ *
+ * I_DIO_WAKEUP		Never set.  Only used as a key for wait_on_bit().
+ *
+ * I_WB_SWITCH		Cgroup bdi_writeback switching in progress.  Used to
+ *			synchronize competing switching instances and to tell
+ *			wb stat updates to grab mapping->tree_lock.  See
+ *			inode_switch_wb_work_fn() for details.
+ *
+ * Q: What is the difference between I_WILL_FREE and I_FREEING?
+ */
+#define I_DIRTY_SYNC		(1 << 0)
+#define I_DIRTY_DATASYNC	(1 << 1)
+#define I_DIRTY_PAGES		(1 << 2)
+#define __I_NEW			3
+#define I_NEW			(1 << __I_NEW)
+#define I_WILL_FREE		(1 << 4)
+#define I_FREEING		(1 << 5)
+#define I_CLEAR			(1 << 6)
+#define __I_SYNC		7
+#define I_SYNC			(1 << __I_SYNC)
+#define I_REFERENCED		(1 << 8)
+#define __I_DIO_WAKEUP		9
+#define I_DIO_WAKEUP		(1 << __I_DIO_WAKEUP)
+#define I_LINKABLE		(1 << 10)
+#define I_DIRTY_TIME		(1 << 11)
+#define __I_DIRTY_TIME_EXPIRED	12
+#define I_DIRTY_TIME_EXPIRED	(1 << __I_DIRTY_TIME_EXPIRED)
+#define I_WB_SWITCH		(1 << 13)
+
+#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
+#define I_DIRTY_ALL (I_DIRTY | I_DIRTY_TIME)
+
 #endif /* _LINUX_FS_H */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/8] fs: move pgoff_t definition to include/linux/types.h
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
  2016-01-27 11:53 ` [PATCH 2/8] fs: ubifs: remove redundant macro defines yegorslists
  2016-01-27 11:53 ` [PATCH 3/8] fs: use linux/fs.h for file system related definitions yegorslists
@ 2016-01-27 11:53 ` yegorslists
  2016-01-27 11:53 ` [PATCH 5/8] fs: ubifs: move dcache related definitions to include/linux/dcache.h yegorslists
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/ubifs.h      | 2 --
 include/linux/types.h | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 53c0813..9a2d2f5 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -58,8 +58,6 @@ extern unsigned int ubifs_msg_flags;
 extern unsigned int ubifs_chk_flags;
 extern unsigned int ubifs_tst_flags;
 
-#define pgoff_t		unsigned long
-
 /*
  * We "simulate" the Linux page struct much simpler here
  */
diff --git a/include/linux/types.h b/include/linux/types.h
index ce1a0ec..9f8eb67 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -157,6 +157,11 @@ typedef __u32 __bitwise __wsum;
 #define __aligned_be64 __be64 __attribute__((aligned(8)))
 #define __aligned_le64 __le64 __attribute__((aligned(8)))
 
+/*
+ * The type of an index into the pagecache.
+ */
+#define pgoff_t unsigned long
+
 /* A dma_addr_t can hold any valid DMA or bus address for the platform */
 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
 typedef u64 dma_addr_t;
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 5/8] fs: ubifs: move dcache related definitions to include/linux/dcache.h
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
                   ` (2 preceding siblings ...)
  2016-01-27 11:53 ` [PATCH 4/8] fs: move pgoff_t definition to include/linux/types.h yegorslists
@ 2016-01-27 11:53 ` yegorslists
  2016-01-27 11:53 ` [PATCH 6/8] fs: ubifs: move vfsmount definition to include/linux/mount.h yegorslists
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/ubifs.h       | 47 +-----------------------------
 include/linux/dcache.h | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 46 deletions(-)
 create mode 100644 include/linux/dcache.h

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 9a2d2f5..424b154 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -37,6 +37,7 @@
 #include <linux/fs.h>
 #include <linux/pagemap.h>
 #include <linux/stat.h>
+#include <linux/dcache.h>
 #include <linux/ctype.h>
 #include <linux/math64.h>
 #include <linux/rbtree.h>
@@ -79,19 +80,6 @@ void iput(struct inode *inode);
 
 /* linux/include/dcache.h */
 
-/*
- * "quick string" -- eases parameter passing, but more importantly
- * saves "metadata" about the string (ie length and the hash).
- *
- * hash comes first so it snuggles against d_parent in the
- * dentry.
- */
-struct qstr {
-	unsigned int hash;
-	unsigned int len;
-	const char *name;
-};
-
 struct file_system_type {
 	const char *name;
 	int fs_flags;
@@ -173,39 +161,6 @@ struct file {
  */
 #define get_seconds()		0
 
-/* linux/include/dcache.h */
-
-#define DNAME_INLINE_LEN_MIN 36
-
-struct dentry {
-	unsigned int d_flags;		/* protected by d_lock */
-	spinlock_t d_lock;		/* per dentry lock */
-	struct inode *d_inode;		/* Where the name belongs to - NULL is
-					 * negative */
-	/*
-	 * The next three fields are touched by __d_lookup.  Place them here
-	 * so they all fit in a cache line.
-	 */
-	struct hlist_node d_hash;	/* lookup hash list */
-	struct dentry *d_parent;	/* parent directory */
-	struct qstr d_name;
-
-	struct list_head d_lru;		/* LRU list */
-	/*
-	 * d_child and d_rcu can share memory
-	 */
-	struct list_head d_subdirs;	/* our children */
-	struct list_head d_alias;	/* inode alias list */
-	unsigned long d_time;		/* used by d_revalidate */
-	struct super_block *d_sb;	/* The root of the dentry tree */
-	void *d_fsdata;			/* fs-specific data */
-#ifdef CONFIG_PROFILING
-	struct dcookie_struct *d_cookie; /* cookie, if any */
-#endif
-	int d_mounted;
-	unsigned char d_iname[DNAME_INLINE_LEN_MIN];	/* small names */
-};
-
 static inline ino_t parent_ino(struct dentry *dentry)
 {
 	ino_t res;
diff --git a/include/linux/dcache.h b/include/linux/dcache.h
new file mode 100644
index 0000000..ea69b68
--- /dev/null
+++ b/include/linux/dcache.h
@@ -0,0 +1,77 @@
+#ifndef __LINUX_DCACHE_H
+#define __LINUX_DCACHE_H
+
+/*
+ * linux/include/linux/dcache.h
+ *
+ * Dirent cache data structures
+ *
+ * (C) Copyright 1997 Thomas Schoebel-Theuer,
+ * with heavy changes by Linus Torvalds
+ */
+
+#define IS_ROOT(x) ((x) == (x)->d_parent)
+
+/* The hash is always the low bits of hash_len */
+#ifdef __LITTLE_ENDIAN
+ #define HASH_LEN_DECLARE u32 hash; u32 len
+ #define bytemask_from_count(cnt)	(~(~0ul << (cnt)*8))
+#else
+ #define HASH_LEN_DECLARE u32 len; u32 hash
+ #define bytemask_from_count(cnt)	(~(~0ul >> (cnt)*8))
+#endif
+
+/*
+ * "quick string" -- eases parameter passing, but more importantly
+ * saves "metadata" about the string (ie length and the hash).
+ *
+ * hash comes first so it snuggles against d_parent in the
+ * dentry.
+ */
+struct qstr {
+	union {
+		struct {
+			HASH_LEN_DECLARE;
+		};
+		u64 hash_len;
+	};
+	const unsigned char *name;
+};
+
+#define QSTR_INIT(n,l) { { { .len = l } }, .name = n }
+#define hashlen_hash(hashlen) ((u32) (hashlen))
+#define hashlen_len(hashlen)  ((u32)((hashlen) >> 32))
+#define hashlen_create(hash,len) (((u64)(len)<<32)|(u32)(hash))
+
+#define DNAME_INLINE_LEN_MIN 36
+
+struct dentry {
+	unsigned int d_flags;		/* protected by d_lock */
+	spinlock_t d_lock;		/* per dentry lock */
+	struct inode *d_inode;		/* Where the name belongs to - NULL is
+					 * negative */
+	/*
+	 * The next three fields are touched by __d_lookup.  Place them here
+	 * so they all fit in a cache line.
+	 */
+	struct hlist_node d_hash;	/* lookup hash list */
+	struct dentry *d_parent;	/* parent directory */
+	struct qstr d_name;
+
+	struct list_head d_lru;		/* LRU list */
+	/*
+	 * d_child and d_rcu can share memory
+	 */
+	struct list_head d_subdirs;	/* our children */
+	struct list_head d_alias;	/* inode alias list */
+	unsigned long d_time;		/* used by d_revalidate */
+	struct super_block *d_sb;	/* The root of the dentry tree */
+	void *d_fsdata;			/* fs-specific data */
+#ifdef CONFIG_PROFILING
+	struct dcookie_struct *d_cookie; /* cookie, if any */
+#endif
+	int d_mounted;
+	unsigned char d_iname[DNAME_INLINE_LEN_MIN];	/* small names */
+};
+
+#endif	/* __LINUX_DCACHE_H */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 6/8] fs: ubifs: move vfsmount definition to include/linux/mount.h
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
                   ` (3 preceding siblings ...)
  2016-01-27 11:53 ` [PATCH 5/8] fs: ubifs: move dcache related definitions to include/linux/dcache.h yegorslists
@ 2016-01-27 11:53 ` yegorslists
  2016-01-27 11:53 ` [PATCH 7/8] fs: ubifs: move path definition to include/linux/path.h yegorslists
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/ubifs.h      | 35 +----------------------------------
 include/linux/mount.h | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 34 deletions(-)
 create mode 100644 include/linux/mount.h

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 424b154..8f362ed 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -38,6 +38,7 @@
 #include <linux/pagemap.h>
 #include <linux/stat.h>
 #include <linux/dcache.h>
+#include <linux/mount.h>
 #include <linux/ctype.h>
 #include <linux/math64.h>
 #include <linux/rbtree.h>
@@ -91,40 +92,6 @@ struct file_system_type {
 	struct list_head fs_supers;
 };
 
-struct vfsmount {
-	struct list_head mnt_hash;
-	struct vfsmount *mnt_parent;	/* fs we are mounted on */
-	struct dentry *mnt_mountpoint;	/* dentry of mountpoint */
-	struct dentry *mnt_root;	/* root of the mounted tree */
-	struct super_block *mnt_sb;	/* pointer to superblock */
-	struct list_head mnt_mounts;	/* list of children, anchored here */
-	struct list_head mnt_child;	/* and going through their mnt_child */
-	int mnt_flags;
-	/* 4 bytes hole on 64bits arches */
-	const char *mnt_devname;	/* Name of device e.g. /dev/dsk/hda1 */
-	struct list_head mnt_list;
-	struct list_head mnt_expire;	/* link in fs-specific expiry list */
-	struct list_head mnt_share;	/* circular list of shared mounts */
-	struct list_head mnt_slave_list;/* list of slave mounts */
-	struct list_head mnt_slave;	/* slave list entry */
-	struct vfsmount *mnt_master;	/* slave is on master->mnt_slave_list */
-	struct mnt_namespace *mnt_ns;	/* containing namespace */
-	int mnt_id;			/* mount identifier */
-	int mnt_group_id;		/* peer group identifier */
-	/*
-	 * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount
-	 * to let these frequently modified fields in a separate cache line
-	 * (so that reads of mnt_flags wont ping-pong on SMP machines)
-	 */
-	int mnt_expiry_mark;		/* true if marked for expiry */
-	int mnt_pinned;
-	int mnt_ghosts;
-	/*
-	 * This value is not stable unless all of the mnt_writers[] spinlocks
-	 * are held, and all mnt_writer[]s on this mount have 0 as their ->count
-	 */
-};
-
 struct path {
 	struct vfsmount *mnt;
 	struct dentry *dentry;
diff --git a/include/linux/mount.h b/include/linux/mount.h
new file mode 100644
index 0000000..e4d185c
--- /dev/null
+++ b/include/linux/mount.h
@@ -0,0 +1,21 @@
+/*
+ *
+ * Definitions for mount interface. This describes the in the kernel build 
+ * linkedlist with mounted filesystems.
+ *
+ * Author:  Marco van Wieringen <mvw@planets.elm.net>
+ *
+ */
+#ifndef _LINUX_MOUNT_H
+#define _LINUX_MOUNT_H
+
+#include <linux/dcache.h>
+#include <linux/fs.h>
+
+struct vfsmount {
+	struct dentry *mnt_root;	/* root of the mounted tree */
+	struct super_block *mnt_sb;	/* pointer to superblock */
+	int mnt_flags;
+};
+
+#endif /* _LINUX_MOUNT_H */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 7/8] fs: ubifs: move path definition to include/linux/path.h
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
                   ` (4 preceding siblings ...)
  2016-01-27 11:53 ` [PATCH 6/8] fs: ubifs: move vfsmount definition to include/linux/mount.h yegorslists
@ 2016-01-27 11:53 ` yegorslists
  2016-01-27 11:53 ` [PATCH 8/8] fs: ubifs: move file and file_system_type definitions to linux/fs.h yegorslists
  2016-01-29  7:08 ` [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/ubifs.h     |  6 +-----
 include/linux/path.h | 12 ++++++++++++
 2 files changed, 13 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/path.h

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 8f362ed..cfd37f2 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -39,6 +39,7 @@
 #include <linux/stat.h>
 #include <linux/dcache.h>
 #include <linux/mount.h>
+#include <linux/path.h>
 #include <linux/ctype.h>
 #include <linux/math64.h>
 #include <linux/rbtree.h>
@@ -92,11 +93,6 @@ struct file_system_type {
 	struct list_head fs_supers;
 };
 
-struct path {
-	struct vfsmount *mnt;
-	struct dentry *dentry;
-};
-
 struct file {
 	struct path		f_path;
 #define f_dentry	f_path.dentry
diff --git a/include/linux/path.h b/include/linux/path.h
new file mode 100644
index 0000000..cbebdc5
--- /dev/null
+++ b/include/linux/path.h
@@ -0,0 +1,12 @@
+#ifndef _LINUX_PATH_H
+#define _LINUX_PATH_H
+
+struct dentry;
+struct vfsmount;
+
+struct path {
+	struct vfsmount *mnt;
+	struct dentry *dentry;
+};
+
+#endif  /* _LINUX_PATH_H */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 8/8] fs: ubifs: move file and file_system_type definitions to linux/fs.h
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
                   ` (5 preceding siblings ...)
  2016-01-27 11:53 ` [PATCH 7/8] fs: ubifs: move path definition to include/linux/path.h yegorslists
@ 2016-01-27 11:53 ` yegorslists
  2016-01-29  7:08 ` [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: yegorslists @ 2016-01-27 11:53 UTC (permalink / raw)
  To: barebox

From: Yegor Yefremov <yegorslists@googlemail.com>

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
---
 fs/ubifs/ubifs.h   | 39 ---------------------------------------
 include/linux/fs.h | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index cfd37f2..50ac1c4 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -80,45 +80,6 @@ void iput(struct inode *inode);
 #define atomic_long_dec(a)
 #define	atomic_long_sub(a, b)
 
-/* linux/include/dcache.h */
-
-struct file_system_type {
-	const char *name;
-	int fs_flags;
-	int (*get_sb) (struct file_system_type *, int,
-		       const char *, void *, struct vfsmount *);
-	void (*kill_sb) (struct super_block *);
-	struct module *owner;
-	struct file_system_type * next;
-	struct list_head fs_supers;
-};
-
-struct file {
-	struct path		f_path;
-#define f_dentry	f_path.dentry
-#define f_vfsmnt	f_path.mnt
-	const struct file_operations	*f_op;
-	unsigned int 		f_flags;
-	loff_t			f_pos;
-	unsigned int		f_uid, f_gid;
-
-	u64			f_version;
-#ifdef CONFIG_SECURITY
-	void			*f_security;
-#endif
-	/* needed for tty driver, and maybe others */
-	void			*private_data;
-
-#ifdef CONFIG_EPOLL
-	/* Used by fs/eventpoll.c to link all the hooks to this file */
-	struct list_head	f_ep_links;
-	spinlock_t		f_ep_lock;
-#endif /* #ifdef CONFIG_EPOLL */
-#ifdef CONFIG_DEBUG_WRITECOUNT
-	unsigned long f_mnt_write_state;
-#endif
-};
-
 /*
  * get_seconds() not really needed in the read-only implmentation
  */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index d0e61ba..e9fb881 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -4,6 +4,8 @@
 #include <linux/barebox-wrapper.h>
 #include <linux/list.h>
 #include <linux/time.h>
+#include <linux/mount.h>
+#include <linux/path.h>
 
 /* Page cache limit. The filesystems should put that into their s_maxbytes
    limits, otherwise bad things can happen in VM. */
@@ -176,6 +178,43 @@ struct super_block {
 	char *s_options;
 };
 
+struct file_system_type {
+	const char *name;
+	int fs_flags;
+	int (*get_sb) (struct file_system_type *, int,
+		       const char *, void *, struct vfsmount *);
+	void (*kill_sb) (struct super_block *);
+	struct module *owner;
+	struct file_system_type * next;
+	struct list_head fs_supers;
+};
+
+struct file {
+	struct path		f_path;
+#define f_dentry	f_path.dentry
+#define f_vfsmnt	f_path.mnt
+	const struct file_operations	*f_op;
+	unsigned int 		f_flags;
+	loff_t			f_pos;
+	unsigned int		f_uid, f_gid;
+
+	u64			f_version;
+#ifdef CONFIG_SECURITY
+	void			*f_security;
+#endif
+	/* needed for tty driver, and maybe others */
+	void			*private_data;
+
+#ifdef CONFIG_EPOLL
+	/* Used by fs/eventpoll.c to link all the hooks to this file */
+	struct list_head	f_ep_links;
+	spinlock_t		f_ep_lock;
+#endif /* #ifdef CONFIG_EPOLL */
+#ifdef CONFIG_DEBUG_WRITECOUNT
+	unsigned long f_mnt_write_state;
+#endif
+};
+
 /*
  * Inode flags - they have no relation to superblock flags now
  */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h
  2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
                   ` (6 preceding siblings ...)
  2016-01-27 11:53 ` [PATCH 8/8] fs: ubifs: move file and file_system_type definitions to linux/fs.h yegorslists
@ 2016-01-29  7:08 ` Sascha Hauer
  7 siblings, 0 replies; 9+ messages in thread
From: Sascha Hauer @ 2016-01-29  7:08 UTC (permalink / raw)
  To: yegorslists; +Cc: barebox

On Wed, Jan 27, 2016 at 12:53:02PM +0100, yegorslists@googlemail.com wrote:
> From: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  fs/ubifs/ubifs.h        |  5 +----
>  include/linux/pagemap.h | 14 ++++++++++++++
>  2 files changed, 15 insertions(+), 4 deletions(-)
>  create mode 100644 include/linux/pagemap.h

Applied, thanks

Sascha



-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2016-01-29  7:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-27 11:53 [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h yegorslists
2016-01-27 11:53 ` [PATCH 2/8] fs: ubifs: remove redundant macro defines yegorslists
2016-01-27 11:53 ` [PATCH 3/8] fs: use linux/fs.h for file system related definitions yegorslists
2016-01-27 11:53 ` [PATCH 4/8] fs: move pgoff_t definition to include/linux/types.h yegorslists
2016-01-27 11:53 ` [PATCH 5/8] fs: ubifs: move dcache related definitions to include/linux/dcache.h yegorslists
2016-01-27 11:53 ` [PATCH 6/8] fs: ubifs: move vfsmount definition to include/linux/mount.h yegorslists
2016-01-27 11:53 ` [PATCH 7/8] fs: ubifs: move path definition to include/linux/path.h yegorslists
2016-01-27 11:53 ` [PATCH 8/8] fs: ubifs: move file and file_system_type definitions to linux/fs.h yegorslists
2016-01-29  7:08 ` [PATCH 1/8] fs: move PAGE_CACHE definitions to include/linux/pagemap.h Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox