Skip to content

Commit d012bf8

Browse files
Add footnote on file_operations API changes
The main text's 'struct file_operations' example is intentionally kept at the v5.4 LTS version to ensure compatibility with the guide's code. To bridge the gap with modern kernels, a new footnote is introduced. It summarizes the evolution of the struct up to Linux v6.12, documenting key additions, removals, and modifications to its members. This provides crucial context for readers working with newer kernel versions. Co-authored-by: EricccTaiwan <[email protected]>
1 parent b9ed1a7 commit d012bf8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lkmpg.tex

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,18 @@ \subsection{The file\_operations Structure}
956956
Some operations are not implemented by a driver.
957957
For example, a driver that handles a video card will not need to read from a directory structure.
958958
The corresponding entries in the \cpp|file_operations| structure should be set to \cpp|NULL|.
959+
\footnote{
960+
As of Linux kernel 6.12, several member fields have been added or removed, or had their prototypes changed:
961+
\begin{itemize}
962+
\item Added: \texttt{fop\_flags}, \texttt{splice\_eof}, \texttt{uring\_cmd}, \texttt{uring\_cmd\_iopoll}, \texttt{mmap\_capabilities}
963+
\item Removed: \texttt{iterate}, \texttt{sendpage}, \texttt{mmap\_supported\_flags} (!CONFIG\_MMU)
964+
\item Modified:
965+
\begin{itemize}
966+
\item \texttt{iopoll} now takes \texttt{struct io\_comp\_batch *} and \texttt{unsigned int flag}
967+
\item \texttt{setlease} now uses \texttt{struct file\_lease **} and \texttt{int} instead of \texttt{long}
968+
\end{itemize}
969+
\end{itemize}
970+
}
959971

960972
There is a gcc extension that makes assigning to this structure more convenient.
961973
You will see it in modern drivers, and may catch you by surprise.

0 commit comments

Comments
 (0)