\section{Filesystems}

\begin{frame}[fragile]
  \frametitle{Operations structures}
\begin{verbatim}
const struct file_operations ext2_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = do_sync_read,
        .write          = do_sync_write,
        .aio_read       = generic_file_aio_read,
        .aio_write      = generic_file_aio_write,
        .unlocked_ioctl = ext2_ioctl,
#ifdef CONFIG_COMPAT
        .compat_ioctl   = ext2_compat_ioctl,
#endif
        .mmap           = generic_file_mmap,
        .open           = generic_file_open,
        .release        = ext2_release_file,
        .fsync          = ext2_sync_file,
        .splice_read    = generic_file_splice_read,
        .splice_write   = generic_file_splice_write,
};
\end{verbatim}
\end{frame}

\begin{frame}[fragile]
  \frametitle{Using operations structures}
  \begin{semiverbatim}
struct file \{
  \ldots
  unsigned int f\_uid, f\_gid;
  mode\_t f\_mode;
  struct path f\_path;
  const struct file\_operations *f\_op;
  \ldots
\}
  \verb+ret = file->f_op->read(file, buf, count, pos);+
  \end{semiverbatim}
  \begin{itemize}
  \item \texttt{inode\_operations}
  \item \texttt{super\_operations}
  \item \texttt{address\_space\_operations}
  \item \texttt{security\_operations}
  \item \texttt{paravirt\_ops}
  \end{itemize}
\end{frame}
