diff options
Diffstat (limited to 'jffsX-utils')
-rw-r--r-- | jffsX-utils/Makemodule.am | 10 | ||||
-rw-r--r-- | jffsX-utils/compr.c | 8 | ||||
-rw-r--r-- | jffsX-utils/compr.h | 6 | ||||
-rw-r--r-- | jffsX-utils/compr_lzo.c | 15 | ||||
-rw-r--r-- | jffsX-utils/jffs2dump.c | 6 | ||||
-rw-r--r-- | jffsX-utils/jffs2reader.c | 12 | ||||
-rw-r--r-- | jffsX-utils/mkfs.jffs2.c | 12 |
7 files changed, 35 insertions, 34 deletions
diff --git a/jffsX-utils/Makemodule.am b/jffsX-utils/Makemodule.am index 7112d6e..266c12e 100644 --- a/jffsX-utils/Makemodule.am +++ b/jffsX-utils/Makemodule.am @@ -1,10 +1,8 @@ mkfs_jffs2_SOURCES = \ jffsX-utils/mkfs.jffs2.c \ jffsX-utils/rbtree.h \ - jffsX-utils/compr_zlib.c \ jffsX-utils/compr.h \ jffsX-utils/rbtree.c \ - jffsX-utils/compr_lzo.c \ jffsX-utils/compr.c \ jffsX-utils/compr_rtime.c \ jffsX-utils/compr.h \ @@ -27,6 +25,14 @@ jffs2dump_CPPFLAGS = $(AM_CPPFLAGS) $(ZLIB_CFLAGS) $(LZO_CFLAGS) sumtool_SOURCES = jffsX-utils/sumtool.c jffsX-utils/summary.h sumtool_LDADD = libmtd.a +if WITH_LZO +mkfs_jffs2_SOURCES += jffsX-utils/compr_lzo.c +endif + +if WITH_ZLIB +mkfs_jffs2_SOURCES += jffsX-utils/compr_zlib.c +endif + EXTRA_DIST += jffsX-utils/device_table.txt jffsX-utils/mkfs.jffs2.1 dist_man1_MANS += jffsX-utils/mkfs.jffs2.1 diff --git a/jffsX-utils/compr.c b/jffsX-utils/compr.c index cb4432e..01176eb 100644 --- a/jffsX-utils/compr.c +++ b/jffsX-utils/compr.c @@ -511,13 +511,13 @@ reinsert: int jffs2_compressors_init(void) { -#ifdef CONFIG_JFFS2_ZLIB +#ifdef WITH_ZLIB jffs2_zlib_init(); #endif #ifdef CONFIG_JFFS2_RTIME jffs2_rtime_init(); #endif -#ifdef CONFIG_JFFS2_LZO +#ifdef WITH_LZO jffs2_lzo_init(); #endif return 0; @@ -528,10 +528,10 @@ int jffs2_compressors_exit(void) #ifdef CONFIG_JFFS2_RTIME jffs2_rtime_exit(); #endif -#ifdef CONFIG_JFFS2_ZLIB +#ifdef WITH_ZLIB jffs2_zlib_exit(); #endif -#ifdef CONFIG_JFFS2_LZO +#ifdef WITH_LZO jffs2_lzo_exit(); #endif return 0; diff --git a/jffsX-utils/compr.h b/jffsX-utils/compr.h index a21e935..f1f5975 100644 --- a/jffsX-utils/compr.h +++ b/jffsX-utils/compr.h @@ -16,9 +16,7 @@ #include <stdint.h> #include "linux/jffs2.h" -#define CONFIG_JFFS2_ZLIB #define CONFIG_JFFS2_RTIME -#define CONFIG_JFFS2_LZO #define JFFS2_RUBINMIPS_PRIORITY 10 #define JFFS2_DYNRUBIN_PRIORITY 20 @@ -103,7 +101,7 @@ char *jffs2_stats(void); /* Compressor modules */ /* These functions will be called by jffs2_compressors_init/exit */ -#ifdef CONFIG_JFFS2_ZLIB +#ifdef WITH_ZLIB int jffs2_zlib_init(void); void jffs2_zlib_exit(void); #endif @@ -111,7 +109,7 @@ void jffs2_zlib_exit(void); int jffs2_rtime_init(void); void jffs2_rtime_exit(void); #endif -#ifdef CONFIG_JFFS2_LZO +#ifdef WITH_LZO int jffs2_lzo_init(void); void jffs2_lzo_exit(void); #endif diff --git a/jffsX-utils/compr_lzo.c b/jffsX-utils/compr_lzo.c index 56aa1b4..ddd8d55 100644 --- a/jffsX-utils/compr_lzo.c +++ b/jffsX-utils/compr_lzo.c @@ -24,8 +24,6 @@ #include <stdint.h> #include <stdio.h> #include <string.h> - -#ifndef WITHOUT_LZO #include <asm/types.h> #include <linux/jffs2.h> #include <lzo/lzo1x.h> @@ -121,16 +119,3 @@ void jffs2_lzo_exit(void) free(lzo_compress_buf); free(lzo_mem); } - -#else - -int jffs2_lzo_init(void) -{ - return 0; -} - -void jffs2_lzo_exit(void) -{ -} - -#endif diff --git a/jffsX-utils/jffs2dump.c b/jffsX-utils/jffs2dump.c index d30b59f..30455ea 100644 --- a/jffsX-utils/jffs2dump.c +++ b/jffsX-utils/jffs2dump.c @@ -757,6 +757,12 @@ int main(int argc, char **argv) // get image length imglen = lseek(fd, 0, SEEK_END); + if (imglen < 0) { + perror(img); + close(fd); + exit(EXIT_FAILURE); + } + lseek (fd, 0, SEEK_SET); data = malloc (imglen); diff --git a/jffsX-utils/jffs2reader.c b/jffsX-utils/jffs2reader.c index 083500e..87a2167 100644 --- a/jffsX-utils/jffs2reader.c +++ b/jffsX-utils/jffs2reader.c @@ -75,7 +75,11 @@ BUGS: #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> +#ifdef WITH_ZLIB #include <zlib.h> +#else +typedef unsigned long uLongf; +#endif #include "mtd/jffs2-user.h" #include "common.h" @@ -132,12 +136,13 @@ static void putblock(char *b, size_t bsize, size_t * rsize, bzero(b + *rsize, je32_to_cpu(n->isize) - *rsize); switch (n->compr) { +#ifdef WITH_ZLIB case JFFS2_COMPR_ZLIB: uncompress((Bytef *) b + je32_to_cpu(n->offset), &dlen, (Bytef *) ((char *) n) + sizeof(struct jffs2_raw_inode), (uLongf) je32_to_cpu(n->csize)); break; - +#endif case JFFS2_COMPR_NONE: memcpy(b + je32_to_cpu(n->offset), ((char *) n) + sizeof(struct jffs2_raw_inode), dlen); @@ -336,8 +341,9 @@ static void printdir(char *o, size_t size, struct dir *d, const char *path, d = d->next; continue; } - - filetime = ctime((const time_t *) &(ri->ctime)); + time_t _ctime; + memcpy(&_ctime, &(ri->ctime), sizeof(time_t)); + filetime = ctime(&_ctime); age = time(NULL) - je32_to_cpu(ri->ctime); mode.v32 = ri->mode.m; printf("%s %-4d %-8d %-8d ", mode_string(je32_to_cpu(mode)), diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c index bd67634..b9dd96b 100644 --- a/jffsX-utils/mkfs.jffs2.c +++ b/jffsX-utils/mkfs.jffs2.c @@ -65,7 +65,7 @@ #include <ctype.h> #include <time.h> #include <getopt.h> -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR #include <sys/xattr.h> #include <sys/acl.h> #endif @@ -978,7 +978,7 @@ static void write_special_file(struct filesystem_entry *e) padword(); } -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR typedef struct xattr_entry { struct xattr_entry *next; uint32_t xid; @@ -1209,7 +1209,7 @@ static void write_xattr_entry(struct filesystem_entry *e) } } -#else /* WITHOUT_XATTR */ +#else /* WITH_XATTR */ #define write_xattr_entry(x) #endif @@ -1380,7 +1380,7 @@ static struct option long_options[] = { {"test-compression", 0, NULL, 't'}, {"compressor-priority", 1, NULL, 'y'}, {"incremental", 1, NULL, 'i'}, -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR {"with-xattr", 0, NULL, 1000 }, {"with-selinux", 0, NULL, 1001 }, {"with-posix-acl", 0, NULL, 1002 }, @@ -1420,7 +1420,7 @@ static const char helptext[] = " -q, --squash Squash permissions and owners making all files be owned by root\n" " -U, --squash-uids Squash owners making all files be owned by root\n" " -P, --squash-perms Squash permissions on all files\n" -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR " --with-xattr stuff all xattr entries into image\n" " --with-selinux stuff only SELinux Labels into jffs2 image\n" " --with-posix-acl stuff only POSIX ACL entries into jffs2 image\n" @@ -1745,7 +1745,7 @@ int main(int argc, char **argv) sys_errmsg_die("cannot open (incremental) file"); } break; -#ifndef WITHOUT_XATTR +#ifdef WITH_XATTR case 1000: /* --with-xattr */ enable_xattr |= (1 << JFFS2_XPREFIX_USER) | (1 << JFFS2_XPREFIX_SECURITY) |