On Sat, Mar 23, 2019 at 03:01:56PM -0400, Valdis Klētnieks wrote: > On Sat, 23 Mar 2019 22:29:45 +0530, Bharath Vedartham said: > > > I was wondering how we can overwrite the copy functionality while > > writing our own filesystem in linux. > > VFS does not offer any sort of API for copy. I think it calls create and > > write when we execute the copy the file/dir. > > Which you can verify using strace. Which you should already be familiar with > if you have the experience needed to write a usable filesystem. > Yes I did that. I have observed that it is a mixture of create,read,write system calls. > > I am interested in overwriting the way copy happens in my > > filesystem(which I am writing for fun :p). > > And what, exactly, do you want copy to do differently on the API level, > and on the file system level? > I was interested in implementing copy-on-write for my filesystem(for fun :P). When I do a "cp" operation, I do not want to create a seperate inode for the new file. I only want to create a inode when I make a change to the file. There is no vfs api for cp. I would need to make creat syscall aware of the fact that it is being executed by "cp". My immediate idea was to check if a file with the same data exists in the filesystem but that would be way too much overhead. _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies