WEBVTT 1 00:00:06.240 --> 00:00:18.090 William Cheng: Okay, so this is a week 10 discussion section. So last time we I guess we'll show a little bit of code for 2 00:00:19.619 --> 00:00:29.700 William Cheng: You know, for Colonel to and we look at this file on the class web on the discussion webpage. It's called week nine notes that txt 3 00:00:30.600 --> 00:00:40.020 William Cheng: Week nine notes that txt so basically I was, you know, introducing polymorphous them to you to show you know how the poly morphic 4 00:00:40.740 --> 00:00:49.350 William Cheng: Pointer works and we look at, you know, a lot of these VN up so I guess, let me look for it again be an underscore apps. 5 00:00:50.310 --> 00:00:57.930 William Cheng: So you need to look for all these via naps again anytime you see a VN apps. It's a real function pointers and it's Polly morphic 6 00:00:58.290 --> 00:01:02.160 William Cheng: Because, you know, you can use it appointed different bosses them or different implementation. 7 00:01:02.610 --> 00:01:10.020 William Cheng: Inside the actual process stuff. Yeah. And one of the most important part over here. Again, it's inside vino. See, that's how you 8 00:01:10.740 --> 00:01:30.720 William Cheng: You know, sort of set out the pointers to to be to be by device and block devices. So I think our terminal is by device. And I think for Colonel to the are. No, there are no blog devices gay. So even though it's kind of weird. I will you try to read from the this clearly the disk is a 9 00:01:32.070 --> 00:01:39.180 William Cheng: The. This is a block device because you should be able to read, you know, sort of, sort of block data in time. 10 00:01:39.900 --> 00:01:49.590 William Cheng: But somehow the internal to in. We're not implementing it yet. Alright, so it's a little mystery, but let's not worry about it too much. Okay. All right. 11 00:01:49.950 --> 00:01:56.160 William Cheng: So, again, is the ramp our system over here. There's bunch of other places where you set up the bn ops. 12 00:01:56.730 --> 00:02:05.430 William Cheng: So, so the idea here is that you know the the Vienna ops, a real function pointer at some point in time, you need to have the array of function point of point to something 13 00:02:06.120 --> 00:02:09.360 William Cheng: Okay, so what we saw before, is that there are some places where you 14 00:02:09.870 --> 00:02:19.710 William Cheng: will assign the array of function pointer and then assigned to one of the value versus the other. Because again, these appalling morphic pointer. So you have a choice to point to a are you point to be 15 00:02:20.010 --> 00:02:25.440 William Cheng: There. So the time that you decide this point or point to these A or B. This is called binding. 16 00:02:25.950 --> 00:02:31.530 William Cheng: Okay, as a binding is like, you know, like, like you have a glue you try to find a piece of a two pieces of wood together. 17 00:02:32.040 --> 00:02:41.010 William Cheng: So you put them all together. You press really hard and then they got stuck together because this is the same thing. You have appointed that originally pointed out. And at some point, you need to have a point to something 18 00:02:41.820 --> 00:02:50.490 William Cheng: Even though we're sort of used to the terminology like initialization and stuff like that. So this is a little different from the neutralization or because at the beginning we initialize these points are that are not 19 00:02:50.760 --> 00:02:58.170 William Cheng: At some point, once you make these decisions of what is supposed to to to to to to to bind to you perform this operation is called binding. 20 00:02:58.470 --> 00:03:03.630 William Cheng: There. So we saw example over here, you know, be an ops over here equals to the RAND file system. 21 00:03:04.260 --> 00:03:12.600 William Cheng: You know, the, the referral systems file operations versus the directory operation. So some so so at some point, we decided that this particular I note. 22 00:03:12.870 --> 00:03:20.520 William Cheng: If it's a, you know, if it's a if it's a directory or if it's a file we we buying this point or two different functions. 23 00:03:20.730 --> 00:03:30.030 William Cheng: So this way you know when it's a file, you call it the you close to all these function pointer. The right thing will happen to the file. And if there's a directory. When you call this function. 24 00:03:31.410 --> 00:03:36.390 William Cheng: You know the writing what happened because it's a directory. Okay, so this way, the operating system can actually call this function. 25 00:03:36.690 --> 00:03:44.340 William Cheng: In a, in some sort of an independent way. So in this case, the, the independence is that whether it's a follower directory will call it exactly the same thing. 26 00:03:44.700 --> 00:03:51.630 William Cheng: Yeah, alright. So, so when you're doing your kernel to sort of keep those kind of any kind of stuff in mind when you have a point where you don't really know what it is but what 27 00:03:52.320 --> 00:03:58.560 William Cheng: As long as they are set up correctly, you can actually, you know, make a function point mimicking indirect costs through these function pointers. Yeah. 28 00:03:59.640 --> 00:04:04.110 William Cheng: Right. So today, when I saw a look at a little more code inside ran fastest them. 29 00:04:04.620 --> 00:04:11.400 William Cheng: So let's take a look at the ramp bosses me implementation. So again, we are in the Phoenix directories of Colonel Fs. 30 00:04:11.700 --> 00:04:19.050 William Cheng: Ram Fs. So inside ramp FS directory. There's only ran FS Darcy as, again, this is very simple. Right. Last time we sort of saw it. 31 00:04:19.680 --> 00:04:22.890 William Cheng: This fall is 681 lines long with lots of comments and 32 00:04:23.640 --> 00:04:32.340 William Cheng: So grandpa systems actually pretty small. So what we're gonna do is I'm gonna, you know, right up briefly go through some of the code over here, spend some time. You know what we are walking down this co 33 00:04:32.970 --> 00:04:43.620 William Cheng: So what you need to do that you sort of think about what we talked about in chapter six in a lecture what system file, file system look like and the brand versus them is kind of like that, except there's no desk. 34 00:04:44.190 --> 00:04:49.650 William Cheng: Okay, so therefore we're going to sort of you know you. So, so what do you have to do, then you start using your imagination right don't 35 00:04:50.430 --> 00:04:57.060 William Cheng: You know when you see some names or something like that, you need to start. Imagine what they might be and that was to try to try to sort of figure out how to use them. Yeah. 36 00:04:57.510 --> 00:05:06.810 William Cheng: So that's what you have to do when you read other people's code, right. So we have this code coming from Brown University. We have no idea what's in there. And now we try to try to sort of do some discovery, you know, steps now. 37 00:05:07.650 --> 00:05:11.880 William Cheng: Okay. And also, of course, you're supposed to read comments and, you know, hopefully they will, you know, 38 00:05:12.450 --> 00:05:19.380 William Cheng: They will help you to understand. Alright, so let's take a look at some of the code over here. So first we saw you know the file system operation. 39 00:05:19.830 --> 00:05:23.850 William Cheng: For the emphasis them or you can read a vino you can delete it, you know, you can create a be know 40 00:05:24.090 --> 00:05:33.390 William Cheng: You can also among the first seminar at the beginning with mountain passes. Then when we're completely done with it right before we shut down our machine. We need to amend the file system. Yeah. 41 00:05:33.900 --> 00:05:38.970 William Cheng: So all these things are implement it right there are some a function called ram Rubino which we saw last time. 42 00:05:39.540 --> 00:05:45.510 William Cheng: We have really gone through the code with the levy know according to be no but the rest of them you know Rubino over here. 43 00:05:45.960 --> 00:05:50.070 William Cheng: This is a very important function. So when I go there again. So last time we see it right 44 00:05:50.490 --> 00:05:58.620 William Cheng: So this is the one over here that you start with the vino you try to you know basically bind you know the the the data, the function pointer. 45 00:05:58.980 --> 00:06:08.880 William Cheng: With the actual object they again inside ran faster than one of the attractive. Right. It could be a. It could be a regular file that could be a directly file. It can also be a device file. Yeah. 46 00:06:09.660 --> 00:06:16.320 William Cheng: Right. So we saw last time before over here, we said the Wii and operations. So this is a data type. That means that is the regular file. 47 00:06:16.650 --> 00:06:24.540 William Cheng: We're going to have the URL function wonder point to the file operation if it turns out to be a directory type rise again just read this names. It's a directory type 48 00:06:24.990 --> 00:06:33.210 William Cheng: We're going to say that the mode of this will be a file. So again, most tells you what kind of, you know, what kind of followers a falcon regular file could be direct your target device. 49 00:06:33.900 --> 00:06:39.270 William Cheng: So the motivator. What it is and then the real function one over here will be the directory operations. Right. 50 00:06:39.510 --> 00:06:46.410 William Cheng: If it turns out if it's a character device, it will remember that this is a character device. It is a block, block device, you remember this is a block device. 51 00:06:46.800 --> 00:06:51.540 William Cheng: The real function part over here will be no, because this is going to be a special file and the special file. 52 00:06:51.990 --> 00:07:04.590 William Cheng: We saw that before in Vino de CV know that sees where you implement all these special file operation. Remember, there's a special file read that a special file right to read and write from the devices. Right, so therefore they are not set up right here, they're set up somewhere else. Yeah. 53 00:07:05.640 --> 00:07:10.590 William Cheng: All right, and then a device identifier. I'll be here is going to be passed in from the, you know, from the 54 00:07:11.340 --> 00:07:17.130 William Cheng: Guys over here somehow defines the the i know i over here says the iron 55 00:07:17.730 --> 00:07:26.520 William Cheng: How you get the I know that I know is that the so basically what it will do is that you start with the other vino over here. It called vino to ram Fs. 56 00:07:26.820 --> 00:07:32.370 William Cheng: So let's take a look at what a function is vino to ram Fs. This one is a pound defined over here. 57 00:07:32.910 --> 00:07:42.390 William Cheng: So what is shown over here is that inside the vino over here. And I think last i'm also went over this code right there is a VN underscore I so this one is the I know pointer. 58 00:07:42.840 --> 00:07:49.890 William Cheng: Guys will get inside the virtual offices and there's a vino instead of vino there's I know pointer and the I know pointer is the one that point. I know. 59 00:07:50.400 --> 00:07:58.080 William Cheng: So of course in the virtual classes and they don't really know exactly what I know his so this particular object over here is a voice star pointer. 60 00:07:58.410 --> 00:08:09.210 William Cheng: There but once you pass the voice to a point to point back to the actual process, then the actual versus them know exactly what object in this. Okay. So, therefore, in this case the code over here will take VN underscore I which the voice start 61 00:08:09.630 --> 00:08:18.480 William Cheng: With yet. But this is kind of like a warm up one right in warm up one the application know what kind of object. It is so the application for magic. Take the voice pointer and typecast to 62 00:08:18.900 --> 00:08:26.700 William Cheng: You know what, what is supposed to be. And right now, this is the same thing right at the beginning, the emphasis of creative. I know. And then what it would do that. 63 00:08:28.740 --> 00:08:38.160 William Cheng: And then what it will do is that it will give the address assigned to a voice star pointer. So later on when the voice appointed get passed back to the actual file system, you will take us back to the actual time 64 00:08:38.520 --> 00:08:44.940 William Cheng: Man, so therefore we hear it knows that that I know is REM Fs. I know T as well. This one we want the ramparts, is that 65 00:08:45.210 --> 00:08:50.160 William Cheng: Later on in Colonel three, you're going to be dealing with the system baba says that this isn't about us as 66 00:08:50.370 --> 00:08:57.150 William Cheng: Your own implementation of. I know, right. So again, it's completely different. You can use the same voice star pointed to point to it. All you have to do is typecast 67 00:08:57.570 --> 00:09:12.750 William Cheng: typecast at the right time at the right time. Yeah. So anyways, so over here, this is the place where you know we're we're converts a V note to I know pointer. Yeah. Alright, so let's go back to where we were before over here. Where was it 68 00:09:16.380 --> 00:09:30.600 William Cheng: Okay, so you can see that in red versus them pretty much every function called the you know the every function is a roadmap as the users function because they need to convert a note to. I know, right. Sorry, a combo of, you know, to, I know exactly, that's what it does. Yeah. 69 00:09:31.680 --> 00:09:38.340 William Cheng: All right, whereas the function that we're looking for. Now I lost it. Okay. It was right here right there and file system review note over here. 70 00:09:39.000 --> 00:09:48.390 William Cheng: So what it will do is that at the beginning. I'll be here given a V note right over here, you're converting into I knows and this case again you access the be and underscore I feel 71 00:09:48.600 --> 00:09:58.830 William Cheng: And the typecast arise data type. And now you're going to get end up getting a referral system. So I know data structure. So over here, inside referral system. 72 00:10:00.810 --> 00:10:04.260 William Cheng: Be no to us and to see what is this function. 73 00:10:11.160 --> 00:10:17.190 William Cheng: Oh, I was actually looking at the wrong one. So this one is the vino to ramp up system. I know. So this one is one called number of, you know, I know. 74 00:10:17.850 --> 00:10:24.390 William Cheng: So this one is is that actually will give you the file system. Right. So, given the vino, what do you do that it will it will find the fastest 75 00:10:24.690 --> 00:10:30.720 William Cheng: Pauses them in current or two. There's only one file system. That's the ramparts, is that, I mean, Colonel three there's only one file system and that will be the system. 76 00:10:30.930 --> 00:10:42.690 William Cheng: Our system. Yeah. So right here, inside the vino there is a vino fastest them and then the beautiful system also over here. So again, the bane of our system over here is a virtual it's the fastest them in the virtual 77 00:10:43.620 --> 00:10:53.670 William Cheng: In BFS. So we saw before. Right. It's the Wii and root of the the VM FS Rubino that global variable here again is that, and that 78 00:10:55.380 --> 00:11:07.920 William Cheng: Is that a file system inside a virtual passes, then there is a voice or pointer called FS i and then again, you know, since this is part of the round buses them. You can take it back. You know typecast back. Right. So again, this is how you know 79 00:11:09.750 --> 00:11:10.230 William Cheng: How 80 00:11:11.670 --> 00:11:15.150 William Cheng: You know voice not point, it works. Alright, so I'll be here. 81 00:11:15.630 --> 00:11:25.920 William Cheng: So, so given the V note right the vino stores the bfs Rubino and then you can actually tie pass it back to a you you you found the 82 00:11:26.160 --> 00:11:37.950 William Cheng: Fastest them at the actual file system inside a data structure you type Chrysler the right wine. So now are upset as over here is going to be the RAM file system pointer. So again, there's only one file system in Colonel to and that's around file system. Yeah. 83 00:11:38.610 --> 00:11:42.840 William Cheng: Is our emphasis that we have an array of. I know. So this is our FS I notes. 84 00:11:44.370 --> 00:12:00.990 William Cheng: For it RFS, I know, go to the beginning of the fall over here so so so you can see that this is a referral system implementation. There are 64 I knows right the max ramparts is the puzzle here is 64. So again, it's a fake file system always have is an array of 64 I notes. Okay. 85 00:12:02.820 --> 00:12:10.740 William Cheng: Alright, so this is the lb. Here's the comments at this array of all the files. So when Ron passes and once you create 64 files. He ran out of space. 86 00:12:11.160 --> 00:12:21.720 William Cheng: Yeah, so, so, because you know the can only be 64 paths. Right. Alright, so let's take a look at how this is being used again where it was a code. 87 00:12:22.500 --> 00:12:30.720 William Cheng: Okay. So Ruby node over here. So we hear what it does, is that okay so so so given a veto number 88 00:12:31.200 --> 00:12:36.510 William Cheng: Over here. The vino number is the same as I know number because the ramparts has them against very, very straightforward. 89 00:12:36.900 --> 00:12:44.430 William Cheng: So in this implementation. The vino number. And I don't remember exactly the same thing. So, therefore, using a re index. And then you're going to find you, I note. 90 00:12:44.700 --> 00:12:47.730 William Cheng: And then you type Cassatt, you know, to their emphasis on my note. 91 00:12:48.060 --> 00:12:59.190 William Cheng: And then over here, there's a closer to make sure that the I noticed valid and also the iOS. I don't number and the vino number there exactly the same number, right, because that's the way that this this ramp assistance design. Yeah. 92 00:12:59.730 --> 00:13:07.530 William Cheng: Alright. So in this case, they also do some reference count over here. So we try to read a be node, you're going to end up with the extra pointers. So therefore, in this case. 93 00:13:08.160 --> 00:13:14.010 William Cheng: What it will do is that it will increment the reference cow. Oh, sorry. This is not a reference, but there's actually a link out 94 00:13:14.850 --> 00:13:16.620 William Cheng: Yeah, so, so please understand the difference 95 00:13:16.920 --> 00:13:26.220 William Cheng: The link count is done inside the file system, the reference card is done in the virtual POS system. It's in the it's in some memory, right. So this guy's a little confusing. 96 00:13:26.430 --> 00:13:30.660 William Cheng: Because the actual file system is implementing memory because we have a fake actual file system. 97 00:13:30.930 --> 00:13:38.370 William Cheng: So in this case, the link on the reference counts. Kind of like the same thing. Yeah, right. But, but the reality that the link below, sort of the, the actual process them. 98 00:13:38.880 --> 00:13:40.980 William Cheng: While the virtual instead of virtual versus them. 99 00:13:41.490 --> 00:13:44.520 William Cheng: So remember that the file object has a reference count. 100 00:13:44.820 --> 00:13:50.940 William Cheng: As it turns out, I think also be note object also has a reference count. Right. So all these things every reference guide, right, whenever you add 101 00:13:51.150 --> 00:13:58.620 William Cheng: The pointer to it. You need to include in the reference count. So is that the actual process that whenever you try to add a hardening do something a unit also increment the reference count. 102 00:13:59.460 --> 00:14:12.420 William Cheng: Right, so I'll be here. It sets up a bunch of stuff. And then what it does. Over here, it goes to the I know and find out what type of I know it is if the, the, the, I know type over here is a character device. 103 00:14:12.870 --> 00:14:21.180 William Cheng: They will point is always the device ID to be whatever this number is otherwise will be the other number, right, so remember a device is simply to number that major device number and the 104 00:14:21.600 --> 00:14:31.860 William Cheng: Device number. So, this will show you the actual implementation is that a referral system. Yeah. It turns out to be something else you panic. Okay. So anyways, was spent quite a bit of time on this particular function. 105 00:14:32.280 --> 00:14:38.970 William Cheng: Which we talked about last time. Yeah. All right. And there are other these function over here. We're going to skip them for now. And then there are a bunch of 106 00:14:39.180 --> 00:14:46.410 William Cheng: Implementation for the red versus them to read from a file, right. So again, the first argument over here is the file. The second one is the offset. 107 00:14:46.890 --> 00:14:51.210 William Cheng: So again, the offset is the cursor position. The position is passed on the virtual file system. 108 00:14:51.510 --> 00:14:59.610 William Cheng: Into the actual file system and then the buffer over here. It's a store the result if you want to read from a file and via you need to have a provide a buffer. I just saw the result. 109 00:14:59.820 --> 00:15:02.670 William Cheng: And here is the size of the buffer, how many bytes. You're supposed to modify 110 00:15:03.030 --> 00:15:13.260 William Cheng: And then there's the right operation. Again, we're going to start with the vino from the vino you can find the I note and then here's the cursor position. And then, again, this is the data that you need to write into a file. Okay. 111 00:15:14.130 --> 00:15:20.910 William Cheng: All right, there's a function to create a file, there's quite quite to create a device. There's a function for looking up. 112 00:15:21.450 --> 00:15:26.250 William Cheng: So again, look up is that, you know, so this will be a directory right the records look up function. 113 00:15:26.700 --> 00:15:38.160 William Cheng: Given a string you try to find the corresponding I know number, right. So in this case, you know what it will do is that it will actually return a vino so we will find the I know, create a vino point of the I know and then a call. 114 00:15:39.000 --> 00:15:49.170 William Cheng: What does the F get to create that particular particular veto right we saw that before. Okay, this is at a hard link to remove a hard link make a directory remove a directory 115 00:15:49.680 --> 00:15:55.680 William Cheng: Read a directory. And finally, the stat function is the one that gets the status of that particular. I know there 116 00:15:56.070 --> 00:16:02.220 William Cheng: Are so again all these functions are put inside the directory vino operations where I sort of get a rare function point are we here. 117 00:16:02.370 --> 00:16:12.300 William Cheng: For directory you can I reveal the directory. You can go right to the directory. You cannot, you know, a map on the directory, but you can create a file, create a device look it up, you know, all that kind of stuff. 118 00:16:12.810 --> 00:16:18.780 William Cheng: Yeah for for regular file. You can read them a regular file is where, again, we're doing sequential I O reading 119 00:16:19.320 --> 00:16:27.540 William Cheng: Will also can do writing and can also do the stat operation all the other operations are invalid on a regular phone. OK. So again, we went through this before. 120 00:16:28.050 --> 00:16:35.550 William Cheng: Here's the referral systems data structure for I know so I know has the size of the I know how big that this particular father's 121 00:16:36.120 --> 00:16:43.650 William Cheng: There is the I note. So here, here's the I know number I know to here's the number is on the right hand side over here. It gives you the comment on what they are. 122 00:16:44.160 --> 00:16:53.370 William Cheng: The RF men over here. That's the data that's the, that's the data that you know that the memory buffer to store the content of this file. 123 00:16:54.120 --> 00:17:06.690 William Cheng: Guys, remember in chapter six. We'll talk about the idea. This is the file system has. I know that's pretty complicated at the end there 13 pointer, the size that if I can go to two gigabyte get the ramp assist them again. It's 124 00:17:07.980 --> 00:17:17.190 William Cheng: Just a toy. It's a toy file system. So everything is fake. And over here says that a file, the largest file over here is one page, which means four kilobytes. 125 00:17:18.060 --> 00:17:25.350 William Cheng: Okay, so if you want to make a far bigger than four kilobytes of RAM foster might not allow you to do that. Yeah. Alright. So again, just a toy file system. 126 00:17:25.860 --> 00:17:33.300 William Cheng: The mode over here tell you whether it's a regular file is a directory or it's a device. And then also there's a link out by the number of 127 00:17:33.840 --> 00:17:42.210 William Cheng: Hardening that has made on this particular bar. And again, the way the link. How it works is that when the link goes to zero, that's when you can actually free up this pretty good. I know. Yeah. 128 00:17:43.980 --> 00:17:48.150 William Cheng: Alright, so we saw the other stuff before 64 I notes. 129 00:17:48.510 --> 00:17:58.950 William Cheng: Here's a directory entry is I'll remember that, you know, a directory far is simply a ray of records every record is called a directory entry is not a directory entry, there is the 130 00:17:59.160 --> 00:18:06.540 William Cheng: The there's a string and it is followed by I know number right so that's exactly what you have what we hear the first four bytes over here is I know number 131 00:18:06.780 --> 00:18:17.010 William Cheng: The second one over here is called our DNA. This is the the the the the stream that a map su and that's the directory entry right so i guess in class called is the component name. 132 00:18:17.640 --> 00:18:30.750 William Cheng: So over here is called something else. And this one is named length. So what is the name lane. So let's take a look at this, we can find out that name is actually not here. So we're going to look for it. So, Colonel include stars star dot h 133 00:18:32.040 --> 00:18:39.930 William Cheng: So name apparently is not here. So, therefore, can actually look somewhere else. What about stars. Ah, it's not here either. 134 00:18:40.890 --> 00:18:46.740 William Cheng: So as it turns out, that is actually a very, very high level, it's incredible includes STARTED HE over here is when you try to find it over here. 135 00:18:47.250 --> 00:18:58.410 William Cheng: The maximum length for a directory entry is actually 28 bytes law. Okay, so a component name is maximum 27 characters long, followed by facts backslash zero these are see students. Okay. 136 00:18:59.250 --> 00:19:05.130 William Cheng: Alright, so, so again, this is what a you know what a you know what a directory entry look like 137 00:19:05.430 --> 00:19:09.540 William Cheng: It has, I know number of followed by a string, right. So when you perform look up operation. 138 00:19:09.780 --> 00:19:17.070 William Cheng: Given that I don't number you want to find the corresponding say give up. Given a stream. You want to find the corresponding I know number right so that's exactly what it's doing. Okay. 139 00:19:17.970 --> 00:19:27.780 William Cheng: All right, so when you allocate the. I know. What do you do over here. What it will do is that it will search the entire emphasis them to find the first space. So the RAM file system, you know, he has 64 140 00:19:28.410 --> 00:19:36.330 William Cheng: I node. So, some of them are used. Some of them are on us. So again, the emphasis is it's toy file system. It doesn't really have a list of free 141 00:19:37.170 --> 00:19:39.120 William Cheng: It doesn't have a list of free this block. 142 00:19:39.510 --> 00:19:43.710 William Cheng: So would you do that every time when you start to allocate something you need to go down to the list. Look at every day. 143 00:19:43.920 --> 00:19:50.700 William Cheng: You know, look at every I know to see if it's allocate it if it's not allocated well that you can actually allocate it right otherwise. 144 00:19:50.940 --> 00:19:57.480 William Cheng: You ran out of space. So you need to print error message. I'm sorry. You don't create an error message you return an error code is that currently can really print anything 145 00:19:58.650 --> 00:20:02.880 William Cheng: Yeah, so over here. What it will do is that I will go from eyes from zero to 64 146 00:20:03.390 --> 00:20:09.450 William Cheng: Tried to see if there is a I know a physical to know that means that this one is available. So what it will do is they were allocated. 147 00:20:09.690 --> 00:20:15.780 William Cheng: If it turns out this one is not available over here, it will go to the, to the next one and the next why if all of them are allocated. 148 00:20:16.050 --> 00:20:24.390 William Cheng: In this case, what it will do is that it will go to the end over here and it will return he no space that whenever there's an error in return a negative number. 149 00:20:24.780 --> 00:20:38.910 William Cheng: Is what a, you know, space, you know, space again let's look for it. Grab you know space Colonel include star that he flips over here, is it there. Yeah. Okay. So this one is 150 00:20:39.540 --> 00:20:51.660 William Cheng: There's a pocket air number. So, let's go. Colonel include air number that he guys are going to look for no space over here 20 so this one give you all the possible error number 151 00:20:52.950 --> 00:21:03.150 William Cheng: Okay, so you know he permanent error no entry. He is TR E I O mean tons of, you know, each child he bad f e again so 152 00:21:03.540 --> 00:21:17.850 William Cheng: Some of these Eric number you're going to get very familiar with you in Colonel too because when the bfs test failed, and he is going to return all these error code. Yeah. So now you know where it is. Number 28 over here says that it has no space. Yeah. 153 00:21:18.960 --> 00:21:26.070 William Cheng: Right. So when you try to allocate it. I know. And if you go down all the I knows all 64 of them. If there's, you know, 154 00:21:27.030 --> 00:21:37.890 William Cheng: If all that are being used is, as you all know, being used what in that case you you return your return you know space there. And again, this RFS I know to be here. 155 00:21:38.490 --> 00:21:47.430 William Cheng: We're in right index of i. So, this one is right here RFS, I note over here, right. Next up I 156 00:21:48.150 --> 00:21:58.320 William Cheng: What it would do is that, so. So this one, and it gets me when the fastest I'm initialize they will point to note, so you know so. So once you allocate them over here, they'll point to something 157 00:21:58.680 --> 00:22:06.240 William Cheng: So you can this code over here, you know, if this one entry is equal to know you got assigned to something. So in this case, a call a function called K Malik. 158 00:22:06.600 --> 00:22:13.050 William Cheng: Because they don't use a slab alligator, because this is one is not actually in the, this, this one is inside a ramp assist them. 159 00:22:13.440 --> 00:22:27.540 William Cheng: So therefore, they call it. Okay. Malik to allocate I note and then what it will do is it will assign this I know to RFS RFS I know with array. So I so from this point on this entry right here will no longer be no 160 00:22:28.440 --> 00:22:34.050 William Cheng: Okay, so you don't get it. I know and you point to it so that that's how you keep track of it. Yeah. All right. 161 00:22:35.400 --> 00:22:43.290 William Cheng: And then ramp us is the mount. Well, we saw that before. So in the end, they set up the the roof. Our system inside this function. 162 00:22:43.890 --> 00:22:50.040 William Cheng: Rubino we saw before the lead, because I'm going to skip some of these functions over here amount of criticism over here. 163 00:22:50.580 --> 00:22:55.830 William Cheng: So now we have the emphasis and this is how you create a file. Okay, so we're here again given 164 00:22:56.070 --> 00:23:08.010 William Cheng: The directory been over here. I tried to create a file. So what it will do is that it will first perform a lookup function because what you have to do that when you create a far you want to make sure that that file name is not being used. Right. So, if not 165 00:23:08.880 --> 00:23:18.180 William Cheng: The component name is not being used in the component name is being used when you are not allowed to create another file. So you're not allowed created the on the same component name instead of directly instead of directly inside 166 00:23:18.480 --> 00:23:26.580 William Cheng: Directory, which kind of makes sense. Yeah. So, therefore, what it will do is that it will do. Okay, a search and make sure that the lookup will fail, right, because if you look up succeed. 167 00:23:26.760 --> 00:23:37.140 William Cheng: That means that you already have this I item inside of directory. Okay. So, therefore, you shouldn't call them FS create. So we got to create function over here, you better make sure that this is going to be a new component name. 168 00:23:37.380 --> 00:23:52.290 William Cheng: Inside this directory. Right. So this has been over here, you can see that the variable name is dirt. That means that you should also make sure that this one's a directory. Otherwise, you better not call this function, right, otherwise we if you make a mistake then cancer over here, it's gonna 169 00:23:54.570 --> 00:23:59.310 William Cheng: It's going to fail. And then you'll progress your career. I was gonna, I was gonna panic right 170 00:24:00.270 --> 00:24:12.990 William Cheng: Okay. And then what it will do over here is that it will try to look for entry over here where the RD name is zero. So, in that case, this one will be entry, where the entry is available. So what it will do is that it will allocate the century. 171 00:24:13.500 --> 00:24:20.910 William Cheng: So if it turns out that this one is equal to 64. That means that there's no space and then it will return an error again it will return no space. 172 00:24:21.150 --> 00:24:30.600 William Cheng: Otherwise it will allocate that I know and this will be the I know that that you get assigned to. And then what it will do is that it will 173 00:24:30.930 --> 00:24:45.150 William Cheng: You know, basically initialize this. I know. And then what it will do is that is that it will create a vino and it will return a vino right over here, resolve, you know, you go to be in Vienna howdy howdy queer be know you call the get we saw the function before. Okay. 174 00:24:46.170 --> 00:24:53.640 William Cheng: All right. So in this case, you know, we call the get started with the I know you're gonna end up creating vino and the vino points to that. I know a return to be enough. Yeah. 175 00:24:55.080 --> 00:25:01.080 William Cheng: All right. How do you make a device. So over here, again, all the code over here is very, very similar. Make sure it doesn't exist. 176 00:25:01.470 --> 00:25:12.270 William Cheng: You know, and make sure you don't run out of space and then what you do is that you create a I know and then you copy the major device number and do my device number and then again the bottom part up here is the same thing. 177 00:25:12.810 --> 00:25:17.340 William Cheng: You, you end up creating, you know, I'll be here. I guess do creative, you know, 178 00:25:20.190 --> 00:25:26.550 William Cheng: We here. Okay, so we're here, you don't you don't create a V note over here. So you just end up creating a device. Okay. 179 00:25:27.420 --> 00:25:38.970 William Cheng: So this one is a little different from the previous function when you call create the Create actually a passing of vino to receive the, the, the new file that you have just created. Yeah. 180 00:25:39.690 --> 00:25:43.800 William Cheng: For make for make no it doesn't do that. So again, this is just what the function does. 181 00:25:44.100 --> 00:25:56.820 William Cheng: And then this important version, right. Look up. So given a directory, you're going to iterate through every entries here. I tried to do a string compare try to find that a component name or that you're looking for us over here, this is what you're looking for. 182 00:25:57.090 --> 00:26:13.410 William Cheng: And then over here, they the argument they use over here is not a it's not an alternate industry. Okay, so it's very important understand over here. So if you look at the code over here. What it does is it, why should we do a name match as what his name match the name match over here. 183 00:26:16.860 --> 00:26:18.060 William Cheng: Rep name match. 184 00:26:21.060 --> 00:26:23.250 William Cheng: Okay, no such thing. 185 00:26:24.600 --> 00:26:37.290 William Cheng: Okay so name matches in Colonel include FS BFS stuff. He were here name match. Okay. So over here, what it does is it actually costs string and compare 186 00:26:37.770 --> 00:26:46.650 William Cheng: Okay, so we only compare up to that many character. So if you have a component name. That's a prefix. The prefix of that particular name. 187 00:26:47.130 --> 00:26:59.160 William Cheng: You might end up, you know, finding something wrong. Okay. But anyway, so this is how you know we next is implemented. I don't know why they do this I have it. But again, this is the high works. So what it will do is that, is that where 188 00:27:00.240 --> 00:27:04.830 William Cheng: I'm at look up function over here. Yeah. So what happened is that it basically only look at the beginning and 189 00:27:05.070 --> 00:27:11.910 William Cheng: That's so many characters over here if they're the same. What it will do is that it will create a vino to represent. So again, this function at the end over here. 190 00:27:12.090 --> 00:27:16.170 William Cheng: Is vino star star. So, therefore, it's a return value. So what you will do is that you will 191 00:27:16.470 --> 00:27:24.840 William Cheng: You know, as you say, star result over here. It was the bigger you create a vino and you return it in the last argument over here. So in this case, it was successful. So return zero. 192 00:27:25.140 --> 00:27:35.580 William Cheng: Now, if it turns out that we iterate through all 64 entries over here. And if you can find it. So in this case you will say, you will return Ino entry over here. That means that you cannot find it, you know. 193 00:27:36.300 --> 00:27:42.180 William Cheng: When you try to perform look up operation. Again, you're giving a stream you try to look it up. We can't find it, you return no entry. 194 00:27:43.050 --> 00:27:49.890 William Cheng: There's some cases you know entry is good. Some cases know entries back there. So again, depends on which function you're using 195 00:27:50.790 --> 00:28:01.890 William Cheng: Alright, the next function over here is link or you add a hard link to us or again, you look it up to make sure that it doesn't exist, and then make sure that you have space. And again, all the other codes over here. Again, very, very similar. 196 00:28:02.460 --> 00:28:07.740 William Cheng: This function, you know, doesn't return a vino rise over here. Again, you don't have to copy get 197 00:28:08.220 --> 00:28:13.680 William Cheng: This set things up over here. So again, if you're interested, you can look into more detail on link over here. 198 00:28:14.130 --> 00:28:28.380 William Cheng: So over here, what support over here is that it's going to detriment the link on over here and it to, you know, Link, count, you know, minus, minus, over here, and then what he will do is that you will call the function called V put two 199 00:28:30.450 --> 00:28:37.980 William Cheng: Is gonna be put right because, you know, for every i know there's a corresponding vino so what it will do is, you know, a detriment the reference count on the Beano 200 00:28:38.430 --> 00:28:51.270 William Cheng: Okay, so we recommended reference got if it goes to zero, then why is that the vino is going to destroy itself when vino destroy yourself. We will also destroy the. I know. Yeah, so that's why this function over here does not destroy the I know 201 00:28:52.290 --> 00:28:53.550 William Cheng: You guys are again when you're supposed to be. 202 00:28:53.790 --> 00:29:05.250 William Cheng: Destroyed, I know you're supposed to destroy the I know when the link count on the I know is equal to zero. But in this case, you know, we have a representation inside the virtual bosses and part of vino and those reference. How should be synchronized. 203 00:29:05.610 --> 00:29:14.730 William Cheng: Okay, so when the vino referent goes to zero, that means that there's also nothing referring referring to the. I know. So in that case, when you delete the Beano you also delete the I know 204 00:29:15.360 --> 00:29:24.240 William Cheng: The answer, so that the logic is a little unusual. But again, this is how the the the Brown University people decided design your system. Right. 205 00:29:25.050 --> 00:29:33.090 William Cheng: All right. When you create a directory directory over here, you got to make sure it doesn't exist, you're gonna have space over here. You're going to allocate I know you know, etc. 206 00:29:33.300 --> 00:29:44.490 William Cheng: And then, again, this one, you need to declare that this one is a you're calling make her you're creating a directory inside this particular directory. Right. So again, you create you create a file. And this is a directory file. 207 00:29:44.760 --> 00:29:52.650 William Cheng: Okay, so, so, so anyways you said all these things up inside over here. This one doesn't return Urbino. So again, you don't have to copy get 208 00:29:53.430 --> 00:30:02.310 William Cheng: Okay. And then what else is there removed directory. So again, this case remove directories that you go to the directory file you want to remove one of the entries over there. 209 00:30:02.730 --> 00:30:06.870 William Cheng: So again, a look it up, make sure that it doesn't actually exist if it doesn't exist. 210 00:30:07.320 --> 00:30:18.780 William Cheng: If it turns out that this one is not a directory you will return he data directory. Otherwise, if the lookout fail and it will return that that you know the directory you try to remove doesn't exist. So you're getting all these Eric 211 00:30:19.500 --> 00:30:30.360 William Cheng: Condition over here. Otherwise, what he would do is that it will try to, you know, look for this entry. And then again, there's a lot of stuff needs to be set up to make sure that the referral system is in a consistent state. 212 00:30:31.410 --> 00:30:34.920 William Cheng: And then over here, here's a referral system read over here. 213 00:30:35.370 --> 00:30:46.170 William Cheng: So when you try to reef on the ram versus them up here. Again, this is the the sequential read and write operation. So, therefore, what are you supposed to do, right. You go to the data and you copy the data to the to 214 00:30:46.950 --> 00:30:52.440 William Cheng: Send it back to the virtual file system. OK, so the curve is very simple. It's simply a meme copy 215 00:30:52.950 --> 00:31:01.170 William Cheng: Right over here. He says, you know, I want to start with us offset. So again, since we are implementing since around us. As of as a toy operating system. 216 00:31:01.770 --> 00:31:10.170 William Cheng: Default is only this is only four kilobytes in size. So therefore, you're going to go to this pretty good offset. Make sure there's offset is less than, you know, for four kilobytes. 217 00:31:10.470 --> 00:31:14.250 William Cheng: And then you copy the data so many bites you know into this buffer. 218 00:31:14.640 --> 00:31:24.120 William Cheng: OK. So again, would you do that you'll come from copying to the buffer, starting with the RF mmm over here. Again there that that's appointed a point two, four kilobytes of data. 219 00:31:24.330 --> 00:31:30.900 William Cheng: You add the offset to it because they're doing pointer math. And then over here, are you try to sort of figure out how many bites you have to copy 220 00:31:31.080 --> 00:31:40.650 William Cheng: Guys, what do you have to do that right because indeed because you you might, you know, the offset over here. Maybe you're near the end of the four kilobytes. And if you so many buys into it, you're going to end up 221 00:31:40.950 --> 00:31:46.740 William Cheng: copying your beyond the end of the other four kilobytes of the four kilobytes buffer. Right. So in that case, 222 00:31:47.220 --> 00:31:52.290 William Cheng: You're going to basically start really memory corruption, but you're copying data where there's no data. 223 00:31:52.710 --> 00:32:04.530 William Cheng: Okay. So, therefore, what you need to do is that you need to find out what's the minimum between the count and the size minus offset. That means that there's how many bites are left inside the file. So this way you will computer right by value over here. Yeah. 224 00:32:06.240 --> 00:32:10.260 William Cheng: Alright, so that's how you read from the emphasis them right again, there's a buffer, you try to 225 00:32:10.650 --> 00:32:15.660 William Cheng: Copy data from the up on the buffer into the buffer that are provided by the argument over here. Yeah. 226 00:32:15.900 --> 00:32:21.990 William Cheng: Well, how do you actually write to a file, you do the opposite. You take this on your argument you try to copy number of bytes over here. 227 00:32:22.200 --> 00:32:27.630 William Cheng: Into that four kilobytes of memory. And I said, again, it is possible that this bump over here is going to be bigger. 228 00:32:27.930 --> 00:32:39.390 William Cheng: You don't want to overflow your buffer, because then you're going to end up with memory corruption as over here. You're gonna get figure out what is the right number of bytes stability, right, and then you call men copy and then you write that memory location. Yeah. 229 00:32:40.620 --> 00:32:45.900 William Cheng: Alright, so this is the function over here is to read a directory or will you read a directory over here. 230 00:32:46.410 --> 00:32:54.210 William Cheng: So again, you go to the directory over here. And then you start with precision offset. So remember that directly answer helpings directory Angie. 231 00:32:54.630 --> 00:33:06.780 William Cheng: Why we saw before the directory entry only has two things. One is an integer. The otherwise array of characters, the integers four bytes long the array of character, we saw that is 28 characters. So every direct entry is 32 bites law. 232 00:33:07.290 --> 00:33:15.450 William Cheng: Okay. So over here, what you're trying to do over here is that you try to fill this data structure. So, what is the structure rent. Okay, so we're here. Let's look for it. 233 00:33:16.410 --> 00:33:21.690 William Cheng: Graph or ran Colonel include stars slash slash ah 234 00:33:22.260 --> 00:33:37.290 William Cheng: So Duran is in direct that age. Right. So, Colonel include Fs, the rent so direct. That's what directory entry. So, therefore, you go to that that follow me here. Look for Duran right here. So here's structure and and here's direct the rent over here. 235 00:33:38.520 --> 00:33:42.870 William Cheng: Yeah, so this is the virtual file system is Doran 236 00:33:43.500 --> 00:33:50.730 William Cheng: Now that's what happened is that you know he's had a version versus them. They think that the directory entry look like something different in the actual Foster, Sam. 237 00:33:51.090 --> 00:33:58.710 William Cheng: You know, it has those 32 bites but individual buses them over here I over here you have. I don't remember who just for by as long. The opposite of yours for by Islam. 238 00:33:58.920 --> 00:34:08.700 William Cheng: In this case name line over here is 28 bytes long plus one is 29 by law. So this data structure is a little bigger than the I know data structure. Okay, so what you do is that when you call the reading. 239 00:34:09.780 --> 00:34:18.090 William Cheng: refunded reading data from the directory you need to convert the actual file system direct to entry into something that the virtual assistant can use 240 00:34:18.630 --> 00:34:28.170 William Cheng: Okay, so that way again this case because the virtual bosses them has their own data structure. So you so inside the actual file system, you can actually do the conversion. Right. So why don't we do this conversion is that the verge of us is that 241 00:34:28.410 --> 00:34:34.650 William Cheng: Well, because the verge of us is that has no idea what data structure look like inside the actual file system. So, therefore, in order for you to convert 242 00:34:34.920 --> 00:34:41.460 William Cheng: A actual file system directly entry into a virtual assistant director Angie, this has to be done inside the actual file system. 243 00:34:41.910 --> 00:34:48.630 William Cheng: Yeah, so that's the the reason that we have this function over here reader over here. We're going to convert the actual file systems. 244 00:34:49.110 --> 00:34:53.520 William Cheng: You know, the, the directory entry into a virtual assistant director entry. Yeah. 245 00:34:53.880 --> 00:35:05.850 William Cheng: Alright so this code over here. I tried to sort of find out you know how much data, it is. And then what it will do is that it was set up this Duran over here and fill out every entry one at a time. Right, so do we. Here is the one that's inside virtual buses, then 246 00:35:06.120 --> 00:35:13.770 William Cheng: We're going to set up what the I know number is what the offset is over here and then the D name over here. Again, this one is 2029 based law. 247 00:35:13.980 --> 00:35:21.360 William Cheng: It's good that it's actually bigger than what's inside the, the, the, the, the, I know. So, therefore, you can just copy from the directory entries that I know. 248 00:35:21.720 --> 00:35:32.640 William Cheng: Into this particular buffer there. And then once you do a string and copy. So you got to be very, very careful with string and copy the stream then copy it is possible that when you do a string and copy it might not copy the trailing zero 249 00:35:33.030 --> 00:35:43.230 William Cheng: Yeah. So therefore, the next thing that you have to do over here is that you need to set the trends. The last fight over here, equal to zero. Okay, so this way you're going to always end up with a always end up with a string. Okay. 250 00:35:45.180 --> 00:35:53.070 William Cheng: All right. And finally, the last function over here staff, the staff on zoom over here is that you try to try to get information for a particular file. 251 00:35:53.580 --> 00:35:58.110 William Cheng: So I don't know if you actually use it in warm up one and warm up to some people actually use that to find out whether 252 00:35:58.680 --> 00:36:05.940 William Cheng: You know whether a particular file is a directory on our. So in this case you will make the system call so we can actually do a man called stat. 253 00:36:06.690 --> 00:36:13.230 William Cheng: So this one is the wrong one. Right. This one is a user commands. So that's not what we want. So we say man to I think two is that 254 00:36:13.860 --> 00:36:24.060 William Cheng: So typically two is going to give you a system called sometimes two sometimes three. So let's try to over here. So again, this is the London. It's just the programmers manual. So in this case, this is the user 255 00:36:24.480 --> 00:36:33.720 William Cheng: You know, the C library function stat. So given the path name over here. He tried to fill a structure. So, in this case it's a structure that the user program can use 256 00:36:34.470 --> 00:36:37.950 William Cheng: Guys, so this is. Yeah. So again, we need to do all these kind of current kind of conversion 257 00:36:38.430 --> 00:36:42.570 William Cheng: So the, the status information of the file inside the actual process then 258 00:36:42.780 --> 00:36:50.430 William Cheng: Maybe represented differently, instead of virtual versus them and then the status representation represented instead of virtue of us is that might be different from the application. 259 00:36:50.700 --> 00:36:56.880 William Cheng: Okay, so therefore you going to do any kind of conversion, if you want to, you know, convert from the, the actual file system to the virtual Sam. 260 00:36:57.120 --> 00:37:03.660 William Cheng: A venture to the application, right. So what does it look like in the application as over here. You need to look at this you know the the man pages over here. 261 00:37:03.990 --> 00:37:08.250 William Cheng: It will show you that this the structure is actually a very big structure right 262 00:37:08.850 --> 00:37:16.470 William Cheng: Structure that over here has the, the idea of the device that contain the file right get major device number minus device number 263 00:37:16.650 --> 00:37:26.100 William Cheng: It has the I know number he has the protection mo. So over here, they use the MO NASA represent what kind of father this but for the production mode. So again, chapter one, we talked about production mo. 264 00:37:26.490 --> 00:37:34.530 William Cheng: And then it talks about LB here has number of hard links the user ID, the group ID. So again, for our Colonel assignment. There's no such thing. Right. 265 00:37:35.130 --> 00:37:42.900 William Cheng: So there's a bunch of other stuff. Other side. And then the ST size over here. Here is the actual file size okay in the number of bytes. 266 00:37:43.620 --> 00:37:49.530 William Cheng: Yeah, and then they have a bunch of other information over here. So again, lots of information about you know when was the last time this 267 00:37:49.830 --> 00:37:58.680 William Cheng: You know this file was modify the time the the file was access. And then the last time the status change you know of this kind of stuff. Yeah. 268 00:37:59.280 --> 00:38:09.660 William Cheng: And also there's something for backwards compatibility. Again, you know, anyways, so this show you what the user space, you know, uh, you know, Doran data structure look like 269 00:38:10.500 --> 00:38:18.780 William Cheng: Wait, hold on. Sorry. I guess I was confused. There's one is not a direct data structure. Hey, where's the render the church so man reader. 270 00:38:19.770 --> 00:38:28.200 William Cheng: So there's a fanatical reader. So in this case, there's a directory structure as call Duran right here is what you call reader, it returns a directory 271 00:38:28.950 --> 00:38:39.270 William Cheng: Or directory entries over here. Again, instead of directly, Andrew. Andrew over here. We saw that in the bfs. There's the I know number. There's the offset and there is the name over here. So in Linux. 272 00:38:39.630 --> 00:38:53.010 William Cheng: The component name can be 256 character law. Okay so much, much bigger than. But then, then things that we next. They also other other stuff over here. So I'm not the type of the file, you know, all this kind of stuff. Yeah. 273 00:38:54.090 --> 00:39:02.970 William Cheng: OK, so again inside over here, you need to return the stat buffer. So let's take a look at where that is inside the virtual versus them grab 274 00:39:03.720 --> 00:39:14.640 William Cheng: This kernel include start a startup. Ah, so where's that it's it's a stat. Ah, OK. So, Colonel include FS that that ah 275 00:39:15.300 --> 00:39:24.360 William Cheng: So this one is probably has one data structure, as we can see that inside this stat data structure there is the MO that I don't have a device and pretty much all the other stuff that we saw before. 276 00:39:24.840 --> 00:39:38.100 William Cheng: The time it was access the time it was created modified, all that kind of stuff. And then what's most important over here, as St size. That's the size of the file in bytes. And also, I guess. What other things are important over here. 277 00:39:40.020 --> 00:39:40.860 William Cheng: Um, 278 00:39:42.240 --> 00:39:46.920 William Cheng: Okay, I guess the size is the most important thing. There's also a bunch of these. 279 00:39:47.220 --> 00:39:53.970 William Cheng: You know bits that are defined over here. He calls them be no masks. They're called mass, because each one of those big pattern over here. 280 00:39:54.210 --> 00:40:03.240 William Cheng: Only one of them. The bed is equal to one and the or the other one is equal to zero, right. So you can see that this one is 100 in hex. So therefore, only one is one, two, and four and eight. And one, and two. 281 00:40:03.690 --> 00:40:10.620 William Cheng: So all these numbers over here. There's a single the single bit of one. So in this case, all these biz can be ordered together. 282 00:40:11.100 --> 00:40:22.140 William Cheng: You know, in order for you to create other pattern that's why these things are called mask. There are also other upon divine over here. So these are macros. So if you want. So, so, so if you are given, you know, 283 00:40:24.570 --> 00:40:32.670 William Cheng: If you are given one of these arguments over here, we can actually we can end it with zero FF 00 and then checks to see one of these value. 284 00:40:32.940 --> 00:40:38.400 William Cheng: If they're equal to true they will tell you what that whether this is a carpet devices is a regular files as a director file. 285 00:40:38.610 --> 00:40:51.300 William Cheng: All that kind of stuff. Right, so I'll be here if you want to see if something is a directory file you call it. So is there a need to pass the right kind of data structure over here. I think it's a be no I'm not quite sure. But anyways, might be something like that. Yeah. 286 00:40:53.100 --> 00:40:57.210 William Cheng: Oh no, I think you need to passing the ST mode. Anyways, when you see that 287 00:40:59.130 --> 00:41:00.240 William Cheng: You can actually figure out what to do. 288 00:41:01.560 --> 00:41:07.530 William Cheng: Okay, so over here as I yeah I'm pretty sure it's St Moda you Pattinson over here. So in this case over here which will try to 289 00:41:07.890 --> 00:41:16.140 William Cheng: You know, find out what's the status of the file. So again, we need to find the I know we're going to zero out this particular buffer. And then we need to fill in every one of these data structure over here. 290 00:41:16.380 --> 00:41:21.120 William Cheng: So again, since we zero it out. So anything that you don't touch, they will remain to be zero. 291 00:41:21.390 --> 00:41:29.520 William Cheng: So therefore, the mode over here is equal to the files of VM mode over here. So again, inside the virtual bosses and they make a copy of this information. 292 00:41:29.940 --> 00:41:38.460 William Cheng: They also copy the I know number over here and then it will set up all these other parameters over here. And finally, what's important. Over here is the ST size. 293 00:41:38.700 --> 00:41:48.660 William Cheng: The St side is the I knows file size. So over here is the I know RF size over here is the size of the file again it should be between zero and you know four kilobytes minus one. 294 00:41:48.960 --> 00:41:52.530 William Cheng: And then that will be equals to you know that this particular file size. 295 00:41:53.010 --> 00:41:59.520 William Cheng: Okay, so you will see that a lot of times when you instead of virtual Sam will you do BFS test when you try to find out what the font sizes. 296 00:41:59.790 --> 00:42:02.820 William Cheng: So in this case you will create a vino and then from the Venus. 297 00:42:03.090 --> 00:42:11.940 William Cheng: St. SIGHS You will find out what the size of the file this okay and this number of better be in agreement with what store inside the actual file system. Right. So you can see that this code over here. 298 00:42:12.150 --> 00:42:21.450 William Cheng: These two things are exactly the same. So it's your job to make sure that these two numbers are always the same. So what does that mean that means every time. Will you write to a file. If you make the font bigger 299 00:42:21.780 --> 00:42:34.470 William Cheng: Okay, inside the I know you know the the size of us go get incremental. You also need to make sure that the same thing get incremental inside the inside the Beano okay so so this way you can also once you finish doing that. 300 00:42:35.580 --> 00:42:40.350 William Cheng: Well, let me see if it's actually do that in this co. So if we look at the right function over here. 301 00:42:42.960 --> 00:42:45.900 William Cheng: Okay. So over here, you can see that what it does. Over here is that 302 00:42:46.500 --> 00:42:56.040 William Cheng: The file is the beat the Venus VN length over here is going to be equal to the RF sighs Okay, so we perform the right operation when you're done. When you return, they will actually update the Venus. 303 00:42:57.000 --> 00:43:05.520 William Cheng: file size so that they're always consistent. Okay, so one of the common bug and Colonel tool is that sometimes this thing is going to go out of whack. And then people go crazy. 304 00:43:06.090 --> 00:43:09.660 William Cheng: Because it really not supposed to go out of whack. Right. The code over here says they're always be the same. 305 00:43:10.410 --> 00:43:19.950 William Cheng: Okay, so there's going to be, you know, some people either they are not doing reference counting very, very carefully, you're going to end up we free up one of the vino vino get reallocated these number gay change. 306 00:43:20.160 --> 00:43:27.630 William Cheng: Again, these are the typical memory corruption, but we have a memory corruption bug, then these two numbers these two fields over here will not agree. 307 00:43:28.620 --> 00:43:35.850 William Cheng: Okay, so you can see that inside this card over here that they should always agree. When should they not be agree when you have a memory corruption, but okay. 308 00:43:37.620 --> 00:43:43.920 William Cheng: All right. Um, so I guess I've been talking about the ramp, a system code of here for a while. So the next thing that we're going to look at 309 00:43:44.220 --> 00:43:49.110 William Cheng: Guys, we just went through all the codes, again, you know, that should give you a good foundation to start your kernel to 310 00:43:49.380 --> 00:44:00.810 William Cheng: So again anytime we confuse read the coast stepping to the referral system called single step on it to see exactly what happens when you have a memory corruption bug. Well, then it's going to be a little tricky. So you need to catch it. So again, 311 00:44:01.800 --> 00:44:15.090 William Cheng: So how do you actually catch it. Right. Remember, corruption, but right. So one thing that I would do is that I actually write another function instead of RAM file system kernel FS ram file system emphasis emphasis in that seat. 312 00:44:16.860 --> 00:44:27.120 William Cheng: So you know if it turns out that there is a memory corruption bug and they're really, really difficult to find. You want to find it as early as possible. What I would do is I will go to every one of these function. 313 00:44:27.630 --> 00:44:32.640 William Cheng: Will you what we call any of these functions. I want to make sure that the ramparts ism is intact. 314 00:44:33.750 --> 00:44:41.280 William Cheng: Okay, so what I will do that I'll actually, I will scan through all the, the, the, the, I knows instead of us them and make sure they are what I expect them to be. 315 00:44:41.670 --> 00:44:47.580 William Cheng: Right, because, you know, how do you, how do you enable the memory corruption background you expect certain stuff to be there. I later on they disappear. 316 00:44:47.850 --> 00:44:53.520 William Cheng: And we don't know why they disappear. So therefore, we can do that, we can actually every time, what we call any of the referral system function. 317 00:44:53.760 --> 00:44:57.720 William Cheng: The first thing that we need to make sure is that the emphasis and he's actually in a in a consistent state. 318 00:44:58.380 --> 00:45:05.430 William Cheng: Okay, so maybe what you can do that. You can read a new function over here and edit at the beginning of every one of these function so that you will call that function to 319 00:45:06.000 --> 00:45:17.880 William Cheng: Make sure that whatever you're checking for you will be able to check it. Okay, so. So again, if it turns out that you know those two numbers, I guess, you know, guess let me go look at look for that function again. 320 00:45:19.290 --> 00:45:28.860 William Cheng: Okay, if it turns out that these two these two values are different, but guess what you can do that at the beginning of every referral system function you check it to make sure that they're the same. 321 00:45:29.580 --> 00:45:35.130 William Cheng: Okay, so this way when the first time they'd be done differently than, say, ah, whatever they did last time is the one that actually caused the memory corruption, but 322 00:45:36.210 --> 00:45:41.880 William Cheng: Okay. I mean, this sounds really really annoying and because every function over here, you need to check to make sure that our emphasis on his concerts are not 323 00:45:42.990 --> 00:45:48.390 William Cheng: As it turns out, that's the only way that I can think of the catch memory corruption bug. Okay, there's no other easy way 324 00:45:49.140 --> 00:45:55.320 William Cheng: Easy way to get cache memory corruption. Okay, so, yeah. One thing that you need to make sure that you don't have memory. Memory reference 325 00:45:55.590 --> 00:46:02.970 William Cheng: You know reference counting bunnies are your core. Because if you're under reference something you're going to end up freeing up a data structure, the data search get reallocated 326 00:46:03.240 --> 00:46:10.080 William Cheng: Then all the numbers there you will change while you still have a point here. The point is object. So you still think that objects. The old object, but now it's a brand new object. 327 00:46:10.590 --> 00:46:19.890 William Cheng: Okay, so therefore it will look like a memory corruption, but OK. Alright, anyways, that's enough warning because that's one of the most nastiest bug is that Colonel to 328 00:46:21.000 --> 00:46:35.430 William Cheng: Alright, so I just want to sort of briefly, you know, I'll take a look at the bfs test Colonel has BFS tears BFS SRC, so I think instead this directory. There's only BFS. See, there's only a blank that age, what's the point that he 329 00:46:36.720 --> 00:46:46.530 William Cheng: Is blank. Oh, okay. All right. So, Colonel tests BFS tears BFS. See, so you will notice that over here we have Src is actually a symbolic link. 330 00:46:46.800 --> 00:46:52.380 William Cheng: So again, that doesn't really work. If you're using a shared folder, but in reality is actually a symbolic link there. 331 00:46:52.860 --> 00:46:57.360 William Cheng: This code is actually very tricky. What it does is that over here. It says if def Colonel 332 00:46:57.840 --> 00:47:07.200 William Cheng: Yeah, so if you are so, so this particular test. Turns out he can actually tested inside the Colonel. You can also test uses this function in the user space program. 333 00:47:07.830 --> 00:47:15.120 William Cheng: Okay. So, this function is dual purpose. So the code is kind of tricky. So that's why it's really difficult to decipher this code that 334 00:47:15.570 --> 00:47:26.160 William Cheng: So we're going to see DFS test you in three different places, you're going to use it in Colonel to you're going to use it in Colonel three and then in the end the colonel colonel three, you're gonna rub BFS test as a user space program. 335 00:47:27.120 --> 00:47:39.750 William Cheng: Yeah so. So anyway, it's pretty fancy function. So again, if you want to sort of figure out how this one and this one is done is very tricky. So don't spend too much time on it. Spend a few minutes and and give up trust that this one is going to work. Okay. 336 00:47:40.980 --> 00:47:50.130 William Cheng: All right, so let's take a look at the main function over here so you can see that the DFS main function over here could be a main function. So if it's if it's if the Colonel. 337 00:47:50.520 --> 00:47:57.090 William Cheng: If this pretty good symbol is not defined. So if you are not inside a colonel. That means that we're user space program then here's the main function. 338 00:47:58.290 --> 00:48:05.640 William Cheng: Okay, so this is a user space application, right, if it turns out the colonel symbol is define what they were inside a kernel or then this is just a function 339 00:48:06.120 --> 00:48:18.690 William Cheng: Okay, so therefore, again, just like you know the favor you know the favor threat test. The test function. This is the first procedure of a the first procedure of a 340 00:48:20.370 --> 00:48:25.050 William Cheng: Sort of a child process, the child side of the you need to create an occasional command. OK. So again, 341 00:48:25.590 --> 00:48:32.910 William Cheng: In Colonel to one of the main function, you have to test is called BFS tasks. So here's going to be the entry point. Right. So again, you can create a case shall come in. 342 00:48:33.090 --> 00:48:40.830 William Cheng: His dedication command going to create a child process is that a child process you're going to create childcare and the first procedure of the child there is going to be called BFS may 343 00:48:41.700 --> 00:48:49.890 William Cheng: Okay. And then of course in Colonel to you are only in the kernel. So therefore, the symbol Colonel is always defined so therefore you are either 344 00:48:50.700 --> 00:48:59.610 William Cheng: The main will not be defined yeah alright so let's take a look at this code over here. What does it do over here. So check out the RFC go to one over here. So again, RFC over here. 345 00:49:00.090 --> 00:49:06.300 William Cheng: You're going to pass into arguments over here, just like all the other first procedure for your guess 346 00:49:07.260 --> 00:49:12.660 William Cheng: Is that true proc favorite test over here. If we look at favorite has over here. 347 00:49:13.140 --> 00:49:20.550 William Cheng: He has in followed by voice start to rise again, it's a little different, right, because in is our, our wine and Boise tourists are V2. 348 00:49:20.940 --> 00:49:28.620 William Cheng: So this why it's in followed by charge, star, star again charge, star, star is compatible with voice stars. So therefore, the, you know, you can actually use it as a first procedure. 349 00:49:29.040 --> 00:49:44.610 William Cheng: You know inside a instead of kernel for for for Colonel threat right so it called the initialization of a task it called BFS start and then what we'll do is we'll create a root directory. Okay so router over here. And so what it will do is that what is the router. 350 00:49:46.830 --> 00:49:53.010 William Cheng: So ruder over here is right here ruder it's a, it's a, you know, it's just a character. 351 00:49:53.580 --> 00:50:05.670 William Cheng: Array of 64 character over here. So we call BFS star, what happened is that is going to call the random number generator, create a directory. So in order for BFS start to work, you know, a Commodore already 352 00:50:06.330 --> 00:50:17.010 William Cheng: Okay, so what does this make sure i. So, this is the major and as it turns out, again, that's caused a little tricky because this, this makes her works in the user space program and also works in Colonel to is also working Colonel three 353 00:50:17.580 --> 00:50:38.370 William Cheng: So what happened is that this maker eventually issue called the ramp houses and make her okay and also inside BFS. There should be a major. So let's look for this make MK dir Colonel FS BFS star or something like that in VFR Cisco over here. There's something called to make her 354 00:50:42.480 --> 00:50:48.240 William Cheng: Make her Colonel Fs, star, star, star does see over here. 355 00:50:48.870 --> 00:51:02.310 William Cheng: So can actually see that in the emphasis and there's an emphasis and make her and then their system purpose is to make her and then in BFS. There's a bfs this call. So let's look at BFS Cisco over here. I think this is one of the the the 356 00:51:03.390 --> 00:51:11.310 William Cheng: Many function, you have to implement. Right. Yeah, so I'll be over here is you know BFS. You know, do redo right so when you execute 357 00:51:12.300 --> 00:51:23.460 William Cheng: When you execute make her insight BFS test what happens, that is going to call one of these function. Okay, so there's a function or to make her right so you're familiar with a do. Right. So there's do exit do 358 00:51:24.300 --> 00:51:30.300 William Cheng: You know way P ID, the sounds lovely do function. So again, these are the function that you have to implement. So in to make their over here. 359 00:51:30.600 --> 00:51:39.960 William Cheng: We're gonna, we're gonna call mater. So again, the virtual versus and doesn't know how to create directory. So what you need to do is that you define the the pointer inside the actual versus them and then make an indirect costs. 360 00:51:40.260 --> 00:51:45.000 William Cheng: Yeah. So again, the implementation should be very simple. Eventually what it will do is it will create 361 00:51:45.390 --> 00:51:59.130 William Cheng: A call the referral system to make her now. So in order for BFS starts to work your do make there has to work there. And then, so we're here, you can actually see that the first function over here is tests in it. What is testing it. 362 00:52:01.500 --> 00:52:02.970 William Cheng: Okay so test in there. 363 00:52:04.560 --> 00:52:07.830 William Cheng: Colonel include start on each night here. 364 00:52:09.180 --> 00:52:18.600 William Cheng: star star. Ah, OK. So there's something called a user test at H Colonel include Test, test user test that ah 365 00:52:20.850 --> 00:52:23.940 William Cheng: Alright so this one is a function. So you can look for it. So anyways, 366 00:52:24.450 --> 00:52:34.770 William Cheng: You can see the initialize the test. Okay, so again this is fantasy because it needs to work inside Colonel tunes that Colonel three also need to inside workings a user space again it's a tricky function. 367 00:52:35.100 --> 00:52:44.010 William Cheng: And then what it will do is that I've created a root directory and then it will call change there's again changed her you know again. Now eventually is going to call do change their 368 00:52:45.060 --> 00:52:49.890 William Cheng: wares to change the colonel FS star see 369 00:52:51.120 --> 00:52:58.920 William Cheng: So it's inside BFS a system called. So again, this is one of the function, you have to implement, you know, over here again BFS do changed her 370 00:52:59.310 --> 00:53:07.890 William Cheng: So one of the function, you have to implement so so you're gonna call changed her and then make sure that this one is success via a Cisco success. 371 00:53:08.550 --> 00:53:15.420 William Cheng: What is this. Okay, so let's go to the beginning over here. So this one is a Cisco success. It costs tests assert 372 00:53:15.870 --> 00:53:24.030 William Cheng: Tried to make sure this expression over here is less than equal to zero. Otherwise going to print it era number or something like that. So be here. Let's go back over here. 373 00:53:24.450 --> 00:53:38.610 William Cheng: They tried to make sure that we can cause a change in return a zero. Okay. Because if it doesn't return to zero Robins that then then then then then you fail. Yeah. Alright, so this one is basically an assertion. Again, if you feel they're searching is going to get a kernel panic. 374 00:53:40.260 --> 00:53:47.340 William Cheng: Actually yeah I don't, I'm not sure whether you get a kernel panic or not, because this is just a test. So maybe this case you will actually fail a test. 375 00:53:47.730 --> 00:53:53.280 William Cheng: So happens that we perform BFS test, they will keep track of how many tests you have failed, and in the end it will give you a report. 376 00:53:53.670 --> 00:53:58.620 William Cheng: Okay, so I think that's why I should examine across the Colonel, they would keep track of the number of testers fit. So again, 377 00:53:58.860 --> 00:54:03.480 William Cheng: All these macros are pretty fancy because they have to work a user space for inside corner. Yeah. 378 00:54:03.810 --> 00:54:14.250 William Cheng: All right, and then the FSS Becky basically goes through all these tests there. So there are a lot of times over here or if you go to the nodder over here. So it's testing for what for, not a directory. Right. 379 00:54:14.430 --> 00:54:24.420 William Cheng: Over here is the test for stat is going to test the stat implementation is going to stay a test the change during implementation, they'll call the major implementation is going to call all the these other stuff. 380 00:54:24.780 --> 00:54:29.310 William Cheng: So the top part over here is actually pretty easy to understand and then that sort of briefly go over the 381 00:54:30.390 --> 00:54:32.550 William Cheng: You know, the path you know code over here. 382 00:54:33.720 --> 00:54:41.310 William Cheng: Alright so this one is actually pretty weird right so what it will do is that I'm actually in the beginning. Over here on the, make sure that you cannot, you know, over here. 383 00:54:42.540 --> 00:54:51.930 William Cheng: Try to say Cisco success. Make sure you can create a directory with this file protection Mo, make sure you can change into this directory over here. It's called path over here. 384 00:54:52.200 --> 00:55:02.700 William Cheng: And then what it will do is it is I will make sure that this pretty your operation is fail. And so this is the great part about the DFS as it was when something is supposed to fail. The way I should tell you what 385 00:55:03.120 --> 00:55:09.420 William Cheng: You know what the number is supposed to be. Okay, so this is a great debugging tool because if you return the wrong. 386 00:55:09.930 --> 00:55:15.870 William Cheng: Aaron number they will tell you what the right number is. So all you have to do is to fix up your purse or they will return. Right, right. Aaron number 387 00:55:16.260 --> 00:55:20.580 William Cheng: There. So this is why my recommendation for you is that when you're implementing your kernel to 388 00:55:21.030 --> 00:55:29.550 William Cheng: Don't overdo things to the simplest step will be here to get things going. And then, as it turns out, if you return the wrong area code, it would be Fs, that I should tell you that you return the wrong area code. 389 00:55:30.120 --> 00:55:35.910 William Cheng: Okay, so this one will make it really easy to fix your kernel to code, right. So this is why the colonel to is actually one of the easiest 390 00:55:36.150 --> 00:55:41.400 William Cheng: Colonel assignment over here because a lot of time the test call it tells you exactly what you're supposed to do next. 391 00:55:42.330 --> 00:55:56.070 William Cheng: Right. So when you feel something that tells you what the expected code over here. So make sure that that that that that you do that in order for you to find out what the meaning of. He is the elders. So yeah, look at the man page for stat right man. 392 00:55:57.540 --> 00:56:06.060 William Cheng: To a stat over here. There. So what do we do over here, they're actually in the end over here, it will tell you all the possible error code over here. 393 00:56:08.820 --> 00:56:09.360 William Cheng: Where's that 394 00:56:12.990 --> 00:56:16.800 William Cheng: Okay, so we. Yeah, right. So when you look at the main page over here. Again, it will 395 00:56:17.430 --> 00:56:24.030 William Cheng: There's a section called return value tell you what the value is supposed to return it will also tell you all the possible air numbers is 396 00:56:24.480 --> 00:56:32.280 William Cheng: It. This one is using air number. Okay. So, therefore, if you look at this over here. These are all the air number we saw the air number that he filed a complaint, all these air number 397 00:56:33.780 --> 00:56:43.620 William Cheng: This is a, e, i, NBA. So this means that the imbalance flag specify in flags, the flags over here is the, you know, we, here is the 398 00:56:44.910 --> 00:56:58.350 William Cheng: Where is the flags. So again, he can search inside the main page flag over here. Okay. So inside F stat over here. If the flag is wrong. Over here, they will actually give you, they give you the air number. Yeah. So yeah. 399 00:56:59.070 --> 00:57:09.210 William Cheng: So if you look at Linux men page the lens main page is really, really long again. So again, you don't have to implement all that you only have to implement enough to pass BFS test. Okay, so again, don't overdo stuff. Yeah. 400 00:57:10.260 --> 00:57:17.580 William Cheng: Alright, so we hear it costs that over here again you know if your code is not returning this value just change your code returns is valid. Yeah. 401 00:57:18.030 --> 00:57:27.090 William Cheng: All right. And then what it will do that it will do a lot of these things called path equal. It's saying that God and da should return the same thing we have, it's kind of obvious. 402 00:57:28.200 --> 00:57:34.830 William Cheng: But, but it's trying to test you that he also test you. You know, one slash slash three. It's the same as one slash slash three 403 00:57:35.130 --> 00:57:44.310 William Cheng: And also tried to test for slash five or six is equal to force fit it looks very, very silly. Okay, so we need you to look at what is path equal. Okay. So over here, if you look at path equal 404 00:57:44.640 --> 00:57:54.810 William Cheng: It's a macro that's divided as defined in the beginning of this file over here it says town defined path equal what it actually does is over here is that it will actually create directory is based on the first argument. 405 00:57:55.350 --> 00:58:01.620 William Cheng: Okay, so what I tried to do is to create that directory. So we saw before one slide to slide show you I should create a directory 406 00:58:01.830 --> 00:58:08.700 William Cheng: And then what you would do that, it will go to pee to over here to verify that that particular directory over here is as the same 407 00:58:09.240 --> 00:58:14.460 William Cheng: You know I know number as the one that you have created. Okay, so what it will do is that they will go to us over here. 408 00:58:14.820 --> 00:58:22.020 William Cheng: See, the idea is try to perform assertion that s one I know number equal to, as to the I O number. And what does s one s to 409 00:58:22.260 --> 00:58:33.630 William Cheng: S one, S to over here is that when you perform the stat operation on p one, p two. So in this case p one, p two are exactly the same. But so what does over here is that it creates the directory inside P one 410 00:58:33.900 --> 00:58:44.070 William Cheng: And then it called the stat operation to get the I know for the first for the first argument and it costs that function to get it for the second argument, and that is hard to make sure that the item number exactly the same. 411 00:58:44.910 --> 00:58:50.910 William Cheng: Okay, so this is what it is. So path equals like this. Okay. So, therefore, in the beginning, over here, they're also they're all very trivial. 412 00:58:51.180 --> 00:58:59.760 William Cheng: And then it comes to tricky starter we start over here, they tried to sort of make sure that slash is the same as slash right that's rude. The route. I know number they should be the same. 413 00:59:00.090 --> 00:59:04.170 William Cheng: And over here, slash should be the same as last such a slash data. 414 00:59:04.770 --> 00:59:13.410 William Cheng: That's the route. I know the data is is all I know. So, therefore, you try to make sure that your implementation is correct so that the road I know are the parent of the road. I know is also ran out. 415 00:59:13.830 --> 00:59:27.210 William Cheng: Okay. He also said the Route nine over here is the rude. I know with a slash at the end. So if you go back to their the the pair of rude. I know you find the root. I know. And then you for for another slash you're going to end up inside the same directory 416 00:59:28.320 --> 00:59:38.730 William Cheng: Rather, this is a little weird. Yeah, you know, typical to Robin's that will you have a stream like this is the last character over here. It's a slash this you refer to a directory. I know. 417 00:59:40.350 --> 00:59:48.060 William Cheng: Where if the last entry is over here or not, you know, it doesn't it with a slash. It could be a fad. It could be. I know to convey the bias. It could be any kind of. I know. 418 00:59:48.360 --> 00:59:55.650 William Cheng: Because it could be, it could be a directory could be regular. I know. So over here, basically, they're testing all these different combination of that and make sure they're the same thing. 419 00:59:56.220 --> 01:00:05.220 William Cheng: There. So again, you can see that this one is really long. It makes sure the current working directory. It's the same thing as one.to dot three dot.us 420 01:00:06.540 --> 01:00:07.770 William Cheng: This is exactly the same. 421 01:00:08.670 --> 01:00:18.600 William Cheng: Alright, so again, you know. Will you try to pass this test. So you need to understand that what we do is that they will you create all these directory, starting from the beginning. Over here, all these directory will get created. 422 01:00:18.960 --> 01:00:22.410 William Cheng: And then try to sort of make sure that all these things are equivalent. Yeah. 423 01:00:23.520 --> 01:00:29.310 William Cheng: All right. And then finally, what it will do is it will actually create the way to delete all these directory that was created. Okay. 424 01:00:30.960 --> 01:00:42.720 William Cheng: All right, so I guess that should be enough. So again, what you should do is he again read the bfs code over here anytime. What is supposed to fail to tell you exactly what the error number supposed to be. 425 01:00:42.930 --> 01:00:45.180 William Cheng: This should make it really easy to fix your code there. 426 01:00:45.540 --> 01:00:55.260 William Cheng: There are lots of these things, lots of tears over here that I mentioned before, there are 500 something test but again sometime when you have one value who fixed one but all of a sudden it past 100 more tests. 427 01:00:55.980 --> 01:01:04.560 William Cheng: OK. So again, just so, so whenever you know I have a you know I you know I have a program like this that will fail a lot of tests. I always fix the first one. 428 01:01:05.940 --> 01:01:10.830 William Cheng: Okay. I mean, some people will do that while you have a team of four people, you said, Well, you know, you get the first time I get a second 10 429 01:01:11.700 --> 01:01:14.130 William Cheng: In might not be a good idea because when you fix the first 430 01:01:14.310 --> 01:01:23.130 William Cheng: First bug, maybe a lot of them will disappear. Right. So in this case you will end up doing a lot of redundant stuff. And also, you know, whatever that you fix over here might be inconsistent with the other person. So again, 431 01:01:23.310 --> 01:01:36.210 William Cheng: Your team needs to work together and find out exactly how to tackle this problem. Okay. All right. So, so I'm going to end the discussion section here right now. If you have a question, you know, afterwards, you know, feel free to send me email. Yeah.