test case: int main(void) { struct stat buf; int ret; stat("test1.t", &buf); printf("test1.t st.mode:%x\n", buf.st_mode); stat("test.t", &buf); printf("test.t st.mode:%x\n", buf.st_mode); ret = chmod("test1.t", buf.st_mode); if (ret == 0) { stat("test1.t", &buf); printf("test1.t st.mode:%x\n", buf.st_mode); } return 0; } >> test1.t st.mode:81b4 test.t st.mode:81fd test1.t st.mode:81fd Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
The full mask for st_mode is 0177777 Now modify any file permissions in hostfs and all will fail
https://pubs.opengroup.org/onlinepubs/9699919799/functions/futimens.html https://www.daemon-systems.org/man/utimens.2.html Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
and implement all status related change function. the individual file system change will provide in other upcoming patchset. Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I8fde9db8eba9586e9c8da078b67e020c26623cf4