inode.c (1d9d4495001d3c470e5c902ff35a6aa626924fc1) inode.c (fceef393a538134f03b778c5d2519e670269342f)
1/*
2 *
3 * Copyright (C) 2011 Novell Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */

--- 117 unchanged lines hidden (view full) ---

126 }
127
128 err = __inode_permission(realinode, mask);
129out_dput:
130 dput(alias);
131 return err;
132}
133
1/*
2 *
3 * Copyright (C) 2011 Novell Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */

--- 117 unchanged lines hidden (view full) ---

126 }
127
128 err = __inode_permission(realinode, mask);
129out_dput:
130 dput(alias);
131 return err;
132}
133
134
135struct ovl_link_data {
136 struct dentry *realdentry;
137 void *cookie;
138};
139
140static const char *ovl_follow_link(struct dentry *dentry, void **cookie)
134static const char *ovl_get_link(struct dentry *dentry,
135 struct inode *inode,
136 struct delayed_call *done)
141{
142 struct dentry *realdentry;
143 struct inode *realinode;
137{
138 struct dentry *realdentry;
139 struct inode *realinode;
144 struct ovl_link_data *data = NULL;
145 const char *ret;
146
140
141 if (!dentry)
142 return ERR_PTR(-ECHILD);
143
147 realdentry = ovl_dentry_real(dentry);
148 realinode = realdentry->d_inode;
149
144 realdentry = ovl_dentry_real(dentry);
145 realinode = realdentry->d_inode;
146
150 if (WARN_ON(!realinode->i_op->follow_link))
147 if (WARN_ON(!realinode->i_op->get_link))
151 return ERR_PTR(-EPERM);
152
148 return ERR_PTR(-EPERM);
149
153 if (realinode->i_op->put_link) {
154 data = kmalloc(sizeof(struct ovl_link_data), GFP_KERNEL);
155 if (!data)
156 return ERR_PTR(-ENOMEM);
157 data->realdentry = realdentry;
158 }
159
160 ret = realinode->i_op->follow_link(realdentry, cookie);
161 if (IS_ERR_OR_NULL(ret)) {
162 kfree(data);
163 return ret;
164 }
165
166 if (data)
167 data->cookie = *cookie;
168
169 *cookie = data;
170
171 return ret;
150 return realinode->i_op->get_link(realdentry, realinode, done);
172}
173
151}
152
174static void ovl_put_link(struct inode *unused, void *c)
175{
176 struct inode *realinode;
177 struct ovl_link_data *data = c;
178
179 if (!data)
180 return;
181
182 realinode = data->realdentry->d_inode;
183 realinode->i_op->put_link(realinode, data->cookie);
184 kfree(data);
185}
186
187static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz)
188{
189 struct path realpath;
190 struct inode *realinode;
191
192 ovl_path_real(dentry, &realpath);
193 realinode = realpath.dentry->d_inode;
194

--- 178 unchanged lines hidden (view full) ---

373 .setxattr = ovl_setxattr,
374 .getxattr = ovl_getxattr,
375 .listxattr = ovl_listxattr,
376 .removexattr = ovl_removexattr,
377};
378
379static const struct inode_operations ovl_symlink_inode_operations = {
380 .setattr = ovl_setattr,
153static int ovl_readlink(struct dentry *dentry, char __user *buf, int bufsiz)
154{
155 struct path realpath;
156 struct inode *realinode;
157
158 ovl_path_real(dentry, &realpath);
159 realinode = realpath.dentry->d_inode;
160

--- 178 unchanged lines hidden (view full) ---

339 .setxattr = ovl_setxattr,
340 .getxattr = ovl_getxattr,
341 .listxattr = ovl_listxattr,
342 .removexattr = ovl_removexattr,
343};
344
345static const struct inode_operations ovl_symlink_inode_operations = {
346 .setattr = ovl_setattr,
381 .follow_link = ovl_follow_link,
382 .put_link = ovl_put_link,
347 .get_link = ovl_get_link,
383 .readlink = ovl_readlink,
384 .getattr = ovl_getattr,
385 .setxattr = ovl_setxattr,
386 .getxattr = ovl_getxattr,
387 .listxattr = ovl_listxattr,
388 .removexattr = ovl_removexattr,
389};
390

--- 42 unchanged lines hidden ---
348 .readlink = ovl_readlink,
349 .getattr = ovl_getattr,
350 .setxattr = ovl_setxattr,
351 .getxattr = ovl_getxattr,
352 .listxattr = ovl_listxattr,
353 .removexattr = ovl_removexattr,
354};
355

--- 42 unchanged lines hidden ---