mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [RFC] fs: move super_block and inode definitions to central fs.h header
@ 2016-01-24 19:24 Yegor Yefremov
  2016-01-24 19:55 ` Yegor Yefremov
  0 siblings, 1 reply; 6+ messages in thread
From: Yegor Yefremov @ 2016-01-24 19:24 UTC (permalink / raw)
  To: barebox

Both super_block and inode are common to various file systems, so
move them to the central place.

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

diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index c025d34..afed252 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -34,6 +34,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <lzo.h>
+#include <fs.h>
 #include <linux/ctype.h>
 #include <linux/time.h>
 #include <linux/math64.h>
@@ -77,13 +78,6 @@ void iput(struct inode *inode);
 #define atomic_long_dec(a)
 #define	atomic_long_sub(a, b)
 
-/* linux/include/time.h */
-
-struct timespec {
-	time_t	tv_sec;		/* seconds */
-	long	tv_nsec;	/* nanoseconds */
-};
-
 /* linux/include/dcache.h */
 
 /*
@@ -99,132 +93,6 @@ struct qstr {
 	const char *name;
 };
 
-struct inode {
-	struct hlist_node	i_hash;
-	struct list_head	i_list;
-	struct list_head	i_sb_list;
-	struct list_head	i_dentry;
-	unsigned long		i_ino;
-	unsigned int		i_nlink;
-	uid_t			i_uid;
-	gid_t			i_gid;
-	dev_t			i_rdev;
-	u64			i_version;
-	loff_t			i_size;
-#ifdef __NEED_I_SIZE_ORDERED
-	seqcount_t		i_size_seqcount;
-#endif
-	struct timespec		i_atime;
-	struct timespec		i_mtime;
-	struct timespec		i_ctime;
-	unsigned int		i_blkbits;
-	unsigned short          i_bytes;
-	umode_t			i_mode;
-	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
-	struct mutex		i_mutex;
-	struct rw_semaphore	i_alloc_sem;
-	const struct inode_operations	*i_op;
-	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
-	struct super_block	*i_sb;
-	struct file_lock	*i_flock;
-#ifdef CONFIG_QUOTA
-	struct dquot		*i_dquot[MAXQUOTAS];
-#endif
-	struct list_head	i_devices;
-	int			i_cindex;
-
-	__u32			i_generation;
-
-#ifdef CONFIG_DNOTIFY
-	unsigned long		i_dnotify_mask; /* Directory notify events */
-	struct dnotify_struct	*i_dnotify; /* for directory notifications */
-#endif
-
-#ifdef CONFIG_INOTIFY
-	struct list_head	inotify_watches; /* watches on this inode */
-	struct mutex		inotify_mutex;	/* protects the watches list */
-#endif
-
-	unsigned long		i_state;
-	unsigned long		dirtied_when;	/* jiffies of first dirtying */
-
-	unsigned int		i_flags;
-
-#ifdef CONFIG_SECURITY
-	void			*i_security;
-#endif
-	void			*i_private; /* fs or device private pointer */
-};
-
-struct super_block {
-	struct list_head	s_list;		/* Keep this first */
-	dev_t			s_dev;		/* search index; _not_ kdev_t */
-	unsigned long		s_blocksize;
-	unsigned char		s_blocksize_bits;
-	unsigned char		s_dirt;
-	unsigned long long	s_maxbytes;	/* Max file size */
-	struct file_system_type	*s_type;
-	const struct super_operations	*s_op;
-	struct dquot_operations	*dq_op;
-	struct quotactl_ops	*s_qcop;
-	const struct export_operations *s_export_op;
-	unsigned long		s_flags;
-	unsigned long		s_magic;
-	struct dentry		*s_root;
-	struct rw_semaphore	s_umount;
-	struct mutex		s_lock;
-	int			s_count;
-	int			s_syncing;
-	int			s_need_sync_fs;
-#ifdef CONFIG_SECURITY
-	void                    *s_security;
-#endif
-	struct xattr_handler	**s_xattr;
-
-	struct list_head	s_inodes;	/* all inodes */
-	struct list_head	s_dirty;	/* dirty inodes */
-	struct list_head	s_io;		/* parked for writeback */
-	struct list_head	s_more_io;	/* parked for more writeback */
-	struct hlist_head	s_anon;		/* anonymous dentries for (nfs) exporting */
-	struct list_head	s_files;
-	/* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
-	struct list_head	s_dentry_lru;	/* unused dentry lru */
-	int			s_nr_dentry_unused;	/* # of dentry on lru */
-
-	struct block_device	*s_bdev;
-	struct mtd_info		*s_mtd;
-	struct list_head	s_instances;
-
-	int			s_frozen;
-	wait_queue_head_t	s_wait_unfrozen;
-
-	char s_id[32];				/* Informational name */
-
-	void 			*s_fs_info;	/* Filesystem private info */
-
-	/*
-	 * The next field is for VFS *only*. No filesystems have any business
-	 * even looking at it. You had been warned.
-	 */
-	struct mutex s_vfs_rename_mutex;	/* Kludge */
-
-	/* Granularity of c/m/atime in ns.
-	   Cannot be worse than a second */
-	u32		   s_time_gran;
-
-	/*
-	 * Filesystem subtype.  If non-empty the filesystem type field
-	 * in /proc/mounts will be "type.subtype"
-	 */
-	char *s_subtype;
-
-	/*
-	 * Saved mount options for lazy filesystems using
-	 * generic_show_options()
-	 */
-	char *s_options;
-};
-
 struct file_system_type {
 	const char *name;
 	int fs_flags;
diff --git a/include/fs.h b/include/fs.h
index ee7e48b..a5e48a2 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -3,6 +3,7 @@
 
 #include <driver.h>
 #include <filetype.h>
+#include <linux/barebox-wrapper.h>
 
 #define PATH_MAX       1024        /* include/linux/limits.h */
 
@@ -10,6 +11,139 @@ struct partition;
 struct node_d;
 struct stat;
 
+/* linux/include/time.h */
+
+struct timespec {
+	time_t	tv_sec;		/* seconds */
+	long	tv_nsec;	/* nanoseconds */
+};
+
+struct super_block {
+	struct list_head	s_list;		/* Keep this first */
+	dev_t			s_dev;		/* search index; _not_ kdev_t */
+	unsigned long		s_blocksize;
+	unsigned char		s_blocksize_bits;
+	unsigned char		s_dirt;
+	unsigned long long	s_maxbytes;	/* Max file size */
+	struct file_system_type	*s_type;
+	const struct super_operations	*s_op;
+	struct dquot_operations	*dq_op;
+	struct quotactl_ops	*s_qcop;
+	const struct export_operations *s_export_op;
+	unsigned long		s_flags;
+	unsigned long		s_magic;
+	struct dentry		*s_root;
+	struct rw_semaphore	s_umount;
+	struct mutex		s_lock;
+	int			s_count;
+	int			s_syncing;
+	int			s_need_sync_fs;
+#ifdef CONFIG_SECURITY
+	void                    *s_security;
+#endif
+	struct xattr_handler	**s_xattr;
+
+	struct list_head	s_inodes;	/* all inodes */
+	struct list_head	s_dirty;	/* dirty inodes */
+	struct list_head	s_io;		/* parked for writeback */
+	struct list_head	s_more_io;	/* parked for more writeback */
+	struct hlist_head	s_anon;		/* anonymous dentries for (nfs) exporting */
+	struct list_head	s_files;
+	/* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
+	struct list_head	s_dentry_lru;	/* unused dentry lru */
+	int			s_nr_dentry_unused;	/* # of dentry on lru */
+
+	struct block_device	*s_bdev;
+	struct mtd_info		*s_mtd;
+	struct list_head	s_instances;
+
+	int			s_frozen;
+	wait_queue_head_t	s_wait_unfrozen;
+
+	char s_id[32];				/* Informational name */
+
+	void 			*s_fs_info;	/* Filesystem private info */
+
+	/*
+	 * The next field is for VFS *only*. No filesystems have any business
+	 * even looking at it. You had been warned.
+	 */
+	struct mutex s_vfs_rename_mutex;	/* Kludge */
+
+	/* Granularity of c/m/atime in ns.
+	   Cannot be worse than a second */
+	u32		   s_time_gran;
+
+	/*
+	 * Filesystem subtype.  If non-empty the filesystem type field
+	 * in /proc/mounts will be "type.subtype"
+	 */
+	char *s_subtype;
+
+	/*
+	 * Saved mount options for lazy filesystems using
+	 * generic_show_options()
+	 */
+	char *s_options;
+};
+
+struct inode {
+	struct hlist_node	i_hash;
+	struct list_head	i_list;
+	struct list_head	i_sb_list;
+	struct list_head	i_dentry;
+	unsigned long		i_ino;
+	unsigned int		i_nlink;
+	uid_t			i_uid;
+	gid_t			i_gid;
+	dev_t			i_rdev;
+	u64			i_version;
+	loff_t			i_size;
+#ifdef __NEED_I_SIZE_ORDERED
+	seqcount_t		i_size_seqcount;
+#endif
+	struct timespec		i_atime;
+	struct timespec		i_mtime;
+	struct timespec		i_ctime;
+	unsigned int		i_blkbits;
+	unsigned short          i_bytes;
+	umode_t			i_mode;
+	spinlock_t		i_lock;	/* i_blocks, i_bytes, maybe i_size */
+	struct mutex		i_mutex;
+	struct rw_semaphore	i_alloc_sem;
+	const struct inode_operations	*i_op;
+	const struct file_operations	*i_fop;	/* former ->i_op->default_file_ops */
+	struct super_block	*i_sb;
+	struct file_lock	*i_flock;
+#ifdef CONFIG_QUOTA
+	struct dquot		*i_dquot[MAXQUOTAS];
+#endif
+	struct list_head	i_devices;
+	int			i_cindex;
+
+	__u32			i_generation;
+
+#ifdef CONFIG_DNOTIFY
+	unsigned long		i_dnotify_mask; /* Directory notify events */
+	struct dnotify_struct	*i_dnotify; /* for directory notifications */
+#endif
+
+#ifdef CONFIG_INOTIFY
+	struct list_head	inotify_watches; /* watches on this inode */
+	struct mutex		inotify_mutex;	/* protects the watches list */
+#endif
+
+	unsigned long		i_state;
+	unsigned long		dirtied_when;	/* jiffies of first dirtying */
+
+	unsigned int		i_flags;
+
+#ifdef CONFIG_SECURITY
+	void			*i_security;
+#endif
+	void			*i_private; /* fs or device private pointer */
+};
+
 struct dirent {
 	char d_name[256];
 };
-- 
2.1.4


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

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

* Re: [RFC] fs: move super_block and inode definitions to central fs.h header
  2016-01-24 19:24 [RFC] fs: move super_block and inode definitions to central fs.h header Yegor Yefremov
@ 2016-01-24 19:55 ` Yegor Yefremov
  2016-01-25  8:20   ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Yegor Yefremov @ 2016-01-24 19:55 UTC (permalink / raw)
  To: barebox

