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 Oct, 2019

2 commits


26 Aug, 2019

1 commit

  • File was found on specified location. Info about file was read,
    but then immediately destroyed using 'free' call. As a result
    file size was set to 0, hence fat process didn't read any data.

    Premature 'free' call removed. Resources are freed right before
    function return. File is read correctly.

    Signed-off-by: Martin Vystrcil

    Martin Vystrčil
     

21 Aug, 2019

1 commit


18 Aug, 2019

6 commits

  • Rename some camel-case variables to match U-Boot style.

    Camel case is not generally allowed in U-Boot. Rename this variable to fit
    in with the style.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     
  • Sometimes an image has multiple CBFS. The current CBFS API is limited to
    handling only one at time. Also it keeps track of the CBFS internally in
    BSS, which does not work before relocation, for example.

    Add a few new functions to overcome these limitations.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     
  • Move the result variable into the struct also, so that it can be used when
    BSS is not available. Add a function to read it.

    Note that all functions sill use the BSS version of the data.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     
  • At present there are a number of static variables in BSS. This cannot work
    with SPL, at least until BSS is available in board_init_r().

    Move the variables into a struct, so it is possible to malloc() it and use
    it before BSS is available.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     
  • At present this file has a function at the top, above declarations. This
    is normally avoided, so fix it.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     
  • Add a new Kconfig option to enable CBFS in SPL. This can be useful when
    the memory-init code is in CBFS.

    Signed-off-by: Simon Glass
    Reviewed-by: Bin Meng
    Tested-by: Bin Meng

    Simon Glass
     

12 Aug, 2019

2 commits


24 Jul, 2019

1 commit


18 Jul, 2019

6 commits


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
     

29 May, 2019

