mirror of
https://github.com/eledio-devices/thirdparty-littlefs.git
synced 2025-11-01 16:14:13 +01:00
Compare commits
9 Commits
inline-fil
...
license-bs
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6beff502e9 | ||
|
|
c5e2b335d6 | ||
|
|
015b86bc51 | ||
|
|
9637b96069 | ||
|
|
89a7630d84 | ||
|
|
43eac3083b | ||
|
|
dbc3cb1798 | ||
|
|
93ece2e87a | ||
|
|
d9c076d909 |
@@ -35,7 +35,7 @@ script:
|
|||||||
if [ "$TRAVIS_TEST_RESULT" -eq 0 ]
|
if [ "$TRAVIS_TEST_RESULT" -eq 0 ]
|
||||||
then
|
then
|
||||||
CURR=$(tail -n1 sizes | awk '{print $1}')
|
CURR=$(tail -n1 sizes | awk '{print $1}')
|
||||||
PREV=$(curl https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
|
PREV=$(curl -u $GEKY_BOT_STATUSES https://api.github.com/repos/$TRAVIS_REPO_SLUG/status/master \
|
||||||
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
|
| jq -re "select(.sha != \"$TRAVIS_COMMIT\")
|
||||||
| .statuses[] | select(.context == \"$STAGE/$NAME\").description
|
| .statuses[] | select(.context == \"$STAGE/$NAME\").description
|
||||||
| capture(\"code size is (?<size>[0-9]+)\").size" \
|
| capture(\"code size is (?<size>[0-9]+)\").size" \
|
||||||
@@ -165,7 +165,8 @@ jobs:
|
|||||||
\"name\": \"$LFS_VERSION\"
|
\"name\": \"$LFS_VERSION\"
|
||||||
}"
|
}"
|
||||||
RELEASE=$(
|
RELEASE=$(
|
||||||
curl -f https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/tags/$LFS_VERSION
|
curl -f -u $GEKY_BOT_RELEASES \
|
||||||
|
https://api.github.com/repos/$TRAVIS_REPO_SLUG/releases/tags/$LFS_VERSION
|
||||||
)
|
)
|
||||||
CHANGES=$(
|
CHANGES=$(
|
||||||
git log --oneline $LFS_PREV_VERSION.. --grep='^Merge' --invert-grep
|
git log --oneline $LFS_PREV_VERSION.. --grep='^Merge' --invert-grep
|
||||||
|
|||||||
183
LICENSE.md
183
LICENSE.md
@@ -1,165 +1,36 @@
|
|||||||
Apache License
|
Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
1. Definitions.
|
- Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
- Redistributions in binary form must reproduce the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
other materials provided with the distribution.
|
||||||
|
- Neither the name of ARM nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific prior
|
||||||
|
written permission.
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction, and
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
distribution as defined by Sections 1 through 9 of this document.
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
---
|
||||||
owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
*Note*:
|
||||||
that control, are controlled by, or are under common control with that entity.
|
Individual files contain the following tag instead of the full license text.
|
||||||
For the purposes of this definition, "control" means (i) the power, direct or
|
|
||||||
indirect, to cause the direction or management of such entity, whether by
|
|
||||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
|
||||||
permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications, including
|
|
||||||
but not limited to software source code, documentation source, and configuration
|
|
||||||
files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical transformation or
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
translation of a Source form, including but not limited to compiled object code,
|
|
||||||
generated documentation, and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
This enables machine processing of license information based on the SPDX
|
||||||
available under the License, as indicated by a copyright notice that is included
|
License Identifiers that are here available: http://spdx.org/licenses/
|
||||||
in or attached to the work (an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
|
||||||
is based on (or derived from) the Work and for which the editorial revisions,
|
|
||||||
annotations, elaborations, or other modifications represent, as a whole, an
|
|
||||||
original work of authorship. For the purposes of this License, Derivative Works
|
|
||||||
shall not include works that remain separable from, or merely link (or bind by
|
|
||||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including the original version
|
|
||||||
of the Work and any modifications or additions to that Work or Derivative Works
|
|
||||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
||||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
||||||
on behalf of the copyright owner. For the purposes of this definition,
|
|
||||||
"submitted" means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems, and
|
|
||||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
|
||||||
the purpose of discussing and improving the Work, but excluding communication
|
|
||||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
||||||
owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
|
||||||
of whom a Contribution has been received by Licensor and subsequently
|
|
||||||
incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License.
|
|
||||||
|
|
||||||
Subject to the terms and conditions of this License, each Contributor hereby
|
|
||||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
||||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
||||||
Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License.
|
|
||||||
|
|
||||||
Subject to the terms and conditions of this License, each Contributor hereby
|
|
||||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
||||||
irrevocable (except as stated in this section) patent license to make, have
|
|
||||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
|
||||||
such license applies only to those patent claims licensable by such Contributor
|
|
||||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
|
||||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
|
||||||
submitted. If You institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
|
||||||
Contribution incorporated within the Work constitutes direct or contributory
|
|
||||||
patent infringement, then any patent licenses granted to You under this License
|
|
||||||
for that Work shall terminate as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution.
|
|
||||||
|
|
||||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
||||||
in any medium, with or without modifications, and in Source or Object form,
|
|
||||||
provided that You meet the following conditions:
|
|
||||||
|
|
||||||
You must give any other recipients of the Work or Derivative Works a copy of
|
|
||||||
this License; and
|
|
||||||
You must cause any modified files to carry prominent notices stating that You
|
|
||||||
changed the files; and
|
|
||||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
|
||||||
all copyright, patent, trademark, and attribution notices from the Source form
|
|
||||||
of the Work, excluding those notices that do not pertain to any part of the
|
|
||||||
Derivative Works; and
|
|
||||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
|
||||||
Derivative Works that You distribute must include a readable copy of the
|
|
||||||
attribution notices contained within such NOTICE file, excluding those notices
|
|
||||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
|
||||||
following places: within a NOTICE text file distributed as part of the
|
|
||||||
Derivative Works; within the Source form or documentation, if provided along
|
|
||||||
with the Derivative Works; or, within a display generated by the Derivative
|
|
||||||
Works, if and wherever such third-party notices normally appear. The contents of
|
|
||||||
the NOTICE file are for informational purposes only and do not modify the
|
|
||||||
License. You may add Your own attribution notices within Derivative Works that
|
|
||||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
||||||
provided that such additional attribution notices cannot be construed as
|
|
||||||
modifying the License.
|
|
||||||
You may add Your own copyright statement to Your modifications and may provide
|
|
||||||
additional or different license terms and conditions for use, reproduction, or
|
|
||||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
||||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
|
||||||
with the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions.
|
|
||||||
|
|
||||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
||||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
|
||||||
conditions of this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
|
||||||
any separate license agreement you may have executed with Licensor regarding
|
|
||||||
such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks.
|
|
||||||
|
|
||||||
This License does not grant permission to use the trade names, trademarks,
|
|
||||||
service marks, or product names of the Licensor, except as required for
|
|
||||||
reasonable and customary use in describing the origin of the Work and
|
|
||||||
reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty.
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
|
||||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
||||||
including, without limitation, any warranties or conditions of TITLE,
|
|
||||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
|
||||||
solely responsible for determining the appropriateness of using or
|
|
||||||
redistributing the Work and assume any risks associated with Your exercise of
|
|
||||||
permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability.
|
|
||||||
|
|
||||||
In no event and under no legal theory, whether in tort (including negligence),
|
|
||||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
|
||||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special, incidental,
|
|
||||||
or consequential damages of any character arising as a result of this License or
|
|
||||||
out of the use or inability to use the Work (including but not limited to
|
|
||||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
|
||||||
any and all other commercial damages or losses), even if such Contributor has
|
|
||||||
been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability.
|
|
||||||
|
|
||||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
|
||||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
|
||||||
other liability obligations and/or rights consistent with this License. However,
|
|
||||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
|
||||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
|
||||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason of your
|
|
||||||
accepting any such warranty or additional liability.
|
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -33,8 +33,8 @@ size: $(OBJ)
|
|||||||
$(SIZE) -t $^
|
$(SIZE) -t $^
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
test: test_format test_dirs test_files test_seek test_truncate test_parallel \
|
test: test_format test_dirs test_files test_seek test_truncate \
|
||||||
test_alloc test_paths test_orphan test_move test_corrupt
|
test_interspersed test_alloc test_paths test_orphan test_move test_corrupt
|
||||||
test_%: tests/test_%.sh
|
test_%: tests/test_%.sh
|
||||||
ifdef QUIET
|
ifdef QUIET
|
||||||
@./$< | sed -n '/^[-=]/p'
|
@./$< | sed -n '/^[-=]/p'
|
||||||
|
|||||||
@@ -1,19 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Block device emulated on standard files
|
* Block device emulated on standard files
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||||
*
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
#include "emubd/lfs_emubd.h"
|
#include "emubd/lfs_emubd.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Block device emulated on standard files
|
* Block device emulated on standard files
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||||
*
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
#ifndef LFS_EMUBD_H
|
#ifndef LFS_EMUBD_H
|
||||||
#define LFS_EMUBD_H
|
#define LFS_EMUBD_H
|
||||||
|
|||||||
149
lfs.h
149
lfs.h
@@ -1,19 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* The little filesystem
|
* The little filesystem
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||||
*
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
#ifndef LFS_H
|
#ifndef LFS_H
|
||||||
#define LFS_H
|
#define LFS_H
|
||||||
@@ -34,7 +23,7 @@
|
|||||||
// Version of On-disk data structures
|
// Version of On-disk data structures
|
||||||
// Major (top-nibble), incremented on backwards incompatible changes
|
// Major (top-nibble), incremented on backwards incompatible changes
|
||||||
// Minor (bottom-nibble), incremented on feature additions
|
// Minor (bottom-nibble), incremented on feature additions
|
||||||
#define LFS_DISK_VERSION 0x00010002
|
#define LFS_DISK_VERSION 0x00010001
|
||||||
#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16))
|
#define LFS_DISK_VERSION_MAJOR (0xffff & (LFS_DISK_VERSION >> 16))
|
||||||
#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0))
|
#define LFS_DISK_VERSION_MINOR (0xffff & (LFS_DISK_VERSION >> 0))
|
||||||
|
|
||||||
@@ -50,78 +39,51 @@ typedef int32_t lfs_soff_t;
|
|||||||
|
|
||||||
typedef uint32_t lfs_block_t;
|
typedef uint32_t lfs_block_t;
|
||||||
|
|
||||||
// Maximum inline file size in bytes. Large inline files require a larger
|
// Max name size in bytes
|
||||||
// read and prog cache, but if a file can be inline it does not need its own
|
|
||||||
// data block. LFS_ATTRS_MAX + LFS_INLINE_MAX must be <= 0xffff. Stored in
|
|
||||||
// superblock and must be respected by other littlefs drivers.
|
|
||||||
#ifndef LFS_INLINE_MAX
|
|
||||||
#define LFS_INLINE_MAX 0x3ff
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Maximum size of all attributes per file in bytes, may be redefined but a
|
|
||||||
// a smaller LFS_ATTRS_MAX has no benefit. LFS_ATTRS_MAX + LFS_INLINE_MAX
|
|
||||||
// must be <= 0xffff. Stored in superblock and must be respected by other
|
|
||||||
// littlefs drivers.
|
|
||||||
#ifndef LFS_ATTRS_MAX
|
|
||||||
#define LFS_ATTRS_MAX 0x3f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Max name size in bytes, may be redefined to reduce the size of the
|
|
||||||
// info struct. Stored in superblock and must be respected by other
|
|
||||||
// littlefs drivers.
|
|
||||||
#ifndef LFS_NAME_MAX
|
#ifndef LFS_NAME_MAX
|
||||||
#define LFS_NAME_MAX 0xff
|
#define LFS_NAME_MAX 255
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Possible error codes, these are negative to allow
|
// Possible error codes, these are negative to allow
|
||||||
// valid positive return values
|
// valid positive return values
|
||||||
enum lfs_error {
|
enum lfs_error {
|
||||||
LFS_ERR_OK = 0, // No error
|
LFS_ERR_OK = 0, // No error
|
||||||
LFS_ERR_IO = -5, // Error during device operation
|
LFS_ERR_IO = -5, // Error during device operation
|
||||||
LFS_ERR_CORRUPT = -52, // Corrupted
|
LFS_ERR_CORRUPT = -52, // Corrupted
|
||||||
LFS_ERR_NOENT = -2, // No directory entry
|
LFS_ERR_NOENT = -2, // No directory entry
|
||||||
LFS_ERR_EXIST = -17, // Entry already exists
|
LFS_ERR_EXIST = -17, // Entry already exists
|
||||||
LFS_ERR_NOTDIR = -20, // Entry is not a dir
|
LFS_ERR_NOTDIR = -20, // Entry is not a dir
|
||||||
LFS_ERR_ISDIR = -21, // Entry is a dir
|
LFS_ERR_ISDIR = -21, // Entry is a dir
|
||||||
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
|
LFS_ERR_NOTEMPTY = -39, // Dir is not empty
|
||||||
LFS_ERR_BADF = -9, // Bad file number
|
LFS_ERR_BADF = -9, // Bad file number
|
||||||
LFS_ERR_INVAL = -22, // Invalid parameter
|
LFS_ERR_INVAL = -22, // Invalid parameter
|
||||||
LFS_ERR_NOSPC = -28, // No space left on device
|
LFS_ERR_NOSPC = -28, // No space left on device
|
||||||
LFS_ERR_NOMEM = -12, // No more memory available
|
LFS_ERR_NOMEM = -12, // No more memory available
|
||||||
LFS_ERR_NAMETOOLONG = -36, // File name too long
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// File types
|
// File types
|
||||||
enum lfs_type {
|
enum lfs_type {
|
||||||
// file type
|
LFS_TYPE_REG = 0x11,
|
||||||
LFS_TYPE_REG = 0x01,
|
LFS_TYPE_DIR = 0x22,
|
||||||
LFS_TYPE_DIR = 0x02,
|
LFS_TYPE_SUPERBLOCK = 0x2e,
|
||||||
LFS_TYPE_SUPERBLOCK = 0x0e,
|
|
||||||
|
|
||||||
// on disk structure
|
|
||||||
LFS_STRUCT_CTZ = 0x10,
|
|
||||||
LFS_STRUCT_DIR = 0x20,
|
|
||||||
LFS_STRUCT_INLINE = 0x30,
|
|
||||||
LFS_STRUCT_MOVED = 0x80,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// File open flags
|
// File open flags
|
||||||
enum lfs_open_flags {
|
enum lfs_open_flags {
|
||||||
// open flags
|
// open flags
|
||||||
LFS_O_RDONLY = 1, // Open a file as read only
|
LFS_O_RDONLY = 1, // Open a file as read only
|
||||||
LFS_O_WRONLY = 2, // Open a file as write only
|
LFS_O_WRONLY = 2, // Open a file as write only
|
||||||
LFS_O_RDWR = 3, // Open a file as read and write
|
LFS_O_RDWR = 3, // Open a file as read and write
|
||||||
LFS_O_CREAT = 0x0100, // Create a file if it does not exist
|
LFS_O_CREAT = 0x0100, // Create a file if it does not exist
|
||||||
LFS_O_EXCL = 0x0200, // Fail if a file already exists
|
LFS_O_EXCL = 0x0200, // Fail if a file already exists
|
||||||
LFS_O_TRUNC = 0x0400, // Truncate the existing file to zero size
|
LFS_O_TRUNC = 0x0400, // Truncate the existing file to zero size
|
||||||
LFS_O_APPEND = 0x0800, // Move to end of file on every write
|
LFS_O_APPEND = 0x0800, // Move to end of file on every write
|
||||||
|
|
||||||
// internally used flags
|
// internally used flags
|
||||||
LFS_F_DIRTY = 0x010000, // File does not match storage
|
LFS_F_DIRTY = 0x10000, // File does not match storage
|
||||||
LFS_F_WRITING = 0x020000, // File has been written since last flush
|
LFS_F_WRITING = 0x20000, // File has been written since last flush
|
||||||
LFS_F_READING = 0x040000, // File has been read since last flush
|
LFS_F_READING = 0x40000, // File has been read since last flush
|
||||||
LFS_F_ERRED = 0x080000, // An error occured during write
|
LFS_F_ERRED = 0x80000, // An error occured during write
|
||||||
LFS_F_INLINE = 0x100000, // Currently inlined in directory entry
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// File seek flags
|
// File seek flags
|
||||||
@@ -198,25 +160,6 @@ struct lfs_config {
|
|||||||
// Optional, statically allocated buffer for files. Must be program sized.
|
// Optional, statically allocated buffer for files. Must be program sized.
|
||||||
// If enabled, only one file may be opened at a time.
|
// If enabled, only one file may be opened at a time.
|
||||||
void *file_buffer;
|
void *file_buffer;
|
||||||
|
|
||||||
// Optional upper limit on inlined files in bytes. Large inline files
|
|
||||||
// require a larger read and prog cache, but if a file can be inlined it
|
|
||||||
// does not need its own data block. Must be smaller than the read size
|
|
||||||
// and prog size. Defaults to min(LFS_INLINE_MAX, read_size) when zero.
|
|
||||||
// Stored in superblock and must be respected by other littlefs drivers.
|
|
||||||
lfs_size_t inline_size;
|
|
||||||
|
|
||||||
// Optional upper limit on attributes per file in bytes. No downside for
|
|
||||||
// larger attributes size but must be less than LFS_ATTRS_MAX. Defaults to
|
|
||||||
// LFS_ATTRS_MAX when zero.Stored in superblock and must be respected by
|
|
||||||
// other littlefs drivers.
|
|
||||||
lfs_size_t attrs_size;
|
|
||||||
|
|
||||||
// Optional upper limit on length of file names in bytes. No downside for
|
|
||||||
// larger names except the size of the info struct which is controlled by
|
|
||||||
// the LFS_NAME_MAX define. Defaults to LFS_NAME_MAX when zero. Stored in
|
|
||||||
// superblock and must be respected by other littlefs drivers.
|
|
||||||
lfs_size_t name_size;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -236,7 +179,6 @@ struct lfs_info {
|
|||||||
/// littlefs data structures ///
|
/// littlefs data structures ///
|
||||||
typedef struct lfs_entry {
|
typedef struct lfs_entry {
|
||||||
lfs_off_t off;
|
lfs_off_t off;
|
||||||
lfs_size_t size;
|
|
||||||
|
|
||||||
struct lfs_disk_entry {
|
struct lfs_disk_entry {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
@@ -268,7 +210,6 @@ typedef struct lfs_file {
|
|||||||
lfs_size_t size;
|
lfs_size_t size;
|
||||||
|
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
lfs_size_t inline_size;
|
|
||||||
lfs_off_t pos;
|
lfs_off_t pos;
|
||||||
lfs_block_t block;
|
lfs_block_t block;
|
||||||
lfs_off_t off;
|
lfs_off_t off;
|
||||||
@@ -291,23 +232,25 @@ typedef struct lfs_dir {
|
|||||||
} lfs_dir_t;
|
} lfs_dir_t;
|
||||||
|
|
||||||
typedef struct lfs_superblock {
|
typedef struct lfs_superblock {
|
||||||
|
lfs_off_t off;
|
||||||
|
|
||||||
struct lfs_disk_superblock {
|
struct lfs_disk_superblock {
|
||||||
|
uint8_t type;
|
||||||
|
uint8_t elen;
|
||||||
|
uint8_t alen;
|
||||||
|
uint8_t nlen;
|
||||||
lfs_block_t root[2];
|
lfs_block_t root[2];
|
||||||
|
uint32_t block_size;
|
||||||
lfs_size_t block_size;
|
uint32_t block_count;
|
||||||
lfs_size_t block_count;
|
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
|
char magic[8];
|
||||||
lfs_size_t inline_size;
|
|
||||||
lfs_size_t attrs_size;
|
|
||||||
lfs_size_t name_size;
|
|
||||||
} d;
|
} d;
|
||||||
} lfs_superblock_t;
|
} lfs_superblock_t;
|
||||||
|
|
||||||
typedef struct lfs_free {
|
typedef struct lfs_free {
|
||||||
lfs_block_t begin;
|
|
||||||
lfs_block_t size;
|
|
||||||
lfs_block_t off;
|
lfs_block_t off;
|
||||||
|
lfs_block_t size;
|
||||||
|
lfs_block_t i;
|
||||||
lfs_block_t ack;
|
lfs_block_t ack;
|
||||||
uint32_t *buffer;
|
uint32_t *buffer;
|
||||||
} lfs_free_t;
|
} lfs_free_t;
|
||||||
@@ -325,10 +268,6 @@ typedef struct lfs {
|
|||||||
|
|
||||||
lfs_free_t free;
|
lfs_free_t free;
|
||||||
bool deorphaned;
|
bool deorphaned;
|
||||||
|
|
||||||
lfs_size_t inline_size;
|
|
||||||
lfs_size_t attrs_size;
|
|
||||||
lfs_size_t name_size;
|
|
||||||
} lfs_t;
|
} lfs_t;
|
||||||
|
|
||||||
|
|
||||||
@@ -370,10 +309,6 @@ int lfs_remove(lfs_t *lfs, const char *path);
|
|||||||
// If the destination exists, it must match the source in type.
|
// If the destination exists, it must match the source in type.
|
||||||
// If the destination is a directory, the directory must be empty.
|
// If the destination is a directory, the directory must be empty.
|
||||||
//
|
//
|
||||||
// Note: If power loss occurs, it is possible that the file or directory
|
|
||||||
// will exist in both the oldpath and newpath simultaneously after the
|
|
||||||
// next mount.
|
|
||||||
//
|
|
||||||
// Returns a negative error code on failure.
|
// Returns a negative error code on failure.
|
||||||
int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath);
|
int lfs_rename(lfs_t *lfs, const char *oldpath, const char *newpath);
|
||||||
|
|
||||||
|
|||||||
15
lfs_util.c
15
lfs_util.c
@@ -1,19 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* lfs util functions
|
* lfs util functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||||
*
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
#include "lfs_util.h"
|
#include "lfs_util.h"
|
||||||
|
|
||||||
|
|||||||
15
lfs_util.h
15
lfs_util.h
@@ -1,19 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* lfs utility functions
|
* lfs utility functions
|
||||||
*
|
*
|
||||||
* Copyright (c) 2017 ARM Limited
|
* Copyright (c) 2017, Arm Limited. All rights reserved.
|
||||||
*
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
*/
|
||||||
#ifndef LFS_UTIL_H
|
#ifndef LFS_UTIL_H
|
||||||
#define LFS_UTIL_H
|
#define LFS_UTIL_H
|
||||||
|
|||||||
@@ -274,12 +274,9 @@ TEST
|
|||||||
tests/test.py << TEST
|
tests/test.py << TEST
|
||||||
lfs_mount(&lfs, &cfg) => 0;
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
|
||||||
// create one block hole for half a directory
|
// create one block whole for half a directory
|
||||||
lfs_file_open(&lfs, &file[0], "bump", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
lfs_file_open(&lfs, &file[0], "bump", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
for (lfs_size_t i = 0; i < cfg.block_size; i += 2) {
|
lfs_file_write(&lfs, &file[0], (void*)"hi", 2) => 2;
|
||||||
memcpy(&buffer[i], "hi", 2);
|
|
||||||
}
|
|
||||||
lfs_file_write(&lfs, &file[0], buffer, cfg.block_size) => cfg.block_size;
|
|
||||||
lfs_file_close(&lfs, &file[0]) => 0;
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
lfs_file_open(&lfs, &file[0], "exhaustion", LFS_O_WRONLY | LFS_O_CREAT);
|
lfs_file_open(&lfs, &file[0], "exhaustion", LFS_O_WRONLY | LFS_O_CREAT);
|
||||||
@@ -298,10 +295,130 @@ tests/test.py << TEST
|
|||||||
lfs_mkdir(&lfs, "splitdir") => 0;
|
lfs_mkdir(&lfs, "splitdir") => 0;
|
||||||
lfs_file_open(&lfs, &file[0], "splitdir/bump",
|
lfs_file_open(&lfs, &file[0], "splitdir/bump",
|
||||||
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
for (lfs_size_t i = 0; i < cfg.block_size; i += 2) {
|
lfs_file_write(&lfs, &file[0], buffer, size) => LFS_ERR_NOSPC;
|
||||||
memcpy(&buffer[i], "hi", 2);
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
|
lfs_unmount(&lfs) => 0;
|
||||||
|
TEST
|
||||||
|
|
||||||
|
echo "--- Outdated lookahead test ---"
|
||||||
|
rm -rf blocks
|
||||||
|
tests/test.py << TEST
|
||||||
|
lfs_format(&lfs, &cfg) => 0;
|
||||||
|
|
||||||
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
|
||||||
|
// fill completely with two files
|
||||||
|
lfs_file_open(&lfs, &file[0], "exhaustion1",
|
||||||
|
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
|
size = strlen("blahblahblahblah");
|
||||||
|
memcpy(buffer, "blahblahblahblah", size);
|
||||||
|
for (lfs_size_t i = 0;
|
||||||
|
i < ((cfg.block_count-4)/2)*(cfg.block_size-8);
|
||||||
|
i += size) {
|
||||||
|
lfs_file_write(&lfs, &file[0], buffer, size) => size;
|
||||||
}
|
}
|
||||||
lfs_file_write(&lfs, &file[0], buffer, cfg.block_size) => LFS_ERR_NOSPC;
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
|
lfs_file_open(&lfs, &file[0], "exhaustion2",
|
||||||
|
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
|
size = strlen("blahblahblahblah");
|
||||||
|
memcpy(buffer, "blahblahblahblah", size);
|
||||||
|
for (lfs_size_t i = 0;
|
||||||
|
i < ((cfg.block_count-4+1)/2)*(cfg.block_size-8);
|
||||||
|
i += size) {
|
||||||
|
lfs_file_write(&lfs, &file[0], buffer, size) => size;
|
||||||
|
}
|
||||||
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
|
// remount to force reset of lookahead
|
||||||
|
lfs_unmount(&lfs) => 0;
|
||||||
|
|
||||||
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
|
||||||
|
// rewrite one file
|
||||||
|
lfs_file_open(&lfs, &file[0], "exhaustion1",
|
||||||
|
LFS_O_WRONLY | LFS_O_TRUNC) => 0;
|
||||||
|
lfs_file_sync(&lfs, &file[0]) => 0;
|
||||||
|
size = strlen("blahblahblahblah");
|
||||||
|
memcpy(buffer, "blahblahblahblah", size);
|
||||||
|
for (lfs_size_t i = 0;
|
||||||
|
i < ((cfg.block_count-4)/2)*(cfg.block_size-8);
|
||||||
|
i += size) {
|
||||||
|
lfs_file_write(&lfs, &file[0], buffer, size) => size;
|
||||||
|
}
|
||||||
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
|
// rewrite second file, this requires lookahead does not
|
||||||
|
// use old population
|
||||||
|
lfs_file_open(&lfs, &file[0], "exhaustion2",
|
||||||
|
LFS_O_WRONLY | LFS_O_TRUNC) => 0;
|
||||||
|
lfs_file_sync(&lfs, &file[0]) => 0;
|
||||||
|
size = strlen("blahblahblahblah");
|
||||||
|
memcpy(buffer, "blahblahblahblah", size);
|
||||||
|
for (lfs_size_t i = 0;
|
||||||
|
i < ((cfg.block_count-4+1)/2)*(cfg.block_size-8);
|
||||||
|
i += size) {
|
||||||
|
lfs_file_write(&lfs, &file[0], buffer, size) => size;
|
||||||
|
}
|
||||||
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
TEST
|
||||||
|
|
||||||
|
echo "--- Outdated lookahead and split dir test ---"
|
||||||
|
rm -rf blocks
|
||||||
|
tests/test.py << TEST
|
||||||
|
lfs_format(&lfs, &cfg) => 0;
|
||||||
|
|
||||||
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
|
||||||
|
// fill completely with two files
|
||||||
|
lfs_file_open(&lfs, &file[0], "exhaustion1",
|
||||||
|
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
|
size = strlen("blahblahblahblah");
|
||||||
|
memcpy(buffer, "blahblahblahblah", size);
|
||||||
|
for (lfs_size_t i = 0;
|
||||||
|
i < ((cfg.block_count-4)/2)*(cfg.block_size-8);
|
||||||
|
i += size) {
|
||||||
|
lfs_file_write(&lfs, &file[0], buffer, size) => size;
|
||||||
|
}
|
||||||
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
|
lfs_file_open(&lfs, &file[0], "exhaustion2",
|
||||||
|
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
|
size = strlen("blahblahblahblah");
|
||||||
|
memcpy(buffer, "blahblahblahblah", size);
|
||||||
|
for (lfs_size_t i = 0;
|
||||||
|
i < ((cfg.block_count-4+1)/2)*(cfg.block_size-8);
|
||||||
|
i += size) {
|
||||||
|
lfs_file_write(&lfs, &file[0], buffer, size) => size;
|
||||||
|
}
|
||||||
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
|
// remount to force reset of lookahead
|
||||||
|
lfs_unmount(&lfs) => 0;
|
||||||
|
|
||||||
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
|
||||||
|
// rewrite one file with a hole of one block
|
||||||
|
lfs_file_open(&lfs, &file[0], "exhaustion1",
|
||||||
|
LFS_O_WRONLY | LFS_O_TRUNC) => 0;
|
||||||
|
lfs_file_sync(&lfs, &file[0]) => 0;
|
||||||
|
size = strlen("blahblahblahblah");
|
||||||
|
memcpy(buffer, "blahblahblahblah", size);
|
||||||
|
for (lfs_size_t i = 0;
|
||||||
|
i < ((cfg.block_count-4)/2 - 1)*(cfg.block_size-8);
|
||||||
|
i += size) {
|
||||||
|
lfs_file_write(&lfs, &file[0], buffer, size) => size;
|
||||||
|
}
|
||||||
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
|
// try to allocate a directory, should fail!
|
||||||
|
lfs_mkdir(&lfs, "split") => LFS_ERR_NOSPC;
|
||||||
|
|
||||||
|
// file should not fail
|
||||||
|
lfs_file_open(&lfs, &file[0], "notasplit",
|
||||||
|
LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
|
lfs_file_write(&lfs, &file[0], "hi", 2) => 2;
|
||||||
lfs_file_close(&lfs, &file[0]) => 0;
|
lfs_file_close(&lfs, &file[0]) => 0;
|
||||||
|
|
||||||
lfs_unmount(&lfs) => 0;
|
lfs_unmount(&lfs) => 0;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ lfs_mktree
|
|||||||
lfs_chktree
|
lfs_chktree
|
||||||
|
|
||||||
echo "--- Block corruption ---"
|
echo "--- Block corruption ---"
|
||||||
for i in {2..33}
|
for i in {0..33}
|
||||||
do
|
do
|
||||||
rm -rf blocks
|
rm -rf blocks
|
||||||
mkdir blocks
|
mkdir blocks
|
||||||
@@ -83,12 +83,12 @@ do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "--- Block persistance ---"
|
echo "--- Block persistance ---"
|
||||||
for i in {2..33}
|
for i in {0..33}
|
||||||
do
|
do
|
||||||
rm -rf blocks
|
rm -rf blocks
|
||||||
mkdir blocks
|
mkdir blocks
|
||||||
lfs_mktree
|
lfs_mktree
|
||||||
chmod a-w blocks/$(printf '%x' $i) || true
|
chmod a-w blocks/$(printf '%x' $i)
|
||||||
lfs_mktree
|
lfs_mktree
|
||||||
lfs_chktree
|
lfs_chktree
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -30,10 +30,20 @@ echo "--- Invalid mount ---"
|
|||||||
tests/test.py << TEST
|
tests/test.py << TEST
|
||||||
lfs_format(&lfs, &cfg) => 0;
|
lfs_format(&lfs, &cfg) => 0;
|
||||||
TEST
|
TEST
|
||||||
rm -f blocks/0 blocks/1
|
rm blocks/0 blocks/1
|
||||||
tests/test.py << TEST
|
tests/test.py << TEST
|
||||||
lfs_mount(&lfs, &cfg) => LFS_ERR_CORRUPT;
|
lfs_mount(&lfs, &cfg) => LFS_ERR_CORRUPT;
|
||||||
TEST
|
TEST
|
||||||
|
|
||||||
|
echo "--- Valid corrupt mount ---"
|
||||||
|
tests/test.py << TEST
|
||||||
|
lfs_format(&lfs, &cfg) => 0;
|
||||||
|
TEST
|
||||||
|
rm blocks/0
|
||||||
|
tests/test.py << TEST
|
||||||
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
lfs_unmount(&lfs) => 0;
|
||||||
|
TEST
|
||||||
|
|
||||||
echo "--- Results ---"
|
echo "--- Results ---"
|
||||||
tests/stats.py
|
tests/stats.py
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
echo "=== Parallel tests ==="
|
echo "=== Interspersed tests ==="
|
||||||
rm -rf blocks
|
rm -rf blocks
|
||||||
tests/test.py << TEST
|
tests/test.py << TEST
|
||||||
lfs_format(&lfs, &cfg) => 0;
|
lfs_format(&lfs, &cfg) => 0;
|
||||||
TEST
|
TEST
|
||||||
|
|
||||||
echo "--- Parallel file test ---"
|
echo "--- Interspersed file test ---"
|
||||||
tests/test.py << TEST
|
tests/test.py << TEST
|
||||||
lfs_mount(&lfs, &cfg) => 0;
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
lfs_file_open(&lfs, &file[0], "a", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
lfs_file_open(&lfs, &file[0], "a", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
@@ -77,7 +77,7 @@ tests/test.py << TEST
|
|||||||
lfs_unmount(&lfs) => 0;
|
lfs_unmount(&lfs) => 0;
|
||||||
TEST
|
TEST
|
||||||
|
|
||||||
echo "--- Parallel remove file test ---"
|
echo "--- Interspersed remove file test ---"
|
||||||
tests/test.py << TEST
|
tests/test.py << TEST
|
||||||
lfs_mount(&lfs, &cfg) => 0;
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
lfs_file_open(&lfs, &file[0], "e", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
lfs_file_open(&lfs, &file[0], "e", LFS_O_WRONLY | LFS_O_CREAT) => 0;
|
||||||
@@ -90,6 +90,22 @@ tests/test.py << TEST
|
|||||||
lfs_unmount(&lfs) => 0;
|
lfs_unmount(&lfs) => 0;
|
||||||
TEST
|
TEST
|
||||||
|
|
||||||
|
echo "--- Trailing dot path tests ---"
|
||||||
|
tests/test.py << TEST
|
||||||
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
lfs_stat(&lfs, "tea/hottea/", &info) => 0;
|
||||||
|
strcmp(info.name, "hottea") => 0;
|
||||||
|
lfs_stat(&lfs, "tea/hottea/.", &info) => 0;
|
||||||
|
strcmp(info.name, "hottea") => 0;
|
||||||
|
lfs_stat(&lfs, "tea/hottea/./.", &info) => 0;
|
||||||
|
strcmp(info.name, "hottea") => 0;
|
||||||
|
lfs_stat(&lfs, "tea/hottea/..", &info) => 0;
|
||||||
|
strcmp(info.name, "tea") => 0;
|
||||||
|
lfs_stat(&lfs, "tea/hottea/../.", &info) => 0;
|
||||||
|
strcmp(info.name, "tea") => 0;
|
||||||
|
lfs_unmount(&lfs) => 0;
|
||||||
|
TEST
|
||||||
|
|
||||||
echo "--- Root dot dot path tests ---"
|
echo "--- Root dot dot path tests ---"
|
||||||
tests/test.py << TEST
|
tests/test.py << TEST
|
||||||
lfs_mount(&lfs, &cfg) => 0;
|
lfs_mount(&lfs, &cfg) => 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user