On Sun, Jan 24, 2016 at 8:24 PM, Yegor Yefremov
<yegorslists@googlemail.com> wrote:
> Both super_block and inode are common to various file systems, so
> move them to the central place.
>
> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> ---
>  fs/ubifs/ubifs.h | 134 +------------------------------------------------------
>  include/fs.h     | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 135 insertions(+), 133 deletions(-)

I'm trying to port SquashFS to Barebox. SquashFS uses at least both
super_block structure as also inode structure. Does it make sense to
introduce include/linux/fs.h?

What to do with struct timespec? It is defined in uapi part. Should it
go to include/linux/barebox-wrapper.h?

Yegor

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

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

* Re: [RFC] fs: move super_block and inode definitions to central fs.h header
  2016-01-24 19:55 ` Yegor Yefremov
@ 2016-01-25  8:20   ` Sascha Hauer
  2016-01-25  8:40     ` Yegor Yefremov
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2016-01-25  8:20 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: barebox

On Sun, Jan 24, 2016 at 08:55:22PM +0100, Yegor Yefremov wrote:
> On Sun, Jan 24, 2016 at 8:24 PM, Yegor Yefremov
> <yegorslists@googlemail.com> wrote:
> > Both super_block and inode are common to various file systems, so
> > move them to the central place.
> >
> > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> > ---
> >  fs/ubifs/ubifs.h | 134 +------------------------------------------------------
> >  include/fs.h     | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 135 insertions(+), 133 deletions(-)
> 
> I'm trying to port SquashFS to Barebox. SquashFS uses at least both
> super_block structure as also inode structure. Does it make sense to
> introduce include/linux/fs.h?

I think not. Using include/linux/ for header files is good for stuff
directly taken from the kernel, but I think the fs related structures in
barebox are quite different from the ones in the kernel.

> 
> What to do with struct timespec? It is defined in uapi part. Should it
> go to include/linux/barebox-wrapper.h?

barebox-wrapper.h contains no-op wrappers for stuff from the kernel that
we want to keep around just to be able to compile kernel code with less
modifications. struct timespec doesn't really fall into that category, I
rather suggest its original place: include/linux/time.h

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] 6+ messages in thread

* Re: [RFC] fs: move super_block and inode definitions to central fs.h header
  2016-01-25  8:20   ` Sascha Hauer
