Skip to content

Commit

Permalink
nilfs2: move ioctl interface and disk layout to uapi separately
Browse files Browse the repository at this point in the history
The header file "include/linux/nilfs2_fs.h" is composed of parts for
ioctl and disk format, and both are intended to be shared with user
space programs.

This moves them to the uapi directory "include/uapi/linux" splitting the
file to "nilfs2_api.h" and "nilfs2_ondisk.h".  The following minor
changes are accompanied by this migration:

 - nilfs_direct_node struct in nilfs2/direct.h is converged to
   nilfs2_ondisk.h because it's an on-disk structure.
 - inline functions nilfs_rec_len_from_disk() and
   nilfs_rec_len_to_disk() are moved to nilfs2/dir.c.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ryusuke Konishi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
konis authored and torvalds committed Aug 2, 2016
1 parent 4ce5c34 commit e63e88b
Show file tree
Hide file tree
Showing 18 changed files with 348 additions and 329 deletions.
3 changes: 2 additions & 1 deletion Documentation/filesystems/nilfs2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ among NILFS2 files can be depicted as follows:
`-- file (ino=yy)
( regular file, directory, or symlink )

For detail on the format of each file, please see include/linux/nilfs2_fs.h.
For detail on the format of each file, please see nilfs2_ondisk.h
located at include/uapi/linux directory.

There are no patents or other intellectual property that we protect
with regard to the design of NILFS2. It is allowed to replicate the
Expand Down
2 changes: 1 addition & 1 deletion Documentation/ioctl/ioctl-number.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ Code Seq#(hex) Include File Comments
'm' 00 drivers/scsi/megaraid/megaraid_ioctl.h conflict!
'm' 00-1F net/irda/irmod.h conflict!
'n' 00-7F linux/ncp_fs.h and fs/ncpfs/ioctl.c
'n' 80-8F linux/nilfs2_fs.h NILFS2
'n' 80-8F uapi/linux/nilfs2_api.h NILFS2
'n' E0-FF linux/matroxfb.h matroxfb
'o' 00-1F fs/ocfs2/ocfs2_fs.h OCFS2
'o' 00-03 mtd/ubi-user.h conflict! (OCFS2 and UBI overlaps)
Expand Down
3 changes: 2 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -8258,8 +8258,9 @@ T: git git://github.com/konis/nilfs2.git
S: Supported
F: Documentation/filesystems/nilfs2.txt
F: fs/nilfs2/
F: include/linux/nilfs2_fs.h
F: include/trace/events/nilfs2.h
F: include/uapi/linux/nilfs2_api.h
F: include/uapi/linux/nilfs2_ondisk.h

NINJA SCSI-3 / NINJA SCSI-32Bi (16bit/CardBus) PCMCIA SCSI HOST ADAPTER DRIVER
M: YOKOTA Hiroshi <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/bmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/nilfs2_fs.h>
#include <linux/nilfs2_ondisk.h> /* nilfs_binfo, nilfs_inode, etc */
#include "alloc.h"
#include "dat.h"

Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/btree.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/types.h>
#include <linux/buffer_head.h>
#include <linux/list.h>
#include <linux/nilfs2_fs.h>
#include <linux/nilfs2_ondisk.h> /* nilfs_btree_node */
#include "btnode.h"
#include "bmap.h"

Expand Down
1 change: 0 additions & 1 deletion fs/nilfs2/cpfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <linux/string.h>
#include <linux/buffer_head.h>
#include <linux/errno.h>
#include <linux/nilfs2_fs.h>
#include "mdt.h"
#include "cpfile.h"

Expand Down
3 changes: 2 additions & 1 deletion fs/nilfs2/cpfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/nilfs2_fs.h>
#include <linux/nilfs2_api.h> /* nilfs_cpstat */
#include <linux/nilfs2_ondisk.h> /* nilfs_inode, nilfs_checkpoint */


int nilfs_cpfile_get_checkpoint(struct inode *, __u64, int,
Expand Down
1 change: 1 addition & 0 deletions fs/nilfs2/dat.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/types.h>
#include <linux/buffer_head.h>
#include <linux/fs.h>
#include <linux/nilfs2_ondisk.h> /* nilfs_inode, nilfs_checkpoint */


struct nilfs_palloc_req;
Expand Down
22 changes: 22 additions & 0 deletions fs/nilfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@
#include "nilfs.h"
#include "page.h"

static inline unsigned int nilfs_rec_len_from_disk(__le16 dlen)
{
unsigned int len = le16_to_cpu(dlen);

#if (PAGE_SIZE >= 65536)
if (len == NILFS_MAX_REC_LEN)
return 1 << 16;
#endif
return len;
}

static inline __le16 nilfs_rec_len_to_disk(unsigned int len)
{
#if (PAGE_SIZE >= 65536)
if (len == (1 << 16))
return cpu_to_le16(NILFS_MAX_REC_LEN);

BUG_ON(len > (1 << 16));
#endif
return cpu_to_le16(len);
}

/*
* nilfs uses block-sized chunks. Arguably, sector-sized ones would be
* more robust, but we have what we have
Expand Down
10 changes: 0 additions & 10 deletions fs/nilfs2/direct.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@
#include "bmap.h"


/**
* struct nilfs_direct_node - direct node
* @dn_flags: flags
* @dn_pad: padding
*/
struct nilfs_direct_node {
__u8 dn_flags;
__u8 pad[7];
};

#define NILFS_DIRECT_NBLOCKS (NILFS_BMAP_SIZE / sizeof(__le64) - 1)
#define NILFS_DIRECT_KEY_MIN 0
#define NILFS_DIRECT_KEY_MAX (NILFS_DIRECT_NBLOCKS - 1)
Expand Down
1 change: 0 additions & 1 deletion fs/nilfs2/ifile.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/nilfs2_fs.h>
#include "mdt.h"
#include "alloc.h"

Expand Down
1 change: 0 additions & 1 deletion fs/nilfs2/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <linux/compat.h> /* compat_ptr() */
#include <linux/mount.h> /* mnt_want_write_file(), mnt_drop_write_file() */
#include <linux/buffer_head.h>
#include <linux/nilfs2_fs.h>
#include "nilfs.h"
#include "segment.h"
#include "bmap.h"
Expand Down
3 changes: 2 additions & 1 deletion fs/nilfs2/nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include <linux/buffer_head.h>
#include <linux/spinlock.h>
#include <linux/blkdev.h>
#include <linux/nilfs2_fs.h>
#include <linux/nilfs2_api.h>
#include <linux/nilfs2_ondisk.h>
#include "the_nilfs.h"
#include "bmap.h"

Expand Down
1 change: 0 additions & 1 deletion fs/nilfs2/segment.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/workqueue.h>
#include <linux/nilfs2_fs.h>
#include "nilfs.h"

struct nilfs_root;
Expand Down
1 change: 0 additions & 1 deletion fs/nilfs2/sufile.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <linux/string.h>
#include <linux/buffer_head.h>
#include <linux/errno.h>
#include <linux/nilfs2_fs.h>
#include "mdt.h"
#include "sufile.h"

Expand Down
1 change: 0 additions & 1 deletion fs/nilfs2/sufile.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

#include <linux/fs.h>
#include <linux/buffer_head.h>
#include <linux/nilfs2_fs.h>
#include "mdt.h"


Expand Down
Loading

0 comments on commit e63e88b

Please sign in to comment.