Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
drm
ttm
ttm_lock.h
Go to the documentation of this file.
1
/**************************************************************************
2
*
3
* Copyright (c) 2007-2009 VMware, Inc., Palo Alto, CA., USA
4
* All Rights Reserved.
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a
7
* copy of this software and associated documentation files (the
8
* "Software"), to deal in the Software without restriction, including
9
* without limitation the rights to use, copy, modify, merge, publish,
10
* distribute, sub license, and/or sell copies of the Software, and to
11
* permit persons to whom the Software is furnished to do so, subject to
12
* the following conditions:
13
*
14
* The above copyright notice and this permission notice (including the
15
* next paragraph) shall be included in all copies or substantial portions
16
* of the Software.
17
*
18
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
21
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
22
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24
* USE OR OTHER DEALINGS IN THE SOFTWARE.
25
*
26
**************************************************************************/
27
/*
28
* Authors: Thomas Hellstrom <thellstrom-at-vmware-dot-com>
29
*/
30
49
#ifndef _TTM_LOCK_H_
50
#define _TTM_LOCK_H_
51
52
#include <
ttm/ttm_object.h
>
53
#include <linux/wait.h>
54
#include <
linux/atomic.h
>
55
69
struct
ttm_lock
{
70
struct
ttm_base_object
base
;
71
wait_queue_head_t
queue
;
72
spinlock_t
lock
;
73
int32_t
rw
;
74
uint32_t
flags
;
75
bool
kill_takers
;
76
int
signal
;
77
struct
ttm_object_file
*
vt_holder
;
78
};
79
80
87
extern
void
ttm_lock_init
(
struct
ttm_lock
*
lock
);
88
96
extern
void
ttm_read_unlock
(
struct
ttm_lock
*
lock
);
97
108
extern
int
ttm_read_lock
(
struct
ttm_lock
*
lock
,
bool
interruptible);
109
125
extern
int
ttm_read_trylock
(
struct
ttm_lock
*
lock
,
bool
interruptible);
126
134
extern
void
ttm_write_unlock
(
struct
ttm_lock
*
lock
);
135
146
extern
int
ttm_write_lock
(
struct
ttm_lock
*
lock
,
bool
interruptible);
147
155
extern
void
ttm_lock_downgrade
(
struct
ttm_lock
*
lock
);
156
164
extern
void
ttm_suspend_lock
(
struct
ttm_lock
*
lock
);
165
173
extern
void
ttm_suspend_unlock
(
struct
ttm_lock
*
lock
);
174
187
extern
int
ttm_vt_lock
(
struct
ttm_lock
*
lock
,
bool
interruptible,
188
struct
ttm_object_file
*tfile);
189
199
extern
int
ttm_vt_unlock
(
struct
ttm_lock
*
lock
);
200
208
extern
void
ttm_write_unlock
(
struct
ttm_lock
*
lock
);
209
220
extern
int
ttm_write_lock
(
struct
ttm_lock
*
lock
,
bool
interruptible);
221
239
static
inline
void
ttm_lock_set_kill(
struct
ttm_lock
*
lock
,
bool
val
,
240
int
signal)
241
{
242
lock->
kill_takers
=
val
;
243
if
(val)
244
lock->
signal
= signal;
245
}
246
247
#endif
Generated on Thu Jan 10 2013 14:51:00 for Linux Kernel by
1.8.2