• Uncategorized

About linux : Linux-kernel-54-how-to-change-code-that-modifies-status-change-time-of-a-file

Question Detail

I’ve found Setting creation or change timestamps, I want to try kernel modification path from the linked answer: https://stackoverflow.com/a/17066309/14557599. However, the answer is 8 years old and as I’ve checked the user had not posted on SO for several years. The answer says:

Here is the change to KERNEL_SRC/fs/attr.c in the notify_change

But there is no link to file location and I was not able to find it via web search, only reposts of that QA. Does kernel still works that way for updating change time? Please help to locate that code in current kernel source to try modification on.

Added 1:

Web search finds notify_change in api docs: https://www.kernel.org/doc/html/latest/filesystems/api-summary.html.
Best way to find functions in kernel code advises to use http://lxr.linux.no, but search for notify_change there produced empty result.

I’ve tried second way from the above answer, downloaded latest from www.kernel.org, cd-d into folder where I extracted archive, but then:

~/Downloads/linux-5.15.12$ make cscope
  GEN     cscope
./scripts/tags.sh: line 126: cscope: command not found

Question Answer

I’ve tried grep:

~/Downloads/linux-5.15.12$ find . -name '*.c' -type f -exec bash -c 'grep " notify_change(" {} && ls -l {} && echo' \;

I found the code where one could have guessed it should be: ./fs/attr.c, that is KERNEL_SRC meant root of kernel source folder.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.