1292538Shselasky/*- 2359956Shselasky * Copyright (c) 2015-2020 Mellanox Technologies, Ltd. 3292538Shselasky * All rights reserved. 4292538Shselasky * 5292538Shselasky * Redistribution and use in source and binary forms, with or without 6292538Shselasky * modification, are permitted provided that the following conditions 7292538Shselasky * are met: 8292538Shselasky * 1. Redistributions of source code must retain the above copyright 9292538Shselasky * notice unmodified, this list of conditions, and the following 10292538Shselasky * disclaimer. 11292538Shselasky * 2. Redistributions in binary form must reproduce the above copyright 12292538Shselasky * notice, this list of conditions and the following disclaimer in the 13292538Shselasky * documentation and/or other materials provided with the distribution. 14292538Shselasky * 15292538Shselasky * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16292538Shselasky * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17292538Shselasky * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18292538Shselasky * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19292538Shselasky * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20292538Shselasky * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21292538Shselasky * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22292538Shselasky * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23292538Shselasky * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24292538Shselasky * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25292538Shselasky * 26292538Shselasky * $FreeBSD: stable/11/sys/compat/linuxkpi/common/include/linux/srcu.h 361924 2020-06-08 09:39:16Z hselasky $ 27292538Shselasky */ 28328653Shselasky 29292538Shselasky#ifndef _LINUX_SRCU_H_ 30292538Shselasky#define _LINUX_SRCU_H_ 31292538Shselasky 32359956Shselasky#include <linux/compiler.h> 33359956Shselasky 34292538Shselaskystruct srcu_struct { 35292538Shselasky}; 36292538Shselasky 37359956Shselasky#define srcu_dereference(p, srcu) \ 38359956Shselasky ((__typeof(*(p)) *)READ_ONCE(p)) 39292538Shselasky 40345916Shselasky#define DEFINE_STATIC_SRCU(name) \ 41359956Shselasky static struct srcu_struct name 42345916Shselasky 43328653Shselasky/* prototypes */ 44292538Shselasky 45328653Shselaskyextern int srcu_read_lock(struct srcu_struct *); 46328653Shselaskyextern void srcu_read_unlock(struct srcu_struct *, int index); 47328653Shselaskyextern void synchronize_srcu(struct srcu_struct *); 48328653Shselaskyextern void srcu_barrier(struct srcu_struct *); 49328653Shselaskyextern int init_srcu_struct(struct srcu_struct *); 50328653Shselaskyextern void cleanup_srcu_struct(struct srcu_struct *); 51292538Shselasky 52361924Shselasky#define synchronize_srcu_expedited(srcu) do { \ 53361924Shselasky synchronize_srcu(srcu); \ 54361924Shselasky} while (0) 55361924Shselasky 56292538Shselasky#endif /* _LINUX_SRCU_H_ */ 57