@ 2016-01-25  8:40     ` Yegor Yefremov
  2016-01-25  8:47       ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Yegor Yefremov @ 2016-01-25  8:40 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, Jan 25, 2016 at 9:20 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Sun, Jan 24, 2016 at 08:55:22PM +0100, Yegor Yefremov wrote:
>> On Sun, Jan 24, 2016 at 8:24 PM, Yegor Yefremov
>> <yegorslists@googlemail.com> wrote:
>> > Both super_block and inode are common to various file systems, so
>> > move them to the central place.
>> >
>> > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>> > ---
>> >  fs/ubifs/ubifs.h | 134 +------------------------------------------------------
>> >  include/fs.h     | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >  2 files changed, 135 insertions(+), 133 deletions(-)
>>
>> I'm trying to port SquashFS to Barebox. SquashFS uses at least both
>> super_block structure as also inode structure. Does it make sense to
>> introduce include/linux/fs.h?
>
> I think not. Using include/linux/ for header files is good for stuff
> directly taken from the kernel, but I think the fs related structures in
> barebox are quite different from the ones in the kernel.

So you're OK about moving super_block and inode to inculde/fs?

>> What to do with struct timespec? It is defined in uapi part. Should it
>> go to include/linux/barebox-wrapper.h?
>
> barebox-wrapper.h contains no-op wrappers for stuff from the kernel that
> we want to keep around just to be able to compile kernel code with less
> modifications. struct timespec doesn't really fall into that category, I
> rather suggest its original place: include/linux/time.h

OK. Then I'll move it there. Should I also add timeval and related
marcos as well?

Yegor

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

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

* Re: [RFC] fs: move super_block and inode definitions to central fs.h header
  2016-01-25  8:40     ` Yegor Yefremov
