summaryrefslogtreecommitdiff
path: root/mkfs.ubifs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-16 16:11:32 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-16 16:11:32 +0200
commit3bcddc65e3ffd69f29a68410c0604218cec8c34a (patch)
tree0ed685cad8496aec9af5c5d2c39ac5568edf1be6 /mkfs.ubifs
parent2416fefc0adc6061212e5ccbf166c8c987385527 (diff)
mkfs.ubifs: fix various warnings
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'mkfs.ubifs')
-rw-r--r--mkfs.ubifs/devtable.c12
-rw-r--r--mkfs.ubifs/key.h392
-rw-r--r--mkfs.ubifs/mkfs.ubifs.c29
-rw-r--r--mkfs.ubifs/mkfs.ubifs.h2
-rw-r--r--mkfs.ubifs/ubifs.h11
5 files changed, 46 insertions, 400 deletions
diff --git a/mkfs.ubifs/devtable.c b/mkfs.ubifs/devtable.c
index 3f38339..236a6e7 100644
--- a/mkfs.ubifs/devtable.c
+++ b/mkfs.ubifs/devtable.c
@@ -125,7 +125,7 @@ static int separate_last(const char *buf, int len, char **path, char **name)
return 0;
}
-static int interpret_table_entry(const char *root, const char *line)
+static int interpret_table_entry(const char *line)
{
char buf[1024], type, *path = NULL, *name = NULL;
int len;
@@ -193,7 +193,7 @@ static int interpret_table_entry(const char *root, const char *line)
dbg_msg(3, "inserting '%s' into path hash table", path);
ph_elt = malloc(sizeof(struct path_htbl_element));
if (!ph_elt) {
- err_msg("cannot allocate %d bytes of memory",
+ err_msg("cannot allocate %zd bytes of memory",
sizeof(struct path_htbl_element));
goto out_free;
}
@@ -226,7 +226,7 @@ static int interpret_table_entry(const char *root, const char *line)
/* This entry does not require any iterating */
nh_elt = malloc(sizeof(struct name_htbl_element));
if (!nh_elt) {
- err_msg("cannot allocate %d bytes of memory",
+ err_msg("cannot allocate %zd bytes of memory",
sizeof(struct name_htbl_element));
goto out_free;
}
@@ -254,7 +254,7 @@ static int interpret_table_entry(const char *root, const char *line)
for (i = start; i < num; i++) {
nh_elt = malloc(sizeof(struct name_htbl_element));
if (!nh_elt) {
- err_msg("cannot allocate %d bytes of memory",
+ err_msg("cannot allocate %zd bytes of memory",
sizeof(struct name_htbl_element));
goto out_free;
}
@@ -311,7 +311,7 @@ out_free:
* Returns zero in case of success and a negative error code in case of
* failure.
*/
-int parse_devtable(const char *root, const char *tbl_file)
+int parse_devtable(const char *tbl_file)
{
FILE *f;
char *line = NULL;
@@ -358,7 +358,7 @@ int parse_devtable(const char *root, const char *tbl_file)
/* If this is not a comment line, try to interpret it */
if (len && *line != '#') {
- if (interpret_table_entry(root, line)) {
+ if (interpret_table_entry(line)) {
err_msg("cannot parse '%s'", line);
goto out_close;
}
diff --git a/mkfs.ubifs/key.h b/mkfs.ubifs/key.h
index 2bdd431..d3a02d4 100644
--- a/mkfs.ubifs/key.h
+++ b/mkfs.ubifs/key.h
@@ -38,6 +38,22 @@
#define __UBIFS_KEY_H__
/**
+ * key_mask_hash - mask a valid hash value.
+ * @val: value to be masked
+ *
+ * We use hash values as offset in directories, so values %0 and %1 are
+ * reserved for "." and "..". %2 is reserved for "end of readdir" marker. This
+ * function makes sure the reserved values are not used.
+ */
+static inline uint32_t key_mask_hash(uint32_t hash)
+{
+ hash &= UBIFS_S_KEY_HASH_MASK;
+ if (unlikely(hash <= 2))
+ hash += 3;
+ return hash;
+}
+
+/**
* key_r5_hash - R5 hash function (borrowed from reiserfs).
* @s: direntry name
* @len: name length
@@ -47,6 +63,7 @@ static inline uint32_t key_r5_hash(const char *s, int len)
uint32_t a = 0;
const signed char *str = (const signed char *)s;
+ len = len;
while (*str) {
a += *str << 4;
a += *str >> 4;
@@ -54,16 +71,7 @@ static inline uint32_t key_r5_hash(const char *s, int len)
str++;
}
- a &= UBIFS_S_KEY_HASH_MASK;
-
- /*
- * We use hash values as offset in directories, so values %0 and %1 are
- * reserved for "." and "..". %2 is reserved for "end of readdir"
- * marker.
- */
- if (unlikely(a >= 0 && a <= 2))
- a += 3;
- return a;
+ return key_mask_hash(a);
}
/**
@@ -77,10 +85,7 @@ static inline uint32_t key_test_hash(const char *str, int len)
len = min_t(uint32_t, len, 4);
memcpy(&a, str, len);
- a &= UBIFS_S_KEY_HASH_MASK;
- if (unlikely(a >= 0 && a <= 2))
- a += 3;
- return a;
+ return key_mask_hash(a);
}
/**
@@ -89,56 +94,13 @@ static inline uint32_t key_test_hash(const char *str, int len)
* @key: key to initialize
* @inum: inode number
*/
-static inline void ino_key_init(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum)
+static inline void ino_key_init(union ubifs_key *key, ino_t inum)
{
key->u32[0] = inum;
key->u32[1] = UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS;
}
/**
- * ino_key_init_flash - initialize on-flash inode key.
- * @c: UBIFS file-system description object
- * @k: key to initialize
- * @inum: inode number
- */
-static inline void ino_key_init_flash(const struct ubifs_info *c, void *k,
- ino_t inum)
-{
- union ubifs_key *key = k;
-
- key->j32[0] = cpu_to_le32(inum);
- key->j32[1] = cpu_to_le32(UBIFS_INO_KEY << UBIFS_S_KEY_BLOCK_BITS);
- memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8);
-}
-
-/**
- * lowest_ino_key - get the lowest possible inode key.
- * @c: UBIFS file-system description object
- * @key: key to initialize
- * @inum: inode number
- */
-static inline void lowest_ino_key(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum)
-{
- key->u32[0] = inum;
- key->u32[1] = 0;
-}
-
-/**
- * highest_ino_key - get the highest possible inode key.
- * @c: UBIFS file-system description object
- * @key: key to initialize
- * @inum: inode number
- */
-static inline void highest_ino_key(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum)
-{
- key->u32[0] = inum;
- key->u32[1] = 0xffffffff;
-}
-
-/**
* dent_key_init - initialize directory entry key.
* @c: UBIFS file-system description object
* @key: key to initialize
@@ -157,132 +119,13 @@ static inline void dent_key_init(const struct ubifs_info *c,
}
/**
- * dent_key_init_hash - initialize directory entry key without re-calculating
- * hash function.
- * @c: UBIFS file-system description object
- * @key: key to initialize
- * @inum: parent inode number
- * @hash: direntry name hash
- */
-static inline void dent_key_init_hash(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum,
- uint32_t hash)
-{
- ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
- key->u32[0] = inum;
- key->u32[1] = hash | (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS);
-}
-
-/**
- * dent_key_init_flash - initialize on-flash directory entry key.
- * @c: UBIFS file-system description object
- * @k: key to initialize
- * @inum: parent inode number
- * @nm: direntry name and length
- */
-static inline void dent_key_init_flash(const struct ubifs_info *c, void *k,
- ino_t inum, const struct qstr *nm)
-{
- union ubifs_key *key = k;
- uint32_t hash = c->key_hash(nm->name, nm->len);
-
- ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
- key->j32[0] = cpu_to_le32(inum);
- key->j32[1] = cpu_to_le32(hash |
- (UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS));
- memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8);
-}
-
-/**
- * lowest_dent_key - get the lowest possible directory entry key.
- * @c: UBIFS file-system description object
- * @key: where to store the lowest key
- * @inum: parent inode number
- */
-static inline void lowest_dent_key(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum)
-{
- key->u32[0] = inum;
- key->u32[1] = UBIFS_DENT_KEY << UBIFS_S_KEY_HASH_BITS;
-}
-
-/**
- * xent_key_init - initialize extended attribute entry key.
- * @c: UBIFS file-system description object
- * @key: key to initialize
- * @inum: host inode number
- * @nm: extended attribute entry name and length
- */
-static inline void xent_key_init(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum,
- const struct qstr *nm)
-{
- uint32_t hash = c->key_hash(nm->name, nm->len);
-
- ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
- key->u32[0] = inum;
- key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS);
-}
-
-/**
- * xent_key_init_hash - initialize extended attribute entry key without
- * re-calculating hash function.
- * @c: UBIFS file-system description object
- * @key: key to initialize
- * @inum: host inode number
- * @hash: extended attribute entry name hash
- */
-static inline void xent_key_init_hash(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum,
- uint32_t hash)
-{
- ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
- key->u32[0] = inum;
- key->u32[1] = hash | (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS);
-}
-
-/**
- * xent_key_init_flash - initialize on-flash extended attribute entry key.
- * @c: UBIFS file-system description object
- * @k: key to initialize
- * @inum: host inode number
- * @nm: extended attribute entry name and length
- */
-static inline void xent_key_init_flash(const struct ubifs_info *c, void *k,
- ino_t inum, const struct qstr *nm)
-{
- union ubifs_key *key = k;
- uint32_t hash = c->key_hash(nm->name, nm->len);
-
- ubifs_assert(!(hash & ~UBIFS_S_KEY_HASH_MASK));
- key->j32[0] = cpu_to_le32(inum);
- key->j32[1] = cpu_to_le32(hash |
- (UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS));
- memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8);
-}
-
-/**
- * lowest_xent_key - get the lowest possible extended attribute entry key.
- * @c: UBIFS file-system description object
- * @key: where to store the lowest key
- * @inum: host inode number
- */
-static inline void lowest_xent_key(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum)
-{
- key->u32[0] = inum;
- key->u32[1] = UBIFS_XENT_KEY << UBIFS_S_KEY_HASH_BITS;
-}
-
-/**
* data_key_init - initialize data key.
* @c: UBIFS file-system description object
* @key: key to initialize
* @inum: inode number
* @block: block number
*/
-static inline void data_key_init(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum,
+static inline void data_key_init(union ubifs_key *key, ino_t inum,
unsigned int block)
{
ubifs_assert(!(block & ~UBIFS_S_KEY_BLOCK_MASK));
@@ -291,157 +134,12 @@ static inline void data_key_init(const struct ubifs_info *c,
}
/**
- * data_key_init_flash - initialize on-flash data key.
- * @c: UBIFS file-system description object
- * @k: key to initialize
- * @inum: inode number
- * @block: block number
- */
-static inline void data_key_init_flash(const struct ubifs_info *c, void *k,
- ino_t inum, unsigned int block)
-{
- union ubifs_key *key = k;
-
- ubifs_assert(!(block & ~UBIFS_S_KEY_BLOCK_MASK));
- key->j32[0] = cpu_to_le32(inum);
- key->j32[1] = cpu_to_le32(block |
- (UBIFS_DATA_KEY << UBIFS_S_KEY_BLOCK_BITS));
- memset(k + 8, 0, UBIFS_MAX_KEY_LEN - 8);
-}
-
-/**
- * trun_key_init - initialize truncation node key.
- * @c: UBIFS file-system description object
- * @key: key to initialize
- * @inum: inode number
- *
- * Note, UBIFS does not have truncation keys on the media and this function is
- * only used for purposes of replay.
- */
-static inline void trun_key_init(const struct ubifs_info *c,
- union ubifs_key *key, ino_t inum)
-{
- key->u32[0] = inum;
- key->u32[1] = UBIFS_TRUN_KEY << UBIFS_S_KEY_BLOCK_BITS;
-}
-
-/**
- * key_type - get key type.
- * @c: UBIFS file-system description object
- * @key: key to get type of
- */
-static inline int key_type(const struct ubifs_info *c,
- const union ubifs_key *key)
-{
- return key->u32[1] >> UBIFS_S_KEY_BLOCK_BITS;
-}
-
-/**
- * key_type_flash - get type of a on-flash formatted key.
- * @c: UBIFS file-system description object
- * @k: key to get type of
- */
-static inline int key_type_flash(const struct ubifs_info *c, const void *k)
-{
- const union ubifs_key *key = k;
-
- return le32_to_cpu(key->u32[1]) >> UBIFS_S_KEY_BLOCK_BITS;
-}
-
-/**
- * key_ino - fetch inode number from key.
- * @c: UBIFS file-system description object
- * @k: key to fetch inode number from
- */
-static inline ino_t key_ino(const struct ubifs_info *c, const void *k)
-{
- const union ubifs_key *key = k;
-
- return key->u32[0];
-}
-
-/**
- * key_ino_flash - fetch inode number from an on-flash formatted key.
- * @c: UBIFS file-system description object
- * @k: key to fetch inode number from
- */
-static inline ino_t key_ino_flash(const struct ubifs_info *c, const void *k)
-{
- const union ubifs_key *key = k;
-
- return le32_to_cpu(key->j32[0]);
-}
-
-/**
- * key_hash - get directory entry hash.
- * @c: UBIFS file-system description object
- * @key: the key to get hash from
- */
-static inline int key_hash(const struct ubifs_info *c,
- const union ubifs_key *key)
-{
- return key->u32[1] & UBIFS_S_KEY_HASH_MASK;
-}
-
-/**
- * key_hash_flash - get directory entry hash from an on-flash formatted key.
- * @c: UBIFS file-system description object
- * @k: the key to get hash from
- */
-static inline int key_hash_flash(const struct ubifs_info *c, const void *k)
-{
- const union ubifs_key *key = k;
-
- return le32_to_cpu(key->j32[1]) & UBIFS_S_KEY_HASH_MASK;
-}
-
-/**
- * key_block - get data block number.
- * @c: UBIFS file-system description object
- * @key: the key to get the block number from
- */
-static inline unsigned int key_block(const struct ubifs_info *c,
- const union ubifs_key *key)
-{
- return key->u32[1] & UBIFS_S_KEY_BLOCK_MASK;
-}
-
-/**
- * key_block_flash - get data block number from an on-flash formatted key.
- * @c: UBIFS file-system description object
- * @k: the key to get the block number from
- */
-static inline unsigned int key_block_flash(const struct ubifs_info *c,
- const void *k)
-{
- const union ubifs_key *key = k;
-
- return le32_to_cpu(key->u32[1]) & UBIFS_S_KEY_BLOCK_MASK;
-}
-
-/**
- * key_read - transform a key to in-memory format.
- * @c: UBIFS file-system description object
- * @from: the key to transform
- * @to: the key to store the result
- */
-static inline void key_read(const struct ubifs_info *c, const void *from,
- union ubifs_key *to)
-{
- const union ubifs_key *f = from;
-
- to->u32[0] = le32_to_cpu(f->j32[0]);
- to->u32[1] = le32_to_cpu(f->j32[1]);
-}
-
-/**
* key_write - transform a key from in-memory format.
* @c: UBIFS file-system description object
* @from: the key to transform
* @to: the key to store the result
*/
-static inline void key_write(const struct ubifs_info *c,
- const union ubifs_key *from, void *to)
+static inline void key_write(const union ubifs_key *from, void *to)
{
union ubifs_key *t = to;
@@ -456,8 +154,7 @@ static inline void key_write(const struct ubifs_info *c,
* @from: the key to transform
* @to: the key to store the result
*/
-static inline void key_write_idx(const struct ubifs_info *c,
- const union ubifs_key *from, void *to)
+static inline void key_write_idx(const union ubifs_key *from, void *to)
{
union ubifs_key *t = to;
@@ -466,18 +163,6 @@ static inline void key_write_idx(const struct ubifs_info *c,
}
/**
- * key_copy - copy a key.
- * @c: UBIFS file-system description object
- * @from: the key to copy from
- * @to: the key to copy to
- */
-static inline void key_copy(const struct ubifs_info *c,
- const union ubifs_key *from, union ubifs_key *to)
-{
- to->u64[0] = from->u64[0];
-}
-
-/**
* keys_cmp - compare keys.
* @c: UBIFS file-system description object
* @key1: the first key to compare
@@ -486,8 +171,7 @@ static inline void key_copy(const struct ubifs_info *c,
* This function compares 2 keys and returns %-1 if @key1 is less than
* @key2, 0 if the keys are equivalent and %1 if @key1 is greater than @key2.
*/
-static inline int keys_cmp(const struct ubifs_info *c,
- const union ubifs_key *key1,
+static inline int keys_cmp(const union ubifs_key *key1,
const union ubifs_key *key2)
{
if (key1->u32[0] < key2->u32[0])
@@ -502,32 +186,4 @@ static inline int keys_cmp(const struct ubifs_info *c,
return 0;
}
-/**
- * is_hash_key - is a key vulnerable to hash collisions.
- * @c: UBIFS file-system description object
- * @key: key
- *
- * This function returns %1 if @key is a hashed key or %0 otherwise.
- */
-static inline int is_hash_key(const struct ubifs_info *c,
- const union ubifs_key *key)
-{
- int type = key_type(c, key);
-
- return type == UBIFS_DENT_KEY || type == UBIFS_XENT_KEY;
-}
-
-/**
- * key_max_inode_size - get maximum file size allowed by current key format.
- * @c: UBIFS file-system description object
- */
-static inline unsigned long long key_max_inode_size(const struct ubifs_info *c)
-{
- switch (c->key_fmt) {
- case UBIFS_SIMPLE_KEY_FMT:
- return (1ULL << UBIFS_S_KEY_BLOCK_BITS) * UBIFS_BLOCK_SIZE;
- default:
- return 0;
- }
-}
#endif /* !__UBIFS_KEY_H__ */
diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c
index e72b44c..22cee8e 100644
--- a/mkfs.ubifs/mkfs.ubifs.c
+++ b/mkfs.ubifs/mkfs.ubifs.c
@@ -650,7 +650,7 @@ static int get_options(int argc, char**argv)
if (validate_options())
return -1;
- if (tbl_file && parse_devtable(root, tbl_file))
+ if (tbl_file && parse_devtable(tbl_file))
return err_msg("cannot parse device table file '%s'", tbl_file);
return 0;
@@ -687,13 +687,14 @@ int write_leb(int lnum, int len, void *buf)
dbg_msg(3, "LEB %d len %d", lnum, len);
if (lseek64(out_fd, pos, SEEK_SET) != pos)
- return sys_err_msg("lseek64 failed seeking %lld", pos);
+ return sys_err_msg("lseek64 failed seeking %lld",
+ (long long)pos);
memset(buf + len, 0xff, c->leb_size - len);
if (write(out_fd, buf, c->leb_size) != c->leb_size)
return sys_err_msg("write failed writing %d bytes at pos %lld",
- c->leb_size, pos);
+ c->leb_size, (long long)pos);
return 0;
}
@@ -721,7 +722,7 @@ static int do_pad(void *buf, int len)
pad_len = wlen - alen;
dbg_msg(3, "len %d pad_len %d", len, pad_len);
buf += alen;
- if (pad_len >= UBIFS_PAD_NODE_SZ) {
+ if (pad_len >= (int)UBIFS_PAD_NODE_SZ) {
struct ubifs_ch *ch = buf;
struct ubifs_pad_node *pad_node = buf;
@@ -788,7 +789,7 @@ static int calc_dark(struct ubifs_info *c, int spc)
* anyway safely assume it we'll be able to write a node of the
* smallest size there.
*/
- if (spc - c->dark_wm < MIN_WRITE_SZ)
+ if (spc - c->dark_wm < (int)MIN_WRITE_SZ)
return spc - MIN_WRITE_SZ;
return c->dark_wm;
@@ -954,9 +955,9 @@ static int add_inode_with_data(struct stat *st, ino_t inum, void *data,
memset(ino, 0, UBIFS_INO_NODE_SZ);
- ino_key_init(c, &key, inum);
+ ino_key_init(&key, inum);
ino->ch.node_type = UBIFS_INO_NODE;
- key_write(c, &key, &ino->key);
+ key_write(&key, &ino->key);
ino->creat_sqnum = cpu_to_le64(creat_sqnum);
ino->size = cpu_to_le64(st->st_size);
ino->nlink = cpu_to_le32(st->st_nlink);
@@ -1092,7 +1093,7 @@ static int add_dent_node(ino_t dir_inum, const char *name, ino_t inum,
dent->ch.node_type = UBIFS_DENT_NODE;
dent_key_init(c, &key, dir_inum, &dname);
- key_write(c, &key, dent->key);
+ key_write(&key, dent->key);
dent->inum = cpu_to_le64(inum);
dent->padding1 = 0;
dent->type = type;
@@ -1202,9 +1203,9 @@ static int add_file(const char *path_name, struct stat *st, ino_t inum,
}
/* Make data node */
memset(dn, 0, UBIFS_DATA_NODE_SZ);
- data_key_init(c, &key, inum, block_no++);
+ data_key_init(&key, inum, block_no++);
dn->ch.node_type = UBIFS_DATA_NODE;
- key_write(c, &key, &dn->key);
+ key_write(&key, &dn->key);
dn->size = cpu_to_le32(bytes_read);
out_len = NODE_BUFFER_SIZE - UBIFS_DATA_NODE_SZ;
if (c->default_compr == UBIFS_COMPR_NONE &&
@@ -1578,7 +1579,7 @@ static int cmp_idx(const void *a, const void *b)
const struct idx_entry *e2 = *(const struct idx_entry **)b;
int cmp;
- cmp = keys_cmp(c, &e1->key, &e2->key);
+ cmp = keys_cmp(&e1->key, &e2->key);
if (cmp)
return cmp;
return namecmp(e1->name, e2->name);
@@ -1628,7 +1629,7 @@ static int write_index(void)
struct ubifs_branch *br;
int child_cnt, j, level, blnum, boffs, blen, blast_len, err;
- dbg_msg(1, "leaf node count: %d", idx_cnt);
+ dbg_msg(1, "leaf node count: %zd", idx_cnt);
/* Reset the head for the index */
head_flags = LPROPS_INDEX;
@@ -1677,7 +1678,7 @@ static int write_index(void)
idx->level = cpu_to_le16(0);
for (j = 0; j < child_cnt; j++, p++) {
br = ubifs_idx_branch(c, idx, j);
- key_write_idx(c, &(*p)->key, &br->key);
+ key_write_idx(&(*p)->key, &br->key);
br->lnum = cpu_to_le32((*p)->lnum);
br->offs = cpu_to_le32((*p)->offs);
br->len = cpu_to_le32((*p)->len);
@@ -1749,7 +1750,7 @@ static int write_index(void)
* of the index node from the level below.
*/
br = ubifs_idx_branch(c, idx, j);
- key_write_idx(c, &(*p)->key, &br->key);
+ key_write_idx(&(*p)->key, &br->key);
br->lnum = cpu_to_le32(blnum);
br->offs = cpu_to_le32(boffs);
br->len = cpu_to_le32(blen);
diff --git a/mkfs.ubifs/mkfs.ubifs.h b/mkfs.ubifs/mkfs.ubifs.h
index 3c0d79c..6460bd5 100644
--- a/mkfs.ubifs/mkfs.ubifs.h
+++ b/mkfs.ubifs/mkfs.ubifs.h
@@ -129,7 +129,7 @@ extern struct ubifs_info info_;
struct hashtable_itr;
int write_leb(int lnum, int len, void *buf);
-int parse_devtable(const char *root, const char *tbl_file);
+int parse_devtable(const char *tbl_file);
struct path_htbl_element *devtbl_find_path(const char *path);
struct name_htbl_element *devtbl_find_name(struct path_htbl_element *ph_elt,
const char *name);
diff --git a/mkfs.ubifs/ubifs.h b/mkfs.ubifs/ubifs.h
index fbefc53..48a583c 100644
--- a/mkfs.ubifs/ubifs.h
+++ b/mkfs.ubifs/ubifs.h
@@ -424,15 +424,4 @@ struct ubifs_branch *ubifs_idx_branch(const struct ubifs_info *c,
(UBIFS_BRANCH_SZ + c->key_len) * bnum);
}
-/**
- * ubifs_idx_key - return pointer to an index key.
- * @c: the UBIFS file-system description object
- * @idx: index node
- */
-static inline void *ubifs_idx_key(const struct ubifs_info *c,
- const struct ubifs_idx_node *idx)
-{
- return (void *)((struct ubifs_branch *)idx->branches)->key;
-}
-
#endif /* __UBIFS_H__ */