I am using vfs_write(...)
to write a file in kernel module. If an error occurs while writing file I want the changes to get reverted and file should be restored to its original state. Currently I am thinking of maintaining a temp file which contains data of file to be written and in case of faliure replace the temp file with original file but its too much work in kernel module.
I am stuck here anyone know any work around this ?
It might be too much work, but it sounds like the right solution.
Alternatively, handle the getting data from the kernel userspace (eg read it from a file in /proc/
or similar), and make this atomically replace the file concerned.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.