\section{Utilities and Conventions}

\begin{frame}[fragile]
  \frametitle{\texttt{printk}}
  \verb+printk(KERN_ERR "My pid is %d\n", current->tgid);+
\end{frame}

\begin{frame}[fragile]
  \frametitle{Linked Lists}
  Circular, doubly-linked
  \begin{verbatim}
#include <linux/list.h>
struct my_struct {
  int data;
  struct list_head list;
};
LIST_HEAD(my_list);
  \end{verbatim}
  \begin{verbatim}
void my_function(int n)
{
  struct my_struct foo = {.data = n};
  struct list_head *ptr;
  list_add(&my_struct->foo, &my_list);
  list_for_each(ptr, &my_list)
    printk("%d\n",
      list_entry(ptr, struct my_struct, list)->data);
}
  \end{verbatim}
\end{frame} 

\begin{frame}
  \frametitle{Memory Allocation}
  \begin{itemize}
  \item \texttt{kmalloc} and \texttt{kfree}
  \item Slab allocator
  \item \texttt{get\_free\_page}
  \item \texttt{vmalloc} and \texttt{vfree}
  \item \texttt{ioremap}
  \item per-cpu variables
  \end{itemize}
\end{frame}
