Commit 22341d8f authored by Al Viro's avatar Al Viro

befs: constify stuff a bit

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent e8991089
...@@ -116,7 +116,7 @@ BEFS_I(const struct inode *inode) ...@@ -116,7 +116,7 @@ BEFS_I(const struct inode *inode)
} }
static inline befs_blocknr_t static inline befs_blocknr_t
iaddr2blockno(struct super_block *sb, befs_inode_addr * iaddr) iaddr2blockno(struct super_block *sb, const befs_inode_addr *iaddr)
{ {
return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) + return ((iaddr->allocation_group << BEFS_SB(sb)->ag_shift) +
iaddr->start); iaddr->start);
...@@ -141,7 +141,7 @@ befs_iaddrs_per_block(struct super_block *sb) ...@@ -141,7 +141,7 @@ befs_iaddrs_per_block(struct super_block *sb)
} }
static inline int static inline int
befs_iaddr_is_empty(befs_inode_addr * iaddr) befs_iaddr_is_empty(const befs_inode_addr *iaddr)
{ {
return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len); return (!iaddr->allocation_group) && (!iaddr->start) && (!iaddr->len);
} }
......
...@@ -88,15 +88,15 @@ struct befs_btree_node { ...@@ -88,15 +88,15 @@ struct befs_btree_node {
static const befs_off_t befs_bt_inval = 0xffffffffffffffffULL; static const befs_off_t befs_bt_inval = 0xffffffffffffffffULL;
/* local functions */ /* local functions */
static int befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds, static int befs_btree_seekleaf(struct super_block *sb, const befs_data_stream *ds,
befs_btree_super * bt_super, befs_btree_super * bt_super,
struct befs_btree_node *this_node, struct befs_btree_node *this_node,
befs_off_t * node_off); befs_off_t * node_off);
static int befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, static int befs_bt_read_super(struct super_block *sb, const befs_data_stream *ds,
befs_btree_super * sup); befs_btree_super * sup);
static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds, static int befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds,
struct befs_btree_node *node, struct befs_btree_node *node,
befs_off_t node_off); befs_off_t node_off);
...@@ -134,7 +134,7 @@ static int befs_compare_strings(const void *key1, int keylen1, ...@@ -134,7 +134,7 @@ static int befs_compare_strings(const void *key1, int keylen1,
* On failure, BEFS_ERR is returned. * On failure, BEFS_ERR is returned.
*/ */
static int static int
befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, befs_bt_read_super(struct super_block *sb, const befs_data_stream *ds,
befs_btree_super * sup) befs_btree_super * sup)
{ {
struct buffer_head *bh; struct buffer_head *bh;
...@@ -193,7 +193,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, ...@@ -193,7 +193,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
*/ */
static int static int
befs_bt_read_node(struct super_block *sb, befs_data_stream * ds, befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds,
struct befs_btree_node *node, befs_off_t node_off) struct befs_btree_node *node, befs_off_t node_off)
{ {
uint off = 0; uint off = 0;
...@@ -247,7 +247,7 @@ befs_bt_read_node(struct super_block *sb, befs_data_stream * ds, ...@@ -247,7 +247,7 @@ befs_bt_read_node(struct super_block *sb, befs_data_stream * ds,
* actuall value stored with the key. * actuall value stored with the key.
*/ */
int int
befs_btree_find(struct super_block *sb, befs_data_stream * ds, 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)
{ {
struct befs_btree_node *this_node; struct befs_btree_node *this_node;
...@@ -416,7 +416,7 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node, ...@@ -416,7 +416,7 @@ befs_find_key(struct super_block *sb, struct befs_btree_node *node,
* 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
befs_btree_read(struct super_block *sb, befs_data_stream * ds, befs_btree_read(struct super_block *sb, const befs_data_stream *ds,
loff_t key_no, size_t bufsize, char *keybuf, size_t * keysize, loff_t key_no, size_t bufsize, char *keybuf, size_t * keysize,
befs_off_t * value) befs_off_t * value)
{ {
...@@ -548,7 +548,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, ...@@ -548,7 +548,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
* 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.
*/ */
static int static int
befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds, befs_btree_seekleaf(struct super_block *sb, const befs_data_stream *ds,
befs_btree_super *bt_super, befs_btree_super *bt_super,
struct befs_btree_node *this_node, struct befs_btree_node *this_node,
befs_off_t * node_off) befs_off_t * node_off)
......
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
*/ */
int befs_btree_find(struct super_block *sb, 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, 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);
...@@ -21,16 +21,16 @@ ...@@ -21,16 +21,16 @@
const befs_inode_addr BAD_IADDR = { 0, 0, 0 }; const befs_inode_addr BAD_IADDR = { 0, 0, 0 };
static int befs_find_brun_direct(struct super_block *sb, static int befs_find_brun_direct(struct super_block *sb,
befs_data_stream * data, const befs_data_stream *data,
befs_blocknr_t blockno, befs_block_run * run); befs_blocknr_t blockno, befs_block_run * run);
static int befs_find_brun_indirect(struct super_block *sb, static int befs_find_brun_indirect(struct super_block *sb,
befs_data_stream * data, const befs_data_stream *data,
befs_blocknr_t blockno, befs_blocknr_t blockno,
befs_block_run * run); befs_block_run * run);
static int befs_find_brun_dblindirect(struct super_block *sb, static int befs_find_brun_dblindirect(struct super_block *sb,
befs_data_stream * data, const befs_data_stream *data,
befs_blocknr_t blockno, befs_blocknr_t blockno,
befs_block_run * run); befs_block_run * run);
...@@ -45,7 +45,7 @@ static int befs_find_brun_dblindirect(struct super_block *sb, ...@@ -45,7 +45,7 @@ static int befs_find_brun_dblindirect(struct super_block *sb,
* if you don't need to know offset just set @off = NULL. * if you don't need to know offset just set @off = NULL.
*/ */
struct buffer_head * struct buffer_head *
befs_read_datastream(struct super_block *sb, befs_data_stream * ds, befs_read_datastream(struct super_block *sb, const befs_data_stream *ds,
befs_off_t pos, uint * off) befs_off_t pos, uint * off)
{ {
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
...@@ -87,7 +87,7 @@ befs_read_datastream(struct super_block *sb, befs_data_stream * ds, ...@@ -87,7 +87,7 @@ befs_read_datastream(struct super_block *sb, befs_data_stream * ds,
* 2001-11-15 Will Dyson * 2001-11-15 Will Dyson
*/ */
int int
befs_fblock2brun(struct super_block *sb, befs_data_stream * data, 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)
{ {
int err; int err;
...@@ -122,8 +122,8 @@ befs_fblock2brun(struct super_block *sb, befs_data_stream * data, ...@@ -122,8 +122,8 @@ befs_fblock2brun(struct super_block *sb, befs_data_stream * data,
* Returns the number of bytes read * Returns the number of bytes read
*/ */
size_t size_t
befs_read_lsymlink(struct super_block * sb, befs_data_stream * ds, void *buff, befs_read_lsymlink(struct super_block *sb, const befs_data_stream *ds,
befs_off_t len) void *buff, befs_off_t len)
{ {
befs_off_t bytes_read = 0; /* bytes readed */ befs_off_t bytes_read = 0; /* bytes readed */
u16 plen; u16 plen;
...@@ -163,7 +163,7 @@ befs_read_lsymlink(struct super_block * sb, befs_data_stream * ds, void *buff, ...@@ -163,7 +163,7 @@ befs_read_lsymlink(struct super_block * sb, befs_data_stream * ds, void *buff,
*/ */
befs_blocknr_t befs_blocknr_t
befs_count_blocks(struct super_block * sb, befs_data_stream * ds) befs_count_blocks(struct super_block *sb, const befs_data_stream *ds)
{ {
befs_blocknr_t blocks; befs_blocknr_t blocks;
befs_blocknr_t datablocks; /* File data blocks */ befs_blocknr_t datablocks; /* File data blocks */
...@@ -243,11 +243,11 @@ befs_count_blocks(struct super_block * sb, befs_data_stream * ds) ...@@ -243,11 +243,11 @@ befs_count_blocks(struct super_block * sb, befs_data_stream * ds)
2001-11-15 Will Dyson 2001-11-15 Will Dyson
*/ */
static int static int
befs_find_brun_direct(struct super_block *sb, befs_data_stream * data, befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data,
befs_blocknr_t blockno, befs_block_run * run) befs_blocknr_t blockno, befs_block_run * run)
{ {
int i; int i;
befs_block_run *array = data->direct; const befs_block_run *array = data->direct;
befs_blocknr_t sum; befs_blocknr_t sum;
befs_blocknr_t max_block = befs_blocknr_t max_block =
data->max_direct_range >> BEFS_SB(sb)->block_shift; data->max_direct_range >> BEFS_SB(sb)->block_shift;
...@@ -304,7 +304,8 @@ befs_find_brun_direct(struct super_block *sb, befs_data_stream * data, ...@@ -304,7 +304,8 @@ befs_find_brun_direct(struct super_block *sb, befs_data_stream * data,
*/ */
static int static int
befs_find_brun_indirect(struct super_block *sb, befs_find_brun_indirect(struct super_block *sb,
befs_data_stream * data, befs_blocknr_t blockno, const befs_data_stream *data,
befs_blocknr_t blockno,
befs_block_run * run) befs_block_run * run)
{ {
int i, j; int i, j;
...@@ -412,7 +413,8 @@ befs_find_brun_indirect(struct super_block *sb, ...@@ -412,7 +413,8 @@ befs_find_brun_indirect(struct super_block *sb,
*/ */
static int static int
befs_find_brun_dblindirect(struct super_block *sb, befs_find_brun_dblindirect(struct super_block *sb,
befs_data_stream * data, befs_blocknr_t blockno, const befs_data_stream *data,
befs_blocknr_t blockno,
befs_block_run * run) befs_block_run * run)
{ {
int dblindir_indx; int dblindir_indx;
......
...@@ -4,16 +4,17 @@ ...@@ -4,16 +4,17 @@
*/ */
struct buffer_head *befs_read_datastream(struct super_block *sb, struct buffer_head *befs_read_datastream(struct super_block *sb,
befs_data_stream * ds, befs_off_t pos, const befs_data_stream *ds,
uint * off); befs_off_t pos, uint * off);
int befs_fblock2brun(struct super_block *sb, 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, 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);
befs_blocknr_t befs_count_blocks(struct super_block *sb, befs_data_stream * ds); befs_blocknr_t befs_count_blocks(struct super_block *sb,
const befs_data_stream *ds);
extern const befs_inode_addr BAD_IADDR; extern const befs_inode_addr BAD_IADDR;
...@@ -157,7 +157,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags) ...@@ -157,7 +157,7 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
{ {
struct inode *inode = NULL; struct inode *inode = NULL;
struct super_block *sb = dir->i_sb; struct super_block *sb = dir->i_sb;
befs_data_stream *ds = &BEFS_I(dir)->i_data.ds; const befs_data_stream *ds = &BEFS_I(dir)->i_data.ds;
befs_off_t offset; befs_off_t offset;
int ret; int ret;
int utfnamelen; int utfnamelen;
...@@ -207,7 +207,7 @@ befs_readdir(struct file *file, struct dir_context *ctx) ...@@ -207,7 +207,7 @@ befs_readdir(struct file *file, struct dir_context *ctx)
{ {
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
befs_data_stream *ds = &BEFS_I(inode)->i_data.ds; const befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
befs_off_t value; befs_off_t value;
int result; int result;
size_t keysize; size_t keysize;
......
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