[{"id":1762280,"web_url":"http://patchwork.ozlabs.org/comment/1762280/","msgid":"<c382687b-ed99-624e-3aed-97cefb1c5936@denx.de>","list_archive_url":null,"date":"2017-09-03T15:08:55","subject":"Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators","submitter":{"id":70701,"url":"http://patchwork.ozlabs.org/api/people/70701/","name":"Lukasz Majewski","email":"lukma@denx.de"},"content":"On 09/02/2017 06:37 PM, Rob Clark wrote:\n> And drop a whole lot of ugly code!\n\n+1\n\nReviewed-by: Łukasz Majewski <lukma@denx.de>\n\n\n> \n> Signed-off-by: Rob Clark <robdclark@gmail.com>\n> ---\n>   fs/fat/fat.c  | 723 ++++++----------------------------------------------------\n>   include/fat.h |   6 -\n>   2 files changed, 75 insertions(+), 654 deletions(-)\n> \n> diff --git a/fs/fat/fat.c b/fs/fat/fat.c\n> index c72d6ca931..3193290434 100644\n> --- a/fs/fat/fat.c\n> +++ b/fs/fat/fat.c\n> @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no)\n>   }\n>   \n>   /*\n> - * Get the first occurence of a directory delimiter ('/' or '\\') in a string.\n> - * Return index into string if found, -1 otherwise.\n> - */\n> -static int dirdelim(char *str)\n> -{\n> -\tchar *start = str;\n> -\n> -\twhile (*str != '\\0') {\n> -\t\tif (ISDIRDELIM(*str))\n> -\t\t\treturn str - start;\n> -\t\tstr++;\n> -\t}\n> -\treturn -1;\n> -}\n> -\n> -/*\n>    * Extract zero terminated short name from a directory entry.\n>    */\n>   static void get_name(dir_entry *dirent, char *s_name)\n> @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name, int *idx)\n>   \treturn 0;\n>   }\n>   \n> -/*\n> - * Extract the full long filename starting at 'retdent' (which is really\n> - * a slot) into 'l_name'. If successful also copy the real directory entry\n> - * into 'retdent'\n> - * Return 0 on success, -1 otherwise.\n> - */\n> -static int\n> -get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,\n> -\t     dir_entry *retdent, char *l_name)\n> -{\n> -\tdir_entry *realdent;\n> -\tdir_slot *slotptr = (dir_slot *)retdent;\n> -\t__u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ?\n> -\t\t\t\t\t\t\tPREFETCH_BLOCKS :\n> -\t\t\t\t\t\t\tmydata->clust_size);\n> -\t__u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;\n> -\tint idx = 0;\n> -\n> -\tif (counter > VFAT_MAXSEQ) {\n> -\t\tdebug(\"Error: VFAT name is too long\\n\");\n> -\t\treturn -1;\n> -\t}\n> -\n> -\twhile ((__u8 *)slotptr < buflimit) {\n> -\t\tif (counter == 0)\n> -\t\t\tbreak;\n> -\t\tif (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) != counter)\n> -\t\t\treturn -1;\n> -\t\tslotptr++;\n> -\t\tcounter--;\n> -\t}\n> -\n> -\tif ((__u8 *)slotptr >= buflimit) {\n> -\t\tdir_slot *slotptr2;\n> -\n> -\t\tif (curclust == 0)\n> -\t\t\treturn -1;\n> -\t\tcurclust = get_fatent(mydata, curclust);\n> -\t\tif (CHECK_CLUST(curclust, mydata->fatsize)) {\n> -\t\t\tdebug(\"curclust: 0x%x\\n\", curclust);\n> -\t\t\tprintf(\"Invalid FAT entry\\n\");\n> -\t\t\treturn -1;\n> -\t\t}\n> -\n> -\t\tif (get_cluster(mydata, curclust, get_contents_vfatname_block,\n> -\t\t\t\tmydata->clust_size * mydata->sect_size) != 0) {\n> -\t\t\tdebug(\"Error: reading directory block\\n\");\n> -\t\t\treturn -1;\n> -\t\t}\n> -\n> -\t\tslotptr2 = (dir_slot *)get_contents_vfatname_block;\n> -\t\twhile (counter > 0) {\n> -\t\t\tif (((slotptr2->id & ~LAST_LONG_ENTRY_MASK)\n> -\t\t\t    & 0xff) != counter)\n> -\t\t\t\treturn -1;\n> -\t\t\tslotptr2++;\n> -\t\t\tcounter--;\n> -\t\t}\n> -\n> -\t\t/* Save the real directory entry */\n> -\t\trealdent = (dir_entry *)slotptr2;\n> -\t\twhile ((__u8 *)slotptr2 > get_contents_vfatname_block) {\n> -\t\t\tslotptr2--;\n> -\t\t\tslot2str(slotptr2, l_name, &idx);\n> -\t\t}\n> -\t} else {\n> -\t\t/* Save the real directory entry */\n> -\t\trealdent = (dir_entry *)slotptr;\n> -\t}\n> -\n> -\tdo {\n> -\t\tslotptr--;\n> -\t\tif (slot2str(slotptr, l_name, &idx))\n> -\t\t\tbreak;\n> -\t} while (!(slotptr->id & LAST_LONG_ENTRY_MASK));\n> -\n> -\tl_name[idx] = '\\0';\n> -\tif (*l_name == DELETED_FLAG)\n> -\t\t*l_name = '\\0';\n> -\telse if (*l_name == aRING)\n> -\t\t*l_name = DELETED_FLAG;\n> -\tdowncase(l_name);\n> -\n> -\t/* Return the real directory entry */\n> -\tmemcpy(retdent, realdent, sizeof(dir_entry));\n> -\n> -\treturn 0;\n> -}\n> -\n>   /* Calculate short name checksum */\n>   static __u8 mkcksum(const char name[8], const char ext[3])\n>   {\n> @@ -572,170 +467,11 @@ static __u8 mkcksum(const char name[8], const char ext[3])\n>   \treturn ret;\n>   }\n>   \n> -/*\n> - * Get the directory entry associated with 'filename' from the directory\n> - * starting at 'startsect'\n> - */\n> +// These should probably DIAF..\n>   __u8 get_dentfromdir_block[MAX_CLUSTSIZE]\n>   \t__aligned(ARCH_DMA_MINALIGN);\n> -\n> -static dir_entry *get_dentfromdir(fsdata *mydata, int startsect,\n> -\t\t\t\t  char *filename, dir_entry *retdent,\n> -\t\t\t\t  int dols)\n> -{\n> -\t__u16 prevcksum = 0xffff;\n> -\t__u32 curclust = START(retdent);\n> -\tint files = 0, dirs = 0;\n> -\n> -\tdebug(\"get_dentfromdir: %s\\n\", filename);\n> -\n> -\twhile (1) {\n> -\t\tdir_entry *dentptr;\n> -\n> -\t\tint i;\n> -\n> -\t\tif (get_cluster(mydata, curclust, get_dentfromdir_block,\n> -\t\t\t\tmydata->clust_size * mydata->sect_size) != 0) {\n> -\t\t\tdebug(\"Error: reading directory block\\n\");\n> -\t\t\treturn NULL;\n> -\t\t}\n> -\n> -\t\tdentptr = (dir_entry *)get_dentfromdir_block;\n> -\n> -\t\tfor (i = 0; i < DIRENTSPERCLUST; i++) {\n> -\t\t\tchar s_name[14], l_name[VFAT_MAXLEN_BYTES];\n> -\n> -\t\t\tl_name[0] = '\\0';\n> -\t\t\tif (dentptr->name[0] == DELETED_FLAG) {\n> -\t\t\t\tdentptr++;\n> -\t\t\t\tcontinue;\n> -\t\t\t}\n> -\t\t\tif ((dentptr->attr & ATTR_VOLUME)) {\n> -\t\t\t\tif (vfat_enabled &&\n> -\t\t\t\t    (dentptr->attr & ATTR_VFAT) == ATTR_VFAT &&\n> -\t\t\t\t    (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {\n> -\t\t\t\t\tprevcksum = ((dir_slot *)dentptr)->alias_checksum;\n> -\t\t\t\t\tget_vfatname(mydata, curclust,\n> -\t\t\t\t\t\t     get_dentfromdir_block,\n> -\t\t\t\t\t\t     dentptr, l_name);\n> -\t\t\t\t\tif (dols) {\n> -\t\t\t\t\t\tint isdir;\n> -\t\t\t\t\t\tchar dirc;\n> -\t\t\t\t\t\tint doit = 0;\n> -\n> -\t\t\t\t\t\tisdir = (dentptr->attr & ATTR_DIR);\n> -\n> -\t\t\t\t\t\tif (isdir) {\n> -\t\t\t\t\t\t\tdirs++;\n> -\t\t\t\t\t\t\tdirc = '/';\n> -\t\t\t\t\t\t\tdoit = 1;\n> -\t\t\t\t\t\t} else {\n> -\t\t\t\t\t\t\tdirc = ' ';\n> -\t\t\t\t\t\t\tif (l_name[0] != 0) {\n> -\t\t\t\t\t\t\t\tfiles++;\n> -\t\t\t\t\t\t\t\tdoit = 1;\n> -\t\t\t\t\t\t\t}\n> -\t\t\t\t\t\t}\n> -\t\t\t\t\t\tif (doit) {\n> -\t\t\t\t\t\t\tif (dirc == ' ') {\n> -\t\t\t\t\t\t\t\tprintf(\" %8u   %s%c\\n\",\n> -\t\t\t\t\t\t\t\t       FAT2CPU32(dentptr->size),\n> -\t\t\t\t\t\t\t\t\tl_name,\n> -\t\t\t\t\t\t\t\t\tdirc);\n> -\t\t\t\t\t\t\t} else {\n> -\t\t\t\t\t\t\t\tprintf(\"            %s%c\\n\",\n> -\t\t\t\t\t\t\t\t\tl_name,\n> -\t\t\t\t\t\t\t\t\tdirc);\n> -\t\t\t\t\t\t\t}\n> -\t\t\t\t\t\t}\n> -\t\t\t\t\t\tdentptr++;\n> -\t\t\t\t\t\tcontinue;\n> -\t\t\t\t\t}\n> -\t\t\t\t\tdebug(\"vfatname: |%s|\\n\", l_name);\n> -\t\t\t\t} else {\n> -\t\t\t\t\t/* Volume label or VFAT entry */\n> -\t\t\t\t\tdentptr++;\n> -\t\t\t\t\tcontinue;\n> -\t\t\t\t}\n> -\t\t\t}\n> -\t\t\tif (dentptr->name[0] == 0) {\n> -\t\t\t\tif (dols) {\n> -\t\t\t\t\tprintf(\"\\n%d file(s), %d dir(s)\\n\\n\",\n> -\t\t\t\t\t\tfiles, dirs);\n> -\t\t\t\t}\n> -\t\t\t\tdebug(\"Dentname == NULL - %d\\n\", i);\n> -\t\t\t\treturn NULL;\n> -\t\t\t}\n> -\t\t\tif (vfat_enabled) {\n> -\t\t\t\t__u8 csum = mkcksum(dentptr->name, dentptr->ext);\n> -\t\t\t\tif (dols && csum == prevcksum) {\n> -\t\t\t\t\tprevcksum = 0xffff;\n> -\t\t\t\t\tdentptr++;\n> -\t\t\t\t\tcontinue;\n> -\t\t\t\t}\n> -\t\t\t}\n> -\n> -\t\t\tget_name(dentptr, s_name);\n> -\t\t\tif (dols) {\n> -\t\t\t\tint isdir = (dentptr->attr & ATTR_DIR);\n> -\t\t\t\tchar dirc;\n> -\t\t\t\tint doit = 0;\n> -\n> -\t\t\t\tif (isdir) {\n> -\t\t\t\t\tdirs++;\n> -\t\t\t\t\tdirc = '/';\n> -\t\t\t\t\tdoit = 1;\n> -\t\t\t\t} else {\n> -\t\t\t\t\tdirc = ' ';\n> -\t\t\t\t\tif (s_name[0] != 0) {\n> -\t\t\t\t\t\tfiles++;\n> -\t\t\t\t\t\tdoit = 1;\n> -\t\t\t\t\t}\n> -\t\t\t\t}\n> -\n> -\t\t\t\tif (doit) {\n> -\t\t\t\t\tif (dirc == ' ') {\n> -\t\t\t\t\t\tprintf(\" %8u   %s%c\\n\",\n> -\t\t\t\t\t\t       FAT2CPU32(dentptr->size),\n> -\t\t\t\t\t\t\ts_name, dirc);\n> -\t\t\t\t\t} else {\n> -\t\t\t\t\t\tprintf(\"            %s%c\\n\",\n> -\t\t\t\t\t\t\ts_name, dirc);\n> -\t\t\t\t\t}\n> -\t\t\t\t}\n> -\n> -\t\t\t\tdentptr++;\n> -\t\t\t\tcontinue;\n> -\t\t\t}\n> -\n> -\t\t\tif (strcmp(filename, s_name)\n> -\t\t\t    && strcmp(filename, l_name)) {\n> -\t\t\t\tdebug(\"Mismatch: |%s|%s|\\n\", s_name, l_name);\n> -\t\t\t\tdentptr++;\n> -\t\t\t\tcontinue;\n> -\t\t\t}\n> -\n> -\t\t\tmemcpy(retdent, dentptr, sizeof(dir_entry));\n> -\n> -\t\t\tdebug(\"DentName: %s\", s_name);\n> -\t\t\tdebug(\", start: 0x%x\", START(dentptr));\n> -\t\t\tdebug(\", size:  0x%x %s\\n\",\n> -\t\t\t      FAT2CPU32(dentptr->size),\n> -\t\t\t      (dentptr->attr & ATTR_DIR) ? \"(DIR)\" : \"\");\n> -\n> -\t\t\treturn retdent;\n> -\t\t}\n> -\n> -\t\tcurclust = get_fatent(mydata, curclust);\n> -\t\tif (CHECK_CLUST(curclust, mydata->fatsize)) {\n> -\t\t\tdebug(\"curclust: 0x%x\\n\", curclust);\n> -\t\t\tprintf(\"Invalid FAT entry\\n\");\n> -\t\t\treturn NULL;\n> -\t\t}\n> -\t}\n> -\n> -\treturn NULL;\n> -}\n> +__u8 do_fat_read_at_block[MAX_CLUSTSIZE]\n> +\t__aligned(ARCH_DMA_MINALIGN);\n>   \n>   /*\n>    * Read boot sector and volume info from a FAT filesystem\n> @@ -877,374 +613,6 @@ static int get_fs_info(fsdata *mydata)\n>   \treturn 0;\n>   }\n>   \n> -__u8 do_fat_read_at_block[MAX_CLUSTSIZE]\n> -\t__aligned(ARCH_DMA_MINALIGN);\n> -\n> -int do_fat_read_at(const char *filename, loff_t pos, void *buffer,\n> -\t\t   loff_t maxsize, int dols, int dogetsize, loff_t *size)\n> -{\n> -\tchar fnamecopy[2048];\n> -\tfsdata datablock;\n> -\tfsdata *mydata = &datablock;\n> -\tdir_entry *dentptr = NULL;\n> -\t__u16 prevcksum = 0xffff;\n> -\tchar *subname = \"\";\n> -\t__u32 cursect;\n> -\tint idx, isdir = 0;\n> -\tint files = 0, dirs = 0;\n> -\tint ret = -1;\n> -\tint firsttime;\n> -\t__u32 root_cluster = 0;\n> -\t__u32 read_blk;\n> -\tint rootdir_size = 0;\n> -\tint buffer_blk_cnt;\n> -\tint do_read;\n> -\t__u8 *dir_ptr;\n> -\n> -\tif (get_fs_info(mydata))\n> -\t\treturn -1;\n> -\n> -\tcursect = mydata->rootdir_sect;\n> -\n> -\t/* \"cwd\" is always the root... */\n> -\twhile (ISDIRDELIM(*filename))\n> -\t\tfilename++;\n> -\n> -\t/* Make a copy of the filename and convert it to lowercase */\n> -\tstrcpy(fnamecopy, filename);\n> -\tdowncase(fnamecopy);\n> -\n> -root_reparse:\n> -\tif (*fnamecopy == '\\0') {\n> -\t\tif (!dols)\n> -\t\t\tgoto exit;\n> -\n> -\t\tdols = LS_ROOT;\n> -\t} else if ((idx = dirdelim(fnamecopy)) >= 0) {\n> -\t\tisdir = 1;\n> -\t\tfnamecopy[idx] = '\\0';\n> -\t\tsubname = fnamecopy + idx + 1;\n> -\n> -\t\t/* Handle multiple delimiters */\n> -\t\twhile (ISDIRDELIM(*subname))\n> -\t\t\tsubname++;\n> -\t} else if (dols) {\n> -\t\tisdir = 1;\n> -\t}\n> -\n> -\tbuffer_blk_cnt = 0;\n> -\tfirsttime = 1;\n> -\twhile (1) {\n> -\t\tint i;\n> -\n> -\t\tif (mydata->fatsize == 32 || firsttime) {\n> -\t\t\tdir_ptr = do_fat_read_at_block;\n> -\t\t\tfirsttime = 0;\n> -\t\t} else {\n> -\t\t\t/**\n> -\t\t\t * FAT16 sector buffer modification:\n> -\t\t\t * Each loop, the second buffered block is moved to\n> -\t\t\t * the buffer begin, and two next sectors are read\n> -\t\t\t * next to the previously moved one. So the sector\n> -\t\t\t * buffer keeps always 3 sectors for fat16.\n> -\t\t\t * And the current sector is the buffer second sector\n> -\t\t\t * beside the \"firsttime\" read, when it is the first one.\n> -\t\t\t *\n> -\t\t\t * PREFETCH_BLOCKS is 2 for FAT16 == loop[0:1]\n> -\t\t\t * n = computed root dir sector\n> -\t\t\t * loop |  cursect-1  | cursect    | cursect+1  |\n> -\t\t\t *   0  |  sector n+0 | sector n+1 | none       |\n> -\t\t\t *   1  |  none       | sector n+0 | sector n+1 |\n> -\t\t\t *   0  |  sector n+1 | sector n+2 | sector n+3 |\n> -\t\t\t *   1  |  sector n+3 | ...\n> -\t\t\t*/\n> -\t\t\tdir_ptr = (do_fat_read_at_block + mydata->sect_size);\n> -\t\t\tmemcpy(do_fat_read_at_block, dir_ptr, mydata->sect_size);\n> -\t\t}\n> -\n> -\t\tdo_read = 1;\n> -\n> -\t\tif (mydata->fatsize == 32 && buffer_blk_cnt)\n> -\t\t\tdo_read = 0;\n> -\n> -\t\tif (do_read) {\n> -\t\t\tread_blk = (mydata->fatsize == 32) ?\n> -\t\t\t\t    mydata->clust_size : PREFETCH_BLOCKS;\n> -\n> -\t\t\tdebug(\"FAT read(sect=%d, cnt:%d), clust_size=%d, DIRENTSPERBLOCK=%zd\\n\",\n> -\t\t\t\tcursect, read_blk, mydata->clust_size, DIRENTSPERBLOCK);\n> -\n> -\t\t\tif (disk_read(cursect, read_blk, dir_ptr) < 0) {\n> -\t\t\t\tdebug(\"Error: reading rootdir block\\n\");\n> -\t\t\t\tgoto exit;\n> -\t\t\t}\n> -\n> -\t\t\tdentptr = (dir_entry *)dir_ptr;\n> -\t\t}\n> -\n> -\t\tfor (i = 0; i < DIRENTSPERBLOCK; i++) {\n> -\t\t\tchar s_name[14], l_name[VFAT_MAXLEN_BYTES];\n> -\t\t\t__u8 csum;\n> -\n> -\t\t\tl_name[0] = '\\0';\n> -\t\t\tif (dentptr->name[0] == DELETED_FLAG) {\n> -\t\t\t\tdentptr++;\n> -\t\t\t\tcontinue;\n> -\t\t\t}\n> -\n> -\t\t\tif (vfat_enabled)\n> -\t\t\t\tcsum = mkcksum(dentptr->name, dentptr->ext);\n> -\n> -\t\t\tif (dentptr->attr & ATTR_VOLUME) {\n> -\t\t\t\tif (vfat_enabled &&\n> -\t\t\t\t    (dentptr->attr & ATTR_VFAT) == ATTR_VFAT &&\n> -\t\t\t\t    (dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {\n> -\t\t\t\t\tprevcksum =\n> -\t\t\t\t\t\t((dir_slot *)dentptr)->alias_checksum;\n> -\n> -\t\t\t\t\tget_vfatname(mydata,\n> -\t\t\t\t\t\t     root_cluster,\n> -\t\t\t\t\t\t     dir_ptr,\n> -\t\t\t\t\t\t     dentptr, l_name);\n> -\n> -\t\t\t\t\tif (dols == LS_ROOT) {\n> -\t\t\t\t\t\tchar dirc;\n> -\t\t\t\t\t\tint doit = 0;\n> -\t\t\t\t\t\tint isdir =\n> -\t\t\t\t\t\t\t(dentptr->attr & ATTR_DIR);\n> -\n> -\t\t\t\t\t\tif (isdir) {\n> -\t\t\t\t\t\t\tdirs++;\n> -\t\t\t\t\t\t\tdirc = '/';\n> -\t\t\t\t\t\t\tdoit = 1;\n> -\t\t\t\t\t\t} else {\n> -\t\t\t\t\t\t\tdirc = ' ';\n> -\t\t\t\t\t\t\tif (l_name[0] != 0) {\n> -\t\t\t\t\t\t\t\tfiles++;\n> -\t\t\t\t\t\t\t\tdoit = 1;\n> -\t\t\t\t\t\t\t}\n> -\t\t\t\t\t\t}\n> -\t\t\t\t\t\tif (doit) {\n> -\t\t\t\t\t\t\tif (dirc == ' ') {\n> -\t\t\t\t\t\t\t\tprintf(\" %8u   %s%c\\n\",\n> -\t\t\t\t\t\t\t\t       FAT2CPU32(dentptr->size),\n> -\t\t\t\t\t\t\t\t\tl_name,\n> -\t\t\t\t\t\t\t\t\tdirc);\n> -\t\t\t\t\t\t\t} else {\n> -\t\t\t\t\t\t\t\tprintf(\"            %s%c\\n\",\n> -\t\t\t\t\t\t\t\t\tl_name,\n> -\t\t\t\t\t\t\t\t\tdirc);\n> -\t\t\t\t\t\t\t}\n> -\t\t\t\t\t\t}\n> -\t\t\t\t\t\tdentptr++;\n> -\t\t\t\t\t\tcontinue;\n> -\t\t\t\t\t}\n> -\t\t\t\t\tdebug(\"Rootvfatname: |%s|\\n\",\n> -\t\t\t\t\t       l_name);\n> -\t\t\t\t} else {\n> -\t\t\t\t\t/* Volume label or VFAT entry */\n> -\t\t\t\t\tdentptr++;\n> -\t\t\t\t\tcontinue;\n> -\t\t\t\t}\n> -\t\t\t} else if (dentptr->name[0] == 0) {\n> -\t\t\t\tdebug(\"RootDentname == NULL - %d\\n\", i);\n> -\t\t\t\tif (dols == LS_ROOT) {\n> -\t\t\t\t\tprintf(\"\\n%d file(s), %d dir(s)\\n\\n\",\n> -\t\t\t\t\t\tfiles, dirs);\n> -\t\t\t\t\tret = 0;\n> -\t\t\t\t}\n> -\t\t\t\tgoto exit;\n> -\t\t\t}\n> -\t\t\telse if (vfat_enabled &&\n> -\t\t\t\t dols == LS_ROOT && csum == prevcksum) {\n> -\t\t\t\tprevcksum = 0xffff;\n> -\t\t\t\tdentptr++;\n> -\t\t\t\tcontinue;\n> -\t\t\t}\n> -\n> -\t\t\tget_name(dentptr, s_name);\n> -\n> -\t\t\tif (dols == LS_ROOT) {\n> -\t\t\t\tint isdir = (dentptr->attr & ATTR_DIR);\n> -\t\t\t\tchar dirc;\n> -\t\t\t\tint doit = 0;\n> -\n> -\t\t\t\tif (isdir) {\n> -\t\t\t\t\tdirc = '/';\n> -\t\t\t\t\tif (s_name[0] != 0) {\n> -\t\t\t\t\t\tdirs++;\n> -\t\t\t\t\t\tdoit = 1;\n> -\t\t\t\t\t}\n> -\t\t\t\t} else {\n> -\t\t\t\t\tdirc = ' ';\n> -\t\t\t\t\tif (s_name[0] != 0) {\n> -\t\t\t\t\t\tfiles++;\n> -\t\t\t\t\t\tdoit = 1;\n> -\t\t\t\t\t}\n> -\t\t\t\t}\n> -\t\t\t\tif (doit) {\n> -\t\t\t\t\tif (dirc == ' ') {\n> -\t\t\t\t\t\tprintf(\" %8u   %s%c\\n\",\n> -\t\t\t\t\t\t       FAT2CPU32(dentptr->size),\n> -\t\t\t\t\t\t\ts_name, dirc);\n> -\t\t\t\t\t} else {\n> -\t\t\t\t\t\tprintf(\"            %s%c\\n\",\n> -\t\t\t\t\t\t\ts_name, dirc);\n> -\t\t\t\t\t}\n> -\t\t\t\t}\n> -\t\t\t\tdentptr++;\n> -\t\t\t\tcontinue;\n> -\t\t\t}\n> -\n> -\t\t\tif (strcmp(fnamecopy, s_name)\n> -\t\t\t    && strcmp(fnamecopy, l_name)) {\n> -\t\t\t\tdebug(\"RootMismatch: |%s|%s|\\n\", s_name,\n> -\t\t\t\t       l_name);\n> -\t\t\t\tdentptr++;\n> -\t\t\t\tcontinue;\n> -\t\t\t}\n> -\n> -\t\t\tif (isdir && !(dentptr->attr & ATTR_DIR))\n> -\t\t\t\tgoto exit;\n> -\n> -\t\t\tdebug(\"RootName: %s\", s_name);\n> -\t\t\tdebug(\", start: 0x%x\", START(dentptr));\n> -\t\t\tdebug(\", size:  0x%x %s\\n\",\n> -\t\t\t       FAT2CPU32(dentptr->size),\n> -\t\t\t       isdir ? \"(DIR)\" : \"\");\n> -\n> -\t\t\tgoto rootdir_done;\t/* We got a match */\n> -\t\t}\n> -\t\tdebug(\"END LOOP: buffer_blk_cnt=%d   clust_size=%d\\n\", buffer_blk_cnt,\n> -\t\t       mydata->clust_size);\n> -\n> -\t\t/*\n> -\t\t * On FAT32 we must fetch the FAT entries for the next\n> -\t\t * root directory clusters when a cluster has been\n> -\t\t * completely processed.\n> -\t\t */\n> -\t\t++buffer_blk_cnt;\n> -\t\tint rootdir_end = 0;\n> -\t\tif (mydata->fatsize == 32) {\n> -\t\t\tif (buffer_blk_cnt == mydata->clust_size) {\n> -\t\t\t\tint nxtsect = 0;\n> -\t\t\t\tint nxt_clust = 0;\n> -\n> -\t\t\t\tnxt_clust = get_fatent(mydata, root_cluster);\n> -\t\t\t\trootdir_end = CHECK_CLUST(nxt_clust, 32);\n> -\n> -\t\t\t\tnxtsect = mydata->data_begin +\n> -\t\t\t\t\t(nxt_clust * mydata->clust_size);\n> -\n> -\t\t\t\troot_cluster = nxt_clust;\n> -\n> -\t\t\t\tcursect = nxtsect;\n> -\t\t\t\tbuffer_blk_cnt = 0;\n> -\t\t\t}\n> -\t\t} else {\n> -\t\t\tif (buffer_blk_cnt == PREFETCH_BLOCKS)\n> -\t\t\t\tbuffer_blk_cnt = 0;\n> -\n> -\t\t\trootdir_end = (++cursect - mydata->rootdir_sect >=\n> -\t\t\t\t       rootdir_size);\n> -\t\t}\n> -\n> -\t\t/* If end of rootdir reached */\n> -\t\tif (rootdir_end) {\n> -\t\t\tif (dols == LS_ROOT) {\n> -\t\t\t\tprintf(\"\\n%d file(s), %d dir(s)\\n\\n\",\n> -\t\t\t\t       files, dirs);\n> -\t\t\t\t*size = 0;\n> -\t\t\t}\n> -\t\t\tgoto exit;\n> -\t\t}\n> -\t}\n> -rootdir_done:\n> -\n> -\tfirsttime = 1;\n> -\n> -\twhile (isdir) {\n> -\t\tint startsect = mydata->data_begin\n> -\t\t\t+ START(dentptr) * mydata->clust_size;\n> -\t\tdir_entry dent;\n> -\t\tchar *nextname = NULL;\n> -\n> -\t\tdent = *dentptr;\n> -\t\tdentptr = &dent;\n> -\n> -\t\tidx = dirdelim(subname);\n> -\n> -\t\tif (idx >= 0) {\n> -\t\t\tsubname[idx] = '\\0';\n> -\t\t\tnextname = subname + idx + 1;\n> -\t\t\t/* Handle multiple delimiters */\n> -\t\t\twhile (ISDIRDELIM(*nextname))\n> -\t\t\t\tnextname++;\n> -\t\t\tif (dols && *nextname == '\\0')\n> -\t\t\t\tfirsttime = 0;\n> -\t\t} else {\n> -\t\t\tif (dols && firsttime) {\n> -\t\t\t\tfirsttime = 0;\n> -\t\t\t} else {\n> -\t\t\t\tisdir = 0;\n> -\t\t\t}\n> -\t\t}\n> -\n> -\t\tif (get_dentfromdir(mydata, startsect, subname, dentptr,\n> -\t\t\t\t     isdir ? 0 : dols) == NULL) {\n> -\t\t\tif (dols && !isdir)\n> -\t\t\t\t*size = 0;\n> -\t\t\tgoto exit;\n> -\t\t}\n> -\n> -\t\tif (isdir && !(dentptr->attr & ATTR_DIR))\n> -\t\t\tgoto exit;\n> -\n> -\t\t/*\n> -\t\t * If we are looking for a directory, and found a directory\n> -\t\t * type entry, and the entry is for the root directory (as\n> -\t\t * denoted by a cluster number of 0), jump back to the start\n> -\t\t * of the function, since at least on FAT12/16, the root dir\n> -\t\t * lives in a hard-coded location and needs special handling\n> -\t\t * to parse, rather than simply following the cluster linked\n> -\t\t * list in the FAT, like other directories.\n> -\t\t */\n> -\t\tif (isdir && (dentptr->attr & ATTR_DIR) && !START(dentptr)) {\n> -\t\t\t/*\n> -\t\t\t * Modify the filename to remove the prefix that gets\n> -\t\t\t * back to the root directory, so the initial root dir\n> -\t\t\t * parsing code can continue from where we are without\n> -\t\t\t * confusion.\n> -\t\t\t */\n> -\t\t\tstrcpy(fnamecopy, nextname ?: \"\");\n> -\t\t\t/*\n> -\t\t\t * Set up state the same way as the function does when\n> -\t\t\t * first started. This is required for the root dir\n> -\t\t\t * parsing code operates in its expected environment.\n> -\t\t\t */\n> -\t\t\tsubname = \"\";\n> -\t\t\tcursect = mydata->rootdir_sect;\n> -\t\t\tisdir = 0;\n> -\t\t\tgoto root_reparse;\n> -\t\t}\n> -\n> -\t\tif (idx >= 0)\n> -\t\t\tsubname = nextname;\n> -\t}\n> -\n> -\tif (dogetsize) {\n> -\t\t*size = FAT2CPU32(dentptr->size);\n> -\t\tret = 0;\n> -\t} else {\n> -\t\tret = get_contents(mydata, dentptr, pos, buffer, maxsize, size);\n> -\t}\n> -\tdebug(\"Size: %u, got: %llu\\n\", FAT2CPU32(dentptr->size), *size);\n> -\n> -exit:\n> -\tfree(mydata->fatbuf);\n> -\treturn ret;\n> -}\n> -\n>   \n>   /*\n>    * Directory iterator, to simplify filesystem traversal\n> @@ -1571,12 +939,6 @@ static int fat_itr_resolve(fat_itr *itr, const char *path, unsigned type)\n>   \treturn -ENOENT;\n>   }\n>   \n> -int do_fat_read(const char *filename, void *buffer, loff_t maxsize, int dols,\n> -\t\tloff_t *actread)\n> -{\n> -\treturn do_fat_read_at(filename, 0, buffer, maxsize, dols, 0, actread);\n> -}\n> -\n>   int file_fat_detectfs(void)\n>   {\n>   \tboot_sector bs;\n> @@ -1641,31 +1003,96 @@ int file_fat_detectfs(void)\n>   \n>   int file_fat_ls(const char *dir)\n>   {\n> -\tloff_t size;\n> +\tfsdata fsdata;\n> +\tfat_itr itrblock, *itr = &itrblock;\n> +\tint files = 0, dirs = 0;\n> +\tint ret;\n> +\n> +\tret = fat_itr_root(itr, &fsdata);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = fat_itr_resolve(itr, dir, TYPE_DIR);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\twhile (fat_itr_next(itr)) {\n> +\t\tif (fat_itr_isdir(itr)) {\n> +\t\t\tprintf(\"            %s/\\n\", itr->name);\n> +\t\t\tdirs++;\n> +\t\t} else {\n> +\t\t\tprintf(\" %8u   %s\\n\",\n> +\t\t\t       FAT2CPU32(itr->dent->size),\n> +\t\t\t       itr->name);\n> +\t\t\tfiles++;\n> +\t\t}\n> +\t}\n> +\n> +\tprintf(\"\\n%d file(s), %d dir(s)\\n\\n\", files, dirs);\n>   \n> -\treturn do_fat_read(dir, NULL, 0, LS_YES, &size);\n> +\treturn 0;\n>   }\n>   \n>   int fat_exists(const char *filename)\n>   {\n> +\tfsdata fsdata;\n> +\tfat_itr itrblock, *itr = &itrblock;\n>   \tint ret;\n> -\tloff_t size;\n>   \n> -\tret = do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, &size);\n> +\tret = fat_itr_root(itr, &fsdata);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = fat_itr_resolve(itr, filename, TYPE_ANY);\n>   \treturn ret == 0;\n>   }\n>   \n>   int fat_size(const char *filename, loff_t *size)\n>   {\n> -\treturn do_fat_read_at(filename, 0, NULL, 0, LS_NO, 1, size);\n> +\tfsdata fsdata;\n> +\tfat_itr itrblock, *itr = &itrblock;\n> +\tint ret;\n> +\n> +\tret = fat_itr_root(itr, &fsdata);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = fat_itr_resolve(itr, filename, TYPE_FILE);\n> +\tif (ret) {\n> +\t\t/*\n> +\t\t * Directories don't have size, but fs_size() is not\n> +\t\t * expected to fail if passed a directory path:\n> +\t\t */\n> +\t\tfat_itr_root(itr, &fsdata);\n> +\t\tif (!fat_itr_resolve(itr, filename, TYPE_DIR)) {\n> +\t\t\t*size = 0;\n> +\t\t\treturn 0;\n> +\t\t}\n> +\t\treturn ret;\n> +\t}\n> +\n> +\t*size = FAT2CPU32(itr->dent->size);\n> +\n> +\treturn 0;\n>   }\n>   \n>   int file_fat_read_at(const char *filename, loff_t pos, void *buffer,\n>   \t\t     loff_t maxsize, loff_t *actread)\n>   {\n> +\tfsdata fsdata;\n> +\tfat_itr itrblock, *itr = &itrblock;\n> +\tint ret;\n> +\n> +\tret = fat_itr_root(itr, &fsdata);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n> +\tret = fat_itr_resolve(itr, filename, TYPE_FILE);\n> +\tif (ret)\n> +\t\treturn ret;\n> +\n>   \tprintf(\"reading %s\\n\", filename);\n> -\treturn do_fat_read_at(filename, pos, buffer, maxsize, LS_NO, 0,\n> -\t\t\t      actread);\n> +\treturn get_contents(&fsdata, itr->dent, pos, buffer, maxsize, actread);\n>   }\n>   \n>   int file_fat_read(const char *filename, void *buffer, int maxsize)\n> diff --git a/include/fat.h b/include/fat.h\n> index 6d3fc8e4a6..3e7ab9ea8d 100644\n> --- a/include/fat.h\n> +++ b/include/fat.h\n> @@ -58,12 +58,6 @@\n>    */\n>   #define LAST_LONG_ENTRY_MASK\t0x40\n>   \n> -/* Flags telling whether we should read a file or list a directory */\n> -#define LS_NO\t\t0\n> -#define LS_YES\t\t1\n> -#define LS_DIR\t\t1\n> -#define LS_ROOT\t\t2\n> -\n>   #define ISDIRDELIM(c)\t((c) == '/' || (c) == '\\\\')\n>   \n>   #define FSTYPE_NONE\t(-1)\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlbww3mtcz9t3F\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 01:09:20 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 10A86C21EC2; Sun,  3 Sep 2017 15:09:17 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 20130C21E5B;\n\tSun,  3 Sep 2017 15:09:12 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 3ADF0C21EEC; Sun,  3 Sep 2017 15:08:59 +0000 (UTC)","from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9])\n\tby lists.denx.de (Postfix) with ESMTPS id D9E36C21F32\n\tfor <u-boot@lists.denx.de>; Sun,  3 Sep 2017 15:08:58 +0000 (UTC)","from frontend01.mail.m-online.net (unknown [192.168.8.182])\n\tby mail-out.m-online.net (Postfix) with ESMTP id 3xlbwV4w1vz1qxxl;\n\tSun,  3 Sep 2017 17:08:58 +0200 (CEST)","from localhost (dynscan1.mnet-online.de [192.168.6.70])\n\tby mail.m-online.net (Postfix) with ESMTP id 3xlbwV2GkMz3hjkw;\n\tSun,  3 Sep 2017 17:08:58 +0200 (CEST)","from mail.mnet-online.de ([192.168.8.182])\n\tby localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new,\n\tport 10024)\n\twith ESMTP id KHxrEr3CdweO; Sun,  3 Sep 2017 17:08:56 +0200 (CEST)","from [192.168.2.222] (89-77-92-62.dynamic.chello.pl [89.77.92.62])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mail.mnet-online.de (Postfix) with ESMTPSA;\n\tSun,  3 Sep 2017 17:08:56 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,\n\tRCVD_IN_MSPIKE_H3,\n\tRCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no\n\tversion=3.4.0","X-Virus-Scanned":"amavisd-new at mnet-online.de","X-Auth-Info":"QefLcD7rnaOW1bPY4T+HMJUqYBZRB+/Ern2XbnpivZg=","To":"Rob Clark <robdclark@gmail.com>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>","References":"<20170902163806.27265-1-robdclark@gmail.com>\n\t<20170902163806.27265-4-robdclark@gmail.com>","From":"=?utf-8?q?=C5=81ukasz_Majewski?= <lukma@denx.de>","Organization":"DENX","Message-ID":"<c382687b-ed99-624e-3aed-97cefb1c5936@denx.de>","Date":"Sun, 3 Sep 2017 17:08:55 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.2.1","MIME-Version":"1.0","In-Reply-To":"<20170902163806.27265-4-robdclark@gmail.com>","Content-Language":"en-US","Cc":"Tien Fong Chee <tfchee@altera.com>, Genevieve Chan <ccheauya@altera.com>","Subject":"Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1763087,"web_url":"http://patchwork.ozlabs.org/comment/1763087/","msgid":"<CAPnjgZ0me2XqhD1v384ShEA7hGYw7eq-i8U1ycVMsnAP+V2TMA@mail.gmail.com>","list_archive_url":null,"date":"2017-09-05T08:56:14","subject":"Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators","submitter":{"id":6170,"url":"http://patchwork.ozlabs.org/api/people/6170/","name":"Simon Glass","email":"sjg@chromium.org"},"content":"Hi Rob,\n\nOn 3 September 2017 at 23:08, Łukasz Majewski <lukma@denx.de> wrote:\n> On 09/02/2017 06:37 PM, Rob Clark wrote:\n>>\n>> And drop a whole lot of ugly code!\n\n:-)\n\n>\n>\n> +1\n>\n> Reviewed-by: Łukasz Majewski <lukma@denx.de>\n>\n>\n>\n>>\n>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>> ---\n>>   fs/fat/fat.c  | 723\n>> ++++++----------------------------------------------------\n>>   include/fat.h |   6 -\n>>   2 files changed, 75 insertions(+), 654 deletions(-)\n>>\n>> diff --git a/fs/fat/fat.c b/fs/fat/fat.c\n>> index c72d6ca931..3193290434 100644\n>> --- a/fs/fat/fat.c\n>> +++ b/fs/fat/fat.c\n>> @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc,\n>> int part_no)\n>>   }\n>>     /*\n>> - * Get the first occurence of a directory delimiter ('/' or '\\') in a\n>> string.\n>> - * Return index into string if found, -1 otherwise.\n>> - */\n>> -static int dirdelim(char *str)\n>> -{\n>> -       char *start = str;\n>> -\n>> -       while (*str != '\\0') {\n>> -               if (ISDIRDELIM(*str))\n>> -                       return str - start;\n>> -               str++;\n>> -       }\n>> -       return -1;\n>> -}\n>> -\n>> -/*\n>>    * Extract zero terminated short name from a directory entry.\n>>    */\n>>   static void get_name(dir_entry *dirent, char *s_name)\n>> @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name,\n>> int *idx)\n>>         return 0;\n>>   }\n>>   -/*\n>> - * Extract the full long filename starting at 'retdent' (which is really\n>> - * a slot) into 'l_name'. If successful also copy the real directory\n>> entry\n>> - * into 'retdent'\n>> - * Return 0 on success, -1 otherwise.\n>> - */\n>> -static int\n>> -get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,\n>> -            dir_entry *retdent, char *l_name)\n>> -{\n>> -       dir_entry *realdent;\n>> -       dir_slot *slotptr = (dir_slot *)retdent;\n>> -       __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ?\n>> -                                                       PREFETCH_BLOCKS :\n>> -\n>> mydata->clust_size);\n>> -       __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;\n>> -       int idx = 0;\n>> -\n>> -       if (counter > VFAT_MAXSEQ) {\n>> -               debug(\"Error: VFAT name is too long\\n\");\n>> -               return -1;\n>> -       }\n>> -\n>> -       while ((__u8 *)slotptr < buflimit) {\n>> -               if (counter == 0)\n>> -                       break;\n>> -               if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) !=\n>> counter)\n>> -                       return -1;\n>> -               slotptr++;\n>> -               counter--;\n>> -       }\n>> -\n>> -       if ((__u8 *)slotptr >= buflimit) {\n>> -               dir_slot *slotptr2;\n>> -\n>> -               if (curclust == 0)\n>> -                       return -1;\n>> -               curclust = get_fatent(mydata, curclust);\n>> -               if (CHECK_CLUST(curclust, mydata->fatsize)) {\n>> -                       debug(\"curclust: 0x%x\\n\", curclust);\n>> -                       printf(\"Invalid FAT entry\\n\");\n>> -                       return -1;\n>> -               }\n>> -\n>> -               if (get_cluster(mydata, curclust,\n>> get_contents_vfatname_block,\n>> -                               mydata->clust_size * mydata->sect_size) !=\n>> 0) {\n>> -                       debug(\"Error: reading directory block\\n\");\n>> -                       return -1;\n>> -               }\n>> -\n>> -               slotptr2 = (dir_slot *)get_contents_vfatname_block;\n>> -               while (counter > 0) {\n>> -                       if (((slotptr2->id & ~LAST_LONG_ENTRY_MASK)\n>> -                           & 0xff) != counter)\n>> -                               return -1;\n>> -                       slotptr2++;\n>> -                       counter--;\n>> -               }\n>> -\n>> -               /* Save the real directory entry */\n>> -               realdent = (dir_entry *)slotptr2;\n>> -               while ((__u8 *)slotptr2 > get_contents_vfatname_block) {\n>> -                       slotptr2--;\n>> -                       slot2str(slotptr2, l_name, &idx);\n>> -               }\n>> -       } else {\n>> -               /* Save the real directory entry */\n>> -               realdent = (dir_entry *)slotptr;\n>> -       }\n>> -\n>> -       do {\n>> -               slotptr--;\n>> -               if (slot2str(slotptr, l_name, &idx))\n>> -                       break;\n>> -       } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));\n>> -\n>> -       l_name[idx] = '\\0';\n>> -       if (*l_name == DELETED_FLAG)\n>> -               *l_name = '\\0';\n>> -       else if (*l_name == aRING)\n>> -               *l_name = DELETED_FLAG;\n>> -       downcase(l_name);\n>> -\n>> -       /* Return the real directory entry */\n>> -       memcpy(retdent, realdent, sizeof(dir_entry));\n>> -\n>> -       return 0;\n>> -}\n>> -\n>>   /* Calculate short name checksum */\n>>   static __u8 mkcksum(const char name[8], const char ext[3])\n>>   {\n>> @@ -572,170 +467,11 @@ static __u8 mkcksum(const char name[8], const char\n>> ext[3])\n>>         return ret;\n>>   }\n>>   -/*\n>> - * Get the directory entry associated with 'filename' from the directory\n>> - * starting at 'startsect'\n>> - */\n>> +// These should probably DIAF..\n\nCan you use /* ?\n\nPerhaps a TODO here would help - are you suggesting using malloc()?\n\nDid this patch go through patman/checkpatch?\n\nRegards,\nSimon","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"lwXyTibt\"; \n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"nxa62m26\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmgdX3XmLz9s72\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue,  5 Sep 2017 18:59:44 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 408FDC21C45; Tue,  5 Sep 2017 08:57:32 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id D5720C21D56;\n\tTue,  5 Sep 2017 08:57:01 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 41E78C21D8D; Tue,  5 Sep 2017 08:56:39 +0000 (UTC)","from mail-qk0-f179.google.com (mail-qk0-f179.google.com\n\t[209.85.220.179])\n\tby lists.denx.de (Postfix) with ESMTPS id 5AB21C21DA0\n\tfor <u-boot@lists.denx.de>; Tue,  5 Sep 2017 08:56:36 +0000 (UTC)","by mail-qk0-f179.google.com with SMTP id z143so9537496qkb.3\n\tfor <u-boot@lists.denx.de>; Tue, 05 Sep 2017 01:56:36 -0700 (PDT)","by 10.200.28.108 with HTTP; Tue, 5 Sep 2017 01:56:14 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n\ts=20161025; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-transfer-encoding;\n\tbh=UVIPopO2flywrUOtLC8d2a7OjbQ153+fTXjBrcdAwRs=;\n\tb=lwXyTibtqtS6PFhmw5043FG99bBfHDiF8XI+9M8/kamgFtqwRTYapKLwaH8R4/+XUI\n\t9Xv3Z/RcTPq9gCcu0dnEX/cfnwa+FAVNa3LANquae5b+QGbjP/fhCrZnGAVC4Ze7VG9T\n\t7lPtF8/s9ckEoHRw0f3IC4jrSVYGE4kjT168OUmzmyHAjvEo7haUnRIO+/jiIYgyK9RZ\n\tGQdjvhsIrhp3c8vgq1opm6R2fMx6A19CINFlplrGK6w+EMj8v915kZC+K9o4T0pgZ7O4\n\t7l4CXedhhBpDrTJ6ad6gxKb7XBHozr1xztw4uQ+EQ0IXsGO3wqJGcwDn+whtVORzotSR\n\tt8fQ==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:sender:in-reply-to:references:from:date:message-id\n\t:subject:to:cc:content-transfer-encoding;\n\tbh=UVIPopO2flywrUOtLC8d2a7OjbQ153+fTXjBrcdAwRs=;\n\tb=nxa62m26M3uxpxswM/OqsNg2UNf9iVqF8ff4BXrX/BC+TtkHxSk7bjc8FzGwO+0VVH\n\tp/iVzyoP6CyXSx60g4yCU3ZnJlcbD7KqHwoFRU1jQ4zHbH3Z1Lw2kQcr+XhzurfvxoTP\n\t/6Dh7Rwegau+feOpVC18rEoMAHaP9ut0oQ5sw="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:sender:in-reply-to:references:from\n\t:date:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=UVIPopO2flywrUOtLC8d2a7OjbQ153+fTXjBrcdAwRs=;\n\tb=OKZptwbVVzhQ2FpFzsJmZpwlDD5rEOgVXDPivbxUt4R8w8W0G29GyRmjmu2jTGNbKe\n\t073/1Z3HPy+hxRfJCPCc5c1/6XFMnAcW6eBMsSvkEGe/4cZZTX0DJacGXIhPraB2igIZ\n\tJoMOz2oKbzsy7zaFJk7Kcm8zQulDmfOQk7XHOZFFlgduTw/tVhIujYcSb6n0hEFQEoSn\n\tEn6ZB5icpFKB60gPEBDHoZroDjbwer4U1r+/GM8h3fu3Jh0HtqkN5A2PotBkBwrO0xKM\n\tVzKxwSiaNmA5rLT1Ot0cwmn+E32RiRgRj+Bhd2vGkwtxYKSXgyi+xs1BElWef7ATXRca\n\tycuw==","X-Gm-Message-State":"AHPjjUhVF9EGci9rWLe6zFdeyFT4hlpYU3zoNGyheOtZ7UEPg8pvF1st\n\tCslQ5bS7nIKBaY7tosE/effkh6gREb0YfjI=","X-Google-Smtp-Source":"ADKCNb4tp2gEsJlKyicICHHnaJS7VSW1pJevEg43ndCp/Kclqys9glgLouBw4/6Vzyr926PC4YmOuAyicKj2XJR6bs0=","X-Received":"by 10.55.79.66 with SMTP id d63mr4209703qkb.326.1504601795086;\n\tTue, 05 Sep 2017 01:56:35 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<c382687b-ed99-624e-3aed-97cefb1c5936@denx.de>","References":"<20170902163806.27265-1-robdclark@gmail.com>\n\t<20170902163806.27265-4-robdclark@gmail.com>\n\t<c382687b-ed99-624e-3aed-97cefb1c5936@denx.de>","From":"Simon Glass <sjg@chromium.org>","Date":"Tue, 5 Sep 2017 16:56:14 +0800","X-Google-Sender-Auth":"l9XCRIZrbDtJGwsh2KZxBm-IyQA","Message-ID":"<CAPnjgZ0me2XqhD1v384ShEA7hGYw7eq-i8U1ycVMsnAP+V2TMA@mail.gmail.com>","To":"=?utf-8?q?=C5=81ukasz_Majewski?= <lukma@denx.de>","Cc":"U-Boot Mailing List <u-boot@lists.denx.de>,\n\tGenevieve Chan <ccheauya@altera.com>, Tien Fong Chee <tfchee@altera.com>","Subject":"Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}},{"id":1763786,"web_url":"http://patchwork.ozlabs.org/comment/1763786/","msgid":"<CAF6AEGt3fh-7k=bwe7ZtWdpKoEX9ZpbCtN9OYg2CGPcnzK9VQg@mail.gmail.com>","list_archive_url":null,"date":"2017-09-06T02:18:30","subject":"Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators","submitter":{"id":18760,"url":"http://patchwork.ozlabs.org/api/people/18760/","name":"Rob Clark","email":"robdclark@gmail.com"},"content":"On Tue, Sep 5, 2017 at 4:56 AM, Simon Glass <sjg@chromium.org> wrote:\n> Hi Rob,\n>\n> On 3 September 2017 at 23:08, Łukasz Majewski <lukma@denx.de> wrote:\n>> On 09/02/2017 06:37 PM, Rob Clark wrote:\n>>>\n>>> And drop a whole lot of ugly code!\n>\n> :-)\n>\n>>\n>>\n>> +1\n>>\n>> Reviewed-by: Łukasz Majewski <lukma@denx.de>\n>>\n>>\n>>\n>>>\n>>> Signed-off-by: Rob Clark <robdclark@gmail.com>\n>>> ---\n>>>   fs/fat/fat.c  | 723\n>>> ++++++----------------------------------------------------\n>>>   include/fat.h |   6 -\n>>>   2 files changed, 75 insertions(+), 654 deletions(-)\n>>>\n>>> diff --git a/fs/fat/fat.c b/fs/fat/fat.c\n>>> index c72d6ca931..3193290434 100644\n>>> --- a/fs/fat/fat.c\n>>> +++ b/fs/fat/fat.c\n>>> @@ -119,22 +119,6 @@ int fat_register_device(struct blk_desc *dev_desc,\n>>> int part_no)\n>>>   }\n>>>     /*\n>>> - * Get the first occurence of a directory delimiter ('/' or '\\') in a\n>>> string.\n>>> - * Return index into string if found, -1 otherwise.\n>>> - */\n>>> -static int dirdelim(char *str)\n>>> -{\n>>> -       char *start = str;\n>>> -\n>>> -       while (*str != '\\0') {\n>>> -               if (ISDIRDELIM(*str))\n>>> -                       return str - start;\n>>> -               str++;\n>>> -       }\n>>> -       return -1;\n>>> -}\n>>> -\n>>> -/*\n>>>    * Extract zero terminated short name from a directory entry.\n>>>    */\n>>>   static void get_name(dir_entry *dirent, char *s_name)\n>>> @@ -468,95 +452,6 @@ static int slot2str(dir_slot *slotptr, char *l_name,\n>>> int *idx)\n>>>         return 0;\n>>>   }\n>>>   -/*\n>>> - * Extract the full long filename starting at 'retdent' (which is really\n>>> - * a slot) into 'l_name'. If successful also copy the real directory\n>>> entry\n>>> - * into 'retdent'\n>>> - * Return 0 on success, -1 otherwise.\n>>> - */\n>>> -static int\n>>> -get_vfatname(fsdata *mydata, int curclust, __u8 *cluster,\n>>> -            dir_entry *retdent, char *l_name)\n>>> -{\n>>> -       dir_entry *realdent;\n>>> -       dir_slot *slotptr = (dir_slot *)retdent;\n>>> -       __u8 *buflimit = cluster + mydata->sect_size * ((curclust == 0) ?\n>>> -                                                       PREFETCH_BLOCKS :\n>>> -\n>>> mydata->clust_size);\n>>> -       __u8 counter = (slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff;\n>>> -       int idx = 0;\n>>> -\n>>> -       if (counter > VFAT_MAXSEQ) {\n>>> -               debug(\"Error: VFAT name is too long\\n\");\n>>> -               return -1;\n>>> -       }\n>>> -\n>>> -       while ((__u8 *)slotptr < buflimit) {\n>>> -               if (counter == 0)\n>>> -                       break;\n>>> -               if (((slotptr->id & ~LAST_LONG_ENTRY_MASK) & 0xff) !=\n>>> counter)\n>>> -                       return -1;\n>>> -               slotptr++;\n>>> -               counter--;\n>>> -       }\n>>> -\n>>> -       if ((__u8 *)slotptr >= buflimit) {\n>>> -               dir_slot *slotptr2;\n>>> -\n>>> -               if (curclust == 0)\n>>> -                       return -1;\n>>> -               curclust = get_fatent(mydata, curclust);\n>>> -               if (CHECK_CLUST(curclust, mydata->fatsize)) {\n>>> -                       debug(\"curclust: 0x%x\\n\", curclust);\n>>> -                       printf(\"Invalid FAT entry\\n\");\n>>> -                       return -1;\n>>> -               }\n>>> -\n>>> -               if (get_cluster(mydata, curclust,\n>>> get_contents_vfatname_block,\n>>> -                               mydata->clust_size * mydata->sect_size) !=\n>>> 0) {\n>>> -                       debug(\"Error: reading directory block\\n\");\n>>> -                       return -1;\n>>> -               }\n>>> -\n>>> -               slotptr2 = (dir_slot *)get_contents_vfatname_block;\n>>> -               while (counter > 0) {\n>>> -                       if (((slotptr2->id & ~LAST_LONG_ENTRY_MASK)\n>>> -                           & 0xff) != counter)\n>>> -                               return -1;\n>>> -                       slotptr2++;\n>>> -                       counter--;\n>>> -               }\n>>> -\n>>> -               /* Save the real directory entry */\n>>> -               realdent = (dir_entry *)slotptr2;\n>>> -               while ((__u8 *)slotptr2 > get_contents_vfatname_block) {\n>>> -                       slotptr2--;\n>>> -                       slot2str(slotptr2, l_name, &idx);\n>>> -               }\n>>> -       } else {\n>>> -               /* Save the real directory entry */\n>>> -               realdent = (dir_entry *)slotptr;\n>>> -       }\n>>> -\n>>> -       do {\n>>> -               slotptr--;\n>>> -               if (slot2str(slotptr, l_name, &idx))\n>>> -                       break;\n>>> -       } while (!(slotptr->id & LAST_LONG_ENTRY_MASK));\n>>> -\n>>> -       l_name[idx] = '\\0';\n>>> -       if (*l_name == DELETED_FLAG)\n>>> -               *l_name = '\\0';\n>>> -       else if (*l_name == aRING)\n>>> -               *l_name = DELETED_FLAG;\n>>> -       downcase(l_name);\n>>> -\n>>> -       /* Return the real directory entry */\n>>> -       memcpy(retdent, realdent, sizeof(dir_entry));\n>>> -\n>>> -       return 0;\n>>> -}\n>>> -\n>>>   /* Calculate short name checksum */\n>>>   static __u8 mkcksum(const char name[8], const char ext[3])\n>>>   {\n>>> @@ -572,170 +467,11 @@ static __u8 mkcksum(const char name[8], const char\n>>> ext[3])\n>>>         return ret;\n>>>   }\n>>>   -/*\n>>> - * Get the directory entry associated with 'filename' from the directory\n>>> - * starting at 'startsect'\n>>> - */\n>>> +// These should probably DIAF..\n>\n> Can you use /* ?\n>\n> Perhaps a TODO here would help - are you suggesting using malloc()?\n\nI'll convert to /* TODO .. */\n\nI didn't mean to use malloc, but iirc at least some of this goes away\nwhen fat_write.c gets converted to use directory iterators.. I think\nthese are only used directly or indirectly by do_fat_write()..\n\nI may have to tackle fat_write.c in the near future for UEFI SCT test\nsuite (un)fortunately..  might be after next merge-window but I think\nthat TODO can be tackled in the near future.\n\nBR,\n-R\n\n\n> Did this patch go through patman/checkpatch?\n>\n> Regards,\n> Simon","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"UdaE8uWW\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xn6ms6792z9sR9\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 12:22:37 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 72F4BC21EAB; Wed,  6 Sep 2017 02:21:21 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id E9DABC21F18;\n\tWed,  6 Sep 2017 02:21:18 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid BC298C21EC0; Wed,  6 Sep 2017 02:18:32 +0000 (UTC)","from mail-lf0-f42.google.com (mail-lf0-f42.google.com\n\t[209.85.215.42])\n\tby lists.denx.de (Postfix) with ESMTPS id CAABEC21E4E\n\tfor <u-boot@lists.denx.de>; Wed,  6 Sep 2017 02:18:31 +0000 (UTC)","by mail-lf0-f42.google.com with SMTP id q132so14572316lfe.5\n\tfor <u-boot@lists.denx.de>; Tue, 05 Sep 2017 19:18:31 -0700 (PDT)","by 10.46.82.27 with HTTP; Tue, 5 Sep 2017 19:18:30 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID\n\tautolearn=unavailable autolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=mime-version:in-reply-to:references:from:date:message-id:subject:to\n\t:cc:content-transfer-encoding;\n\tbh=MRAv1aPCayuo5BKKSFB7gsJghOFHxG3tq/M4uz447j4=;\n\tb=UdaE8uWWJFQl4uQIv/tHWdGAMkPk7UZCCqKx6wlunMNOSRa6wKXJK8OijmPNd7d9Bz\n\tELmUWkz45dig4/ArTQOeXCHe2G+24u1oLDijvdegdT43Ju21p4FnziTBnIYuOoQub41t\n\tl+wGZE9v+sgvf8/PiJRbcM5qe1fI27l8AJnbIZfg9IQw4Q2te4kqDvrGoWp3ShElKRA1\n\tmY2n0MJlYq9Nq9QhDJp7cG2kkF7beLV5FyaYzigMwBcTtsyOnmmXFivErHDh6xCGlTny\n\tgYfhAdb9cuvOhXe3pDo6H70p13BgZvAqBAF5sKDhkol5AO5Vf7lIyjrjqs9bOsAZzAZ1\n\taFDg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:in-reply-to:references:from:date\n\t:message-id:subject:to:cc:content-transfer-encoding;\n\tbh=MRAv1aPCayuo5BKKSFB7gsJghOFHxG3tq/M4uz447j4=;\n\tb=V7X+V485VjGpIDF5djxHoORBAQMR20dGF9H+EVX0tULrvxSqR0jbQOJpcC4PYqrz5R\n\t0xG1ksOtKnINw73tgxxjFxgnw2Nf51bkvzuxIeBwPP8nCCUhDwQ4seQw3BIi/+gqQ2z3\n\tP2nbbCD/l7NXOv5ahlbJVGcYYMWLklvmT8m4QDs560LQLR1FdE0LCBIzNzTCUXMGyU73\n\tWXG+4wqslp2d/n+FiPTca/CMF2Pn74G59IIuSqgY4GxlBbvSzwb3n9v60Aqq6uYyqcXj\n\tjZ9z76a4vFEvaq90ucmnfUCe5dc5XsquOMkosE96MYeURUDLboFVW4mK7xNjqZ4dM3JG\n\tvoAA==","X-Gm-Message-State":"AHPjjUjJfTt5JOwK0UX5TcAIF3wveQDzQPZUHGeacev8YUBVjBDkkTD1\n\tl+TiIubyvG561GLzJGrNaKDXbHNDoldK","X-Google-Smtp-Source":"ADKCNb6xOrnMM6t960rxKf/U6oIgctxpJ7Ib2UTILvynUOhv2Iqntd9urbdBF50H5L8uKPMqFM/CazoUPhGlvZ1k9C8=","X-Received":"by 10.46.19.26 with SMTP id 26mr316114ljt.20.1504664311325; Tue,\n\t05 Sep 2017 19:18:31 -0700 (PDT)","MIME-Version":"1.0","In-Reply-To":"<CAPnjgZ0me2XqhD1v384ShEA7hGYw7eq-i8U1ycVMsnAP+V2TMA@mail.gmail.com>","References":"<20170902163806.27265-1-robdclark@gmail.com>\n\t<20170902163806.27265-4-robdclark@gmail.com>\n\t<c382687b-ed99-624e-3aed-97cefb1c5936@denx.de>\n\t<CAPnjgZ0me2XqhD1v384ShEA7hGYw7eq-i8U1ycVMsnAP+V2TMA@mail.gmail.com>","From":"Rob Clark <robdclark@gmail.com>","Date":"Tue, 5 Sep 2017 22:18:30 -0400","Message-ID":"<CAF6AEGt3fh-7k=bwe7ZtWdpKoEX9ZpbCtN9OYg2CGPcnzK9VQg@mail.gmail.com>","To":"Simon Glass <sjg@chromium.org>","Cc":"Genevieve Chan <ccheauya@altera.com>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>,\n\tTien Fong Chee <tfchee@altera.com>","Subject":"Re: [U-Boot] [PATCH v2 3/8] fat/fs: convert to directory iterators","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]