All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH7] microblaze - ROMFS adapt files
@ 2007-08-30  7:54 Michal Simek
  2007-09-11 15:14 ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Michal Simek @ 2007-08-30  7:54 UTC (permalink / raw)
  To: u-boot

DESC:  ROMFS support files and sorted names in Makefiles

Signed-off-by: Michal Simek <monstr@monstr.eu>

Note; I think that we can start process with redesigning all FS support

diff --git a/Makefile b/Makefile
index 0477cd3..6d84dbb 100644
--- a/Makefile
+++ b/Makefile
@@ -201,8 +201,9 @@ ifeq ($(CPU),ixp)
 LIBS += cpu/ixp/npe/libnpe.a
 endif
 LIBS += lib_$(ARCH)/lib$(ARCH).a
-LIBS += fs/cramfs/libcramfs.a fs/fat/libfat.a fs/fdos/libfdos.a fs/jffs2/libjffs2.a \
-       fs/reiserfs/libreiserfs.a fs/ext2/libext2fs.a
+LIBS += fs/cramfs/libcramfs.a fs/ext2/libext2fs.a fs/fat/libfat.a \
+       fs/fdos/libfdos.a fs/jffs2/libjffs2.a fs/reiserfs/libreiserfs.a \
+       fs/romfs/libromfs.a
 LIBS += net/libnet.a
 LIBS += disk/libdisk.a
 LIBS += rtc/librtc.a
@@ -325,14 +326,14 @@ depend dep:
 tags ctags:
                ctags -w -o $(OBJTREE)/ctags `find $(SUBDIRS) include \
                                lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
-                               fs/cramfs fs/fat fs/fdos fs/jffs2 \
+                               fs/cramfs fs/fat fs/fdos fs/jffs2 fs/romfs\
                                net disk rtc dtt drivers drivers/sk98lin common \
                        \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`

 etags:
                etags -a -o $(OBJTREE)/etags `find $(SUBDIRS) include \
                                lib_generic board/$(BOARDDIR) cpu/$(CPU) lib_$(ARCH) \
-                               fs/cramfs fs/fat fs/fdos fs/jffs2 \
+                               fs/cramfs fs/fat fs/fdos fs/jffs2 fs/romfs\
                                net disk rtc dtt drivers drivers/sk98lin common \
                        \( -name CVS -prune \) -o \( -name '*.[ch]' -print \)`

diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index 513a226..3e6061a 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -85,7 +85,7 @@
  */

 /*
- * JFFS2/CRAMFS support
+ * JFFS2/CRAMFS/ROMFS support
  */
 #include <common.h>
 #include <command.h>
@@ -175,6 +175,11 @@ extern int cramfs_load (char *loadoffset, struct part_info *info, char *filename
 extern int cramfs_ls (struct part_info *info, char *filename);
 extern int cramfs_info (struct part_info *info);

+extern int romfs_check (struct part_info *info);
+extern int romfs_load (char *loadoffset, struct part_info *info, char *filename);
+extern int romfs_ls (struct part_info *info, char *filename);
+extern int romfs_info (struct part_info *info);
+
 static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int part_num);

 /* command line only routines */
