OK, we have located the colonel on the other person in this video where we are finished off our module
in our system.
Well, the program opens, so file a hunter will return to the user if the operation succeeds.
So Haddo is an index to the list of open files which is saved.
Infrastructure file descriptor.
Appadurai in the process table.
As you can see in this example, we have two processes, both of which opened some files.
Through each entrance of the sculpture Appointer A in the process, we can find out who scraped our
table and trace on each entry in the scripture table, then points to the foul control blog.
Which is actually a cash of the country when they perform some operations on the file.
We are actually using the FCP to retrieve the file info.
So it's a system pretty much all of the file operations are related to the structure.
OK, let's get started.
So far, modu in the kernel project, it's the same as the one we just rolled in Lawder.
So the difference is that we just add more functions in fantasy and a flat out age in the current product.
So let's see what we have in the file.
In the file, Heider.
We at F.S.B structure under Felty script are table.
In the structure of Sepi, we have our name to starting cluster number Serota director at entry index.
So file size under control.
Well, if it's is opened to control, we increment so to culture indicates how many times we currently
open the file.
The structure of our scripture is simple, we have only two members, so ABCP pointer and the position
indicates we are the last time the process reads are in the file.
As we see in the slide, we need faulty scripture, pintura, in the process to link this to structures
together.
So let's take a look.
In the process, high profile.
We add a new member so far out scripture, poetry in the process structure so that we know which files.
Process opened in this example, one hundred appointers stored in the process at the same time.
OK, that's it for the how to file.
Let's see what we have got to see.
The first function, we will look at a sketch of US pbp since the colonel is running and to Colonel
Reteam is set up now Wakamatsu of Physical Base authorized to watch our troops using Macroom Betawi.
In the initialization function, after we check the first 60 image, the next thing we are going to
do is we are going to initialize F.S.B unfelt descriptor table.
Those two structures are only resident in the memory and we will perform operations on the file with
some.
So what do you find to appointers?
At Subtable Unfelt in scripture table.
To do the initialization.
We call function initialise, IACP and initialise file descriptor table in the function we allocate
to page by Correo function khattak.
And to save the rest of the verbal ABCP table, if there is no Pedro available, we return false.
Otherwise allocation succeeds and we start the page with value zero and the return to.
Function initialise faulty scripture table follows the same Stipe's after we return from these two functions.
We asserts the initialization of these two structures is done because all the our operations are based
on these structures.
All right, that's right, open file function.
To open a file, all we need to do in this system is file entry into process as well as our descriptor
table and then we're served.
So far we are trying to open, if it is found, we copies of our info, such as a file name starting
cluster index to the F.S.B table entry for later use.
The last thing where we were to Asialink that subtable entry.
So faulty scriptura table entry and our entry in the process.
If any one of these steps fails to open, operation fails.
OK, with this in mind, let's get started.
So a function takes two parameters to a process and a name, so variables we need in this function felt
in scripture, the scripture index.
So directory entry index and F.S.B table index.
Then we go ahead and find your free slot in the fall table.
In the process, high profile, we have seen so far table, which can hold hundred entries if we follow
through while we call this the index to file descriptor.
Then we check afte is equal to minus one, it means that we don't find a free table entry and we return
minus one, indicating that open file failed.
Otherwise, we will go to next stop.
Thunder free file, descriptor tape tree.
Remember, in the initialization function, we advocated a table with one memory page, so here we divide
so precise by the sides of the table entry.
If we find that the table entry is not used, we call the index to the descriptor index and breaks the
log.
Next, we check Sovaldi scripter inducts.
If there is no entry available to us, we simply return.
All right, the next step is funds to file by the functions such file.
We have discussed the function before it returns the index of the root directory entry if the return
value is the maximum value.
We know that the AFL is not Phonte, otherwise we can locate the directory entry with index.
The next nothing we are going to do is we are going to cash the directory entry on equipment to counter
by calling a function get F.S.B.
We will discuss it in a minute, so function returns are index of subtable, and we will use the index
to reference the data in subtable.
At this point, we the structures together.
First off, we said the descriptor table entry was zero, then we call it the price of the ABS-CBN table
entry to the F.S.B field of study scriptura table entry.
Next, the way points out table of the to descriptor table entry and we are done.
You'll see two of our handle we returned to the user is our creator index of the table, and in the
process when the user send a request with our handle, the system will find the corresponding FCP entry
with the handle.
All right, next, we implement get F.S.B function.
As you can see, it takes one parameter, which is a route to actually entry under the index of subtable
and free.
Because we need to cash the data of the derogatory entry, we define verbal derogatory table.
First off, we checked the ABCP table, if the contrary zero, then the data of the file is not cached.
So we get to actually copy the directory index to the table for later use.
The only copies of file size, so cadastre index.
Also, we call this a foul name, an extension name, so the table.
Don't forget to incremental culture on the regions index of the subtable entry.
You can see the index of the subtable on the road to direct entry at the same system.
OK, that's it for open file function.
Let's see what we were do to function closed file.
To close a file is simple, all we need to do is document entry, contra and unlink.
I've KBE and a faulty scripter entry, so parameters it takes as a process and faulty scripture.
Tutankhamen's a container of F.S.B entry we call function port F.S.B unpause to F.S.B, point your voyage.
After we take on as a culture, we can link to ABS-CBN Tree by setting the F.S.B you is known as the
Arlington County Scripter Table as well.
Function F.S.B is simple, all it does is decrements FCP Contre.
Here we perform a check, we assume that a counter is greater than zero because normally we should close
the file after we open it.
All right, so when the file is opened, so if our data is cashed in the F.S.B table and then we can
easily retrieve the file info, suppose we want to get a file size.
We can create a function cadfael size.
So prompters, we need to locate a file on the process and file descriptor, then we can simply locate
the entry of the file using file descriptor index and gather file size with a field file size of c.B
entry.
So it's really simple.
OK, let's move on.
So that's.
We are going to talk about is read file.
This function is different from what we have seen in the previous lecture, in this example, so functional
read file uses, so cached, the info is F.S.B table entry.
So the parameters we use here as a precise descriptor so far for analysis of the data we want to reach.
So you can see we use process and effective scripture to locate a file instead of using starting cluster
index as we did before.
In the function, we're first to retrieve the position and file size, then we do a test.
If the position plus the size of data we want to rate is greater than the file size is an invalid request
under way written.
I just want indicating that this is an error.
After the check passed, we can read into our data.
Just starting class, the value is retrieved from the cash involved in the F.S.B.
Here we as a premature position from which we raise the data after it is done, we update the position
by adding the size of data we actually rate and easy and we return the size.
So let's take a look at the raw data function.
As you can see, this function is a lot different from what we have implemented in the loader project
since we add a new parameter position.
We need two more variables, Göncz and offsite to calculate the startled price of the data we want to
rate from.
So our book is used to calculate the starting cluster where we read the data.
So we divide the position by cluster size so far off site is off site into the cluster we just look
at.
OK, to locate the correct data we use, follow up to find the cadastre value and use this value as
an index to find the that's cluster value until we get to the cluster specified by the variable can't.
Here you can see index is initialized with the starting cluster index.
So we call function Galactus the value to retrieve the next cluster index and also asserted that the
cluster value is valid before we get to the location where we want to rate data, then we use the index
together.
And that's a collateral value in the.
After we ousted out of the loop, there is a cluster we want one of our most prepared.
We started reading file.
As you can see, the process is divided into two parts, so the first part is for the scenario where
we don't read data on the cluster sides boundary.
So if we find that took off, site is none zero where we will handle this case.
So first thing we are going to do is we are going to compare to size with class size if offside, plus
the size is less than classroom size, it means that all the data we want to rate is within this cluster.
So we are the right size to size.
Otherwise we have data in more than one clusters and waste as a resource to the remaining sector of
data within this cluster.
Then we locate the data address with function get cluster of site.
Now we can copy the data using what function and copy to arguments as a buffer, so data address we've
just retrieved, plus the offset to get correct location.
The size of a data we will copy in the cluster is specified by resize.
After recovering the data, we opted to buffer and get next cluster index.
OK, at this point, we can raise the data on the cross rossides boundary.
So we will use value to raise a foreign colossus until we read all the data already reached the end
of the Klosters.
In the world, we locate the data address and we compare the results with size, if they found that
the right size plus the class size is larger than the size, it means that the remaining data we want
to rate in this cluster.
And a week later in the bar for an update, the right size, then we break the loop because we have
copied all the data we want to reach.
Otherwise, we still have data in other clusters, so we call it one cluster of data to the buffer on
optical buffer zones or resize.
As the envelope will retrieve the next cluster index to continue the reading process.
After we rounded up the resources indicates the size of data we actually read returns the results to
color and we are done.
OK, we have finished so far modu.
In order to open a file from you, the program we add to the system functions in the US, it's called
module, as we did before.
So we open.
So it's called file.
Here we at full function, open file, ready to file, got file size and cross file.
Injustice, open file function.
We first got process control on the part of the current proceeds to function open file in the name of
the file we want to open.
So following functions follows the same stip.
We passed three arguments to separate five functio from user program, the first one is file descriptor.
So the next one is Buffer, which we will release the data into.
And the last one is a size.
In the CROSSFIRE, so only arguments positive from use, the program is felt in scripture.
After we close the file, we return zero.
Got a full size also takes one parameter, which is Felty scripture.
Since we have added four more entries into a system called.
Which change the checks to make new system function available to the user.
In the main function of the kernel product.
We had felt out H.
On his way, initialise.
Photosystem.
OK, at this point, so Colonel Barr is done now, we will adjust his call functions in the.
So let's switch to the use of product.
So first thing we will do is to create a number of five.
So in the library voter.
As you can see, this is a declaration of the functions where we are at interlibrary.
So let's do it now.
We are dysfunctions in the system.
Somebody file.
The first function we will implement is open file function.
So we define the label open file.
And it takes one parameter, its name, so we allocate it based on a stack.
So index number of the states to function is six, so move six, then they call the address of the past
name on a stack.
The move ardai.
One, which means way possible argument.
So divisive arguments are set to register ARCI.
Or inside.
After it returns from Curnoe, we at Arizpe.
Eight to restart the stack and return.
So that's what it is reify.
Which takes three parameters, so we allocate.
Plentiful based on stock.
So index number is seven.
So we're moving seven.
Then we call these Ackermans on the stack.
Not to save three.
Copies of of arguments to resign.
At age 18.
The start of tech by June Arizpe.
Twenty four.
And a return to the color.
Close file on The Godfather side, functions are pretty much the same as open file function, so we
copy the rainfall out of here.
The only difference is inducts, No.
So enticing function Gladwell Sites is EITE.
So four year, eight index and function, close file is nine, Selimovic X nine.
All right.
Godbold, there's four functions.
And we know that's great.
So a file.
We navigate to the library, Fauja Unassembled Osisko Modu.
Then we add it to the laboratory.
OK, so Laborie file is finished.
Then we copy syllabary file on the laboratory, had a file in the user program.
So you're the program in this example is you the one?
So we copy them here.
Until this project.
We open the file to do the test.
Not that here we need to develop because a white view function is not used in this section, maybe already
a new way to function in the next way to.
So here we just use the infinite loop to keep up the use of process running.
So far, we're open.
This example is called a test not being.
So first we define Lavall, so handle on it, then it's a size.
Buffer.
But he used to start the day to.
The baker opened fire.
So we can function open file.
So far, we want to open you this example is called Tast Dot Baim.
After we open our file, we check a status.
If the return is minus one, it means that the open file filed so perent.
Open file filed.
Otherwise, it's off our handle is why did one so we can do the operations on this file was file Hunter,
for example, Weickert file size.
On his own way past so far, Honjo.
Next, where rates file.
Here we also passed off our handle then to Buffer.
Which we want to read out of our data into Adlen, the size of the data we want to rate.
So here we want to rate all the data out of file.
And next, we perent the data, which are straight from file.
And an extra five percent rate and the data.
Yemenites.
Also on your line to make the result more readable.
OK, that's pretty moderate.
So I'll text file in this example is simple.
Which acidifies.
This is a test for.
OK, now let's assemble the task file under the product, so a navigator to the test folder.
And assembled a task for.
Then we go to the other one.
On the run to be scrapped.
Now, let's monsta fatso's damage.
The big through files, so it has to start being file.
So you are being file.
And so not a lot of people.
Since we added a new module for our module, we added the script.
And added to that in the script.
OK, that's the kernel product.
All right.
We have been on the copyright to the stored image.
All files covid into the image where this month's partition.
OK, that's a round box.
Or rather, you can see the message, this is a text file under way rate 20 bytes in total.
All right, that's it for this lecture and just in the next hour to.