5 commits

  • Contrary to fat12/16, fat32 can have root directory at any location
    and its size can be expanded.
    Without this patch, root directory won't grow properly and so we will
    eventually fail to add files under root directory. Please note that this
    can happen even if you delete many files as deleted directory entries
    are not reclaimed but just marked as "deleted" under the current
    implementation.

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

    AKASHI Takahiro
     
  • When a long name directory entry is created, multiple directory entries
    may be occupied across a directory cluster boundary. Since only one
    directory cluster is cached in a directory iterator, a first cluster must
    be written back to device before switching over a second cluster.

    Without this patch, some added files may be lost even if you don't see
    any failures on write operation.

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

    AKASHI Takahiro
     
  • With the commit below, fat now correctly handles a file read under
    a non-cluster-aligned root directory of fat12/16.
    Write operation should be fixed in the same manner.

    Fixes: commit 9b18358dc05d ("fs: fat: fix reading non-cluster-aligned
    root directory")
    Signed-off-by: AKASHI Takahiro
    Cc: Anssi Hannula
    Tested-by: Heinrich Schuchardt

    AKASHI Takahiro
     
  • fat_itr_root() allocates fatbuf so we free it on the exit path, if
    the function fails we should not free it, check the return value
    and skip freeing if the function fails.

    Signed-off-by: Andrew F. Davis

    Andrew F. Davis
     
  • File names may not contain control characters (< 0x20).
    Simplify the coding.

    Signed-off-by: Heinrich Schuchardt

    Heinrich Schuchardt
     

05 May, 2019

1 commit


03 May, 2019

2 commits


27 Apr, 2019

4 commits

  • Per Pierre this change shouldn't have been applied as it was superseded
    by "fs: btrfs: fix btrfs_search_tree invalid results" which is also
    applied now as 1627e5e5985d.

    This reverts commit 633967f9818cb6a0e87ffa8cba33148a5bcc6edb.

    Signed-off-by: Tom Rini

    Tom Rini
     
  • btrfs_search_tree should return the first item in the tree that is
    greater or equal to the searched item.

    The search algorithm did not properly handle the edge case where the
    searched item is higher than the last item of the node but lower than
    the first item of the next node. Instead of properly returning the first
    item of the next node, it was returning an invalid path pointer
    (pointing to a non-existent item after the last item of the node + 1).

    This fixes two issues in the btrfs driver:
    - Looking for a ROOT_ITEM could fail if it was the first item of its
    leaf node.
    - Iterating through DIR_INDEX entries (for readdir) could fail if the
    first DIR_INDEX entry was the first item of a leaf node.

    Signed-off-by: Pierre Bourdon
    Cc: Marek Behun

    Pierre Bourdon
     
  • Signed-off-by: Ismael Luceno

    Ismael Luceno Cortes
     
  • ROOT_ITEMs in btrfs are referenced without knowing their actual "offset"
    value. To perform these searches using only two items from the key, the
    btrfs driver uses a special "btrfs_search_tree_key_type" function.

    The algorithm used by that function to transform a 3-tuple search into a
    2-tuple search was subtly broken, leading to items not being found if
    they were the first in their tree node.

    This commit fixes btrfs_search_tree_key_type to properly behave in these
    situations.

    Signed-off-by: Pierre Bourdon
    Cc: Marek Behun

    Pierre Bourdon
     

10 Apr, 2019

5 commits

  • Ext4 allows for arbitrarily sized block group descriptors when 64-bit
    addressing is enabled, which was previously not properly supported. This
    patch dynamically allocates a chunk of memory of the correct size.

    Signed-off-by: Benjamin Lim

    Benjamin Lim
     
  • A FAT12/FAT16 root directory location is specified by a sector offset and
    it might not start at a cluster boundary. It also resides before the
    data area (before cluster 2).

    However, the current code assumes that the root directory is located at
    a beginning of a cluster, causing no files to be found if that is not
    the case.

    Since the FAT12/FAT16 root directory is located before the data area
    and is not aligned to clusters, using unsigned cluster numbers to refer
    to the root directory does not work well (the "cluster number" may be
    negative, and even allowing it be signed would not make it properly
    aligned).

    Modify the code to not use the normal cluster numbering when referring to
    the root directory of FAT12/FAT16 and instead use a cluster-sized
    offsets counted from the root directory start sector.

    This is a relatively common case as at least the filesystem formatter on
    Win7 seems to create such filesystems by default on 2GB USB sticks when
    "FAT" is selected (cluster size 64 sectors, rootdir size 32 sectors,
    rootdir starts at half a cluster before cluster 2).

    dosfstools mkfs.vfat does not seem to create affected filesystems.

    Signed-off-by: Anssi Hannula
    Reviewed-by: Bernhard Messerklinger
    Tested-by: Bernhard Messerklinger

    Anssi Hannula
     
  • Hi,

    when I try to load a sparse file via ext4load, I am getting the error message
    'invalid extent'

    After a deeper look in the code, it seems to be an issue in the function ext4fs_get_extent_block in fs/ext4/ext4_common.c:

    The file starts with 1k of zeros. The blocksize is 1024. So the first extend block contains the following information:

    eh_entries: 1
    eh_depth: 1
    ei_block 1

    When the upper layer (ext4fs_read_file) asks for fileblock 0, we are running in the 'invalid extent' error message.
    For me it seems, that the code is not prepared for handling a sparse block at the beginning of the file. The following change, solved my problem:

    I am really not an expert in ext4 filesystems. Can somebody please have a look at this issue and give me a feedback, if I am totally wrong or not?

    Gero Schumacher
     
  • The command line is:
    ln target linkname

    Currently symbolic links are supported only in ext4 and only if the option
    CMD_EXT4_WRITE is enabled.

    Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini

    Jean-Jacques Hiblot
     
  • Re-use the functions used to write/create a file, to support creation of a
    symbolic link.
    The difference with a regular file are small:
    - The inode mode is flagged with S_IFLNK instead of S_IFREG
    - The ext2_dirent's filetype is FILETYPE_SYMLINK instead of FILETYPE_REG
    - Instead of storing the content of a file in allocated blocks, the path
    to the target is stored. And if the target's path is short enough, no block
    is allocated and the target's path is stored in ext2_inode.b.symlink

    As with regulars files, if a file/symlink with the same name exits, it is
    unlinked first and then re-created.

    Signed-off-by: Jean-Jacques Hiblot
    Reviewed-by: Tom Rini
    [trini: Fix ext4 env code]
    Signed-off-by: Tom Rini

    Jean-Jacques Hiblot