18 Oct, 2019

3 commits

  • This function is a variant of fs_get_type_name() and returns a filesystem
    type with which the current device is associated.
    We don't want to export fs_type variable directly because we have to take
    care of it consistently within fs.c.

    Signed-off-by: AKASHI Takahiro
    Reviewed-by: Heinrich Schuchardt

    AKASHI Takahiro
     
  • fs_ls(), fs_mkdir() and fs_unlink() sets fs_type to FS_TYPE_ANY
    explicitly, but it is redundant as they call fs_close().
    So just remove those lines.

    Signed-off-by: AKASHI Takahiro
    Reviewed-by: Heinrich Schuchardt

    AKASHI Takahiro
     
  • fs_close() closes the connection to a file system which opened with
    either fs_set_blk_dev() or fs_set_dev_with_part(). Many file system
    functions implicitly call fs_close(), e.g. fs_closedir(), fs_exist(),
    fs_ln(), fs_ls(), fs_mkdir(), fs_read(), fs_size(), fs_write()
    and fs_unlink().
    So just export it.

    Signed-off-by: AKASHI Takahiro
    Reviewed-by: Heinrich Schuchardt

    AKASHI Takahiro
     

12 Aug, 2019

1 commit


21 Jun, 2019

1 commit

  • fatload command can be used to load the EFI payload since EFI system
    partition is always a FAT partition. Call into EFI code from do_load()
    to set the device path from which the last binary was loaded. An EFI
    application like grub2 can’t find its configuration file without the
    device path set.

    Since device path is now set in do_load() there is no need to set it
    in do_load_wrapper() for the load command.

    Signed-off-by: Mian Yousaf Kaukab
    Reviewed-by: Heinrich Schuchardt

    Mian Yousaf Kaukab
     

10 Apr, 2019

1 commit


09 Feb, 2019

1 commit

  • Unlike other generic FS accessors, fs_get_info() does not call fs_close()
    at the end of it's operation. Thus, using fs_get_info() in do_fs_type()
    without calling fs_close() causes potential memory leak by creating new
    filesystem structures on each call of do_fs_type().

    The test case to trigger this problem is as follows. It is required to
    have ext4 filesystem on the first partition of the SDMMC device, since
    ext4 requires stateful mount and causes memory allocation.
    => while true ; do mmc rescan ; fstype mmc 1 ; done
    Eventually, the mounting of ext4 will fail due to malloc failures
    and the filesystem will not be correctly detected.

    This patch fixes the problem by adding the missing fs_close().

    Signed-off-by: Marek Vasut
    Cc: Simon Glass
    Cc: Tom Rini

    Marek Vasut
     

02 Feb, 2019

1 commit

  • This fixes the automatic lmb initialization and reservation for boards
    with more than one DRAM bank.

    This fixes the CVE-2018-18439 and -18440 fixes that only allowed to load
    files into the firs DRAM bank from fs and via tftp.

    Found-by: Heinrich Schuchardt
    Signed-off-by: Simon Goldschmidt
    Tested-by: Heinrich Schuchardt
    Reviewed-by: Simon Glass

    Simon Goldschmidt
     

01 Feb, 2019

2 commits


17 Jan, 2019

1 commit


03 Dec, 2018

1 commit

  • As in the case of fs_set_blk_dev(), fs_set_blk_dev_with_part() should
    maintain and update fs_dev_part whenever called.

    Without this patch, a problem will come up when an efi binary associated
    with efi's BOOTxxxx variable is invoked via "bootefi bootmgr".

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     

24 Sep, 2018

4 commits

  • In this patch, unlink support is added to FAT file system.
    A directory can be deleted only if it is empty.

    In this implementation, only a directory entry for a short file name
    will be removed. So entries for a long file name can and should be
    reclaimed with fsck.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     
  • "unlink" interface is added to file operations.
    This is a preparatory change as unlink support for FAT file system
    will be added in next patch.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     
  • In this patch, mkdir support is added to FAT file system.
    A newly created directory contains only "." and ".." entries.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     
  • "mkdir" interface is added to file operations.
    This is a preparatory change as mkdir support for FAT file system
    will be added in next patch.

    Signed-off-by: AKASHI Takahiro
    Signed-off-by: Alexander Graf

    AKASHI Takahiro
     

14 Aug, 2018

1 commit


30 May, 2018

1 commit


07 May, 2018

