attr.c (11e4afb49b7fa1fc8e1ffd850c1806dd86a08204) attr.c (6a1a90ad1b0edb556a7550a6ef8a8756f0304dd5)
1/*
2 * linux/fs/attr.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * changes by Thomas Schoebel-Theuer
6 */
7
8#include <linux/module.h>

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

100out_sig:
101 send_sig(SIGXFSZ, current, 0);
102out_big:
103 return -EFBIG;
104}
105EXPORT_SYMBOL(inode_newsize_ok);
106
107/**
1/*
2 * linux/fs/attr.c
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * changes by Thomas Schoebel-Theuer
6 */
7
8#include <linux/module.h>

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

100out_sig:
101 send_sig(SIGXFSZ, current, 0);
102out_big:
103 return -EFBIG;
104}
105EXPORT_SYMBOL(inode_newsize_ok);
106
107/**
108 * generic_setattr - copy simple metadata updates into the generic inode
108 * setattr_copy - copy simple metadata updates into the generic inode
109 * @inode: the inode to be updated
110 * @attr: the new attributes
111 *
109 * @inode: the inode to be updated
110 * @attr: the new attributes
111 *
112 * generic_setattr must be called with i_mutex held.
112 * setattr_copy must be called with i_mutex held.
113 *
113 *
114 * generic_setattr updates the inode's metadata with that specified
114 * setattr_copy updates the inode's metadata with that specified
115 * in attr. Noticably missing is inode size update, which is more complex
116 * as it requires pagecache updates. See simple_setsize.
117 *
118 * The inode is not marked as dirty after this operation. The rationale is
119 * that for "simple" filesystems, the struct inode is the inode storage.
120 * The caller is free to mark the inode dirty afterwards if needed.
121 */
115 * in attr. Noticably missing is inode size update, which is more complex
116 * as it requires pagecache updates. See simple_setsize.
117 *
118 * The inode is not marked as dirty after this operation. The rationale is
119 * that for "simple" filesystems, the struct inode is the inode storage.
120 * The caller is free to mark the inode dirty afterwards if needed.
121 */
122void generic_setattr(struct inode *inode, const struct iattr *attr)
122void setattr_copy(struct inode *inode, const struct iattr *attr)
123{
124 unsigned int ia_valid = attr->ia_valid;
125
126 if (ia_valid & ATTR_UID)
127 inode->i_uid = attr->ia_uid;
128 if (ia_valid & ATTR_GID)
129 inode->i_gid = attr->ia_gid;
130 if (ia_valid & ATTR_ATIME)

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

139 if (ia_valid & ATTR_MODE) {
140 umode_t mode = attr->ia_mode;
141
142 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
143 mode &= ~S_ISGID;
144 inode->i_mode = mode;
145 }
146}
123{
124 unsigned int ia_valid = attr->ia_valid;
125
126 if (ia_valid & ATTR_UID)
127 inode->i_uid = attr->ia_uid;
128 if (ia_valid & ATTR_GID)
129 inode->i_gid = attr->ia_gid;
130 if (ia_valid & ATTR_ATIME)

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

139 if (ia_valid & ATTR_MODE) {
140 umode_t mode = attr->ia_mode;
141
142 if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
143 mode &= ~S_ISGID;
144 inode->i_mode = mode;
145 }
146}
147EXPORT_SYMBOL(generic_setattr);
147EXPORT_SYMBOL(setattr_copy);
148
149/*
150 * note this function is deprecated, the new truncate sequence should be
148
149/*
150 * note this function is deprecated, the new truncate sequence should be
151 * used instead -- see eg. simple_setsize, generic_setattr.
151 * used instead -- see eg. simple_setsize, setattr_copy.
152 */
153int inode_setattr(struct inode *inode, const struct iattr *attr)
154{
155 unsigned int ia_valid = attr->ia_valid;
156
157 if (ia_valid & ATTR_SIZE &&
158 attr->ia_size != i_size_read(inode)) {
159 int error;
160
161 error = vmtruncate(inode, attr->ia_size);
162 if (error)
163 return error;
164 }
165
152 */
153int inode_setattr(struct inode *inode, const struct iattr *attr)
154{
155 unsigned int ia_valid = attr->ia_valid;
156
157 if (ia_valid & ATTR_SIZE &&
158 attr->ia_size != i_size_read(inode)) {
159 int error;
160
161 error = vmtruncate(inode, attr->ia_size);
162 if (error)
163 return error;
164 }
165
166 generic_setattr(inode, attr);
166 setattr_copy(inode, attr);
167
168 mark_inode_dirty(inode);
169
170 return 0;
171}
172EXPORT_SYMBOL(inode_setattr);
173
174int notify_change(struct dentry * dentry, struct iattr * attr)

--- 83 unchanged lines hidden ---
167
168 mark_inode_dirty(inode);
169
170 return 0;
171}
172EXPORT_SYMBOL(inode_setattr);
173
174int notify_change(struct dentry * dentry, struct iattr * attr)

--- 83 unchanged lines hidden ---