~ubuntu-branches/ubuntu/precise/linux-ti-omap/precise

« back to all changes in this revision

Viewing changes to ubuntu/aufs/file.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Amit Kucheria
  • Date: 2010-03-23 18:05:12 UTC
  • Revision ID: james.westby@ubuntu.com-20100323180512-iavj906ocnphdubp
Tags: 2.6.33-500.3
[ Amit Kucheria ]

* [Config] Fix the debug package name to end in -dbgsym
* SAUCE: Add the ubuntu/ drivers to omap
* SAUCE: Re-export the symbols for aufs
* [Config] Enable AUFS and COMPCACHE

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005-2009 Junjiro R. Okajima
 
3
 *
 
4
 * This program, aufs is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
/*
 
20
 * file operations
 
21
 */
 
22
 
 
23
#ifndef __AUFS_FILE_H__
 
24
#define __AUFS_FILE_H__
 
25
 
 
26
#ifdef __KERNEL__
 
27
 
 
28
#include <linux/fs.h>
 
29
#include <linux/poll.h>
 
30
#include <linux/aufs_type.h>
 
31
#include "rwsem.h"
 
32
 
 
33
struct au_branch;
 
34
struct au_hfile {
 
35
        struct file             *hf_file;
 
36
        struct au_branch        *hf_br;
 
37
};
 
38
 
 
39
struct au_vdir;
 
40
struct au_finfo {
 
41
        atomic_t                fi_generation;
 
42
 
 
43
        struct au_rwsem         fi_rwsem;
 
44
        struct au_hfile         *fi_hfile;
 
45
        aufs_bindex_t           fi_bstart, fi_bend;
 
46
 
 
47
        union {
 
48
                /* non-dir only */
 
49
                struct {
 
50
                        struct vm_operations_struct     *fi_h_vm_ops;
 
51
                        struct vm_operations_struct     *fi_vm_ops;
 
52
                        struct mutex                    fi_vm_mtx;
 
53
                };
 
54
 
 
55
                /* dir only */
 
56
                struct {
 
57
                        struct au_vdir          *fi_vdir_cache;
 
58
                        int                     fi_maintain_plink;
 
59
                };
 
60
        };
 
61
};
 
62
 
 
63
/* ---------------------------------------------------------------------- */
 
64
 
 
65
/* file.c */
 
66
extern struct address_space_operations aufs_aop;
 
67
unsigned int au_file_roflags(unsigned int flags);
 
68
struct file *au_h_open(struct dentry *dentry, aufs_bindex_t bindex, int flags,
 
69
                       struct file *file);
 
70
int au_do_open(struct file *file, int (*open)(struct file *file, int flags));
 
71
int au_reopen_nondir(struct file *file);
 
72
struct au_pin;
 
73
int au_ready_to_write(struct file *file, loff_t len, struct au_pin *pin);
 
74
int au_reval_and_lock_fdi(struct file *file, int (*reopen)(struct file *file),
 
75
                          int wlock);
 
76
 
 
77
/* poll.c */
 
78
#ifdef CONFIG_AUFS_POLL
 
79
unsigned int aufs_poll(struct file *file, poll_table *wait);
 
80
#endif
 
81
 
 
82
/* f_op.c */
 
83
extern const struct file_operations aufs_file_fop;
 
84
int aufs_flush(struct file *file, fl_owner_t id);
 
85
 
 
86
/* finfo.c */
 
87
void au_hfput(struct au_hfile *hf, struct file *file);
 
88
void au_set_h_fptr(struct file *file, aufs_bindex_t bindex,
 
89
                   struct file *h_file);
 
90
 
 
91
void au_update_figen(struct file *file);
 
92
 
 
93
void au_finfo_fin(struct file *file);
 
94
int au_finfo_init(struct file *file);
 
95
int au_fi_realloc(struct au_finfo *finfo, int nbr);
 
96
 
 
97
/* ioctl.c */
 
98
long aufs_ioctl_nondir(struct file *file, unsigned int cmd, unsigned long arg);
 
99
 
 
100
/* ---------------------------------------------------------------------- */
 
101
 
 
102
static inline struct au_finfo *au_fi(struct file *file)
 
103
{
 
104
        return file->private_data;
 
105
}
 
106
 
 
107
/* ---------------------------------------------------------------------- */
 
108
 
 
109
/*
 
110
 * fi_read_lock, fi_write_lock,
 
111
 * fi_read_unlock, fi_write_unlock, fi_downgrade_lock
 
112
 */
 
113
AuSimpleRwsemFuncs(fi, struct file *f, &au_fi(f)->fi_rwsem);
 
114
 
 
115
#define FiMustNoWaiters(f)      AuRwMustNoWaiters(&au_fi(f)->fi_rwsem)
 
116
#define FiMustAnyLock(f)        AuRwMustAnyLock(&au_fi(f)->fi_rwsem)
 
117
#define FiMustWriteLock(f)      AuRwMustWriteLock(&au_fi(f)->fi_rwsem)
 
118
 
 
119
/* ---------------------------------------------------------------------- */
 
120
 
 
121
/* todo: hard/soft set? */
 
122
static inline aufs_bindex_t au_fbstart(struct file *file)
 
123
{
 
124
        FiMustAnyLock(file);
 
125
        return au_fi(file)->fi_bstart;
 
126
}
 
127
 
 
128
static inline aufs_bindex_t au_fbend(struct file *file)
 
129
{
 
130
        FiMustAnyLock(file);
 
131
        return au_fi(file)->fi_bend;
 
132
}
 
133
 
 
134
static inline struct au_vdir *au_fvdir_cache(struct file *file)
 
135
{
 
136
        FiMustAnyLock(file);
 
137
        return au_fi(file)->fi_vdir_cache;
 
138
}
 
139
 
 
140
static inline void au_set_fbstart(struct file *file, aufs_bindex_t bindex)
 
141
{
 
142
        FiMustWriteLock(file);
 
143
        au_fi(file)->fi_bstart = bindex;
 
144
}
 
145
 
 
146
static inline void au_set_fbend(struct file *file, aufs_bindex_t bindex)
 
147
{
 
148
        FiMustWriteLock(file);
 
149
        au_fi(file)->fi_bend = bindex;
 
150
}
 
151
 
 
152
static inline void au_set_fvdir_cache(struct file *file,
 
153
                                      struct au_vdir *vdir_cache)
 
154
{
 
155
        FiMustWriteLock(file);
 
156
        au_fi(file)->fi_vdir_cache = vdir_cache;
 
157
}
 
158
 
 
159
static inline struct file *au_h_fptr(struct file *file, aufs_bindex_t bindex)
 
160
{
 
161
        FiMustAnyLock(file);
 
162
        return au_fi(file)->fi_hfile[0 + bindex].hf_file;
 
163
}
 
164
 
 
165
/* todo: memory barrier? */
 
166
static inline unsigned int au_figen(struct file *f)
 
167
{
 
168
        return atomic_read(&au_fi(f)->fi_generation);
 
169
}
 
170
 
 
171
static inline int au_test_mmapped(struct file *f)
 
172
{
 
173
        /* FiMustAnyLock(f); */
 
174
        return !!(au_fi(f)->fi_h_vm_ops);
 
175
}
 
176
 
 
177
#endif /* __KERNEL__ */
 
178
#endif /* __AUFS_FILE_H__ */