‫We are now going to implement the fact 16 FS that function go to fat, 16 dot sea, scroll down.
‫And just after that 16 open, we're going to say in it, 16 stat struck desk boy Privette.
‫And remember, this private data is the descriptor, OK?
‫The descriptive private data struct files that stat and I we're going to go and address equals zero
‫return address.
‫Now, in between here, we're going to say struct fat file to scripter to scripter equals struct fat
‫file descriptor
‫Privette.
‫Struct fat item, just scripter item equals scripter item, and I was just going to say, if the descript
‫item type does not equal fat item type file, then we're just going to return invalid argument because
‫currently we don't allow you to start directories.
‫So we've got to do use go to outs as well and we'll make an out label by here guys.
‫And now we're going to go struct fat directory item.
‫Item equals to scripter item item.
‫Stats file size equals Eitam file size, so you can see here where actually set in the file size, the
‫file stat provided to us allowing the color of the F-stop function to know the size of our file.
‫We could put 10 bags here if we wanted and then the color of of F stat will think that the file is only
‫10 bytes long.
‫So what we do is we access our private data here, the fat directory item, and we pull the file size
‫from it.
‫Basically, guys, that's what we're doing here.
‫OK.
‫OK, so now I just want us to go start Flagg's equals zero.
‫And then down here we're going to say if item attribute and percent fat file read-only.
‫If that flag is set, then we're going to set the flag in the state, so we're going to set flags or
‫equals and let's just take a look at what that is and follow that Hajj.
‫They are fast at Read-Only, so we're going to copy that and we're going to just paste that in here
‫so that we'll just set the flag of the stat guys if the foul attribute is read-only.
‫So if we now just make a clean
‫bill that S.H..
‫We can see that Kampala's fine, so let's copy this prototype now and we're going to go to the top of
‫this file.
‫We're just going to paste it in here and we're going to go dot statt equals five 16 stap just appointed
‫to that function pointer.
‫OK, perfect.
‫Let's compare that again.
‫We can see that Kampala's fine and we are now going to actually try and start our haloed that to.
‫OK, so let's go to kernel that C.
‫And we're simply going to get rid of this while everything in here, I mean, and we're just going to
‫say struct.
‫File stat s and then we're going to go F stats.
‫F.T. Ampersand as OK, sir, if we now go to here and we're going to make clean Beltzer S.H..
‫Keep in GDP at symbol file, Bill kind of falls out of Xerox one, one, two, three, four, five.
‫And now we're just going to break on kernel that C line one hundred and four when I go C to continue.
‫Oh, wait, we have to target remote Shiomi System I 386 HD AOS Dobbyn Dash Capital Capitalist's GDB
‫Sadio.
‫That's what we have to do first.
‫And I was just going to go see to continue.
‫We can see we're now on here, we're going to go next and we're going to print S and it says S is not
‫in the current context because I accidentally left the scope.
‫Never mind, we're going to do it in the debugger instead.
‫So we're going to go print F Stat's F.T. And now here we're going to go struct file site and we're just
‫going to cast it to address zero zero zero.
‫OK, and we're going to press enter here.
‫OK, good.
‫And now we're going to print struck fast and we're going to put you in here and we're going to put an
‫asterisk by here.
‫And there we go.
‫We can see that the file size is 12.
‫So that's the good thing about GDB.
‫By the way, you can actually call functions from within, which is pretty awesome.
‫So what I've done here is, is I've made a dress zero zero and I've basically said that that's a false
‫step, which obviously it isn't.
‫We might have corrupted something, but never mind.
‫We can see that the false size is 12 because it loaded the data into a dress.
‫You see a zero because we told it it was a false step.
‫And anyway.
‫Yeah, false size 12.
‫Perfect.
‫So we can see the stat was successful.
‫So we've now implemented a virtual file system.
‫Congratulations.