Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow attribute get on root#7873

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
earlephilhower merged 4 commits intoesp8266:masterfromqistoph:pr_root_attributes
Mar 3, 2021

Conversation

@qistoph
Copy link
Contributor

This PR enables attributes on the root, such ascreation/modification time of volume.

  fs::Dir fs = LittleFS.openDir("/");  Serial.print("FS creation timestamp:");  Serial.println(fs.fileCreationTime());

After quite some testing I believe the attached changed is the only one required. It didn't seem to break anything in my tests, though I'm not 100% sure, because the use and value of_valid in undocumented and unclear to me.

Test project available:LittleFSTest

Effects of checking 'c' and 't' attributes on a root node, if:

  1. attribute present: return its value (mklittlefs sincePR15)
  2. attribute unavailable at root and sub nodes: return 0 (older version of mklittlefs)
  3. attribute unavailable at root, but available at sub node: return (last?) sub node's value

I'm haven't been able to figure out why situation 3. doesn't respond like 2. If this is an undesirable side effect, I'm hoping someone has a suggestion on fixing it or where to look.

Copy link
Collaborator

@earlephilhowerearlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'm worried that when_valid is false the filename is not guaranteed to be proper. Has this been verified?

Also, the::format method should be setting these attributes when on-device formatting occurs.

@qistoph
Copy link
ContributorAuthor

I'll extend my tests and verify the workings of all available methods.

Where would you say is the right place to set the attributes on::format?

  1. LittleFSImpl::format (LittleFS.h)
  2. lfs_format (lfs.c)

The first would be most in line with the change in mklittlefs, I guess.

@earlephilhower
Copy link
Collaborator

earlephilhower commentedFeb 13, 2021
edited
Loading

TheLittleFSImpl::format() would be the spot to add the attributes. We don't touch the upstream FS lib itself.

The _valid thing still sets off alarms. You're assuming that dirent is all 0'd (which it is, luckily, in the constructor...but only until something writes to it which can happen on rewind() or next() or other calls). Also, this would return the FS date no matter what the subdir it's in which is not what you're going for. Currently, also, if I read the sprintf logic you're doing a lfs_get_attr("") and not lfs_get_attr("/")

@qistoph
Copy link
ContributorAuthor

Thanks for the feedback and insights. I have updated the code to a more proper way to get the attributes. Also included is the proposed change to set the attributes on format.

LittleFS.creationTime()

Copy link
Collaborator

@earlephilhowerearlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good way to add in the call! Just some minor things and we should be good to go!

When `FS::getCreationTime` isn't implemented in the FS, return 0 not -1, same as other getXXXtime() calls in the File object.
@earlephilhowerearlephilhower merged commitc90c329 intoesp8266:masterMar 3, 2021
earlephilhower added a commit to earlephilhower/Arduino that referenced this pull requestMar 4, 2021
Rebuild entire toolchain instead of manually hacking the tools JSON toensure repeatability.New mklittlefs sets the new FS timestamp added inesp8266#7873
d-a-v pushed a commit that referenced this pull requestMar 4, 2021
Rebuild entire toolchain instead of manually hacking the tools JSON toensure repeatability.New mklittlefs sets the new FS timestamp added in#7873
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@earlephilhowerearlephilhowerearlephilhower approved these changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@qistoph@earlephilhower

[8]ページ先頭

©2009-2025 Movatter.jp