@ 2016-01-25  8:47       ` Sascha Hauer
  2016-01-25  8:49         ` Yegor Yefremov
  0 siblings, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2016-01-25  8:47 UTC (permalink / raw)
  To: Yegor Yefremov; +Cc: barebox

On Mon, Jan 25, 2016 at 09:40:26AM +0100, Yegor Yefremov wrote:
> On Mon, Jan 25, 2016 at 9:20 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> > On Sun, Jan 24, 2016 at 08:55:22PM +0100, Yegor Yefremov wrote:
> >> On Sun, Jan 24, 2016 at 8:24 PM, Yegor Yefremov
> >> <yegorslists@googlemail.com> wrote:
> >> > Both super_block and inode are common to various file systems, so
> >> > move them to the central place.
> >> >
> >> > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> >> > ---
> >> >  fs/ubifs/ubifs.h | 134 +------------------------------------------------------
> >> >  include/fs.h     | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> >  2 files changed, 135 insertions(+), 133 deletions(-)
> >>
> >> I'm trying to port SquashFS to Barebox. SquashFS uses at least both
> >> super_block structure as also inode structure. Does it make sense to
> >> introduce include/linux/fs.h?
> >
> > I think not. Using include/linux/ for header files is good for stuff
> > directly taken from the kernel, but I think the fs related structures in
> > barebox are quite different from the ones in the kernel.
> 
> So you're OK about moving super_block and inode to inculde/fs?

