]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Merge branch 'master' of /home/wd/git/u-boot/custodians
authorWolfgang Denk <wd@denx.de>
Wed, 16 Nov 2011 19:44:06 +0000 (20:44 +0100)
committerWolfgang Denk <wd@denx.de>
Wed, 16 Nov 2011 19:44:06 +0000 (20:44 +0100)
* 'master' of /home/wd/git/u-boot/custodians:
  api: export LCD device to external apps
  font: split font data from video_font.h
  tools: logo: split bmp arrays from bmp_logo.h
  lcd: add clear and draw bitmap declaration
  VIDEO: mx3fb: GCC4.6 fix build warnings
  Powerpc/DIU: Fixed the 800x600 and 1024x768 resolution bug

common/cmd_nvedit.c
common/env_dataflash.c
common/env_eeprom.c
common/env_flash.c
common/env_mmc.c
common/env_nand.c
common/env_nvram.c
common/env_onenand.c
common/env_sf.c
include/search.h
lib/hashtable.c

index 396a17135eb558205ff226d12d54389c6635b4a8..7194ade8027a2faf8d3780c4b6a819a6ce1fe51e 100644 (file)
@@ -125,7 +125,7 @@ static int env_print(char *name)
        }
 
        /* print whole list */
-       len = hexport_r(&env_htab, '\n', &res, 0);
+       len = hexport_r(&env_htab, '\n', &res, 0, 0, NULL);
 
        if (len > 0) {
                puts(res);
@@ -647,7 +647,7 @@ static int do_env_delete(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
 
 #ifdef CONFIG_CMD_EXPORTENV
 /*
- * env export [-t | -b | -c] addr [size]
+ * env export [-t | -b | -c] [-s size] addr [var ...]
  *     -t:     export as text format; if size is given, data will be
  *             padded with '\0' bytes; if not, one terminating '\0'
  *             will be added (which is included in the "filesize"
@@ -657,8 +657,12 @@ static int do_env_delete(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
  *             '\0', list end marked by double "\0\0")
  *     -c:     export as checksum protected environment format as
  *             used for example by "saveenv" command
+ *     -s size:
+ *             size of output buffer
  *     addr:   memory address where environment gets stored
- *     size:   size of output buffer
+ *     var...  List of variable names that get included into the
+ *             export. Without arguments, the whole environment gets
+ *             exported.
  *
  * With "-c" and size is NOT given, then the export command will
  * format the data as currently used for the persistent storage,
@@ -691,7 +695,7 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
 {
        char    buf[32];
        char    *addr, *cmd, *res;
-       size_t  size;
+       size_t  size = 0;
        ssize_t len;
        env_t   *envp;
        char    sep = '\n';
@@ -715,6 +719,11 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
                                sep = '\0';
                                chk = 1;
                                break;
+                       case 's':               /* size given */
+                               if (--argc <= 0)
+                                       return cmd_usage(cmdtp);
+                               size = simple_strtoul(*++argv, NULL, 16);
+                               goto NXTARG;
                        case 't':               /* text format */
                                if (fmt++)
                                        goto sep_err;
@@ -724,6 +733,7 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
                                return cmd_usage(cmdtp);
                        }
                }
+NXTARG:                ;
        }
 
        if (argc < 1)
@@ -731,15 +741,14 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
 
        addr = (char *)simple_strtoul(argv[0], NULL, 16);
 
-       if (argc == 2) {
-               size = simple_strtoul(argv[1], NULL, 16);
+       if (size)
                memset(addr, '\0', size);
-       } else {
-               size = 0;
-       }
+
+       argc--;
+       argv++;
 
        if (sep) {              /* export as text file */
-               len = hexport_r(&env_htab, sep, &addr, size);
+               len = hexport_r(&env_htab, sep, &addr, size, argc, argv);
                if (len < 0) {
                        error("Cannot export environment: errno = %d\n",
                                errno);
@@ -758,7 +767,7 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
        else                    /* export as raw binary data */
                res = addr;
 
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, argc, argv);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n",
                        errno);
