aboutsummaryrefslogtreecommitdiff
path: root/jffsX-utils
diff options
context:
space:
mode:
Diffstat (limited to 'jffsX-utils')
-rw-r--r--jffsX-utils/jffs2dump.c10
-rw-r--r--jffsX-utils/jffs2reader.c56
-rw-r--r--jffsX-utils/mkfs.jffs2.c10
-rw-r--r--jffsX-utils/sumtool.c40
4 files changed, 50 insertions, 66 deletions
diff --git a/jffsX-utils/jffs2dump.c b/jffsX-utils/jffs2dump.c
index a7d99e8..ad7a9e3 100644
--- a/jffsX-utils/jffs2dump.c
+++ b/jffsX-utils/jffs2dump.c
@@ -50,7 +50,7 @@
long imglen; // length of image
char *data; // image data
-void display_help (int error)
+static void display_help (int error)
{
printf("Usage: %s [OPTION]... INPUTFILE\n"
"Dump the contents of a binary JFFS2 image.\n\n"
@@ -68,7 +68,7 @@ void display_help (int error)
exit(error ? EXIT_FAILURE : EXIT_SUCCESS);
}
-void display_version (void)
+static void display_version (void)
{
common_print_version();
printf("Copyright (C) 2003 Thomas Gleixner \n"
@@ -95,7 +95,7 @@ char cnvfile[256]; // filename for conversion output
int datsize; // Size of data chunks, when oob data is inside the binary image
int oobsize; // Size of oob chunks, when oob data is inside the binary image
-void process_options (int argc, char *argv[])
+static void process_options (int argc, char *argv[])
{
int error = 0;
@@ -170,7 +170,7 @@ void process_options (int argc, char *argv[])
/*
* Dump image contents
*/
-void do_dumpcontent (void)
+static void do_dumpcontent (void)
{
char *p = data, *p_free_begin;
union jffs2_node_union *node;
@@ -479,7 +479,7 @@ void do_dumpcontent (void)
/*
* Convert endianess
*/
-void do_endianconvert (void)
+static void do_endianconvert (void)
{
char *p = data;
union jffs2_node_union *node, newnode;
diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c
index 16870ba..083500e 100644
--- a/jffsX-utils/jffs2reader.c
+++ b/jffsX-utils/jffs2reader.c
@@ -106,27 +106,9 @@ struct dir {
int target_endian = __BYTE_ORDER;
-void putblock(char *, size_t, size_t *, struct jffs2_raw_inode *);
-struct dir *putdir(struct dir *, struct jffs2_raw_dirent *);
-void printdir(char *o, size_t size, struct dir *d, const char *path,
- int recurse, int want_ctime);
-void freedir(struct dir *);
+static struct jffs2_raw_inode *find_raw_inode(char *, size_t, uint32_t);
-struct jffs2_raw_inode *find_raw_inode(char *o, size_t size, uint32_t ino);
-struct jffs2_raw_dirent *resolvedirent(char *, size_t, uint32_t, uint32_t,
- char *, uint8_t);
-struct jffs2_raw_dirent *resolvename(char *, size_t, uint32_t, char *, uint8_t);
-struct jffs2_raw_dirent *resolveinode(char *, size_t, uint32_t);
-
-struct jffs2_raw_dirent *resolvepath0(char *, size_t, uint32_t, const char *,
- uint32_t *, int);
-struct jffs2_raw_dirent *resolvepath(char *, size_t, uint32_t, const char *,
- uint32_t *);
-
-void lsdir(char *, size_t, const char *, int, int);
-void catfile(char *, size_t, char *, char *, size_t, size_t *);
-
-int main(int, char **);
+static void lsdir(char *, size_t, const char *, int, int);
/* writes file node into buffer, to the proper position. */
/* reading all valid nodes in version order reconstructs the file. */
@@ -138,7 +120,7 @@ int main(int, char **);
n - node
*/
-void putblock(char *b, size_t bsize, size_t * rsize,
+static void putblock(char *b, size_t bsize, size_t * rsize,
struct jffs2_raw_inode *n)
{
uLongf dlen = je32_to_cpu(n->dsize);
@@ -184,7 +166,7 @@ void putblock(char *b, size_t bsize, size_t * rsize,
return value: directory struct value replacing dd
*/
-struct dir *putdir(struct dir *dd, struct jffs2_raw_dirent *n)
+static struct dir *putdir(struct dir *dd, struct jffs2_raw_dirent *n)
{
struct dir *o, *d, *p;
@@ -279,7 +261,7 @@ static const char SMODE0[] = "..S..S..T";
* Return the standard ls-like mode string from a file mode.
* This is static and so is overwritten on each call.
*/
-const char *mode_string(int mode)
+static const char *mode_string(int mode)
{
static char buf[12];
@@ -301,8 +283,8 @@ const char *mode_string(int mode)
d - dir struct
*/
-void printdir(char *o, size_t size, struct dir *d, const char *path, int recurse,
- int want_ctime)
+static void printdir(char *o, size_t size, struct dir *d, const char *path,
+ int recurse, int want_ctime)
{
char m;
char *filetime;
@@ -404,7 +386,7 @@ void printdir(char *o, size_t size, struct dir *d, const char *path, int recurse
d - dir struct
*/
-void freedir(struct dir *d)
+static void freedir(struct dir *d)
{
struct dir *t;
@@ -429,7 +411,8 @@ void freedir(struct dir *d)
inode, or NULL
*/
-struct jffs2_raw_inode *find_raw_inode(char *o, size_t size, uint32_t ino)
+static struct jffs2_raw_inode *find_raw_inode(char *o, size_t size,
+ uint32_t ino)
{
/* aligned! */
union jffs2_node_union *n;
@@ -497,7 +480,7 @@ struct jffs2_raw_inode *find_raw_inode(char *o, size_t size, uint32_t ino)
return value: result directory structure, replaces d.
*/
-struct dir *collectdir(char *o, size_t size, uint32_t ino, struct dir *d)
+static struct dir *collectdir(char *o, size_t size, uint32_t ino, struct dir *d)
{
/* aligned! */
union jffs2_node_union *n;
@@ -585,7 +568,7 @@ struct dir *collectdir(char *o, size_t size, uint32_t ino, struct dir *d)
filesystem image or NULL
*/
-struct jffs2_raw_dirent *resolvedirent(char *o, size_t size,
+static struct jffs2_raw_dirent *resolvedirent(char *o, size_t size,
uint32_t ino, uint32_t pino,
char *name, uint8_t nsize)
{
@@ -642,7 +625,7 @@ struct jffs2_raw_dirent *resolvedirent(char *o, size_t size,
filesystem image or NULL
*/
-struct jffs2_raw_dirent *resolvename(char *o, size_t size, uint32_t pino,
+static struct jffs2_raw_dirent *resolvename(char *o, size_t size, uint32_t pino,
char *name, uint8_t nsize)
{
return resolvedirent(o, size, 0, pino, name, nsize);
@@ -659,7 +642,7 @@ struct jffs2_raw_dirent *resolvename(char *o, size_t size, uint32_t pino,
filesystem image or NULL
*/
-struct jffs2_raw_dirent *resolveinode(char *o, size_t size, uint32_t ino)
+static struct jffs2_raw_dirent *resolveinode(char *o, size_t size, uint32_t ino)
{
return resolvedirent(o, size, ino, 0, NULL, 0);
}
@@ -682,7 +665,7 @@ struct jffs2_raw_dirent *resolveinode(char *o, size_t size, uint32_t ino)
(return value is NULL), but it has inode (*inos=1)
*/
-struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino,
+static struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino,
const char *p, uint32_t * inos, int recc)
{
struct jffs2_raw_dirent *dir = NULL;
@@ -798,7 +781,7 @@ struct jffs2_raw_dirent *resolvepath0(char *o, size_t size, uint32_t ino,
(return value is NULL), but it has inode (*inos=1)
*/
-struct jffs2_raw_dirent *resolvepath(char *o, size_t size, uint32_t ino,
+static struct jffs2_raw_dirent *resolvepath(char *o, size_t size, uint32_t ino,
const char *p, uint32_t * inos)
{
return resolvepath0(o, size, ino, p, inos, 0);
@@ -812,7 +795,8 @@ struct jffs2_raw_dirent *resolvepath(char *o, size_t size, uint32_t ino,
p - path to be resolved
*/
-void lsdir(char *o, size_t size, const char *path, int recurse, int want_ctime)
+static void lsdir(char *o, size_t size, const char *path, int recurse,
+ int want_ctime)
{
struct jffs2_raw_dirent *dd;
struct dir *d = NULL;
@@ -841,8 +825,8 @@ void lsdir(char *o, size_t size, const char *path, int recurse, int want_ctime)
rsize - file result size
*/
-void catfile(char *o, size_t size, char *path, char *b, size_t bsize,
- size_t * rsize)
+static void catfile(char *o, size_t size, char *path, char *b, size_t bsize,
+ size_t * rsize)
{
struct jffs2_raw_dirent *dd;
struct jffs2_raw_inode *ri;
diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
index 2fb7730..9aa6c39 100644
--- a/jffsX-utils/mkfs.jffs2.c
+++ b/jffsX-utils/mkfs.jffs2.c
@@ -112,7 +112,7 @@ static int squash_perms = 0;
static int fake_times = 0;
int target_endian = __BYTE_ORDER;
-uint32_t find_hardlink(struct filesystem_entry *e)
+static uint32_t find_hardlink(struct filesystem_entry *e)
{
struct filesystem_entry *f;
struct rb_node **n = &hardlinks.rb_node;
@@ -139,7 +139,7 @@ uint32_t find_hardlink(struct filesystem_entry *e)
return 0;
}
-extern char *xreadlink(const char *path)
+static char *xreadlink(const char *path)
{
static const int GROWBY = 80; /* how large we will grow strings by */
@@ -1428,7 +1428,7 @@ static const char helptext[] =
" -V, --version Display version information\n"
" -i, --incremental=FILE Parse FILE and generate appendage output for it\n\n";
-int load_next_block() {
+static int load_next_block(void) {
int ret;
ret = read(in_fd, file_buffer, erase_block_size);
@@ -1439,7 +1439,7 @@ int load_next_block() {
return ret;
}
-void process_buffer(int inp_size) {
+static void process_buffer(int inp_size) {
uint8_t *p = file_buffer;
union jffs2_node_union *node;
uint16_t type;
@@ -1542,7 +1542,7 @@ void process_buffer(int inp_size) {
}
}
-void parse_image(){
+static void parse_image(void){
int ret;
file_buffer = xmalloc(erase_block_size);
diff --git a/jffsX-utils/sumtool.c b/jffsX-utils/sumtool.c
index a995bdf..68268a9 100644
--- a/jffsX-utils/sumtool.c
+++ b/jffsX-utils/sumtool.c
@@ -120,7 +120,7 @@ static unsigned char ffbuf[16] = {
static void full_write(void *target_buff, const void *buf, int len);
-void setup_cleanmarker(void)
+static void setup_cleanmarker(void)
{
cleanmarker.magic = cpu_to_je16(JFFS2_MAGIC_BITMASK);
cleanmarker.nodetype = cpu_to_je16(JFFS2_NODETYPE_CLEANMARKER);
@@ -128,7 +128,7 @@ void setup_cleanmarker(void)
cleanmarker.hdr_crc = cpu_to_je32(mtd_crc32(0, &cleanmarker, sizeof(struct jffs2_unknown_node)-4));
}
-void process_options (int argc, char **argv)
+static void process_options (int argc, char **argv)
{
int opt,c;
@@ -227,24 +227,24 @@ void process_options (int argc, char **argv)
}
-void init_buffers(void)
+static void init_buffers(void)
{
data_buffer = xmalloc(erase_block_size);
file_buffer = xmalloc(erase_block_size);
}
-void init_sumlist(void)
+static void init_sumlist(void)
{
sum_collected = xzalloc(sizeof(*sum_collected));
}
-void clean_buffers(void)
+static void clean_buffers(void)
{
free(data_buffer);
free(file_buffer);
}
-void clean_sumlist(void)
+static void clean_sumlist(void)
{
union jffs2_sum_mem *temp;
@@ -264,7 +264,7 @@ void clean_sumlist(void)
}
}
-int load_next_block(void)
+static int load_next_block(void)
{
int ret;
ret = read(in_fd, file_buffer, erase_block_size);
@@ -275,7 +275,7 @@ int load_next_block(void)
return ret;
}
-void write_buff_to_file(void)
+static void write_buff_to_file(void)
{
int ret;
int len = data_ofs;
@@ -299,7 +299,7 @@ void write_buff_to_file(void)
data_ofs = 0;
}
-void dump_sum_records(void)
+static void dump_sum_records(void)
{
struct jffs2_raw_summary isum;
@@ -475,7 +475,7 @@ static inline void pad_block_if_less_than(int req,int plus)
}
}
-void flush_buffers(void)
+static void flush_buffers(void)
{
if ((add_cleanmarkers == 1) && (found_cleanmarkers == 1)) { /* CLEANMARKER */
@@ -513,7 +513,7 @@ void flush_buffers(void)
}
}
-int add_sum_mem(union jffs2_sum_mem *item)
+static int add_sum_mem(union jffs2_sum_mem *item)
{
if (!sum_collected->sum_list_head)
@@ -549,7 +549,7 @@ int add_sum_mem(union jffs2_sum_mem *item)
return 0;
}
-void add_sum_inode_mem(union jffs2_node_union *node)
+static void add_sum_inode_mem(union jffs2_node_union *node)
{
struct jffs2_sum_inode_mem *temp = xmalloc(sizeof(*temp));
@@ -563,7 +563,7 @@ void add_sum_inode_mem(union jffs2_node_union *node)
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void add_sum_dirent_mem(union jffs2_node_union *node)
+static void add_sum_dirent_mem(union jffs2_node_union *node)
{
struct jffs2_sum_dirent_mem *temp = xmalloc(sizeof(*temp) + node->d.nsize);
@@ -581,7 +581,7 @@ void add_sum_dirent_mem(union jffs2_node_union *node)
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void add_sum_xattr_mem(union jffs2_node_union *node)
+static void add_sum_xattr_mem(union jffs2_node_union *node)
{
struct jffs2_sum_xattr_mem *temp = xmalloc(sizeof(*temp));
@@ -595,7 +595,7 @@ void add_sum_xattr_mem(union jffs2_node_union *node)
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void add_sum_xref_mem(union jffs2_node_union *node)
+static void add_sum_xref_mem(union jffs2_node_union *node)
{
struct jffs2_sum_xref_mem *temp = xmalloc(sizeof(*temp));
@@ -606,7 +606,7 @@ void add_sum_xref_mem(union jffs2_node_union *node)
add_sum_mem((union jffs2_sum_mem *) temp);
}
-void write_dirent_to_buff(union jffs2_node_union *node)
+static void write_dirent_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu (node->d.totlen),JFFS2_SUMMARY_DIRENT_SIZE(node->d.nsize));
add_sum_dirent_mem(node);
@@ -615,7 +615,7 @@ void write_dirent_to_buff(union jffs2_node_union *node)
}
-void write_inode_to_buff(union jffs2_node_union *node)
+static void write_inode_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu (node->i.totlen),JFFS2_SUMMARY_INODE_SIZE);
add_sum_inode_mem(node); /* Add inode summary mem to summary list */
@@ -623,7 +623,7 @@ void write_inode_to_buff(union jffs2_node_union *node)
padword();
}
-void write_xattr_to_buff(union jffs2_node_union *node)
+static void write_xattr_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu(node->x.totlen), JFFS2_SUMMARY_XATTR_SIZE);
add_sum_xattr_mem(node); /* Add xdatum summary mem to summary list */
@@ -631,7 +631,7 @@ void write_xattr_to_buff(union jffs2_node_union *node)
padword();
}
-void write_xref_to_buff(union jffs2_node_union *node)
+static void write_xref_to_buff(union jffs2_node_union *node)
{
pad_block_if_less_than(je32_to_cpu(node->r.totlen), JFFS2_SUMMARY_XREF_SIZE);
add_sum_xref_mem(node); /* Add xref summary mem to summary list */
@@ -639,7 +639,7 @@ void write_xref_to_buff(union jffs2_node_union *node)
padword();
}
-void create_summed_image(int inp_size)
+static void create_summed_image(int inp_size)
{
uint8_t *p = file_buffer;
union jffs2_node_union *node;