Commit fc26901b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'befs-v4.10-rc1' of git://github.com/luisbg/linux-befs

Pull befs updates from Luis de Bethencourt:
 "A series of small fixes and adding NFS export support"

* tag 'befs-v4.10-rc1' of git://github.com/luisbg/linux-befs:
  befs: add NFS export support
  befs: remove trailing whitespaces
  befs: remove signatures from comments
  befs: fix style issues in header files
  befs: fix style issues in linuxvfs.c
  befs: fix typos in linuxvfs.c
  befs: fix style issues in io.c
  befs: fix style issues in inode.c
  befs: fix style issues in debug.c
parents 01302aac ac632f5b
...@@ -129,6 +129,7 @@ static inline befs_inode_addr ...@@ -129,6 +129,7 @@ static inline befs_inode_addr
blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno) blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
{ {
befs_inode_addr iaddr; befs_inode_addr iaddr;
iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift; iaddr.allocation_group = blockno >> BEFS_SB(sb)->ag_shift;
iaddr.start = iaddr.start =
blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift); blockno - (iaddr.allocation_group << BEFS_SB(sb)->ag_shift);
...@@ -140,7 +141,7 @@ blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno) ...@@ -140,7 +141,7 @@ blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
static inline unsigned int static inline unsigned int
befs_iaddrs_per_block(struct super_block *sb) befs_iaddrs_per_block(struct super_block *sb)
{ {
return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr); return BEFS_SB(sb)->block_size / sizeof(befs_disk_inode_addr);
} }
#include "endian.h" #include "endian.h"
......
...@@ -55,12 +55,12 @@ enum super_flags { ...@@ -55,12 +55,12 @@ enum super_flags {
}; };
#define BEFS_BYTEORDER_NATIVE 0x42494745 #define BEFS_BYTEORDER_NATIVE 0x42494745
#define BEFS_BYTEORDER_NATIVE_LE (__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE) #define BEFS_BYTEORDER_NATIVE_LE ((__force fs32)cpu_to_le32(BEFS_BYTEORDER_NATIVE))
#define BEFS_BYTEORDER_NATIVE_BE (__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE) #define BEFS_BYTEORDER_NATIVE_BE ((__force fs32)cpu_to_be32(BEFS_BYTEORDER_NATIVE))
#define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1 #define BEFS_SUPER_MAGIC BEFS_SUPER_MAGIC1
#define BEFS_SUPER_MAGIC1_LE (__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1) #define BEFS_SUPER_MAGIC1_LE ((__force fs32)cpu_to_le32(BEFS_SUPER_MAGIC1))
#define BEFS_SUPER_MAGIC1_BE (__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1) #define BEFS_SUPER_MAGIC1_BE ((__force fs32)cpu_to_be32(BEFS_SUPER_MAGIC1))
/* /*
* Flags of inode * Flags of inode
......
...@@ -3,11 +3,9 @@ ...@@ -3,11 +3,9 @@
* *
*/ */
int befs_btree_find(struct super_block *sb, const befs_data_stream *ds, int befs_btree_find(struct super_block *sb, const befs_data_stream *ds,
const char *key, befs_off_t * value); const char *key, befs_off_t *value);
int befs_btree_read(struct super_block *sb, const befs_data_stream *ds, int befs_btree_read(struct super_block *sb, const befs_data_stream *ds,
loff_t key_no, size_t bufsize, char *keybuf, loff_t key_no, size_t bufsize, char *keybuf,
size_t * keysize, befs_off_t * value); size_t *keysize, befs_off_t *value);
...@@ -89,8 +89,6 @@ befs_read_datastream(struct super_block *sb, const befs_data_stream *ds, ...@@ -89,8 +89,6 @@ befs_read_datastream(struct super_block *sb, const befs_data_stream *ds,
* *
* Calls specialized functions for each of the three possible * Calls specialized functions for each of the three possible
* datastream regions. * datastream regions.
*
* 2001-11-15 Will Dyson
*/ */
int int
befs_fblock2brun(struct super_block *sb, const befs_data_stream *data, befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
......
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
struct buffer_head *befs_read_datastream(struct super_block *sb, struct buffer_head *befs_read_datastream(struct super_block *sb,
const befs_data_stream *ds, const befs_data_stream *ds,
befs_off_t pos, uint * off); befs_off_t pos, uint *off);
int befs_fblock2brun(struct super_block *sb, const befs_data_stream *data, int befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
befs_blocknr_t fblock, befs_block_run * run); befs_blocknr_t fblock, befs_block_run *run);
size_t befs_read_lsymlink(struct super_block *sb, const befs_data_stream *data, size_t befs_read_lsymlink(struct super_block *sb, const befs_data_stream *data,
void *buff, befs_off_t len); void *buff, befs_off_t len);
...@@ -17,4 +17,3 @@ befs_blocknr_t befs_count_blocks(struct super_block *sb, ...@@ -17,4 +17,3 @@ befs_blocknr_t befs_count_blocks(struct super_block *sb,
const befs_data_stream *ds); const befs_data_stream *ds);
extern const befs_inode_addr BAD_IADDR; extern const befs_inode_addr BAD_IADDR;
...@@ -57,6 +57,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...) ...@@ -57,6 +57,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...)
struct va_format vaf; struct va_format vaf;
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vaf.fmt = fmt; vaf.fmt = fmt;
vaf.va = &args; vaf.va = &args;
...@@ -67,7 +68,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...) ...@@ -67,7 +68,7 @@ befs_debug(const struct super_block *sb, const char *fmt, ...)
} }
void void
befs_dump_inode(const struct super_block *sb, befs_inode * inode) befs_dump_inode(const struct super_block *sb, befs_inode *inode)
{ {
#ifdef CONFIG_BEFS_DEBUG #ifdef CONFIG_BEFS_DEBUG
...@@ -151,7 +152,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode) ...@@ -151,7 +152,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode)
*/ */
void void
befs_dump_super_block(const struct super_block *sb, befs_super_block * sup) befs_dump_super_block(const struct super_block *sb, befs_super_block *sup)
{ {
#ifdef CONFIG_BEFS_DEBUG #ifdef CONFIG_BEFS_DEBUG
...@@ -202,7 +203,7 @@ befs_dump_super_block(const struct super_block *sb, befs_super_block * sup) ...@@ -202,7 +203,7 @@ befs_dump_super_block(const struct super_block *sb, befs_super_block * sup)
#if 0 #if 0
/* unused */ /* unused */
void void
befs_dump_small_data(const struct super_block *sb, befs_small_data * sd) befs_dump_small_data(const struct super_block *sb, befs_small_data *sd)
{ {
} }
...@@ -221,7 +222,8 @@ befs_dump_run(const struct super_block *sb, befs_disk_block_run run) ...@@ -221,7 +222,8 @@ befs_dump_run(const struct super_block *sb, befs_disk_block_run run)
#endif /* 0 */ #endif /* 0 */
void void
befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * super) befs_dump_index_entry(const struct super_block *sb,
befs_disk_btree_super *super)
{ {
#ifdef CONFIG_BEFS_DEBUG #ifdef CONFIG_BEFS_DEBUG
...@@ -242,7 +244,7 @@ befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * supe ...@@ -242,7 +244,7 @@ befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * supe
} }
void void
befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead * node) befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *node)
{ {
#ifdef CONFIG_BEFS_DEBUG #ifdef CONFIG_BEFS_DEBUG
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
#include "inode.h" #include "inode.h"
/* /*
Validates the correctness of the befs inode * Validates the correctness of the befs inode
Returns BEFS_OK if the inode should be used, otherwise * Returns BEFS_OK if the inode should be used, otherwise
returns BEFS_BAD_INODE * returns BEFS_BAD_INODE
*/ */
int int
befs_check_inode(struct super_block *sb, befs_inode * raw_inode, befs_check_inode(struct super_block *sb, befs_inode *raw_inode,
befs_blocknr_t inode) befs_blocknr_t inode)
{ {
u32 magic1 = fs32_to_cpu(sb, raw_inode->magic1); u32 magic1 = fs32_to_cpu(sb, raw_inode->magic1);
......
...@@ -3,6 +3,5 @@ ...@@ -3,6 +3,5 @@
* *
*/ */
int befs_check_inode(struct super_block *sb, befs_inode * raw_inode, int befs_check_inode(struct super_block *sb, befs_inode *raw_inode,
befs_blocknr_t inode); befs_blocknr_t inode);
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
/* /*
* Converts befs notion of disk addr to a disk offset and uses * Converts befs notion of disk addr to a disk offset and uses
* linux kernel function sb_bread() to get the buffer containing * linux kernel function sb_bread() to get the buffer containing
* the offset. -Will Dyson * the offset.
*
*/ */
struct buffer_head * struct buffer_head *
...@@ -55,7 +54,7 @@ befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr) ...@@ -55,7 +54,7 @@ befs_bread_iaddr(struct super_block *sb, befs_inode_addr iaddr)
befs_debug(sb, "<--- %s", __func__); befs_debug(sb, "<--- %s", __func__);
return bh; return bh;
error: error:
befs_debug(sb, "<--- %s ERROR", __func__); befs_debug(sb, "<--- %s ERROR", __func__);
return NULL; return NULL;
} }
...@@ -4,4 +4,3 @@ ...@@ -4,4 +4,3 @@
struct buffer_head *befs_bread_iaddr(struct super_block *sb, struct buffer_head *befs_bread_iaddr(struct super_block *sb,
befs_inode_addr iaddr); befs_inode_addr iaddr);
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/parser.h> #include <linux/parser.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/exportfs.h>
#include "befs.h" #include "befs.h"
#include "btree.h" #include "btree.h"
...@@ -37,7 +38,8 @@ static int befs_readdir(struct file *, struct dir_context *); ...@@ -37,7 +38,8 @@ static int befs_readdir(struct file *, struct dir_context *);
static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int); static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int);
static int befs_readpage(struct file *file, struct page *page); static int befs_readpage(struct file *file, struct page *page);
static sector_t befs_bmap(struct address_space *mapping, sector_t block); static sector_t befs_bmap(struct address_space *mapping, sector_t block);
static struct dentry *befs_lookup(struct inode *, struct dentry *, unsigned int); static struct dentry *befs_lookup(struct inode *, struct dentry *,
unsigned int);
static struct inode *befs_iget(struct super_block *, unsigned long); static struct inode *befs_iget(struct super_block *, unsigned long);
static struct inode *befs_alloc_inode(struct super_block *sb); static struct inode *befs_alloc_inode(struct super_block *sb);
static void befs_destroy_inode(struct inode *inode); static void befs_destroy_inode(struct inode *inode);
...@@ -51,6 +53,10 @@ static void befs_put_super(struct super_block *); ...@@ -51,6 +53,10 @@ static void befs_put_super(struct super_block *);
static int befs_remount(struct super_block *, int *, char *); static int befs_remount(struct super_block *, int *, char *);
static int befs_statfs(struct dentry *, struct kstatfs *); static int befs_statfs(struct dentry *, struct kstatfs *);
static int parse_options(char *, struct befs_mount_options *); static int parse_options(char *, struct befs_mount_options *);
static struct dentry *befs_fh_to_dentry(struct super_block *sb,
struct fid *fid, int fh_len, int fh_type);
static struct dentry *befs_fh_to_parent(struct super_block *sb,
struct fid *fid, int fh_len, int fh_type);
static const struct super_operations befs_sops = { static const struct super_operations befs_sops = {
.alloc_inode = befs_alloc_inode, /* allocate a new inode */ .alloc_inode = befs_alloc_inode, /* allocate a new inode */
...@@ -83,6 +89,11 @@ static const struct address_space_operations befs_symlink_aops = { ...@@ -83,6 +89,11 @@ static const struct address_space_operations befs_symlink_aops = {
.readpage = befs_symlink_readpage, .readpage = befs_symlink_readpage,
}; };
static const struct export_operations befs_export_operations = {
.fh_to_dentry = befs_fh_to_dentry,
.fh_to_parent = befs_fh_to_parent,
};
/* /*
* Called by generic_file_read() to read a page of data * Called by generic_file_read() to read a page of data
* *
...@@ -109,8 +120,6 @@ befs_bmap(struct address_space *mapping, sector_t block) ...@@ -109,8 +120,6 @@ befs_bmap(struct address_space *mapping, sector_t block)
* Used by many higher level functions. * Used by many higher level functions.
* *
* Calls befs_fblock2brun() in datastream.c to do the real work. * Calls befs_fblock2brun() in datastream.c to do the real work.
*
* -WD 10-26-01
*/ */
static int static int
...@@ -414,10 +423,10 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino) ...@@ -414,10 +423,10 @@ static struct inode *befs_iget(struct super_block *sb, unsigned long ino)
unlock_new_inode(inode); unlock_new_inode(inode);
return inode; return inode;
unacquire_bh: unacquire_bh:
brelse(bh); brelse(bh);
unacquire_none: unacquire_none:
iget_failed(inode); iget_failed(inode);
befs_debug(sb, "<--- %s - Bad inode", __func__); befs_debug(sb, "<--- %s - Bad inode", __func__);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
...@@ -493,11 +502,8 @@ static int befs_symlink_readpage(struct file *unused, struct page *page) ...@@ -493,11 +502,8 @@ static int befs_symlink_readpage(struct file *unused, struct page *page)
/* /*
* UTF-8 to NLS charset convert routine * UTF-8 to NLS charset convert routine
* *
* * Uses uni2char() / char2uni() rather than the nls tables directly
* Changed 8/10/01 by Will Dyson. Now use uni2char() / char2uni() rather than
* the nls tables directly
*/ */
static int static int
befs_utf2nls(struct super_block *sb, const char *in, befs_utf2nls(struct super_block *sb, const char *in,
int in_len, char **out, int *out_len) int in_len, char **out, int *out_len)
...@@ -521,9 +527,8 @@ befs_utf2nls(struct super_block *sb, const char *in, ...@@ -521,9 +527,8 @@ befs_utf2nls(struct super_block *sb, const char *in,
} }
*out = result = kmalloc(maxlen, GFP_NOFS); *out = result = kmalloc(maxlen, GFP_NOFS);
if (!*out) { if (!*out)
return -ENOMEM; return -ENOMEM;
}
for (i = o = 0; i < in_len; i += utflen, o += unilen) { for (i = o = 0; i < in_len; i += utflen, o += unilen) {
...@@ -546,7 +551,7 @@ befs_utf2nls(struct super_block *sb, const char *in, ...@@ -546,7 +551,7 @@ befs_utf2nls(struct super_block *sb, const char *in,
return o; return o;
conv_err: conv_err:
befs_error(sb, "Name using character set %s contains a character that " befs_error(sb, "Name using character set %s contains a character that "
"cannot be converted to unicode.", nls->charset); "cannot be converted to unicode.", nls->charset);
befs_debug(sb, "<--- %s", __func__); befs_debug(sb, "<--- %s", __func__);
...@@ -585,9 +590,11 @@ befs_nls2utf(struct super_block *sb, const char *in, ...@@ -585,9 +590,11 @@ befs_nls2utf(struct super_block *sb, const char *in,
wchar_t uni; wchar_t uni;
int unilen, utflen; int unilen, utflen;
char *result; char *result;
/* There're nls characters that will translate to 3-chars-wide UTF-8 /*
* characters, a additional byte is needed to save the final \0 * There are nls characters that will translate to 3-chars-wide UTF-8
* in special cases */ * characters, an additional byte is needed to save the final \0
* in special cases
*/
int maxlen = (3 * in_len) + 1; int maxlen = (3 * in_len) + 1;
befs_debug(sb, "---> %s\n", __func__); befs_debug(sb, "---> %s\n", __func__);
...@@ -624,14 +631,41 @@ befs_nls2utf(struct super_block *sb, const char *in, ...@@ -624,14 +631,41 @@ befs_nls2utf(struct super_block *sb, const char *in,
return i; return i;
conv_err: conv_err:
befs_error(sb, "Name using charecter set %s contains a charecter that " befs_error(sb, "Name using character set %s contains a character that "
"cannot be converted to unicode.", nls->charset); "cannot be converted to unicode.", nls->charset);
befs_debug(sb, "<--- %s", __func__); befs_debug(sb, "<--- %s", __func__);
kfree(result); kfree(result);
return -EILSEQ; return -EILSEQ;
} }
static struct inode *befs_nfs_get_inode(struct super_block *sb, uint64_t ino,
uint32_t generation)
{
/* No need to handle i_generation */
return befs_iget(sb, ino);
}
/*
* Map a NFS file handle to a corresponding dentry
*/
static struct dentry *befs_fh_to_dentry(struct super_block *sb,
struct fid *fid, int fh_len, int fh_type)
{
return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
befs_nfs_get_inode);
}
/*
* Find the parent for a file specified by NFS handle
*/
static struct dentry *befs_fh_to_parent(struct super_block *sb,
struct fid *fid, int fh_len, int fh_type)
{
return generic_fh_to_parent(sb, fid, fh_len, fh_type,
befs_nfs_get_inode);
}
enum { enum {
Opt_uid, Opt_gid, Opt_charset, Opt_debug, Opt_err, Opt_uid, Opt_gid, Opt_charset, Opt_debug, Opt_err,
}; };
...@@ -666,6 +700,7 @@ parse_options(char *options, struct befs_mount_options *opts) ...@@ -666,6 +700,7 @@ parse_options(char *options, struct befs_mount_options *opts)
while ((p = strsep(&options, ",")) != NULL) { while ((p = strsep(&options, ",")) != NULL) {
int token; int token;
if (!*p) if (!*p)
continue; continue;
...@@ -782,7 +817,6 @@ befs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -782,7 +817,6 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
* Linux 2.4.10 and later refuse to read blocks smaller than * Linux 2.4.10 and later refuse to read blocks smaller than
* the logical block size for the device. But we also need to read at * the logical block size for the device. But we also need to read at
* least 1k to get the second 512 bytes of the volume. * least 1k to get the second 512 bytes of the volume.
* -WD 10-26-01
*/ */
blocksize = sb_min_blocksize(sb, 1024); blocksize = sb_min_blocksize(sb, 1024);
if (!blocksize) { if (!blocksize) {
...@@ -791,7 +825,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -791,7 +825,8 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
goto unacquire_priv_sbp; goto unacquire_priv_sbp;
} }
if (!(bh = sb_bread(sb, sb_block))) { bh = sb_bread(sb, sb_block);
if (!bh) {
if (!silent) if (!silent)
befs_error(sb, "unable to read superblock"); befs_error(sb, "unable to read superblock");
goto unacquire_priv_sbp; goto unacquire_priv_sbp;
...@@ -816,7 +851,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -816,7 +851,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
brelse(bh); brelse(bh);
if( befs_sb->num_blocks > ~((sector_t)0) ) { if (befs_sb->num_blocks > ~((sector_t)0)) {
if (!silent) if (!silent)
befs_error(sb, "blocks count: %llu is larger than the host can use", befs_error(sb, "blocks count: %llu is larger than the host can use",
befs_sb->num_blocks); befs_sb->num_blocks);
...@@ -831,6 +866,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -831,6 +866,7 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
/* Set real blocksize of fs */ /* Set real blocksize of fs */
sb_set_blocksize(sb, (ulong) befs_sb->block_size); sb_set_blocksize(sb, (ulong) befs_sb->block_size);
sb->s_op = &befs_sops; sb->s_op = &befs_sops;
sb->s_export_op = &befs_export_operations;
root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir))); root = befs_iget(sb, iaddr2blockno(sb, &(befs_sb->root_dir)));
if (IS_ERR(root)) { if (IS_ERR(root)) {
ret = PTR_ERR(root); ret = PTR_ERR(root);
...@@ -861,16 +897,16 @@ befs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -861,16 +897,16 @@ befs_fill_super(struct super_block *sb, void *data, int silent)
} }
return 0; return 0;
/*****************/
unacquire_bh: unacquire_bh:
brelse(bh); brelse(bh);
unacquire_priv_sbp: unacquire_priv_sbp:
kfree(befs_sb->mount_opts.iocharset); kfree(befs_sb->mount_opts.iocharset);
kfree(sb->s_fs_info); kfree(sb->s_fs_info);
sb->s_fs_info = NULL; sb->s_fs_info = NULL;
unacquire_none: unacquire_none:
return ret; return ret;
} }
...@@ -956,9 +992,9 @@ exit_befs_fs(void) ...@@ -956,9 +992,9 @@ exit_befs_fs(void)
} }
/* /*
Macros that typecheck the init and exit functions, * Macros that typecheck the init and exit functions,
ensures that they are called at init and cleanup, * ensures that they are called at init and cleanup,
and eliminates warnings about unused functions. * and eliminates warnings about unused functions.
*/ */
module_init(init_befs_fs) module_init(init_befs_fs)
module_exit(exit_befs_fs) module_exit(exit_befs_fs)
...@@ -2,7 +2,5 @@ ...@@ -2,7 +2,5 @@
* super.h * super.h
*/ */
int befs_load_sb(struct super_block *sb, befs_super_block * disk_sb); int befs_load_sb(struct super_block *sb, befs_super_block *disk_sb);
int befs_check_sb(struct super_block *sb); int befs_check_sb(struct super_block *sb);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment