~ubuntu-branches/ubuntu/wily/apparmor/wily

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/struct_path/struct_path-vfs_getattr.diff

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2011-04-27 10:38:07 UTC
  • mfrom: (5.1.118 natty)
  • Revision ID: james.westby@ubuntu.com-20110427103807-ym3rhwys6o84ith0
Tags: 2.6.1-2
debian/copyright: clarify for some full organization names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Index: linux-2.6/drivers/block/loop.c
2
 
===================================================================
3
 
--- linux-2.6.orig/drivers/block/loop.c
4
 
+++ linux-2.6/drivers/block/loop.c
5
 
@@ -1000,7 +1000,7 @@ loop_get_status(struct loop_device *lo, 
6
 
 
7
 
        if (lo->lo_state != Lo_bound)
8
 
                return -ENXIO;
9
 
-       error = vfs_getattr(file->f_path.mnt, file->f_path.dentry, &stat);
10
 
+       error = vfs_getattr(&file->f_path, &stat);
11
 
        if (error)
12
 
                return error;
13
 
        memset(info, 0, sizeof(*info));
14
 
Index: linux-2.6/fs/gfs2/ops_fstype.c
15
 
===================================================================
16
 
--- linux-2.6.orig/fs/gfs2/ops_fstype.c
17
 
+++ linux-2.6/fs/gfs2/ops_fstype.c
18
 
@@ -827,7 +827,7 @@ static struct super_block* get_gfs2_sb(c
19
 
                       dev_name);
20
 
                goto out;
21
 
        }
22
 
-       error = vfs_getattr(nd.path.mnt, nd.path.dentry, &stat);
23
 
+       error = vfs_getattr(&nd.path, &stat);
24
 
 
25
 
        fstype = get_fs_type("gfs2");
