From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Andreas_Bie=DFmann?= Date: Tue, 30 Oct 2012 12:05:37 +0100 Subject: [U-Boot] [PATCH V4 3/3] fs: add filesystem switch libary, implement ls and fsload commands In-Reply-To: <1350924231-5830-3-git-send-email-swarren@wwwdotorg.org> References: <1350924231-5830-1-git-send-email-swarren@wwwdotorg.org> <1350924231-5830-3-git-send-email-swarren@wwwdotorg.org> Message-ID: <508FB481.3020101@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear all, On 22.10.2012 18:43, Stephen Warren wrote: > From: Stephen Warren > > Implement "ls" and "fsload" commands that act like {fat,ext2}{ls,load}, > and transparently handle either file-system. This scheme could easily be > extended to other filesystem types; I only didn't do it for zfs because > I don't have any filesystems of that type to test with. > > Replace the implementation of {fat,ext[24]}{ls,load} with this new code > too. > > Signed-off-by: Stephen Warren this patch (namely 045fa1e1142552799ad3203e9e0bc22a11e866ea) seems to break avr32 on runtime. It seems there is a new array introduced (the fstypes array in fs/fs.c) which do not provide a relocation method (CONFIG_NEEDS_MANUAL_RELOC). This is currently only a weak assumption, but has any other requiring manual relocation m86k, mips, nds32m sparc) also encountered this problem? > --- > diff --git a/fs/fs.c b/fs/fs.c > new file mode 100644 > index 0000000..23ffa25 > --- /dev/null > +++ b/fs/fs.c > @@ -0,0 +1,308 @@ > + > +static const struct { > + int fstype; > + int (*probe)(void); > +} fstypes[] = { > + { > + .fstype = FS_TYPE_FAT, > + .probe = fs_probe_fat, > + }, > + { > + .fstype = FS_TYPE_EXT, > + .probe = fs_probe_ext, > + }, > +}; I currently think this should be manually relocated for those arches which need the manual relocation. > + > +int fs_set_blk_dev(const char *ifname, const char *dev_part_str, int fstype) > +{ > + int part, i; > + > + part = get_device_and_partition(ifname, dev_part_str, &fs_dev_desc, > + &fs_partition, 1); > + if (part < 0) > + return -1; > + > + for (i = 0; i < ARRAY_SIZE(fstypes); i++) { > + if ((fstype != FS_TYPE_ANY) && (fstype != fstypes[i].fstype)) > + continue; > + > + if (!fstypes[i].probe()) { > + fs_type = fstypes[i].fstype; > + return 0; > + } > + } > + > + printf("** Unrecognized filesystem type **\n"); > + return -1; > +} Best regards Andreas Bie?mann