Sorry, I should have read the patch before replying to your followup.
You were talking about the struct inode/superblock in ubifs which indeed
are taken from the kernel and not actively used by barebox. These should
indeed go to include/linux/.

> 
> >> What to do with struct timespec? It is defined in uapi part. Should it
> >> go to include/linux/barebox-wrapper.h?
> >
> > barebox-wrapper.h contains no-op wrappers for stuff from the kernel that
> > we want to keep around just to be able to compile kernel code with less
> > modifications. struct timespec doesn't really fall into that category, I
> > rather suggest its original place: include/linux/time.h
> 
> OK. Then I'll move it there. Should I also add timeval and related
> marcos as well?

I would rather take the lazy approach and add them as needed.

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] 6+ messages in thread

* Re: [RFC] fs: move super_block and inode definitions to central fs.h header
  2016-01-25  8:47       ` Sascha Hauer
@ 2016-01-25  8:49         ` Yegor Yefremov
  0 siblings, 0 replies; 6+ messages in thread
From: Yegor Yefremov @ 2016-01-25  8:49 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, Jan 25, 2016 at 9:47 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Mon, Jan 25, 2016 at 09:40:26AM +0100, Yegor Yefremov wrote:
>> On Mon, Jan 25, 2016 at 9:20 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
>> > On Sun, Jan 24, 2016 at 08:55:22PM +0100, Yegor Yefremov wrote:
>> >> On Sun, Jan 24, 2016 at 8:24 PM, Yegor Yefremov
>> >> <yegorslists@googlemail.com> wrote:
>> >> > Both super_block and inode are common to various file systems, so
>> >> > move them to the central place.
>> >> >
>> >> > Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
>> >> > ---
>> >> >  fs/ubifs/ubifs.h | 134 +------------------------------------------------------
>> >> >  include/fs.h     | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >> >  2 files changed, 135 insertions(+), 133 deletions(-)
>> >>
>> >> I'm trying to port SquashFS to Barebox. SquashFS uses at least both
>> >> super_block structure as also inode structure. Does it make sense to
>> >> introduce include/linux/fs.h?
>> >
>> > I think not. Using include/linux/ for header files is good for stuff
>> > directly taken from the kernel, but I think the fs related structures in
>> > barebox are quite different from the ones in the kernel.
>>
>> So you're OK about moving super_block and inode to inculde/fs?
>
> Sorry, I should have read the patch before replying to your followup.
> You were talking about the struct inode/superblock in ubifs which indeed
> are taken from the kernel and not actively used by barebox. These should
> indeed go to include/linux/.

OK

>>
>> >> What to do with struct timespec? It is defined in uapi part. Should it
>> >> go to include/linux/barebox-wrapper.h?
>> >
>> > barebox-wrapper.h contains no-op wrappers for stuff from the kernel that
>> > we want to keep around just to be able to compile kernel code with less
>> > modifications. struct timespec doesn't really fall into that category, I
>> > rather suggest its original place: include/linux/time.h
>>
>> OK. Then I'll move it there. Should I also add timeval and related
>> marcos as well?
>
> I would rather take the lazy approach and add them as needed.

OK

Yegor

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

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

end of thread, other threads:[~2016-01-25  8:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-24 19:24 [RFC] fs: move super_block and inode definitions to central fs.h header Yegor Yefremov
2016-01-24 19:55 ` Yegor Yefremov
2016-01-25  8:20   ` Sascha Hauer
2016-01-25  8:40     ` Yegor Yefremov
2016-01-25  8:47       ` Sascha Hauer
2016-01-25  8:49         ` Yegor Yefremov

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