Skip to content

Commit 0ab637f

Browse files
DS-LKGUIDINGLI
authored andcommitted
fs/littlefs: Add attr to dirA
Signed-off-by: zhouliang3 <[email protected]>
1 parent f70de1c commit 0ab637f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

fs/littlefs/lfs_vfs.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,25 @@ static int littlefs_mkdir(FAR struct inode *mountpt, FAR const char *relpath,
14441444
}
14451445

14461446
ret = lfs_mkdir(&fs->lfs, relpath);
1447+
if (ret >= 0)
1448+
{
1449+
struct littlefs_attr_s attr;
1450+
struct timespec time;
1451+
1452+
clock_gettime(CLOCK_REALTIME, &time);
1453+
memset(&attr, 0, sizeof(attr));
1454+
attr.at_mode = mode;
1455+
attr.at_ctim = 1000000000ull * time.tv_sec + time.tv_nsec;
1456+
attr.at_atim = attr.at_ctim;
1457+
attr.at_mtim = attr.at_ctim;
1458+
ret = littlefs_convert_result(lfs_setattr(&fs->lfs, relpath, 0,
1459+
&attr, sizeof(attr)));
1460+
if (ret < 0)
1461+
{
1462+
lfs_remove(&fs->lfs, relpath);
1463+
}
1464+
}
1465+
14471466
nxmutex_unlock(&fs->lock);
14481467

14491468
return ret;
@@ -1556,6 +1575,7 @@ static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath,
15561575

15571576
ret = 0;
15581577
memset(&attr, 0, sizeof(attr));
1578+
attr.at_mode = S_IRWXG | S_IRWXU | S_IRWXO;
15591579
}
15601580

15611581
buf->st_mode = attr.at_mode;

0 commit comments

Comments
 (0)