Skip to content

Filesystem: Include '.' and '..' in directory iteration #4186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2017

Conversation

geky
Copy link
Contributor

@geky geky commented Apr 13, 2017

The standard is intentionally vague on if filesystems must have '.' and '..' entries, allowing filesystems to omit this concept completely. However, if '.' and '..' entries are present, they must appear during directory iteration:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html

The '.' and '..' entries are common on FAT filesystems and in most other filesystems. Not providing '.' and '..' entries deviates from convention in a way that may cause user's code to not work when ported to a different filesystem.

This enables '.' and '..' entries in the FAT filesystem.

Note: After this patch, '.' and '..' entries will show up during directory iteration. This is a breaking change, but needed to match conventions on host PCs.

I also need to check if the sd-driver tests need updating, but wanted to get this up there for review.

cc @simonqhughes, @theotherjimmy

The standard is intentionally vague on if filesystems must
have '.' and '..' entries, allowing filesystems to omit this
concept completely:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/readdir.html

However, the '.' and '..' entries are common on FAT filesystems
and in most other filesystems.

This enables '.' and '..' entries in the FAT filesystem.
@0xc0170
Copy link
Contributor

0xc0170 commented Apr 18, 2017

bump for review

@0xc0170 0xc0170 requested a review from simonqhughes April 18, 2017 12:18
@sg-
Copy link
Contributor

sg- commented Apr 19, 2017

Is there any meaningful code size implication with this change?

@0xc0170
Copy link
Contributor

0xc0170 commented Apr 24, 2017

@geky Bump

@geky
Copy link
Contributor Author

geky commented May 1, 2017

Here are the code size changes (with K64F, GCC_ARM, and the features-tests-filesystem-fat_filesystem test, all units are bytes):

text data bss heap stack
before 73732 2700 13968 22820 1712
after 73852 2700 13976 22820 1720
diff +0.16% 0% +0.06% 0% 0%

And I have now ran the full test suite. There is a small change needed to support the '.' and '..' directories, but this would be needed if a different filesystem included these during iteration:
PelionIoT/sd-driver#17

@0xc0170
Copy link
Contributor

0xc0170 commented May 2, 2017

@simonqhughes Can you review?

It looks good to me

@0xc0170
Copy link
Contributor

0xc0170 commented May 2, 2017

/morph test-nightly

@mbed-bot
Copy link

mbed-bot commented May 2, 2017

Result: FAILURE

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 116

Test failed!

@0xc0170
Copy link
Contributor

0xc0170 commented May 2, 2017

@bridadan @studavekar timeout or windows seriall error for some targets in the last CI run? Any pointers for those?

@bridadan
Copy link
Contributor

bridadan commented May 2, 2017

Some how multiple boards were being accessed at once. We should restart this.

/morph test-nightly

@mbed-bot
Copy link

mbed-bot commented May 2, 2017

Result: SUCCESS

Your command has finished executing! Here's what you wrote!

/morph test-nightly

Output

mbed Build Number: 127

All builds and test passed!

@0xc0170 0xc0170 removed the needs: CI label May 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants