Updated custom attribute documentation and tweaked nonexistant attributes
Because of limitations in how littlefs manages attributes on disk, littlefs views zero-length attributes and missing attributes as the same thing. The simpliest implementation of attributes mirrors this behaviour transparently for the user.
This commit is contained in:
@@ -2651,14 +2651,11 @@ lfs_ssize_t lfs_getattr(lfs_t *lfs, const char *path,
|
||||
res = lfs_dir_get(lfs, &cwd, 0x7ffff000,
|
||||
LFS_MKTAG(0x100 | type, lfs_tagid(res),
|
||||
lfs_min(size, lfs->attr_size)), buffer);
|
||||
if (res < 0) {
|
||||
if (res == LFS_ERR_NOENT) {
|
||||
return LFS_ERR_NOATTR;
|
||||
}
|
||||
if (res < 0 && res != LFS_ERR_NOENT) {
|
||||
return res;
|
||||
}
|
||||
|
||||
return lfs_tagsize(res);
|
||||
return (res == LFS_ERR_NOENT) ? 0 : lfs_tagsize(res);
|
||||
}
|
||||
|
||||
int lfs_setattr(lfs_t *lfs, const char *path,
|
||||
@@ -3270,13 +3267,10 @@ lfs_ssize_t lfs_fs_getattr(lfs_t *lfs,
|
||||
LFS_MKTAG(0x100 | type, 0,
|
||||
lfs_min(size, lfs->attr_size)), buffer);
|
||||
if (res < 0) {
|
||||
if (res == LFS_ERR_NOENT) {
|
||||
return LFS_ERR_NOATTR;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
return lfs_tagsize(res);
|
||||
return (res == LFS_ERR_NOENT) ? 0 : lfs_tagsize(res);
|
||||
}
|
||||
|
||||
int lfs_fs_setattr(lfs_t *lfs,
|
||||
|
||||
Reference in New Issue
Block a user