1 commit

  • When U-Boot started using SPDX tags we were among the early adopters and
    there weren't a lot of other examples to borrow from. So we picked the
    area of the file that usually had a full license text and replaced it
    with an appropriate SPDX-License-Identifier: entry. Since then, the
    Linux Kernel has adopted SPDX tags and they place it as the very first
    line in a file (except where shebangs are used, then it's second line)
    and with slightly different comment styles than us.

    In part due to community overlap, in part due to better tag visibility
    and in part for other minor reasons, switch over to that style.

    This commit changes all instances where we have a single declared
    license in the tag as both the before and after are identical in tag
    contents. There's also a few places where I found we did not have a tag
    and have introduced one.

    Signed-off-by: Tom Rini

    Tom Rini
     

20 Jan, 2018

1 commit

  • The message
    "** %s shorter than offset + len **\n"
    may be interesting when debugging but it does not indicate an
    error.

    So we should not write it if we are not in debug mode.

    Fixes: 7a3e70cfd88c fs/fs.c: read up to EOF when len would read past EOF
    Signed-off-by: Heinrich Schuchardt
    Reviewed-by: Simon Glass

    Heinrich Schuchardt
     

16 Oct, 2017

1 commit


03 Oct, 2017

1 commit


15 Sep, 2017

2 commits

  • Add a generic implementation of 'ls' using opendir/readdir/closedir, and
    replace fat's custom implementation. Other filesystems should move to
    the generic implementation after they add opendir/readdir/closedir
    support.

    Signed-off-by: Rob Clark
    Reviewed-by: Łukasz Majewski
    Reviewed-by: Simon Glass

    Rob Clark
     
  • Needed to support efi file protocol. The fallback.efi loader wants
    to be able to read the contents of the /EFI directory to find an OS
    to boot.

    Modelled after POSIX opendir()/readdir()/closedir(). Unlike the other
    fs APIs, this is stateful (ie. state is held in the FS_DIR "directory
    stream"), to avoid re-traversing of the directory structure at each
    step. The directory stream must be released with closedir() when it
    is no longer needed.

    Signed-off-by: Rob Clark
    Reviewed-by: Łukasz Majewski
    Reviewed-by: Simon Glass

    Rob Clark
     

16 Aug, 2017

3 commits

  • We are now using an env_ prefix for environment functions. Rename these
    two functions for consistency. Also add function comments in common.h.

    Quite a few places use getenv() in a condition context, provoking a
    warning from checkpatch. These are fixed up in this patch also.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename these
    commonly used functions, for consistency. Also add function comments in
    common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     
  • We are now using an env_ prefix for environment functions. Rename setenv()
    for consistency. Also add function comments in common.h.

    Suggested-by: Wolfgang Denk
    Signed-off-by: Simon Glass

    Simon Glass
     

15 Mar, 2016

2 commits


19 Jan, 2016

1 commit

  • In a number of places we had wordings of the GPL (or LGPL in a few
    cases) license text that were split in such a way that it wasn't caught
    previously. Convert all of these to the correct SPDX-License-Identifier
    tag.

    Signed-off-by: Tom Rini

    Tom Rini
     

08 Jan, 2016

1 commit


25 Oct, 2015

1 commit


13 Aug, 2015

1 commit

  • http://lists.denx.de/pipermail/u-boot/2012-September/134347.html
    allows for reading files in chunks from the shell.

    When this feature is used to read past the end of a file an error
    was returned instead of returning the bytes read up to the end of
    file. Thus the following fails in the shell:

    offset = 0
    len = chunksize
    do
    read file, offset, len
    write data
    until bytes_read < len

    The patch changes the behaviour to printing an informational
    message and returning the actual read number of bytes aka read(2)
    behaviour for convenient use in U-Boot scripts.

    Signed-off-by: Max Krummenacher
    Signed-off-by: Marcel Ziswiler
    Acked-by: Marek Vasut
    Signed-off-by: Stefan Agner
    Signed-off-by: Marcel Ziswiler

    Max Krummenacher
     

19 Apr, 2015

1 commit


30 Jan, 2015

1 commit


02 Dec, 2014

1 commit


23 Nov, 2014

2 commits

  • The sandbox/ext4/fat/generic fs commands do not gracefully deal with files
    greater than 2GB. Negative values are returned in such cases.

    To handle this, the fs functions have been modified to take an additional
    parameter of type "* loff_t" which is then populated. The return value
    of the fs functions are used only for error conditions.

    Signed-off-by: Suriyan Ramasami
    Acked-by: Simon Glass
    [trini: Update board/gdsys/p1022/controlcenterd-id.c,
    drivers/fpga/zynqpl.c for changes]
    Signed-off-by: Tom Rini

    Suriyan Ramasami
     
  • Some filesystems have a UUID stored in its superblock. To
    allow using root=UUID=... for the kernel command line we
    need a way to read-out the filesystem UUID.

    changes rfc -> v1:
    - make the environment variable an option parameter. If not
    given, the UUID is printed out. If given, it is stored in the env
    variable.
    - corrected typos
    - return error codes

    changes v1 -> v2:
    - fix return code of do_fs_uuid(..)
    - document do_fs_uuid(..)
    - implement fs_uuid_unsuported(..) be more consistent with the
    way other optional functionality works

    changes v2 -> v3:
    - change ext4fs_uuid(..) to make use of #if .. #else .. #endif
    construct to get rid of unreachable code

    Hit any key to stop autoboot: 0
    => fsuuid
    fsuuid - Look up a filesystem UUID

    Usage:
    fsuuid :
    - print filesystem UUID
    fsuuid :
    - set environment variable to filesystem UUID

    => fsuuid mmc 0:1
    d9f9fc05-45ae-4a36-a616-fccce0e4f887
    => fsuuid mmc 0:2
    eb3db83c-7b28-499f-95ce-9e0bb21cda81
    => fsuuid mmc 0:1 uuid1
    => fsuuid mmc 0:2 uuid2
    => printenv uuid1
    uuid1=d9f9fc05-45ae-4a36-a616-fccce0e4f887
    => printenv uuid2
    uuid2=eb3db83c-7b28-499f-95ce-9e0bb21cda81
    =>

    Signed-off-by: Christian Gmeiner
    Acked-by: Stephen Warren

    Christian Gmeiner
     

09 Aug, 2014

1 commit

  • These commands may be used to determine the size of a file without
    actually reading the whole file content into memory. This may be used
    to determine if the file will fit into the memory buffer that will
    contain it. In particular, the DFU code will use it for this purpose
    in the next commit.

    Signed-off-by: Stephen Warren

    Stephen Warren
     

22 Jul, 2014

1 commit