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

« back to all changes in this revision

Viewing changes to ubuntu/aufs/vfsub.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
 * sub-routines for VFS
 
21
 */
 
22
 
 
23
#ifndef __AUFS_VFSUB_H__
 
24
#define __AUFS_VFSUB_H__
 
25
 
 
26
#ifdef __KERNEL__
 
27
 
 
28
#include <linux/fs.h>
 
29
#include <linux/fs_stack.h>
 
30
 
 
31
/* ---------------------------------------------------------------------- */
 
32
 
 
33
/* lock subclass for lower inode */
 
34
/* default MAX_LOCKDEP_SUBCLASSES(8) is not enough */
 
35
/* reduce? gave up. */
 
36
enum {
 
37
        AuLsc_I_Begin = I_MUTEX_QUOTA, /* 4 */
 
38
        AuLsc_I_PARENT,         /* lower inode, parent first */
 
39
        AuLsc_I_PARENT2,        /* copyup dirs */
 
40
        AuLsc_I_PARENT3,        /* copyup wh */
 
41
        AuLsc_I_CHILD,
 
42
        AuLsc_I_CHILD2,
 
43
        AuLsc_I_End
 
44
};
 
45
 
 
46
/* to debug easier, do not make them inlined functions */
 
47
#define MtxMustLock(mtx)        AuDebugOn(!mutex_is_locked(mtx))
 
48
#define IMustLock(i)            MtxMustLock(&(i)->i_mutex)
 
49
 
 
50
/* ---------------------------------------------------------------------- */
 
51
 
 
52
static inline void vfsub_copy_inode_size(struct inode *inode,
 
53
                                         struct inode *h_inode)
 
54
{
 
55
        spin_lock(&inode->i_lock);
 
56
        fsstack_copy_inode_size(inode, h_inode);
 
57
        spin_unlock(&inode->i_lock);
 
58
}
 
59
 
 
60
int vfsub_update_h_iattr(struct path *h_path, int *did);
 
61
struct file *vfsub_filp_open(const char *path, int oflags, int mode);
 
62
struct file *vfsub_dentry_open(struct path *path, int flags,
 
63
                               const struct cred *cred);
 
64
int vfsub_kern_path(const char *name, unsigned int flags, struct path *path);
 
65
struct dentry *vfsub_lookup_one_len(const char *name, struct dentry *parent,
 
66
                                    int len);
 
67
struct dentry *vfsub_lookup_hash(struct nameidata *nd);
 
68
 
 
69
/* ---------------------------------------------------------------------- */
 
70
 
 
71
struct au_hinode;
 
72
struct dentry *vfsub_lock_rename(struct dentry *d1, struct au_hinode *hdir1,
 
73
                                 struct dentry *d2, struct au_hinode *hdir2);
 
74
void vfsub_unlock_rename(struct dentry *d1, struct au_hinode *hdir1,
 
75
                         struct dentry *d2, struct au_hinode *hdir2);
 
76
 
 
77
int vfsub_create(struct inode *dir, struct path *path, int mode);
 
78
int vfsub_symlink(struct inode *dir, struct path *path,
 
79
                  const char *symname);
 
80
int vfsub_mknod(struct inode *dir, struct path *path, int mode, dev_t dev);
 
81
int vfsub_link(struct dentry *src_dentry, struct inode *dir,
 
82
               struct path *path);
 
83
int vfsub_rename(struct inode *src_hdir, struct dentry *src_dentry,
 
84
                 struct inode *hdir, struct path *path);
 
85
int vfsub_mkdir(struct inode *dir, struct path *path, int mode);
 
86
int vfsub_rmdir(struct inode *dir, struct path *path);
 
87
 
 
88
int vfsub_sio_mkdir(struct inode *dir, struct path *path, int mode);
 
89
int vfsub_sio_rmdir(struct inode *dir, struct path *path);
 
90
int vfsub_sio_notify_change(struct path *path, struct iattr *ia);
 
91
int vfsub_notify_change(struct path *path, struct iattr *ia);
 
92
int vfsub_unlink(struct inode *dir, struct path *path, int force);
 
93
 
 
94
/* ---------------------------------------------------------------------- */
 
95
 
 
96
ssize_t vfsub_read_u(struct file *file, char __user *ubuf, size_t count,
 
97
                     loff_t *ppos);
 
98
ssize_t vfsub_read_k(struct file *file, void *kbuf, size_t count,
 
99
                        loff_t *ppos);
 
100
ssize_t vfsub_write_u(struct file *file, const char __user *ubuf, size_t count,
 
101
                      loff_t *ppos);
 
102
ssize_t vfsub_write_k(struct file *file, void *kbuf, size_t count,
 
103
                      loff_t *ppos);
 
104
int vfsub_readdir(struct file *file, filldir_t filldir, void *arg);
 
105
 
 
106
long vfsub_splice_to(struct file *in, loff_t *ppos,
 
107
                     struct pipe_inode_info *pipe, size_t len,
 
108
                     unsigned int flags);
 
109
long vfsub_splice_from(struct pipe_inode_info *pipe, struct file *out,
 
110
                       loff_t *ppos, size_t len, unsigned int flags);
 
111
int vfsub_trunc(struct path *h_path, loff_t length, unsigned int attr,
 
112
                struct file *h_file);
 
113
 
 
114
static inline void vfsub_file_accessed(struct file *h_file)
 
115
{
 
116
        file_accessed(h_file);
 
117
        vfsub_update_h_iattr(&h_file->f_path, /*did*/NULL); /*ignore*/
 
118
}
 
119
 
 
120
static inline void vfsub_touch_atime(struct vfsmount *h_mnt,
 
121
                                     struct dentry *h_dentry)
 
122
{
 
123
        struct path h_path = {
 
124
                .dentry = h_dentry,
 
125
                .mnt    = h_mnt
 
126
        };
 
127
        touch_atime(h_mnt, h_dentry);
 
128
        vfsub_update_h_iattr(&h_path, /*did*/NULL); /*ignore*/
 
129
}
 
130
 
 
131
/* ---------------------------------------------------------------------- */
 
132
 
 
133
static inline loff_t vfsub_llseek(struct file *file, loff_t offset, int origin)
 
134
{
 
135
        loff_t err;
 
136
 
 
137
        /* lockdep_off(); */
 
138
        err = vfs_llseek(file, offset, origin);
 
139
        /* lockdep_on(); */
 
140
        return err;
 
141
}
 
142
 
 
143
/* ---------------------------------------------------------------------- */
 
144
 
 
145
/* dirty workaround for strict type of fmode_t */
 
146
union vfsub_fmu {
 
147
        fmode_t fm;
 
148
        unsigned int ui;
 
149
};
 
150
 
 
151
static inline unsigned int vfsub_fmode_to_uint(fmode_t fm)
 
152
{
 
153
        union vfsub_fmu u = {
 
154
                .fm = fm
 
155
        };
 
156
 
 
157
        BUILD_BUG_ON(sizeof(u.fm) != sizeof(u.ui));
 
158
 
 
159
        return u.ui;
 
160
}
 
161
 
 
162
static inline fmode_t vfsub_uint_to_fmode(unsigned int ui)
 
163
{
 
164
        union vfsub_fmu u = {
 
165
                .ui = ui
 
166
        };
 
167
 
 
168
        return u.fm;
 
169
}
 
170
 
 
171
#endif /* __KERNEL__ */
 
172
#endif /* __AUFS_VFSUB_H__ */