‫Hello and welcome, everybody, in this lecture.
‫We're going to implement the virtual filesystems f close functionality, so just go to foldout page
‫and just above F seek function.
‫We're going to go typedef in it aifs close function and this function pointer will just take an argument
‫that accepts avoid pointer to the private data of the file descriptor.
‫So that's our first close function.
‫Now scroll down and instruct filesystem.
‫We're going to paste that in and we're just going to say close.
‫So EFS close function close.
‫Excellent.
‫Let's go to file dot c and we will implement our F close function, so we're just going to go in it
‫f close and that's going to take an FTA.
‫OK, we go in at risk with zero return address and just by here we're going to say struct file a script
‫to script file, get the script F.T. And obviously here we're going to check the descriptor is null
‫and if it is then the rest should be EIO and we'll go out and just find the out label here.
‫So at this point we now have the file, the script, and we're just going to go rest's equals to script
‫file system close and we're just going to go to script to private.
‫OK, excellent.
‫So now that you've done that, just copy and paste the prototype for F close and we're just going to
‫go to file that page and we're just going to paste it in here.
‫If we now do a make clean and I build that S.H..
‫And we can see that compiles buying so f clothes is implemented in the virtual filesystem functionality
‫now.
‫So simply put, essentially what happens is someone will do have clothes and a handle to close the file
‫and we will grab the file, the script, and we will call it a close method in the lower filesystem.
‫In other words, if the fat 16 filesystem.
‫So obviously in the next election now we're going to have to implement close function for fat 16 so
‫that this F close has something to actually call.
‫If we were to run this now, it would cause some sort of fault because we haven't implemented the clothes
‫function in Fat 16 yet.
‫So it's on initialised.
‫It's basically in an initialized state.
‫So thanks for watching.
‫In the next election now we will go ahead and implement the Fat 16 close.