@@ -1874,14 +1879,22 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])

        if ((part = jffs2_part_info(current_dev, current_partnum))){

-               /* check partition type for cramfs */
-               fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2");
+               /* check partition type for JFFS2, cramfs, romfs */
+               if (cramfs_check(part)) {
+                       fsname = "CRAMFS";
+               } else if (romfs_check(part)) {
+                       fsname = "ROMFS";
+               } else {
+                       fsname = "JFFS2";
+               }
                printf("### %s loading '%s' to 0x%lx\n", fsname, filename, offset);

                if (cramfs_check(part)) {
                        size = cramfs_load ((char *) offset, part, filename);
+               } else if (romfs_check(part)){
+                       size = romfs_load ((char *) offset, part, filename);
                } else {
-                       /* if this is not cramfs assume jffs2 */
+                       /* if this is not cramfs or romfs assume jffs2 */
                        size = jffs2_1pass_load((char *)offset, part, filename);                }

@@ -1928,8 +1941,10 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                /* check partition type for cramfs */
                if (cramfs_check(part)) {
                        ret = cramfs_ls (part, filename);
+               } else if (romfs_check(part)) {
+                       ret = romfs_ls (part, filename);
                } else {
-                       /* if this is not cramfs assume jffs2 */
+                       /* if this is not cramfs or romfs assume jffs2 */
                        ret = jffs2_1pass_ls(part, filename);
                }

@@ -1951,7 +1966,6 @@ int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        struct part_info *part;
-       char *fsname;
        int ret;

        /* make sure we are in sync with env variables */
@@ -1961,13 +1975,17 @@ int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        if ((part = jffs2_part_info(current_dev, current_partnum))){

                /* check partition type for cramfs */
-               fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2");
-               printf("### filesystem type is %s\n", fsname);
+               puts("### filesystem type is ");

                if (cramfs_check(part)) {
+                       puts("CRAMFS\n");
                        ret = cramfs_info (part);
+               } else if (romfs_check(part)) {
+                       puts("ROMFS\n");
+                       ret = romfs_info (part);
                } else {
-                       /* if this is not cramfs assume jffs2 */
+                       /* if this is not cramfs or romfs assume jffs2 */
+                       puts("JFFS2\n");
                        ret = jffs2_1pass_info(part);
                }

diff --git a/fs/Makefile b/fs/Makefile
index 273d90e..2e5cf90 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -22,7 +22,7 @@
 #
 #

-SUBDIRS        := jffs2 cramfs fdos fat reiserfs ext2
+SUBDIRS        := cramfs ext2 fat fdos jffs2 reiserfs romfs

 $(obj).depend all:
        @for dir in $(SUBDIRS) ; do \

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH7] microblaze - ROMFS adapt files
  2007-08-30  7:54 [U-Boot-Users] [PATCH7] microblaze - ROMFS adapt files Michal Simek
@ 2007-09-11 15:14 ` Grant Likely
  2007-09-11 15:36   ` Michal Simek
  2007-09-11 20:49   ` Wolfgang Denk
  0 siblings, 2 replies; 4+ messages in thread
From: Grant Likely @ 2007-09-11 15:14 UTC (permalink / raw)
  To: u-boot

On 8/30/07, Michal Simek <Monstr@seznam.cz> wrote:
> DESC:  ROMFS support files and sorted names in Makefiles
>
> Signed-off-by: Michal Simek <monstr@monstr.eu>
>
> Note; I think that we can start process with redesigning all FS support

I'm still not really fond of this approach.  Repurposing CONFIG_JFFS2
to add more and more filesystems is not a good approach.  I don't
recommend merging this as is.

Ideally, the whole filesystem handling should be reworked into a
single API, but I understand that it's a non-trivial amount of work.
However, at the very least, ROMFS should be configured with a separate
CONFIG_xxx macro.

More comments below.

> diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
> index 513a226..3e6061a 100644
> --- a/common/cmd_jffs2.c
> +++ b/common/cmd_jffs2.c
> @@ -85,7 +85,7 @@
>   */
>
>  /*
> - * JFFS2/CRAMFS support
> + * JFFS2/CRAMFS/ROMFS support
>   */
>  #include <common.h>
>  #include <command.h>
> @@ -175,6 +175,11 @@ extern int cramfs_load (char *loadoffset, struct part_info *info, char *filename
>  extern int cramfs_ls (struct part_info *info, char *filename);
>  extern int cramfs_info (struct part_info *info);
>
> +extern int romfs_check (struct part_info *info);
> +extern int romfs_load (char *loadoffset, struct part_info *info, char *filename);
> +extern int romfs_ls (struct part_info *info, char *filename);
> +extern int romfs_info (struct part_info *info);

Bad form and dangerous.  Use a header file.  (Yes I know this file
already uses a bad pattern, but don't follow the example)

> +
>  static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int part_num);
>
>  /* command line only routines */
> @@ -1874,14 +1879,22 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
>
>         if ((part = jffs2_part_info(current_dev, current_partnum))){
>
> -               /* check partition type for cramfs */
> -               fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2");
> +               /* check partition type for JFFS2, cramfs, romfs */
> +               if (cramfs_check(part)) {
> +                       fsname = "CRAMFS";
> +               } else if (romfs_check(part)) {
> +                       fsname = "ROMFS";
> +               } else {
> +                       fsname = "JFFS2";
> +               }

This will get unwieldy in a real hurry.  This should probably be
reworked into a table of filesystem handlers which binds all the
driver callbacks.

Cheers,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely at secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH7] microblaze - ROMFS adapt files
  2007-09-11 15:14 ` Grant Likely
@ 2007-09-11 15:36   ` Michal Simek
  2007-09-11 20:49   ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Simek @ 2007-09-11 15:36 UTC (permalink / raw)
  To: u-boot


>I'm still not really fond of this approach.  Repurposing CONFIG_JFFS2
>to add more and more filesystems is not a good approach.  I don't
>recommend merging this as is.

Yes it is not good approach. The whole filesystem handling needs to redesign.
I think that we can start with discuss about this.

>Ideally, the whole filesystem handling should be reworked into a
>single API, but I understand that it's a non-trivial amount of work.
>However, at the very least, ROMFS should be configured with a separate
>CONFIG_xxx macro.

OK. I think that for now I create macro for CONFIG_ROMFS and I add it to cmd_jffs.c file

More comments below.

> diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
> index 513a226..3e6061a 100644
> --- a/common/cmd_jffs2.c
> +++ b/common/cmd_jffs2.c
> @@ -85,7 +85,7 @@
>   */
>
>  /*
> - * JFFS2/CRAMFS support
> + * JFFS2/CRAMFS/ROMFS support
>   */
>  #include <common.h>
>  #include <command.h>
> @@ -175,6 +175,11 @@ extern int cramfs_load (char *loadoffset, struct
part_info *info, char *filename
>  extern int cramfs_ls (struct part_info *info, char *filename);
>  extern int cramfs_info (struct part_info *info);
>
> +extern int romfs_check (struct part_info *info);
> +extern int romfs_load (char *loadoffset, struct part_info *info, char
*filename);
> +extern int romfs_ls (struct part_info *info, char *filename);
> +extern int romfs_info (struct part_info *info);

>Bad form and dangerous.  Use a header file.  (Yes I know this file
>already uses a bad pattern, but don't follow the example)

OK


> +
>  static struct part_info* jffs2_part_info(struct mtd_device *dev, unsigned int
part_num);
>
>  /* command line only routines */
> @@ -1874,14 +1879,22 @@ int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int
argc, char *argv[])
>
>         if ((part = jffs2_part_info(current_dev, current_partnum))){
>
> -               /* check partition type for cramfs */
> -               fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2");
> +               /* check partition type for JFFS2, cramfs, romfs */
> +               if (cramfs_check(part)) {
> +                       fsname = "CRAMFS";
> +               } else if (romfs_check(part)) {
> +                       fsname = "ROMFS";
> +               } else {
> +                       fsname = "JFFS2";
> +               }

>This will get unwieldy in a real hurry.  This should probably be
>reworked into a table of filesystem handlers which binds all the
>driver callbacks.

I will add CONFIG_ROMFS macro and it is enough for now.

M

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot-Users] [PATCH7] microblaze - ROMFS adapt files
  2007-09-11 15:14 ` Grant Likely
  2007-09-11 15:36   ` Michal Simek
@ 2007-09-11 20:49   ` Wolfgang Denk
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Denk @ 2007-09-11 20:49 UTC (permalink / raw)
  To: u-boot

In message <fa686aa40709110814m5024c66bo536ff12d0b8be7cd@mail.gmail.com> you wrote:
> On 8/30/07, Michal Simek <Monstr@seznam.cz> wrote:
> > DESC:  ROMFS support files and sorted names in Makefiles
> >
> > Signed-off-by: Michal Simek <monstr@monstr.eu>
> >
> > Note; I think that we can start process with redesigning all FS support
> 
> I'm still not really fond of this approach.  Repurposing CONFIG_JFFS2
> to add more and more filesystems is not a good approach.  I don't
> recommend merging this as is.

Agreed. In any case it's not a bug fix and thus will not go into
1.3.0.

> Ideally, the whole filesystem handling should be reworked into a
> single API, but I understand that it's a non-trivial amount of work.
> However, at the very least, ROMFS should be configured with a separate
> CONFIG_xxx macro.

Agreed, too.

> > -               /* check partition type for cramfs */
> > -               fsname = (cramfs_check(part) ? "CRAMFS" : "JFFS2");
> > +               /* check partition type for JFFS2, cramfs, romfs */
> > +               if (cramfs_check(part)) {
> > +                       fsname = "CRAMFS";
> > +               } else if (romfs_check(part)) {
> > +                       fsname = "ROMFS";
> > +               } else {
> > +                       fsname = "JFFS2";
> > +               }
> 
> This will get unwieldy in a real hurry.  This should probably be
> reworked into a table of filesystem handlers which binds all the
> driver callbacks.

Indeed.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The heart is not a logical organ.
	-- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-11 20:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-30  7:54 [U-Boot-Users] [PATCH7] microblaze - ROMFS adapt files Michal Simek
2007-09-11 15:14 ` Grant Likely
2007-09-11 15:36   ` Michal Simek
2007-09-11 20:49   ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.