file.c (c25141062a82ae8bddced1b3ce2b57a1c0efabe0) file.c (ecd10aa42819cd5dcf639d25575e95a5bda8d08a)
1/*
2 * file.c
3 *
4 * PURPOSE
5 * File handling routines for the OSTA-UDF(tm) filesystem.
6 *
7 * COPYRIGHT
8 * This file is distributed under the terms of the GNU General Public

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

252 .fsync = generic_file_fsync,
253 .splice_read = generic_file_splice_read,
254 .llseek = generic_file_llseek,
255};
256
257static int udf_setattr(struct dentry *dentry, struct iattr *attr)
258{
259 struct inode *inode = d_inode(dentry);
1/*
2 * file.c
3 *
4 * PURPOSE
5 * File handling routines for the OSTA-UDF(tm) filesystem.
6 *
7 * COPYRIGHT
8 * This file is distributed under the terms of the GNU General Public

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

252 .fsync = generic_file_fsync,
253 .splice_read = generic_file_splice_read,
254 .llseek = generic_file_llseek,
255};
256
257static int udf_setattr(struct dentry *dentry, struct iattr *attr)
258{
259 struct inode *inode = d_inode(dentry);
260 struct super_block *sb = inode->i_sb;
260 int error;
261
262 error = setattr_prepare(dentry, attr);
263 if (error)
264 return error;
265
261 int error;
262
263 error = setattr_prepare(dentry, attr);
264 if (error)
265 return error;
266
267 if ((attr->ia_valid & ATTR_UID) &&
268 UDF_QUERY_FLAG(sb, UDF_FLAG_UID_SET) &&
269 !uid_eq(attr->ia_uid, UDF_SB(sb)->s_uid))
270 return -EPERM;
271 if ((attr->ia_valid & ATTR_GID) &&
272 UDF_QUERY_FLAG(sb, UDF_FLAG_GID_SET) &&
273 !gid_eq(attr->ia_gid, UDF_SB(sb)->s_gid))
274 return -EPERM;
275
266 if ((attr->ia_valid & ATTR_SIZE) &&
267 attr->ia_size != i_size_read(inode)) {
268 error = udf_setsize(inode, attr->ia_size);
269 if (error)
270 return error;
271 }
272
273 setattr_copy(inode, attr);
274 mark_inode_dirty(inode);
275 return 0;
276}
277
278const struct inode_operations udf_file_inode_operations = {
279 .setattr = udf_setattr,
280};
276 if ((attr->ia_valid & ATTR_SIZE) &&
277 attr->ia_size != i_size_read(inode)) {
278 error = udf_setsize(inode, attr->ia_size);
279 if (error)
280 return error;
281 }
282
283 setattr_copy(inode, attr);
284 mark_inode_dirty(inode);
285 return 0;
286}
287
288const struct inode_operations udf_file_inode_operations = {
289 .setattr = udf_setattr,
290};