Subversion Repositories Kolibri OS

Rev

Rev 4559 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4559 Serge 1
#ifndef _LINUX_FS_H
2
#define _LINUX_FS_H
6293 serge 3
#include 
4
#include 
5
#include 
6
#include 
7
#define MAY_EXEC		0x00000001
8
#define MAY_WRITE		0x00000002
9
#define MAY_READ		0x00000004
10
#define MAY_APPEND		0x00000008
11
#define MAY_ACCESS		0x00000010
12
#define MAY_OPEN		0x00000020
13
#define MAY_CHDIR		0x00000040
14
/* called from RCU mode, don't block */
15
#define MAY_NOT_BLOCK		0x00000080
16
/*
17
 * Attribute flags.  These should be or-ed together to figure out what
18
 * has been changed!
19
 */
20
#define ATTR_MODE	(1 << 0)
21
#define ATTR_UID	(1 << 1)
22
#define ATTR_GID	(1 << 2)
23
#define ATTR_SIZE	(1 << 3)
24
#define ATTR_ATIME	(1 << 4)
25
#define ATTR_MTIME	(1 << 5)
26
#define ATTR_CTIME	(1 << 6)
27
#define ATTR_ATIME_SET	(1 << 7)
28
#define ATTR_MTIME_SET	(1 << 8)
29
#define ATTR_FORCE	(1 << 9) /* Not a change, but a change it */
30
#define ATTR_ATTR_FLAG	(1 << 10)
31
#define ATTR_KILL_SUID	(1 << 11)
32
#define ATTR_KILL_SGID	(1 << 12)
33
#define ATTR_FILE	(1 << 13)
34
#define ATTR_KILL_PRIV	(1 << 14)
35
#define ATTR_OPEN	(1 << 15) /* Truncating from open(O_TRUNC) */
36
#define ATTR_TIMES_SET	(1 << 16)
37
/*
38
 * inode->i_mutex nesting subclasses for the lock validator:
39
 *
40
 * 0: the object of the current VFS operation
41
 * 1: parent
42
 * 2: child/target
43
 * 3: xattr
44
 * 4: second non-directory
45
 * 5: second parent (when locking independent directories in rename)
46
 *
47
 * I_MUTEX_NONDIR2 is for certain operations (such as rename) which lock two
48
 * non-directories at once.
49
 *
50
 * The locking order between these classes is
51
 * parent[2] -> child -> grandchild -> normal -> xattr -> second non-directory
52
 */
53
enum inode_i_mutex_lock_class
54
{
55
	I_MUTEX_NORMAL,
56
	I_MUTEX_PARENT,
57
	I_MUTEX_CHILD,
58
	I_MUTEX_XATTR,
59
	I_MUTEX_NONDIR2,
60
	I_MUTEX_PARENT2,
61
};
62
struct file {
63
 
64
	/*
65
	 * Protects f_ep_links, f_flags.
66
	 * Must not be taken from IRQ context.
67
	 */
68
	spinlock_t		f_lock;
69
	atomic_long_t		f_count;
70
	unsigned int 		f_flags;
71
	fmode_t			f_mode;
72
 
73
	/* needed for tty driver, and maybe others */
74
	void			*private_data;
75
 
76
    struct page  **pages;         /* physical memory backend */
77
    unsigned int   count;
78
    unsigned int   allocated;
79
    void           *vma;
80
 
81
} __attribute__((aligned(4)));	/* lest something weird decides that 2 is OK */
82
#define get_file_rcu(x) atomic_long_inc_not_zero(&(x)->f_count)
83
#define fput_atomic(x)	atomic_long_add_unless(&(x)->f_count, -1, 1)
84
#define file_count(x)	atomic_long_read(&(x)->f_count)
85
#define FL_POSIX	1
86
#define FL_FLOCK	2
87
#define FL_DELEG	4	/* NFSv4 delegation */
88
#define FL_ACCESS	8	/* not trying to lock, just looking */
89
#define FL_EXISTS	16	/* when unlocking, test for existence */
90
#define FL_LEASE	32	/* lease held on this file */
91
#define FL_CLOSE	64	/* unlock on close */
92
#define FL_SLEEP	128	/* A blocking lock */
93
#define FL_DOWNGRADE_PENDING	256 /* Lease is being downgraded */
94
#define FL_UNLOCK_PENDING	512 /* Lease is being broken */
95
#define FL_OFDLCK	1024	/* lock is "owned" by struct file */
96
#define FL_LAYOUT	2048	/* outstanding pNFS layout */
4559 Serge 97
#endif /* _LINUX_FS_H */