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
...@@ -79,7 +79,7 @@ enum inode_flags { ...@@ -79,7 +79,7 @@ enum inode_flags {
BEFS_INODE_WAS_WRITTEN = 0x00020000, BEFS_INODE_WAS_WRITTEN = 0x00020000,
BEFS_NO_TRANSACTION = 0x00040000, BEFS_NO_TRANSACTION = 0x00040000,
}; };
/* /*
* On-Disk datastructures of BeFS * On-Disk datastructures of BeFS
*/ */
...@@ -139,7 +139,7 @@ typedef struct { ...@@ -139,7 +139,7 @@ typedef struct {
} PACKED befs_super_block; } PACKED befs_super_block;
/* /*
* Note: the indirect and dbl_indir block_runs may * Note: the indirect and dbl_indir block_runs may
* be longer than one block! * be longer than one block!
*/ */
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
* *
* Dominic Giampaolo, author of "Practical File System * Dominic Giampaolo, author of "Practical File System
* Design with the Be File System", for such a helpful book. * Design with the Be File System", for such a helpful book.
* *
* Marcus J. Ranum, author of the b+tree package in * Marcus J. Ranum, author of the b+tree package in
* comp.sources.misc volume 10. This code is not copied from that * comp.sources.misc volume 10. This code is not copied from that
* work, but it is partially based on it. * work, but it is partially based on it.
* *
...@@ -38,38 +38,38 @@ ...@@ -38,38 +38,38 @@
*/ */
/* Befs B+tree structure: /* Befs B+tree structure:
* *
* The first thing in the tree is the tree superblock. It tells you * The first thing in the tree is the tree superblock. It tells you
* all kinds of useful things about the tree, like where the rootnode * all kinds of useful things about the tree, like where the rootnode
* is located, and the size of the nodes (always 1024 with current version * is located, and the size of the nodes (always 1024 with current version
* of BeOS). * of BeOS).
* *
* The rest of the tree consists of a series of nodes. Nodes contain a header * The rest of the tree consists of a series of nodes. Nodes contain a header
* (struct befs_btree_nodehead), the packed key data, an array of shorts * (struct befs_btree_nodehead), the packed key data, an array of shorts
* containing the ending offsets for each of the keys, and an array of * containing the ending offsets for each of the keys, and an array of
* befs_off_t values. In interior nodes, the keys are the ending keys for * befs_off_t values. In interior nodes, the keys are the ending keys for
* the childnode they point to, and the values are offsets into the * the childnode they point to, and the values are offsets into the
* datastream containing the tree. * datastream containing the tree.
*/ */
/* Note: /* Note:
* *
* The book states 2 confusing things about befs b+trees. First, * The book states 2 confusing things about befs b+trees. First,
* it states that the overflow field of node headers is used by internal nodes * it states that the overflow field of node headers is used by internal nodes
* to point to another node that "effectively continues this one". Here is what * to point to another node that "effectively continues this one". Here is what
* I believe that means. Each key in internal nodes points to another node that * I believe that means. Each key in internal nodes points to another node that
* contains key values less than itself. Inspection reveals that the last key * contains key values less than itself. Inspection reveals that the last key
* in the internal node is not the last key in the index. Keys that are * in the internal node is not the last key in the index. Keys that are
* greater than the last key in the internal node go into the overflow node. * greater than the last key in the internal node go into the overflow node.
* I imagine there is a performance reason for this. * I imagine there is a performance reason for this.
* *
* Second, it states that the header of a btree node is sufficient to * Second, it states that the header of a btree node is sufficient to
* distinguish internal nodes from leaf nodes. Without saying exactly how. * distinguish internal nodes from leaf nodes. Without saying exactly how.
* After figuring out the first, it becomes obvious that internal nodes have * After figuring out the first, it becomes obvious that internal nodes have
* overflow nodes and leafnodes do not. * overflow nodes and leafnodes do not.
*/ */
/* /*
* Currently, this code is only good for directory B+trees. * Currently, this code is only good for directory B+trees.
* In order to be used for other BFS indexes, it needs to be extended to handle * In order to be used for other BFS indexes, it needs to be extended to handle
* duplicate keys and non-string keytypes (int32, int64, float, double). * duplicate keys and non-string keytypes (int32, int64, float, double).
...@@ -237,8 +237,8 @@ befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds, ...@@ -237,8 +237,8 @@ befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds,
* with @key (usually the disk block number of an inode). * with @key (usually the disk block number of an inode).
* *
* On failure, returns BEFS_ERR or BEFS_BT_NOT_FOUND. * On failure, returns BEFS_ERR or BEFS_BT_NOT_FOUND.
* *
* Algorithm: * Algorithm:
* Read the superblock and rootnode of the b+tree. * Read the superblock and rootnode of the b+tree.
* Drill down through the interior nodes using befs_find_key(). * Drill down through the interior nodes using befs_find_key().
* Once at the correct leaf node, use befs_find_key() again to get the * Once at the correct leaf node, use befs_find_key() again to get the
...@@ -402,12 +402,12 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node, ...@@ -402,12 +402,12 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node,
* *
* Here's how it works: Key_no is the index of the key/value pair to * Here's how it works: Key_no is the index of the key/value pair to
* return in keybuf/value. * return in keybuf/value.
* Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is * Bufsize is the size of keybuf (BEFS_NAME_LEN+1 is a good size). Keysize is
* the number of characters in the key (just a convenience). * the number of characters in the key (just a convenience).
* *
* Algorithm: * Algorithm:
* Get the first leafnode of the tree. See if the requested key is in that * Get the first leafnode of the tree. See if the requested key is in that
* node. If not, follow the node->right link to the next leafnode. Repeat * node. If not, follow the node->right link to the next leafnode. Repeat
* until the (key_no)th key is found or the tree is out of keys. * until the (key_no)th key is found or the tree is out of keys.
*/ */
int int
...@@ -536,7 +536,7 @@ befs_btree_read(struct super_block *sb, const befs_data_stream *ds, ...@@ -536,7 +536,7 @@ befs_btree_read(struct super_block *sb, const befs_data_stream *ds,
* @node_off: Pointer to offset of current node within datastream. Modified * @node_off: Pointer to offset of current node within datastream. Modified
* by the function. * by the function.
* *
* Helper function for btree traverse. Moves the current position to the * Helper function for btree traverse. Moves the current position to the
* start of the first leaf node. * start of the first leaf node.
* *
* Also checks for an empty tree. If there are no keys, returns BEFS_BT_EMPTY. * Also checks for an empty tree. If there are no keys, returns BEFS_BT_EMPTY.
...@@ -592,10 +592,10 @@ befs_btree_seekleaf(struct super_block *sb, const befs_data_stream *ds, ...@@ -592,10 +592,10 @@ befs_btree_seekleaf(struct super_block *sb, const befs_data_stream *ds,
} }
/** /**
* befs_leafnode - Determine if the btree node is a leaf node or an * befs_leafnode - Determine if the btree node is a leaf node or an
* interior node * interior node
* @node: Pointer to node structure to test * @node: Pointer to node structure to test
* *
* Return 1 if leaf, 0 if interior * Return 1 if leaf, 0 if interior
*/ */
static int static int
...@@ -656,7 +656,7 @@ befs_bt_valarray(struct befs_btree_node *node) ...@@ -656,7 +656,7 @@ befs_bt_valarray(struct befs_btree_node *node)
* @node: Pointer to the node structure to find the keydata array within * @node: Pointer to the node structure to find the keydata array within
* *
* Returns a pointer to the start of the keydata array * Returns a pointer to the start of the keydata array
* of the node pointed to by the node header * of the node pointed to by the node header
*/ */
static char * static char *
befs_bt_keydata(struct befs_btree_node *node) befs_bt_keydata(struct befs_btree_node *node)
...@@ -702,7 +702,7 @@ befs_bt_get_key(struct super_block *sb, struct befs_btree_node *node, ...@@ -702,7 +702,7 @@ befs_bt_get_key(struct super_block *sb, struct befs_btree_node *node,
/** /**
* befs_compare_strings - compare two strings * befs_compare_strings - compare two strings
* @key1: pointer to the first key to be compared * @key1: pointer to the first key to be compared
* @keylen1: length in bytes of key1 * @keylen1: length in bytes of key1
* @key2: pointer to the second key to be compared * @key2: pointer to the second key to be compared
* @keylen2: length in bytes of key2 * @keylen2: length in bytes of key2
......
/* /*
* btree.h * btree.h
* *
*/ */
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);
...@@ -84,13 +84,11 @@ befs_read_datastream(struct super_block *sb, const befs_data_stream *ds, ...@@ -84,13 +84,11 @@ befs_read_datastream(struct super_block *sb, const befs_data_stream *ds,
* *
* Takes a file position and gives back a brun who's starting block * Takes a file position and gives back a brun who's starting block
* is block number fblock of the file. * is block number fblock of the file.
* *
* Returns BEFS_OK or BEFS_ERR. * Returns BEFS_OK or BEFS_ERR.
* *
* 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,
...@@ -120,7 +118,7 @@ befs_fblock2brun(struct super_block *sb, const befs_data_stream *data, ...@@ -120,7 +118,7 @@ befs_fblock2brun(struct super_block *sb, const befs_data_stream *data,
/** /**
* befs_read_lsmylink - read long symlink from datastream. * befs_read_lsmylink - read long symlink from datastream.
* @sb: Filesystem superblock * @sb: Filesystem superblock
* @ds: Datastream to read from * @ds: Datastream to read from
* @buff: Buffer in which to place long symlink data * @buff: Buffer in which to place long symlink data
* @len: Length of the long symlink in bytes * @len: Length of the long symlink in bytes
......
...@@ -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;
/* /*
* linux/fs/befs/debug.c * linux/fs/befs/debug.c
* *
* Copyright (C) 2001 Will Dyson (will_dyson at pobox.com) * Copyright (C) 2001 Will Dyson (will_dyson at pobox.com)
* *
* With help from the ntfs-tng driver by Anton Altparmakov * With help from the ntfs-tng driver by Anton Altparmakov
...@@ -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
......
/* /*
* inode.c * inode.c
* *
* Copyright (C) 2001 Will Dyson <will_dyson@pobox.com> * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com>
*/ */
...@@ -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);
......
/* /*
* inode.h * inode.h
* *
*/ */
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);
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright (C) 2001 Will Dyson <will_dyson@pobox.com * Copyright (C) 2001 Will Dyson <will_dyson@pobox.com
* *
* Based on portions of file.c and inode.c * Based on portions of file.c and inode.c
* by Makoto Kato (m_kato@ga2.so-net.ne.jp) * by Makoto Kato (m_kato@ga2.so-net.ne.jp)
* *
* Many thanks to Dominic Giampaolo, author of Practical File System * Many thanks to Dominic Giampaolo, author of Practical File System
...@@ -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);
This diff is collapsed.
...@@ -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