>From 6a9e5e96a0dd94b6f20052ab741d2606e79dc80f Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@xxxxxxxxx> Date: Tue, 22 Oct 2019 23:23:42 +0900 Subject: [PATCH v4 5/6] defer/rcuintro: Convert snippet to new scheme This snippet was added using the verbatimbox scheme. Convert it using VerbatimL. Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- Hi Paul, > With the exception of defer/rcuintro.tex, which collided with one of > my cleanups. I believe that the fix is straightforward, just accounting > for the line I added, but I figured that I should check. FWIW, this is the result of my rebase of the patch. Thanks, Akira > > Thanx, Paul -- defer/rcuintro.tex | 58 ++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/defer/rcuintro.tex b/defer/rcuintro.tex index ed7ff0b0..dc750326 100644 --- a/defer/rcuintro.tex +++ b/defer/rcuintro.tex @@ -375,50 +375,48 @@ has executed a context switch, which in turn guarantees that all pre-existing reader threads have completed. \begin{listing}[tbp] -{ \scriptsize -\begin{verbbox}[\LstLineNo] +\begin{linelabel}[ln:defer:Insertion and Deletion With Concurrent Readers] +\begin{VerbatimL}[commandchars=\\\[\]] struct route *gptr; int access_route(int (*f)(struct route *rp)) { - int ret = -1; - struct route *rp; - - rcu_read_lock(); - rp = rcu_dereference(gptr); - if (rp) - ret = f(rp); - rcu_read_unlock(); - return ret; + int ret = -1; + struct route *rp; + + rcu_read_lock(); + rp = rcu_dereference(gptr); + if (rp) + ret = f(rp); + rcu_read_unlock(); + return ret; } struct route *ins_route(struct route *rp) { - struct route *old_rp; + struct route *old_rp; - spin_lock(&route_lock); - old_rp = gptr; - rcu_assign_pointer(gptr, rp); - spin_unlock(&route_lock); - return old_rp; + spin_lock(&route_lock); + old_rp = gptr; + rcu_assign_pointer(gptr, rp); + spin_unlock(&route_lock); + return old_rp; } int del_route(void) { - struct route *old_rp; - - spin_lock(&route_lock); - old_rp = gptr; - RCU_INIT_POINTER(gptr, NULL); - spin_unlock(&route_lock); - synchronize_rcu(); - free(old_rp); - return !!old_rp; + struct route *old_rp; + + spin_lock(&route_lock); + old_rp = gptr; + RCU_INIT_POINTER(gptr, NULL); + spin_unlock(&route_lock); + synchronize_rcu(); + free(old_rp); + return !!old_rp; } -\end{verbbox} -} -\centering -\theverbbox +\end{VerbatimL} +\end{linelabel} \caption{Insertion and Deletion With Concurrent Readers} \label{lst:defer:Insertion and Deletion With Concurrent Readers} \end{listing} -- 2.17.1