\doxysection{src/disk.c File Reference}
\hypertarget{disk_8c}{}\label{disk_8c}\index{src/disk.c@{src/disk.c}}
{\ttfamily \#include "{}disk.\+h"{}}\newline
{\ttfamily \#include "{}struct.\+h"{}}\newline
{\ttfamily \#include $<$stdio.\+h$>$}\newline
{\ttfamily \#include $<$stdlib.\+h$>$}\newline
{\ttfamily \#include $<$unistd.\+h$>$}\newline
Include dependency graph for disk.\+c\+:
% FIG 0
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \mbox{\hyperlink{disk_8c_a756e632b29a777267828c50a5d4a4cfe}{init\+\_\+inode\+\_\+in\+\_\+disk}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, int inode\+\_\+index, int filetype, unsigned short perms, int owned\+\_\+bloc)
\item 
\mbox{\hyperlink{structdisk}{disk}} \mbox{\hyperlink{disk_8c_a7eb10c7006ff648d851b15f24e4305c3}{create\+\_\+disk}} ()
\begin{DoxyCompactList}\small\item\em Créer un fichier "{}disk"{} de taille MAX\+\_\+\+BYTES\+\_\+\+PER\+\_\+\+BLOC \texorpdfstring{$\ast$}{*} MAX\+\_\+\+BLOCS, renvoi ce disque. \end{DoxyCompactList}\item 
\mbox{\hyperlink{structdisk}{disk}} \mbox{\hyperlink{disk_8c_a0410aa30c92de7cca42080e61d4dcd91}{open\+\_\+disk}} (char \texorpdfstring{$\ast$}{*}filename)
\begin{DoxyCompactList}\small\item\em Si un fichier filename existe, alors on le lit et le stocke en mémoire. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{disk_8c_ade4ebb1901ddd0ddd60a246d0981c9ab}{find\+\_\+free\+\_\+bloc}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
\item 
int \mbox{\hyperlink{disk_8c_a7abd1b379bf3695a8120a92fde42203b}{find\+\_\+offset\+\_\+in\+\_\+parent\+\_\+bloc}} (\mbox{\hyperlink{structbloc}{bloc}} \texorpdfstring{$\ast$}{*}parent\+\_\+bloc)
\item 
void \mbox{\hyperlink{disk_8c_aa7d14d97833c0c0665892b3c624ab2d9}{create\+\_\+directory}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}parent, char \texorpdfstring{$\ast$}{*}dirname)
\item 
void \mbox{\hyperlink{disk_8c_a90556d464c7b49fa1d4a76c37358a7bd}{create\+\_\+file}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}parent, char \texorpdfstring{$\ast$}{*}filename)
\item 
void \mbox{\hyperlink{disk_8c_ad46ea636209e0726c208aaa61c49ae16}{create\+\_\+inode}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}parent, char inode\+\_\+type, char \texorpdfstring{$\ast$}{*}name)
\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\Hypertarget{disk_8c_aa7d14d97833c0c0665892b3c624ab2d9}\label{disk_8c_aa7d14d97833c0c0665892b3c624ab2d9} 
\index{disk.c@{disk.c}!create\_directory@{create\_directory}}
\index{create\_directory@{create\_directory}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{create\_directory()}{create\_directory()}}
{\footnotesize\ttfamily void create\+\_\+directory (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk,  }\item[{\mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}}]{parent,  }\item[{char \texorpdfstring{$\ast$}{*}}]{dirname }\end{DoxyParamCaption})}

\Hypertarget{disk_8c_a7eb10c7006ff648d851b15f24e4305c3}\label{disk_8c_a7eb10c7006ff648d851b15f24e4305c3} 
\index{disk.c@{disk.c}!create\_disk@{create\_disk}}
\index{create\_disk@{create\_disk}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{create\_disk()}{create\_disk()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structdisk}{disk}} create\+\_\+disk (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Créer un fichier "{}disk"{} de taille MAX\+\_\+\+BYTES\+\_\+\+PER\+\_\+\+BLOC \texorpdfstring{$\ast$}{*} MAX\+\_\+\+BLOCS, renvoi ce disque. 

\begin{DoxyReturn}{Returns}
Le disque créé 
\end{DoxyReturn}
\Hypertarget{disk_8c_a90556d464c7b49fa1d4a76c37358a7bd}\label{disk_8c_a90556d464c7b49fa1d4a76c37358a7bd} 
\index{disk.c@{disk.c}!create\_file@{create\_file}}
\index{create\_file@{create\_file}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{create\_file()}{create\_file()}}
{\footnotesize\ttfamily void create\+\_\+file (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk,  }\item[{\mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}}]{parent,  }\item[{char \texorpdfstring{$\ast$}{*}}]{filename }\end{DoxyParamCaption})}

