1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Basic library routines.
25 #ifndef __LIBCFS_LINUX_CFS_LOCK_H__
26 #define __LIBCFS_LINUX_CFS_LOCK_H__
28 #ifndef __LIBCFS_LIBCFS_H__
29 #error Do not #include this file directly. #include <libcfs/libcfs.h> instead
33 #include <linux/smp_lock.h>
38 * All locks' declaration are not guaranteed to be initialized,
39 * Althought some of they are initialized in Linux. All locks
40 * declared by CFS_DECL_* should be initialized explicitly.
45 * spin_lock (use Linux kernel's primitives)
52 * - spin_lock_irqsave(x, f)
53 * - spin_unlock_irqrestore(x, f)
57 * rw_semaphore (use Linux kernel's primitives)
67 * rwlock_t (use Linux kernel's primitives)
80 * - init_mutex_locked(x)
84 #define init_mutex(x) init_MUTEX(x)
85 #define init_mutex_locked(x) init_MUTEX_LOCKED(x)
86 #define mutex_up(x) up(x)
87 #define mutex_down(x) down(x)
88 #define mutex_down_trylock(x) down_trylock(x)
91 * completion (use Linux kernel's primitives)
93 * - init_complition(c)
95 * - wait_for_completion(c)
101 #include "../user-lock.h"