@@ -965,7 +974,7 @@ U_BOOT_CMD(
 #if defined(CONFIG_CMD_EDITENV)
        "env edit name - edit environment variable\n"
 #endif
-       "env export [-t | -b | -c] addr [size] - export environment\n"
+       "env export [-t | -b | -c] [-s size] addr [var ...] - export environment\n"
 #if defined(CONFIG_CMD_GREPENV)
        "env grep string [...] - search environment\n"
 #endif
index 1d570790277b2393e24ec4a7591beb4ca984bc71..0c4c676e196a1bc7d84c5895d284c1766ec451d1 100644 (file)
@@ -68,7 +68,7 @@ int saveenv(void)
        char    *res;
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
index 0a179ad3d25917104c271718aae19755ed16c587..1233b1aa39abaf2cbf7034af3d89c32a0e169c48 100644 (file)
@@ -143,7 +143,7 @@ int saveenv(void)
        BUG_ON(env_ptr != NULL);
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
index 50ca4ffa5687736ad8e99ca36fb9d8d960e681d7..8e415d72d37576fb4c70370d4d4bd82c47e124c7 100644 (file)
@@ -155,7 +155,7 @@ int saveenv(void)
        }
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                goto done;
@@ -289,7 +289,7 @@ int saveenv(void)
                goto done;
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                goto done;
index 83f40f43417ef39ca88b6b94e9e03e84924da920..12d647a826de078d4c56c7cb80727feecf620198 100644 (file)
@@ -124,7 +124,7 @@ int saveenv(void)
                return 1;
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
index 14446a6a5793ce0d37016d7a883445815517d479..da4d3b1df1dbd80ba698a14baf3b86f6e7894976 100644 (file)
@@ -200,7 +200,7 @@ int saveenv(void)
                return 1;
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
@@ -255,7 +255,7 @@ int saveenv(void)
                return 1;
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
index 544ce4711ea210517ca7288b19f361ce39f306ce..b108e6e7610948e71da65eeb01d931674009340b 100644 (file)
@@ -94,7 +94,7 @@ int saveenv(void)
        int     rcode = 0;
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
index 5e04a06cf537c1faef56b1613ff66d6488d174b3..414447594fd9db03d09abc3bf4b830f3aeaf3504 100644 (file)
@@ -109,7 +109,7 @@ int saveenv(void)
        };
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
index d3b36d01053586b3f8bb155b3eade8460efecc1b..a1ff297ba7e2568b795af35ce6cd653468cf79f3 100644 (file)
@@ -91,7 +91,7 @@ int saveenv(void)
        }
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                return 1;
@@ -293,7 +293,7 @@ int saveenv(void)
        }
 
        res = (char *)&env_new.data;
-       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+       len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
        if (len < 0) {
                error("Cannot export environment: errno = %d\n", errno);
                goto done;
index b4edd43103554882e7a755d081bb8d2f9446f9f0..ef53edb9fef26d50c9c8ffd6ff8d4401dbee0ccf 100644 (file)
@@ -91,7 +91,8 @@ extern int hstrstr_r(const char *__match, int __last_idx, ENTRY ** __retval,
 extern int hdelete_r(const char *__key, struct hsearch_data *__htab);
 
 extern ssize_t hexport_r(struct hsearch_data *__htab,
-                    const char __sep, char **__resp, size_t __size);
+                    const char __sep, char **__resp, size_t __size,
+                    int argc, char * const argv[]);
 
 extern int himport_r(struct hsearch_data *__htab,
                     const char *__env, size_t __size, const char __sep,
index 6895550d3cae5a7ac476f3aa8770542fefd87e1f..b7ba3414b013cbcf58200ea8a3bca36b035b1e0d 100644 (file)
@@ -478,7 +478,8 @@ static int cmpkey(const void *p1, const void *p2)
 }
 
 ssize_t hexport_r(struct hsearch_data *htab, const char sep,
-                char **resp, size_t size)
+                char **resp, size_t size,
+                int argc, char * const argv[])
 {
        ENTRY *list[htab->size];
        char *res, *p;
@@ -502,6 +503,16 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep,
 
                if (htab->table[i].used > 0) {
                        ENTRY *ep = &htab->table[i].entry;
+                       int arg, found = 0;
+
+                       for (arg = 0; arg < argc; ++arg) {
+                               if (strcmp(argv[arg], ep->key) == 0) {
+                                       found = 1;
+                                       break;
+                               }
+                       }
+                       if ((argc > 0) && (found == 0))
+                               continue;
 
                        list[n++] = ep;
 
@@ -539,7 +550,7 @@ ssize_t hexport_r(struct hsearch_data *htab, const char sep,
        /* Check if the user supplied buffer size is sufficient */
        if (size) {
                if (size < totlen + 1) {        /* provided buffer too small */
-                       debug("### buffer too small: %d, but need %d\n",
+                       printf("Env export buffer too small: %d, but need %d\n",
                                size, totlen + 1);
                        __set_errno(ENOMEM);
                        return (-1);