698 lines
41 KiB
TeX
698 lines
41 KiB
TeX
\doxysection{src/disk.c File Reference}
|
|
\hypertarget{disk_8c}{}\label{disk_8c}\index{src/disk.c@{src/disk.c}}
|
|
|
|
|
|
Implémentation des primitives de bas niveau et des commandes du Système de Gestion de Fichiers (SGF).
|
|
|
|
|
|
{\ttfamily \#include "{}disk.\+h"{}}\newline
|
|
{\ttfamily \#include "{}env.\+h"{}}\newline
|
|
{\ttfamily \#include "{}struct.\+h"{}}\newline
|
|
{\ttfamily \#include $<$linux/limits.\+h$>$}\newline
|
|
{\ttfamily \#include $<$stdio.\+h$>$}\newline
|
|
{\ttfamily \#include $<$string.\+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)
|
|
\begin{DoxyCompactList}\small\item\em Initialise les métadonnées d\textquotesingle{}un inode spécifique directement sur le disque. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_ade4ebb1901ddd0ddd60a246d0981c9ab}{find\+\_\+free\+\_\+bloc}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
|
|
\begin{DoxyCompactList}\small\item\em Parcourt le vecteur d\textquotesingle{}allocation pour trouver et réserver le premier bloc libre détecté. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a7abd1b379bf3695a8120a92fde42203b}{find\+\_\+offset\+\_\+in\+\_\+parent\+\_\+bloc}} (\mbox{\hyperlink{structbloc}{bloc}} \texorpdfstring{$\ast$}{*}parent\+\_\+bloc)
|
|
\begin{DoxyCompactList}\small\item\em Calcule la première position disponible (offset en octets) au sein d\textquotesingle{}un bloc parent de type répertoire. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_ad449fb17ffb0311c29836bb27b09d14e}{is\+\_\+dir\+\_\+empty}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, int bloc\+\_\+index)
|
|
\begin{DoxyCompactList}\small\item\em Vérifie si un bloc de répertoire donné est vide. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a3817714a1f4d5a69d2962eb1ae0a49a5}{is\+\_\+file\+\_\+empty}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, int bloc\+\_\+index)
|
|
\begin{DoxyCompactList}\small\item\em Scanne l\textquotesingle{}intégralité d\textquotesingle{}un bloc de fichier pour valider s\textquotesingle{}il ne comporte que des zéros. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_afc37d4fbfdaabb22dd4865848a799887}{allocate\+\_\+node}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}parent, char \texorpdfstring{$\ast$}{*}name, char type)
|
|
\begin{DoxyCompactList}\small\item\em Alloue un nouvel inode et met à jour les liaisons structurelles dans le répertoire parent. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a8a8845ddf7dc88a527775a335100697e}{remove\+\_\+inode}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}parent, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}inode\+\_\+to\+\_\+remove, int inode\+\_\+to\+\_\+remove\+\_\+idx)
|
|
\begin{DoxyCompactList}\small\item\em Supprime physiquement un inode, libère ses ressources blocs et efface sa référence chez son parent. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_af10807a70b9341c379973247c446824e}{do\+\_\+rmdir}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, char \texorpdfstring{$\ast$}{*}filepath)
|
|
\begin{DoxyCompactList}\small\item\em Commande système {\ttfamily rmdir}. Supprime un répertoire vide identifié par son chemin absolu. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_ab892860e63632cdcf960c65b314772b9}{do\+\_\+rm}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, char \texorpdfstring{$\ast$}{*}filepath)
|
|
\begin{DoxyCompactList}\small\item\em Commande système {\ttfamily rm}. Supprime un fichier classique ou un lien symbolique. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a68a10bc46f98c1f3577d7b29d87d2cc7}{create\+\_\+file}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}parent, char \texorpdfstring{$\ast$}{*}filename)
|
|
\begin{DoxyCompactList}\small\item\em Précise la création d\textquotesingle{}un nœud d\textquotesingle{}index typé comme Fichier Régulier ({\ttfamily TYPE\+\_\+\+FILE}). \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_ab1bd0d9ea50c88f8b9268cf79be4a5d4}{create\+\_\+directory}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, \mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}parent, char \texorpdfstring{$\ast$}{*}dirname)
|
|
\begin{DoxyCompactList}\small\item\em Conçoit un sous-\/répertoire complet et initialise ses entrées auto-\/référentielles ({\ttfamily .} et {\ttfamily ..}). \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a147b2f811e195cee380e7ecd8b9b19e0}{check\+\_\+if\+\_\+name\+\_\+is\+\_\+already\+\_\+taken}} (char \texorpdfstring{$\ast$}{*}name, int dir\+\_\+index, \mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
|
|
\begin{DoxyCompactList}\small\item\em Détermine si une chaîne textuelle de nommage est déjà enregistrée dans les entrées du répertoire ciblé. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_ae99a488757a20d04370d00dd36dcd605}{do\+\_\+touch}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, char \texorpdfstring{$\ast$}{*}filepath)
|
|
\begin{DoxyCompactList}\small\item\em Commande système {\ttfamily touch}. Crée un nouveau fichier vide à l\textquotesingle{}emplacement indiqué. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a69cc37c23ee36cbf476280a13b83276b}{do\+\_\+mkdir}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, char \texorpdfstring{$\ast$}{*}dirpath)
|
|
\begin{DoxyCompactList}\small\item\em Commande système {\ttfamily mkdir}. Génère une arborescence de sous-\/répertoire d\textquotesingle{}après un chemin fourni. \end{DoxyCompactList}\item
|
|
void \mbox{\hyperlink{disk_8c_ae47207456dba126fc3321d8d39a07d6e}{write\+\_\+in\+\_\+file}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, int file\+\_\+index, char \texorpdfstring{$\ast$}{*}data, char mode)
|
|
\begin{DoxyCompactList}\small\item\em Injecte du contenu texte dans le premier bloc alloué d\textquotesingle{}un inode fichier selon deux modes d\textquotesingle{}écriture. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a613bddcfeda22d0c295b6d9174386ab6}{get\+\_\+number\+\_\+of\+\_\+free\+\_\+blocs}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
|
|
\begin{DoxyCompactList}\small\item\em Calcule le volume de stockage disponible en comptabilisant le nombre de blocs non possédés. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a1f21a0af7127bb009470fa8333930c17}{get\+\_\+number\+\_\+of\+\_\+inode\+\_\+left}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
|
|
\begin{DoxyCompactList}\small\item\em Mesure la quantité d\textquotesingle{}inodes résiduels disponibles au sein de la table d\textquotesingle{}inodes globale. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a31d16b7fcc1b8c0cfc7651c86d233bd5}{do\+\_\+df}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
|
|
\begin{DoxyCompactList}\small\item\em Commande système {\ttfamily df}. Affiche les statistiques d\textquotesingle{}utilisation de l\textquotesingle{}espace disque et des inodes. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a6f69e1d7bb5d136f816149887845e9c8}{find\+\_\+dir\+\_\+inode\+\_\+by\+\_\+name}} (char \texorpdfstring{$\ast$}{*}name, int dir\+\_\+index, \mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
|
|
\begin{DoxyCompactList}\small\item\em Parcourt les entrées d\textquotesingle{}un répertoire pour extraire l\textquotesingle{}ID numérique de l\textquotesingle{}inode correspondant à un nom donné. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a9db73bc21d502f4b9231a7366070fcad}{do\+\_\+ls}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, char \texorpdfstring{$\ast$}{*}path)
|
|
\begin{DoxyCompactList}\small\item\em Commande système {\ttfamily ls}. Liste l\textquotesingle{}ensemble des éléments compris dans un répertoire. \end{DoxyCompactList}\item
|
|
char \texorpdfstring{$\ast$}{*} \mbox{\hyperlink{disk_8c_a35dd02a9671bb584317b099516eb46be}{read\+\_\+in\+\_\+file}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, int file\+\_\+index)
|
|
\begin{DoxyCompactList}\small\item\em Extrait et copie l\textquotesingle{}intégralité du texte stocké dans le premier bloc de données d\textquotesingle{}un fichier. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_a6715a2ff0198e20d4596d140784d633b}{do\+\_\+cat}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}\mbox{\hyperlink{structdisk}{disk}}, char \texorpdfstring{$\ast$}{*}path\+\_\+to\+\_\+file)
|
|
\begin{DoxyCompactList}\small\item\em Commande système {\ttfamily cat}. Affiche le contenu d\textquotesingle{}un fichier ou redirige l\textquotesingle{}entrée standard. \end{DoxyCompactList}\item
|
|
int \mbox{\hyperlink{disk_8c_ae1bed71dffe181556a19024ae600412f}{redirect\+\_\+out}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d, int mode, char \texorpdfstring{$\ast$}{*}file, int in)
|
|
\begin{DoxyCompactList}\small\item\em Redirige le flux de données lu depuis un descripteur d\textquotesingle{}entrée vers un fichier spécifié de notre SGF. \end{DoxyCompactList}\item
|
|
\mbox{\hyperlink{structdisk}{disk}} \mbox{\hyperlink{disk_8c_a7eb10c7006ff648d851b15f24e4305c3}{create\+\_\+disk}} ()
|
|
\begin{DoxyCompactList}\small\item\em Formate et initialise un tout nouveau disque virtuel brut nommé "{}disk"{} sur le support hôte. \end{DoxyCompactList}\item
|
|
\mbox{\hyperlink{structdisk}{disk}} \mbox{\hyperlink{disk_8c_a0410aa30c92de7cca42080e61d4dcd91}{open\+\_\+disk}} (char \texorpdfstring{$\ast$}{*}filename)
|
|
\begin{DoxyCompactList}\small\item\em Ouvre un fichier conteneur physique existant sur le système hôte pour charger sa structure logique en mémoire RAM. \end{DoxyCompactList}\item
|
|
void \mbox{\hyperlink{disk_8c_ad6626984368788d12c01f0dffe24d4ea}{persist\+\_\+on\+\_\+disk}} (\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}d)
|
|
\begin{DoxyCompactList}\small\item\em Synchronise (sauvegarde) l\textquotesingle{}arborescence logique en mémoire vive dans le conteneur physique "{}disk"{}. \end{DoxyCompactList}\end{DoxyCompactItemize}
|
|
|
|
|
|
\doxysubsection{Detailed Description}
|
|
Implémentation des primitives de bas niveau et des commandes du Système de Gestion de Fichiers (SGF).
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item Ce fichier regroupe l\textquotesingle{}ensemble des fonctions de manipulation de la table d\textquotesingle{}inodes, de gestion de l\textquotesingle{}espace disque (blocs libres) et l\textquotesingle{}implémentation des commandes systèmes standard (ls, mkdir, rm, touch, cat, df).
|
|
\end{DoxyItemize}
|
|
|
|
\doxysubsection{Function Documentation}
|
|
\Hypertarget{disk_8c_afc37d4fbfdaabb22dd4865848a799887}\label{disk_8c_afc37d4fbfdaabb22dd4865848a799887}
|
|
\index{disk.c@{disk.c}!allocate\_node@{allocate\_node}}
|
|
\index{allocate\_node@{allocate\_node}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{allocate\_node()}{allocate\_node()}}
|
|
{\footnotesize\ttfamily int allocate\+\_\+node (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk, }\item[{\mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}}]{parent, }\item[{char \texorpdfstring{$\ast$}{*}}]{name, }\item[{char}]{type }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Alloue un nouvel inode et met à jour les liaisons structurelles dans le répertoire parent.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item Cette fonction bas niveau réalise l\textquotesingle{}équivalent d\textquotesingle{}une allocation de nœud d\textquotesingle{}index \+: recherche d\textquotesingle{}un inode libre, recherche d\textquotesingle{}un bloc de données libre, inscription du couple {\ttfamily \mbox{[}Nom, ID Inode\mbox{]}} dans le parent, et appel à l\textquotesingle{}initialisation.
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em disk} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em parent} & Pointeur vers l\textquotesingle{}inode du répertoire parent devant accueillir la référence. \\
|
|
\hline
|
|
{\em name} & Nom textuel de la nouvelle entrée. \\
|
|
\hline
|
|
{\em type} & Type de fichier à créer (TYPE\+\_\+\+FILE, TYPE\+\_\+\+DIRECTORY). \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int L\textquotesingle{}indice du nouvel inode créé avec succès, ou -\/1 en cas d\textquotesingle{}erreur (Inodes pleins, Disque plein, Répertoire parent saturé).
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a147b2f811e195cee380e7ecd8b9b19e0}\label{disk_8c_a147b2f811e195cee380e7ecd8b9b19e0}
|
|
\index{disk.c@{disk.c}!check\_if\_name\_is\_already\_taken@{check\_if\_name\_is\_already\_taken}}
|
|
\index{check\_if\_name\_is\_already\_taken@{check\_if\_name\_is\_already\_taken}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{check\_if\_name\_is\_already\_taken()}{check\_if\_name\_is\_already\_taken()}}
|
|
{\footnotesize\ttfamily int check\+\_\+if\+\_\+name\+\_\+is\+\_\+already\+\_\+taken (\begin{DoxyParamCaption}\item[{char \texorpdfstring{$\ast$}{*}}]{name, }\item[{int}]{dir\+\_\+index, }\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Détermine si une chaîne textuelle de nommage est déjà enregistrée dans les entrées du répertoire ciblé.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em name} & Chaîne de caractères (Nom recherché). \\
|
|
\hline
|
|
{\em dir\+\_\+index} & Identifiant numérique de l\textquotesingle{}inode de répertoire à examiner. \\
|
|
\hline
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 si le nom existe déjà (conflit de nom), 0 si le nom est disponible, -\/1 en cas d\textquotesingle{}index invalide.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_ab1bd0d9ea50c88f8b9268cf79be4a5d4}\label{disk_8c_ab1bd0d9ea50c88f8b9268cf79be4a5d4}
|
|
\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 int 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})}
|
|
|
|
|
|
|
|
Conçoit un sous-\/répertoire complet et initialise ses entrées auto-\/référentielles ({\ttfamily .} et {\ttfamily ..}).
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em disk} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em parent} & Pointeur vers l\textquotesingle{}inode du dossier parent. \\
|
|
\hline
|
|
{\em dirname} & Nom du nouveau dossier. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int L\textquotesingle{}indice du nouvel inode de dossier créé, ou -\/1 en cas d\textquotesingle{}erreur d\textquotesingle{}écriture ou d\textquotesingle{}allocation.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\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})}
|
|
|
|
|
|
|
|
Formate et initialise un tout nouveau disque virtuel brut nommé "{}disk"{} sur le support hôte.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item Cette fonction crée la structure logique de base \+: vidage des tables, initialisation de la racine {\ttfamily /}, création automatique des liens auto-\/référencés {\ttfamily .} et {\ttfamily ..} sur le bloc 0, et génération d\textquotesingle{}un fichier de test.
|
|
\item \begin{DoxyReturn}{Returns}
|
|
disk La structure de données mémoire représentant le disque nouvellement formaté.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a68a10bc46f98c1f3577d7b29d87d2cc7}\label{disk_8c_a68a10bc46f98c1f3577d7b29d87d2cc7}
|
|
\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 int 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})}
|
|
|
|
|
|
|
|
Précise la création d\textquotesingle{}un nœud d\textquotesingle{}index typé comme Fichier Régulier ({\ttfamily TYPE\+\_\+\+FILE}).
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em disk} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em parent} & Pointeur vers l\textquotesingle{}inode du dossier parent. \\
|
|
\hline
|
|
{\em filename} & Nom du fichier à concevoir. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int L\textquotesingle{}ID du nouvel inode, ou -\/1 si l\textquotesingle{}allocation échoue.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a6715a2ff0198e20d4596d140784d633b}\label{disk_8c_a6715a2ff0198e20d4596d140784d633b}
|
|
\index{disk.c@{disk.c}!do\_cat@{do\_cat}}
|
|
\index{do\_cat@{do\_cat}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{do\_cat()}{do\_cat()}}
|
|
{\footnotesize\ttfamily int do\+\_\+cat (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk, }\item[{char \texorpdfstring{$\ast$}{*}}]{path\+\_\+to\+\_\+file }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Commande système {\ttfamily cat}. Affiche le contenu d\textquotesingle{}un fichier ou redirige l\textquotesingle{}entrée standard.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em disk} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em path\+\_\+to\+\_\+file} & Chemin vers le fichier à lire. Si NULL, la fonction affiche en boucle le flux de l\textquotesingle{}entrée standard. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 en cas de succès, -\/1 s\textquotesingle{}il s\textquotesingle{}agit d\textquotesingle{}un répertoire.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a31d16b7fcc1b8c0cfc7651c86d233bd5}\label{disk_8c_a31d16b7fcc1b8c0cfc7651c86d233bd5}
|
|
\index{disk.c@{disk.c}!do\_df@{do\_df}}
|
|
\index{do\_df@{do\_df}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{do\_df()}{do\_df()}}
|
|
{\footnotesize\ttfamily int do\+\_\+df (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Commande système {\ttfamily df}. Affiche les statistiques d\textquotesingle{}utilisation de l\textquotesingle{}espace disque et des inodes.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int Retourne 0 systématiquement après l\textquotesingle{}affichage sur la sortie standard.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a9db73bc21d502f4b9231a7366070fcad}\label{disk_8c_a9db73bc21d502f4b9231a7366070fcad}
|
|
\index{disk.c@{disk.c}!do\_ls@{do\_ls}}
|
|
\index{do\_ls@{do\_ls}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{do\_ls()}{do\_ls()}}
|
|
{\footnotesize\ttfamily int do\+\_\+ls (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{char \texorpdfstring{$\ast$}{*}}]{path }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Commande système {\ttfamily ls}. Liste l\textquotesingle{}ensemble des éléments compris dans un répertoire.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item Cette fonction colore la sortie selon le type de fichier rencontré (Vert pour un fichier, Bleu pour un dossier).
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em path} & Optionnel \+: chemin vers le dossier à lister. Si NULL, utilise la variable d\textquotesingle{}environnement PWD. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 en cas de succès, -\/1 si le répertoire n\textquotesingle{}existe pas ou s\textquotesingle{}il s\textquotesingle{}agit d\textquotesingle{}un fichier classique.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a69cc37c23ee36cbf476280a13b83276b}\label{disk_8c_a69cc37c23ee36cbf476280a13b83276b}
|
|
\index{disk.c@{disk.c}!do\_mkdir@{do\_mkdir}}
|
|
\index{do\_mkdir@{do\_mkdir}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{do\_mkdir()}{do\_mkdir()}}
|
|
{\footnotesize\ttfamily int do\+\_\+mkdir (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{char \texorpdfstring{$\ast$}{*}}]{dirpath }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Commande système {\ttfamily mkdir}. Génère une arborescence de sous-\/répertoire d\textquotesingle{}après un chemin fourni.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em dirpath} & Chemin logique qualifiant le nouveau dossier. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 0 en cas de succès, -\/1 en cas d\textquotesingle{}erreur de cheminement ou si le répertoire est déjà pris.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_ab892860e63632cdcf960c65b314772b9}\label{disk_8c_ab892860e63632cdcf960c65b314772b9}
|
|
\index{disk.c@{disk.c}!do\_rm@{do\_rm}}
|
|
\index{do\_rm@{do\_rm}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{do\_rm()}{do\_rm()}}
|
|
{\footnotesize\ttfamily int do\+\_\+rm (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk, }\item[{char \texorpdfstring{$\ast$}{*}}]{filepath }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Commande système {\ttfamily rm}. Supprime un fichier classique ou un lien symbolique.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em disk} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em filepath} & Chemin vers le fichier cible à supprimer. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 0 en cas de succès, -\/1 en cas d\textquotesingle{}erreur d\textquotesingle{}accès ou s\textquotesingle{}il s\textquotesingle{}agit d\textquotesingle{}un répertoire.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_af10807a70b9341c379973247c446824e}\label{disk_8c_af10807a70b9341c379973247c446824e}
|
|
\index{disk.c@{disk.c}!do\_rmdir@{do\_rmdir}}
|
|
\index{do\_rmdir@{do\_rmdir}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{do\_rmdir()}{do\_rmdir()}}
|
|
{\footnotesize\ttfamily int do\+\_\+rmdir (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk, }\item[{char \texorpdfstring{$\ast$}{*}}]{filepath }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Commande système {\ttfamily rmdir}. Supprime un répertoire vide identifié par son chemin absolu.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em disk} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em filepath} & Chemin absolu menant au répertoire à supprimer. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 0 en cas de succès, -\/1 en cas d\textquotesingle{}erreur de chemin, si le dossier n\textquotesingle{}est pas vide, ou s\textquotesingle{}il n\textquotesingle{}existe pas.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_ae99a488757a20d04370d00dd36dcd605}\label{disk_8c_ae99a488757a20d04370d00dd36dcd605}
|
|
\index{disk.c@{disk.c}!do\_touch@{do\_touch}}
|
|
\index{do\_touch@{do\_touch}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{do\_touch()}{do\_touch()}}
|
|
{\footnotesize\ttfamily int do\+\_\+touch (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{char \texorpdfstring{$\ast$}{*}}]{filepath }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Commande système {\ttfamily touch}. Crée un nouveau fichier vide à l\textquotesingle{}emplacement indiqué.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item \begin{DoxyNote}{Note}
|
|
Si le nom existe déjà, une erreur est renvoyée (le comportement diffère du touch Unix classique).
|
|
\end{DoxyNote}
|
|
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em filepath} & Chemin complet d\textquotesingle{}accès au fichier à générer. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 0 en cas de succès, -\/1 si le chemin intermédiaire n\textquotesingle{}existe pas ou si le nom est indisponible.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a6f69e1d7bb5d136f816149887845e9c8}\label{disk_8c_a6f69e1d7bb5d136f816149887845e9c8}
|
|
\index{disk.c@{disk.c}!find\_dir\_inode\_by\_name@{find\_dir\_inode\_by\_name}}
|
|
\index{find\_dir\_inode\_by\_name@{find\_dir\_inode\_by\_name}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{find\_dir\_inode\_by\_name()}{find\_dir\_inode\_by\_name()}}
|
|
{\footnotesize\ttfamily int find\+\_\+dir\+\_\+inode\+\_\+by\+\_\+name (\begin{DoxyParamCaption}\item[{char \texorpdfstring{$\ast$}{*}}]{name, }\item[{int}]{dir\+\_\+index, }\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Parcourt les entrées d\textquotesingle{}un répertoire pour extraire l\textquotesingle{}ID numérique de l\textquotesingle{}inode correspondant à un nom donné.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em name} & Nom de l\textquotesingle{}élément recherché au sein du dossier. \\
|
|
\hline
|
|
{\em dir\+\_\+index} & Index du nœud d\textquotesingle{}index du répertoire de recherche. \\
|
|
\hline
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int L\textquotesingle{}index numérique de l\textquotesingle{}inode trouvé, ou -\/1 en cas d\textquotesingle{}erreur ou d\textquotesingle{}absence.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\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})}
|
|
|
|
|
|
|
|
Parcourt le vecteur d\textquotesingle{}allocation pour trouver et réserver le premier bloc libre détecté.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int L\textquotesingle{}indice du bloc libre alloué, ou -\/1 si le disque est saturé (Disk Full).
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\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})}
|
|
|
|
|
|
|
|
Calcule la première position disponible (offset en octets) au sein d\textquotesingle{}un bloc parent de type répertoire.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item Le calcul repose sur une analyse séquentielle par pas de taille fixe {\ttfamily (MAX\+\_\+\+INODE\+\_\+\+NAME + sizeof(int))}. Une entrée est considérée libre si son premier caractère est \textquotesingle{}\textbackslash{}0\textquotesingle{}.
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em parent\+\_\+bloc} & Pointeur vers le bloc de données du répertoire parent. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int L\textquotesingle{}offset en octets par rapport au début du bloc, ou -\/1 si le bloc est complet.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a613bddcfeda22d0c295b6d9174386ab6}\label{disk_8c_a613bddcfeda22d0c295b6d9174386ab6}
|
|
\index{disk.c@{disk.c}!get\_number\_of\_free\_blocs@{get\_number\_of\_free\_blocs}}
|
|
\index{get\_number\_of\_free\_blocs@{get\_number\_of\_free\_blocs}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{get\_number\_of\_free\_blocs()}{get\_number\_of\_free\_blocs()}}
|
|
{\footnotesize\ttfamily int get\+\_\+number\+\_\+of\+\_\+free\+\_\+blocs (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Calcule le volume de stockage disponible en comptabilisant le nombre de blocs non possédés.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int Le nombre total de blocs libres.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a1f21a0af7127bb009470fa8333930c17}\label{disk_8c_a1f21a0af7127bb009470fa8333930c17}
|
|
\index{disk.c@{disk.c}!get\_number\_of\_inode\_left@{get\_number\_of\_inode\_left}}
|
|
\index{get\_number\_of\_inode\_left@{get\_number\_of\_inode\_left}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{get\_number\_of\_inode\_left()}{get\_number\_of\_inode\_left()}}
|
|
{\footnotesize\ttfamily int get\+\_\+number\+\_\+of\+\_\+inode\+\_\+left (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Mesure la quantité d\textquotesingle{}inodes résiduels disponibles au sein de la table d\textquotesingle{}inodes globale.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int Le nombre d\textquotesingle{}inodes libres (dont le type est égal à TYPE\+\_\+\+NULL).
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\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})}
|
|
|
|
|
|
|
|
Initialise les métadonnées d\textquotesingle{}un inode spécifique directement sur le disque.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers la structure représentant le disque virtuel. \\
|
|
\hline
|
|
{\em inode\+\_\+index} & Indice de la table d\textquotesingle{}inodes à initialiser. \\
|
|
\hline
|
|
{\em filetype} & Type à attribuer à l\textquotesingle{}inode (TYPE\+\_\+\+FILE, TYPE\+\_\+\+DIRECTORY, etc.). \\
|
|
\hline
|
|
{\em perms} & Permissions d\textquotesingle{}accès sous forme de masque binaire (ex\+: 0b111111111). \\
|
|
\hline
|
|
{\em owned\+\_\+bloc} & Indice du premier bloc de données associé à cet inode. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int Retourne 0 en cas de succès, -\/1 si l\textquotesingle{}inode ciblé est déjà utilisé (type différent de TYPE\+\_\+\+NULL).
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_ad449fb17ffb0311c29836bb27b09d14e}\label{disk_8c_ad449fb17ffb0311c29836bb27b09d14e}
|
|
\index{disk.c@{disk.c}!is\_dir\_empty@{is\_dir\_empty}}
|
|
\index{is\_dir\_empty@{is\_dir\_empty}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{is\_dir\_empty()}{is\_dir\_empty()}}
|
|
{\footnotesize\ttfamily int is\+\_\+dir\+\_\+empty (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{int}]{bloc\+\_\+index }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Vérifie si un bloc de répertoire donné est vide.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item Un répertoire est jugé vide s\textquotesingle{}il ne contient aucune autre entrée que les pointeurs système obligatoires de navigation "{}."{} et "{}.."{}.
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em bloc\+\_\+index} & Indice du bloc de données associé au répertoire à analyser. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 si le répertoire est vide, 0 s\textquotesingle{}il contient au moins un sous-\/élément actif.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a3817714a1f4d5a69d2962eb1ae0a49a5}\label{disk_8c_a3817714a1f4d5a69d2962eb1ae0a49a5}
|
|
\index{disk.c@{disk.c}!is\_file\_empty@{is\_file\_empty}}
|
|
\index{is\_file\_empty@{is\_file\_empty}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{is\_file\_empty()}{is\_file\_empty()}}
|
|
{\footnotesize\ttfamily int is\+\_\+file\+\_\+empty (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{int}]{bloc\+\_\+index }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Scanne l\textquotesingle{}intégralité d\textquotesingle{}un bloc de fichier pour valider s\textquotesingle{}il ne comporte que des zéros.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em bloc\+\_\+index} & Indice du bloc à analyser. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 si le fichier ne contient aucune donnée (rempli de zéros), 0 sinon.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\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})}
|
|
|
|
|
|
|
|
Ouvre un fichier conteneur physique existant sur le système hôte pour charger sa structure logique en mémoire RAM.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em filename} & Chaîne de caractères qualifiant l\textquotesingle{}emplacement du fichier fichier-\/disque (généralement "{}disk"{}). \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
disk La structure mémoire complétée par la lecture brute sérialisée.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_ad6626984368788d12c01f0dffe24d4ea}\label{disk_8c_ad6626984368788d12c01f0dffe24d4ea}
|
|
\index{disk.c@{disk.c}!persist\_on\_disk@{persist\_on\_disk}}
|
|
\index{persist\_on\_disk@{persist\_on\_disk}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{persist\_on\_disk()}{persist\_on\_disk()}}
|
|
{\footnotesize\ttfamily void persist\+\_\+on\+\_\+disk (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Synchronise (sauvegarde) l\textquotesingle{}arborescence logique en mémoire vive dans le conteneur physique "{}disk"{}.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers la structure mémoire globale à sérialiser sur le disque dur réel. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a35dd02a9671bb584317b099516eb46be}\label{disk_8c_a35dd02a9671bb584317b099516eb46be}
|
|
\index{disk.c@{disk.c}!read\_in\_file@{read\_in\_file}}
|
|
\index{read\_in\_file@{read\_in\_file}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{read\_in\_file()}{read\_in\_file()}}
|
|
{\footnotesize\ttfamily char \texorpdfstring{$\ast$}{*} read\+\_\+in\+\_\+file (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{int}]{file\+\_\+index }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Extrait et copie l\textquotesingle{}intégralité du texte stocké dans le premier bloc de données d\textquotesingle{}un fichier.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item \begin{DoxyWarning}{Warning}
|
|
Alloue dynamiquement de la mémoire via {\ttfamily malloc}. C\textquotesingle{}est à la fonction appelante de libérer la ressource.
|
|
\end{DoxyWarning}
|
|
\begin{DoxyRefDesc}{Todo}
|
|
\item[\mbox{\hyperlink{todo__todo000001}{Todo}}]Prendre en charge le parcours chaîné de l\textquotesingle{}ensemble des blocs possédés par l\textquotesingle{}inode, pas uniquement le premier.\end{DoxyRefDesc}
|
|
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em file\+\_\+index} & Identifiant numérique de l\textquotesingle{}inode de type fichier. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
char\texorpdfstring{$\ast$}{*} Un pointeur vers le tampon contenant la chaîne extraite, ou NULL en cas de typage incorrect.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_ae1bed71dffe181556a19024ae600412f}\label{disk_8c_ae1bed71dffe181556a19024ae600412f}
|
|
\index{disk.c@{disk.c}!redirect\_out@{redirect\_out}}
|
|
\index{redirect\_out@{redirect\_out}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{redirect\_out()}{redirect\_out()}}
|
|
{\footnotesize\ttfamily int redirect\+\_\+out (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{int}]{mode, }\item[{char \texorpdfstring{$\ast$}{*}}]{file, }\item[{int}]{in }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Redirige le flux de données lu depuis un descripteur d\textquotesingle{}entrée vers un fichier spécifié de notre SGF.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item Si le fichier existe déjà, le contenu est soit écrasé, soit complété selon la valeur du paramètre {\ttfamily mode}. S\textquotesingle{}il n\textquotesingle{}existe pas, un fichier classique est automatiquement créé dans son répertoire d\textquotesingle{}appartenance.
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em mode} & Mode d\textquotesingle{}ouverture \+: 0 pour écraser ({\ttfamily \texorpdfstring{$>$}{>}}), 1 pour ajouter à la fin ({\ttfamily \texorpdfstring{$>$}{>}\texorpdfstring{$>$}{>}}). \\
|
|
\hline
|
|
{\em file} & Nom ou chemin du fichier cible devant intercepter le flux. \\
|
|
\hline
|
|
{\em in} & Descripteur d\textquotesingle{}écriture d\textquotesingle{}entrée (Pipe, stdin, etc.) depuis lequel lire les octets. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 après écriture réussie et synchronisation sur le support physique, -\/1 en cas d\textquotesingle{}échec de chemin.
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_a8a8845ddf7dc88a527775a335100697e}\label{disk_8c_a8a8845ddf7dc88a527775a335100697e}
|
|
\index{disk.c@{disk.c}!remove\_inode@{remove\_inode}}
|
|
\index{remove\_inode@{remove\_inode}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{remove\_inode()}{remove\_inode()}}
|
|
{\footnotesize\ttfamily int remove\+\_\+inode (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{disk, }\item[{\mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}}]{parent, }\item[{\mbox{\hyperlink{structinode}{inode}} \texorpdfstring{$\ast$}{*}}]{inode\+\_\+to\+\_\+remove, }\item[{int}]{inode\+\_\+to\+\_\+remove\+\_\+idx }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Supprime physiquement un inode, libère ses ressources blocs et efface sa référence chez son parent.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em disk} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em parent} & Pointeur vers l\textquotesingle{}inode du répertoire parent. \\
|
|
\hline
|
|
{\em inode\+\_\+to\+\_\+remove} & Pointeur vers l\textquotesingle{}inode devant être détruit. \\
|
|
\hline
|
|
{\em inode\+\_\+to\+\_\+remove\+\_\+idx} & Index numérique de l\textquotesingle{}inode à détruire dans la table des inodes. \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
\begin{DoxyReturn}{Returns}
|
|
int 1 en cas de suppression réussie, -\/1 si l\textquotesingle{}opération est interdite (tentative de suppression de la racine ou erreur d\textquotesingle{}index parent).
|
|
\end{DoxyReturn}
|
|
|
|
\end{DoxyItemize}\Hypertarget{disk_8c_ae47207456dba126fc3321d8d39a07d6e}\label{disk_8c_ae47207456dba126fc3321d8d39a07d6e}
|
|
\index{disk.c@{disk.c}!write\_in\_file@{write\_in\_file}}
|
|
\index{write\_in\_file@{write\_in\_file}!disk.c@{disk.c}}
|
|
\doxysubsubsection{\texorpdfstring{write\_in\_file()}{write\_in\_file()}}
|
|
{\footnotesize\ttfamily void write\+\_\+in\+\_\+file (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{structdisk}{disk}} \texorpdfstring{$\ast$}{*}}]{d, }\item[{int}]{file\+\_\+index, }\item[{char \texorpdfstring{$\ast$}{*}}]{data, }\item[{char}]{mode }\end{DoxyParamCaption})}
|
|
|
|
|
|
|
|
Injecte du contenu texte dans le premier bloc alloué d\textquotesingle{}un inode fichier selon deux modes d\textquotesingle{}écriture.
|
|
|
|
|
|
\begin{DoxyItemize}
|
|
\item
|
|
\begin{DoxyParams}{Parameters}
|
|
{\em d} & Pointeur vers le disque virtuel. \\
|
|
\hline
|
|
{\em file\+\_\+index} & Index numérique de l\textquotesingle{}inode cible. \\
|
|
\hline
|
|
{\em data} & Pointeur vers le buffer de chaînes textuelles à enregistrer. \\
|
|
\hline
|
|
{\em mode} & Sélection de comportement \+: 0 pour écraser ({\ttfamily \texorpdfstring{$>$}{>}}), toute autre valeur pour concaténer à la fin ({\ttfamily \texorpdfstring{$>$}{>}\texorpdfstring{$>$}{>}}). \\
|
|
\hline
|
|
\end{DoxyParams}
|
|
|
|
\end{DoxyItemize} |