\Hypertarget{disk_8c_ad46ea636209e0726c208aaa61c49ae16}\label{disk_8c_ad46ea636209e0726c208aaa61c49ae16} 
\index{disk.c@{disk.c}!create\_inode@{create\_inode}}
\index{create\_inode@{create\_inode}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{create\_inode()}{create\_inode()}}
{\footnotesize\ttfamily void create\+\_\+inode (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk,  }\item[{\mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}}]{parent,  }\item[{char}]{inode\+\_\+type,  }\item[{char \texorpdfstring{$\ast$}{*}}]{name }\end{DoxyParamCaption})}

\Hypertarget{disk_8c_ade4ebb1901ddd0ddd60a246d0981c9ab}\label{disk_8c_ade4ebb1901ddd0ddd60a246d0981c9ab} 
\index{disk.c@{disk.c}!find\_free\_bloc@{find\_free\_bloc}}
\index{find\_free\_bloc@{find\_free\_bloc}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{find\_free\_bloc()}{find\_free\_bloc()}}
{\footnotesize\ttfamily int find\+\_\+free\+\_\+bloc (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d }\end{DoxyParamCaption})}

\Hypertarget{disk_8c_a7abd1b379bf3695a8120a92fde42203b}\label{disk_8c_a7abd1b379bf3695a8120a92fde42203b} 
\index{disk.c@{disk.c}!find\_offset\_in\_parent\_bloc@{find\_offset\_in\_parent\_bloc}}
\index{find\_offset\_in\_parent\_bloc@{find\_offset\_in\_parent\_bloc}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{find\_offset\_in\_parent\_bloc()}{find\_offset\_in\_parent\_bloc()}}
{\footnotesize\ttfamily int find\+\_\+offset\+\_\+in\+\_\+parent\+\_\+bloc (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structbloc}{bloc}} \texorpdfstring{$\ast$}{*}}]{parent\+\_\+bloc }\end{DoxyParamCaption})}

\Hypertarget{disk_8c_a756e632b29a777267828c50a5d4a4cfe}\label{disk_8c_a756e632b29a777267828c50a5d4a4cfe} 
\index{disk.c@{disk.c}!init\_inode\_in\_disk@{init\_inode\_in\_disk}}
\index{init\_inode\_in\_disk@{init\_inode\_in\_disk}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{init\_inode\_in\_disk()}{init\_inode\_in\_disk()}}
{\footnotesize\ttfamily int init\+\_\+inode\+\_\+in\+\_\+disk (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d,  }\item[{int}]{inode\+\_\+index,  }\item[{int}]{filetype,  }\item[{unsigned short}]{perms,  }\item[{int}]{owned\+\_\+bloc }\end{DoxyParamCaption})}

\Hypertarget{disk_8c_a0410aa30c92de7cca42080e61d4dcd91}\label{disk_8c_a0410aa30c92de7cca42080e61d4dcd91} 
\index{disk.c@{disk.c}!open\_disk@{open\_disk}}
\index{open\_disk@{open\_disk}!disk.c@{disk.c}}
\doxysubsubsection{\texorpdfstring{open\_disk()}{open\_disk()}}
{\footnotesize\ttfamily \mbox{\hyperlink{structdisk}{disk}} open\+\_\+disk (\begin{DoxyParamCaption}\item[{char \texorpdfstring{$\ast$}{*}}]{filename }\end{DoxyParamCaption})}



Si un fichier filename existe, alors on le lit et le stocke en mémoire. 


\begin{DoxyParams}{Parameters}
{\em char} & \texorpdfstring{$\ast$}{*}filename Le nom du fichier à lire \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Le disque lu 
\end{DoxyReturn}
