cam_xpt.c (300675f6fc464ea902932e6ee4aa2ac98e3f3c34) | cam_xpt.c (33a38f7453a5c2b4afca8729c081bda79afa2a44) |
---|---|
1/*- 2 * Implementation of the Common Access Method Transport (XPT) layer. 3 * 4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs. 5 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 2164 unchanged lines hidden (view full) --- 2173 periph = next_periph) { 2174 2175 2176 /* 2177 * In this case, we want to show peripherals that have been 2178 * invalidated, but not peripherals that are scheduled to 2179 * be freed. So instead of calling cam_periph_acquire(), 2180 * which will fail if the periph has been invalidated, we | 1/*- 2 * Implementation of the Common Access Method Transport (XPT) layer. 3 * 4 * Copyright (c) 1997, 1998, 1999 Justin T. Gibbs. 5 * Copyright (c) 1997, 1998, 1999 Kenneth D. Merry. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 2164 unchanged lines hidden (view full) --- 2173 periph = next_periph) { 2174 2175 2176 /* 2177 * In this case, we want to show peripherals that have been 2178 * invalidated, but not peripherals that are scheduled to 2179 * be freed. So instead of calling cam_periph_acquire(), 2180 * which will fail if the periph has been invalidated, we |
2181 * just check for the free flag here. If it is free, we 2182 * skip to the next periph. | 2181 * just check for the free flag here. If it is in the 2182 * process of being freed, we skip to the next periph. |
2183 */ 2184 if (periph->flags & CAM_PERIPH_FREE) { 2185 next_periph = SLIST_NEXT(periph, periph_links); 2186 continue; 2187 } 2188 2189 /* 2190 * Acquire a reference to this periph while we call the 2191 * traversal function, so it can't go away. 2192 */ 2193 periph->refcount++; 2194 | 2183 */ 2184 if (periph->flags & CAM_PERIPH_FREE) { 2185 next_periph = SLIST_NEXT(periph, periph_links); 2186 continue; 2187 } 2188 2189 /* 2190 * Acquire a reference to this periph while we call the 2191 * traversal function, so it can't go away. 2192 */ 2193 periph->refcount++; 2194 |
2195 xpt_unlock_buses(); 2196 | |
2197 retval = tr_func(periph, arg); 2198 2199 /* | 2195 retval = tr_func(periph, arg); 2196 2197 /* |
2200 * We need the lock for list traversal. 2201 */ 2202 xpt_lock_buses(); 2203 2204 /* | |
2205 * Grab the next peripheral before we release this one, so 2206 * our next pointer is still valid. 2207 */ 2208 next_periph = SLIST_NEXT(periph, periph_links); 2209 2210 cam_periph_release_locked_buses(periph); 2211 2212 if (retval == 0) --- 65 unchanged lines hidden (view full) --- 2278 } 2279 2280 /* 2281 * Acquire a reference to this periph while we call the 2282 * traversal function, so it can't go away. 2283 */ 2284 periph->refcount++; 2285 | 2198 * Grab the next peripheral before we release this one, so 2199 * our next pointer is still valid. 2200 */ 2201 next_periph = SLIST_NEXT(periph, periph_links); 2202 2203 cam_periph_release_locked_buses(periph); 2204 2205 if (retval == 0) --- 65 unchanged lines hidden (view full) --- 2271 } 2272 2273 /* 2274 * Acquire a reference to this periph while we call the 2275 * traversal function, so it can't go away. 2276 */ 2277 periph->refcount++; 2278 |
2286 /* 2287 * XXX KDM we have the toplogy lock here, but in 2288 * xptperiphtraverse(), we drop it before calling the 2289 * traversal function. Which is correct? 2290 */ | |
2291 retval = tr_func(periph, arg); 2292 2293 /* 2294 * Grab the next peripheral before we release this one, so 2295 * our next pointer is still valid. 2296 */ 2297 next_periph = TAILQ_NEXT(periph, unit_links); 2298 --- 2822 unchanged lines hidden --- | 2279 retval = tr_func(periph, arg); 2280 2281 /* 2282 * Grab the next peripheral before we release this one, so 2283 * our next pointer is still valid. 2284 */ 2285 next_periph = TAILQ_NEXT(periph, unit_links); 2286 --- 2822 unchanged lines hidden --- |