26
 
        list_for_each(l, &fstype->fs_supers) {
27
 
Index: linux-2.6/fs/nfsd/nfs3proc.c
28
 
===================================================================
29
 
--- linux-2.6.orig/fs/nfsd/nfs3proc.c
30
 
+++ linux-2.6/fs/nfsd/nfs3proc.c
31
 
@@ -58,6 +58,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqst
32
 
 {
33
 
        int     err;
34
 
        __be32  nfserr;
35
 
+       struct path path;
36
 
 
37
 
        dprintk("nfsd: GETATTR(3)  %s\n",
38
 
                SVCFH_fmt(&argp->fh));
39
 
@@ -67,8 +68,9 @@ nfsd3_proc_getattr(struct svc_rqst *rqst
40
 
        if (nfserr)
41
 
                RETURN_STATUS(nfserr);
42
 
 
43
 
-       err = vfs_getattr(resp->fh.fh_export->ex_mnt,
44
 
-                         resp->fh.fh_dentry, &resp->stat);
45
 
+       path.mnt = resp->fh.fh_export->ex_mnt;
46
 
+       path.dentry = resp->fh.fh_dentry;
47
 
+       err = vfs_getattr(&path, &resp->stat);
48
 
        nfserr = nfserrno(err);
49
 
 
50
 
        RETURN_STATUS(nfserr);
51
 
Index: linux-2.6/fs/nfsd/nfs3xdr.c
52
 
===================================================================
53
 
--- linux-2.6.orig/fs/nfsd/nfs3xdr.c
54
 
+++ linux-2.6/fs/nfsd/nfs3xdr.c
55
 
@@ -223,12 +223,15 @@ encode_saved_post_attr(struct svc_rqst *
56
 
 static __be32 *
57
 
 encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
58
 
 {
59
 
-       struct dentry *dentry = fhp->fh_dentry;
60
 
-       if (dentry && dentry->d_inode != NULL) {
61
 
+       struct path path;
62
 
+
63
 
+       path.dentry = fhp->fh_dentry;
64
 
+       if (path.dentry && path.dentry->d_inode != NULL) {
65
 
                int err;
66
 
                struct kstat stat;
67
 
 
68
 
-               err = vfs_getattr(fhp->fh_export->ex_mnt, dentry, &stat);
69
 
+               path.mnt = fhp->fh_export->ex_mnt;
70
 
+               err = vfs_getattr(&path, &stat);
71
 
                if (!err) {
72
 
                        *p++ = xdr_one;         /* attributes follow */
73
 
                        return encode_fattr3(rqstp, p, fhp, &stat);
74
 
Index: linux-2.6/fs/nfsd/nfs4xdr.c
75
 
===================================================================
76
 
--- linux-2.6.orig/fs/nfsd/nfs4xdr.c
77
 
+++ linux-2.6/fs/nfsd/nfs4xdr.c
78
 
@@ -1442,6 +1442,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
79
 
        int err;
80
 
        int aclsupport = 0;
81
 
        struct nfs4_acl *acl = NULL;
82
 
+       struct path path;
83
 
 
84
 
        BUG_ON(bmval1 & NFSD_WRITEONLY_ATTRS_WORD1);
85
 
        BUG_ON(bmval0 & ~NFSD_SUPPORTED_ATTRS_WORD0);
86
 
@@ -1453,7 +1454,9 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
87
 
                        goto out;
88
 
        }
89
 
 
90
 
-       err = vfs_getattr(exp->ex_mnt, dentry, &stat);
91
 
+       path.mnt = exp->ex_mnt;
92
 
+       path.dentry = dentry;
93
 
+       err = vfs_getattr(&path, &stat);
94
 
        if (err)
95
 
                goto out_nfserr;
96
 
        if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL)) ||
97
 
Index: linux-2.6/fs/nfsd/nfsproc.c
98
 
===================================================================
99
 
--- linux-2.6.orig/fs/nfsd/nfsproc.c
100
 
+++ linux-2.6/fs/nfsd/nfsproc.c
101
 
@@ -39,18 +39,25 @@ nfsd_proc_null(struct svc_rqst *rqstp, v
102
 
 static __be32
103
 
 nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp)
104
 
 {
105
 
-       if (err) return err;
106
 
-       return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt,
107
 
-                                   resp->fh.fh_dentry,
108
 
-                                   &resp->stat));
109
 
+       struct path path;
110
 
+
111
 
+       if (err)
112
 
+               return err;
113
 
+       path.mnt = resp->fh.fh_export->ex_mnt;
114
 
+       path.dentry = resp->fh.fh_dentry;
115
 
+       return nfserrno(vfs_getattr(&path, &resp->stat));
116
 
 }
117
 
+
118
 
 static __be32
119
 
 nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
120
 
 {
121
 
-       if (err) return err;
122
 
-       return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt,
123
 
-                                   resp->fh.fh_dentry,
124
 
-                                   &resp->stat));
125
 
+       struct path path;
126
 
+
127
 
+       if (err)
128
 
+               return err;
129
 
+       path.mnt = resp->fh.fh_export->ex_mnt;
130
 
+       path.dentry = resp->fh.fh_dentry;
131
 
+       return nfserrno(vfs_getattr(&path, &resp->stat));
132
 
 }
133
 
 /*
134
 
  * Get a file's attributes
135
 
@@ -136,6 +143,7 @@ static __be32
136
 
 nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
137
 
                                       struct nfsd_readres  *resp)
138
 
 {
139
 
+       struct path path;
140
 
        __be32  nfserr;
141
 
 
142
 
        dprintk("nfsd: READ    %s %d bytes at %d\n",
143
 
@@ -162,10 +170,11 @@ nfsd_proc_read(struct svc_rqst *rqstp, s
144
 
                                  rqstp->rq_vec, argp->vlen,
145
 
                                  &resp->count);
146
 
 
147
 
-       if (nfserr) return nfserr;
148
 
-       return nfserrno(vfs_getattr(resp->fh.fh_export->ex_mnt,
149
 
-                                   resp->fh.fh_dentry,
150
 
-                                   &resp->stat));
151
 
+       if (nfserr)
152
 
+               return nfserr;
153
 
+       path.mnt = resp->fh.fh_export->ex_mnt;
154
 
+       path.dentry = resp->fh.fh_dentry;
155
 
+       return nfserrno(vfs_getattr(&path, &resp->stat));
156
 
 }
157
 
 
158
 
 /*
159
 
Index: linux-2.6/fs/nfsd/nfsxdr.c
160
 
===================================================================
161
 
--- linux-2.6.orig/fs/nfsd/nfsxdr.c
162
 
+++ linux-2.6/fs/nfsd/nfsxdr.c
163
 
@@ -193,7 +193,11 @@ encode_fattr(struct svc_rqst *rqstp, __b
164
 
 __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
165
 
 {
166
 
        struct kstat stat;
167
 
-       vfs_getattr(fhp->fh_export->ex_mnt, fhp->fh_dentry, &stat);
168
 
+       struct path path;
169
 
+
170
 
+       path.mnt = fhp->fh_export->ex_mnt;
171
 
+       path.dentry = fhp->fh_dentry;
172
 
+       vfs_getattr(&path, &stat);
173
 
        return encode_fattr(rqstp, p, fhp, &stat);
174
 
 }
175
 
 
176
 
Index: linux-2.6/fs/stat.c
177
 
===================================================================
178
 
--- linux-2.6.orig/fs/stat.c
179
 
+++ linux-2.6/fs/stat.c
180
 
@@ -38,17 +38,17 @@ void generic_fillattr(struct inode *inod
181
 
 
182
 
 EXPORT_SYMBOL(generic_fillattr);
183
 
 
184
 
-int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
185
 
+int vfs_getattr(struct path *path, struct kstat *stat)
186
 
 {
187
 
-       struct inode *inode = dentry->d_inode;
188
 
+       struct inode *inode = path->dentry->d_inode;
189
 
        int retval;
190
 
 
191
 
-       retval = security_inode_getattr(mnt, dentry);
192
 
+       retval = security_inode_getattr(path->mnt, path->dentry);
193
 
        if (retval)
194
 
                return retval;
195
 
 
196
 
        if (inode->i_op->getattr)
197
 
-               return inode->i_op->getattr(mnt, dentry, stat);
198
 
+               return inode->i_op->getattr(path->mnt, path->dentry, stat);
199
 
 
200
 
        generic_fillattr(inode, stat);
201
 
        return 0;
202
 
@@ -63,7 +63,7 @@ int vfs_stat_fd(int dfd, char __user *na
203
 
 
204
 
        error = __user_walk_fd(dfd, name, LOOKUP_FOLLOW, &nd);
205
 
        if (!error) {
206
 
-               error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat);
207
 
+               error = vfs_getattr(&nd.path, stat);
208
 
                path_release(&nd);
209
 
        }
210
 
        return error;
211
 
@@ -83,7 +83,7 @@ int vfs_lstat_fd(int dfd, char __user *n
212
 
 
213
 
        error = __user_walk_fd(dfd, name, 0, &nd);
214
 
        if (!error) {
215
 
-               error = vfs_getattr(nd.path.mnt, nd.path.dentry, stat);
216
 
+               error = vfs_getattr(&nd.path, stat);
217
 
                path_release(&nd);
218
 
        }
219
 
        return error;
220
 
@@ -102,7 +102,7 @@ int vfs_fstat(unsigned int fd, struct ks
221
 
        int error = -EBADF;
222
 
 
223
 
        if (f) {
224
 
-               error = vfs_getattr(f->f_path.mnt, f->f_path.dentry, stat);
225
 
+               error = vfs_getattr(&f->f_path, stat);
226
 
                fput(f);
227
 
        }
228
 
        return error;
229
 
Index: linux-2.6/include/linux/fs.h
230
 
===================================================================
231
 
--- linux-2.6.orig/include/linux/fs.h
232
 
+++ linux-2.6/include/linux/fs.h
233
 
@@ -1825,7 +1825,7 @@ extern int page_symlink(struct inode *in
234
 
 extern struct inode_operations page_symlink_inode_operations;
235
 
 extern int generic_readlink(struct dentry *, char __user *, int);
236
 
 extern void generic_fillattr(struct inode *, struct kstat *);
237
 
-extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
238
 
+extern int vfs_getattr(struct path *, struct kstat *);
239
 
 void inode_add_bytes(struct inode *inode, loff_t bytes);
240
 
 void inode_sub_bytes(struct inode *inode, loff_t bytes);
241
 
 loff_t inode_get_bytes(struct inode *inode);