%------------------------------------------------------------------------------- % qcow2_reading.tex - shows how QCOW2 clusters are mapped for reading %------------------------------------------------------------------------------- % author : Manuel Bentele % date : Aug 29, 2019 % copyright: (c) 2019 Manuel Bentele %------------------------------------------------------------------------------- \begin{tikzpicture}[ arrow/.style = {-triangle 45} ] \node[inner sep = 0, anchor = north] (blkdev) at (0, 0) { \renewcommand*{\arraystretch}{1.3} \begin{tabular}{|c|} \hline \\ \hline \\ \hline \\ \hline \\ \hline \cellcolor{dat} \\ \hline \\ \hline \cellcolor{dat} \\ \hline \cellcolor{dat} \\ \hline \\ \hline \cellcolor{dat} \\ \hline \end{tabular} }; \node[inner sep = 0, anchor = north, right = of blkdev] (qcow2) { \renewcommand*{\arraystretch}{1.3} \hspace*{-0.25cm} \begin{tabular}{|c|} \hline \cellcolor{hdr}Header \\ \hline \cellcolor{ret}Refcount table \\ \hline \cellcolor{reb}Refcount block \\ \hline \cellcolor{l1t}L1~table \\ \hline \cellcolor{l2t}L2~table \\ \hline \cellcolor{dat}Data cluster \\ \hline \cellcolor{l2t}L2~table \\ \hline \cellcolor{dat}Data cluster \\ \hline \cellcolor{dat}Data cluster \\ \hline \cellcolor{dat}Data cluster \\ \hline \end{tabular} }; \draw[triangle 45-triangle 45] ($(blkdev.north west)!0!(blkdev.south west)$) -- node[left] {$O$} ($(blkdev.north west)!0.6!(blkdev.south west)$); \draw[triangle 45-triangle 45] ($(blkdev.north west)!0.6!(blkdev.south west)$) -- node[left] {$S$} ($(blkdev.north west)!0.8!(blkdev.south west)$); \node[above = 0.5 of blkdev, align = center] {Block\\device}; \node[above = 0.5 of qcow2, align = center] {QCOW2\\file format}; \draw[arrow] ($(blkdev.north east)!0.45!(blkdev.south east)$) -- ($(qcow2.north west)!0.75!(qcow2.south west)$); \draw[arrow] ($(blkdev.north east)!0.65!(blkdev.south east)$) -- ($(qcow2.north west)!0.55!(qcow2.south west)$); \draw[arrow] ($(blkdev.north east)!0.75!(blkdev.south east)$) -- ($(qcow2.north west)!0.85!(qcow2.south west)$); \draw[arrow] ($(blkdev.north east)!0.95!(blkdev.south east)$) -- ($(qcow2.north west)!0.95!(qcow2.south west)$); \end{tikzpicture}