geom.h (92108) | geom.h (92403) |
---|---|
1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * | 1/*- 2 * Copyright (c) 2002 Poul-Henning Kamp 3 * Copyright (c) 2002 Networks Associates Technology, Inc. 4 * All rights reserved. 5 * 6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp 7 * and NAI Labs, the Security Research Division of Network Associates, Inc. 8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the --- 18 unchanged lines hidden (view full) --- 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * |
35 * $FreeBSD: head/sys/geom/geom.h 92108 2002-03-11 21:42:35Z phk $ | 35 * $FreeBSD: head/sys/geom/geom.h 92403 2002-03-16 09:24:19Z phk $ |
36 */ 37 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <sys/sx.h> 41#include <sys/queue.h> 42 43#ifndef _KERNEL --- 198 unchanged lines hidden (view full) --- 242void g_io_schedule_up(struct thread *tp); 243int g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr, struct thread *tp); 244struct bio *g_new_bio(void); 245void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error); 246 247/* geom_kern.c / geom_kernsim.c */ 248void g_init(void); 249 | 36 */ 37 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <sys/sx.h> 41#include <sys/queue.h> 42 43#ifndef _KERNEL --- 198 unchanged lines hidden (view full) --- 242void g_io_schedule_up(struct thread *tp); 243int g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr, struct thread *tp); 244struct bio *g_new_bio(void); 245void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error); 246 247/* geom_kern.c / geom_kernsim.c */ 248void g_init(void); 249 |
250struct g_ioctl { 251 u_long cmd; 252 void *data; 253 int fflag; 254 struct thread *td; 255}; |
|
250 251#ifdef _KERNEL 252 253MALLOC_DECLARE(M_GEOM); 254 255static __inline void * 256g_malloc(int size, int flags) 257{ --- 9 unchanged lines hidden (view full) --- 267g_free(void *ptr) 268{ 269 mtx_lock(&Giant); 270 free(ptr, M_GEOM); 271 mtx_unlock(&Giant); 272} 273 274extern struct sx topology_lock; | 256 257#ifdef _KERNEL 258 259MALLOC_DECLARE(M_GEOM); 260 261static __inline void * 262g_malloc(int size, int flags) 263{ --- 9 unchanged lines hidden (view full) --- 273g_free(void *ptr) 274{ 275 mtx_lock(&Giant); 276 free(ptr, M_GEOM); 277 mtx_unlock(&Giant); 278} 279 280extern struct sx topology_lock; |
275#define g_topology_lock() sx_xlock(&topology_lock) | 281#define g_topology_lock() do { mtx_assert(&Giant, MA_NOTOWNED); sx_xlock(&topology_lock); } while (0) |
276#define g_topology_unlock() sx_xunlock(&topology_lock) 277#define g_topology_assert() sx_assert(&topology_lock, SX_XLOCKED) 278 279#define DECLARE_GEOM_METHOD(method, name) \ 280 static void \ 281 name##init(void) \ 282 { \ 283 mtx_unlock(&Giant); \ 284 g_add_method(&method); \ 285 mtx_lock(&Giant); \ 286 } \ 287 SYSINIT(name, SI_SUB_PSEUDO, SI_ORDER_FIRST, name##init, NULL); 288 289#endif 290 | 282#define g_topology_unlock() sx_xunlock(&topology_lock) 283#define g_topology_assert() sx_assert(&topology_lock, SX_XLOCKED) 284 285#define DECLARE_GEOM_METHOD(method, name) \ 286 static void \ 287 name##init(void) \ 288 { \ 289 mtx_unlock(&Giant); \ 290 g_add_method(&method); \ 291 mtx_lock(&Giant); \ 292 } \ 293 SYSINIT(name, SI_SUB_PSEUDO, SI_ORDER_FIRST, name##init, NULL); 294 295#endif 296 |