diff options
Diffstat (limited to 'fs/open.c')
-rw-r--r-- | fs/open.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -194,7 +194,8 @@ out: | |||
194 | return error; | 194 | return error; |
195 | } | 195 | } |
196 | 196 | ||
197 | int do_truncate(struct dentry *dentry, loff_t length, struct file *filp) | 197 | int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, |
198 | struct file *filp) | ||
198 | { | 199 | { |
199 | int err; | 200 | int err; |
200 | struct iattr newattrs; | 201 | struct iattr newattrs; |
@@ -204,7 +205,7 @@ int do_truncate(struct dentry *dentry, loff_t length, struct file *filp) | |||
204 | return -EINVAL; | 205 | return -EINVAL; |
205 | 206 | ||
206 | newattrs.ia_size = length; | 207 | newattrs.ia_size = length; |
207 | newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; | 208 | newattrs.ia_valid = ATTR_SIZE | time_attrs; |
208 | if (filp) { | 209 | if (filp) { |
209 | newattrs.ia_file = filp; | 210 | newattrs.ia_file = filp; |
210 | newattrs.ia_valid |= ATTR_FILE; | 211 | newattrs.ia_valid |= ATTR_FILE; |
@@ -216,7 +217,7 @@ int do_truncate(struct dentry *dentry, loff_t length, struct file *filp) | |||
216 | return err; | 217 | return err; |
217 | } | 218 | } |
218 | 219 | ||
219 | static inline long do_sys_truncate(const char __user * path, loff_t length) | 220 | static long do_sys_truncate(const char __user * path, loff_t length) |
220 | { | 221 | { |
221 | struct nameidata nd; | 222 | struct nameidata nd; |
222 | struct inode * inode; | 223 | struct inode * inode; |
@@ -266,7 +267,7 @@ static inline long do_sys_truncate(const char __user * path, loff_t length) | |||
266 | error = locks_verify_truncate(inode, NULL, length); | 267 | error = locks_verify_truncate(inode, NULL, length); |
267 | if (!error) { | 268 | if (!error) { |
268 | DQUOT_INIT(inode); | 269 | DQUOT_INIT(inode); |
269 | error = do_truncate(nd.dentry, length, NULL); | 270 | error = do_truncate(nd.dentry, length, 0, NULL); |
270 | } | 271 | } |
271 | put_write_access(inode); | 272 | put_write_access(inode); |
272 | 273 | ||
@@ -282,7 +283,7 @@ asmlinkage long sys_truncate(const char __user * path, unsigned long length) | |||
282 | return do_sys_truncate(path, (long)length); | 283 | return do_sys_truncate(path, (long)length); |
283 | } | 284 | } |
284 | 285 | ||
285 | static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small) | 286 | static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) |
286 | { | 287 | { |
287 | struct inode * inode; | 288 | struct inode * inode; |
288 | struct dentry *dentry; | 289 | struct dentry *dentry; |
@@ -318,7 +319,7 @@ static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small) | |||
318 | 319 | ||
319 | error = locks_verify_truncate(inode, file, length); | 320 | error = locks_verify_truncate(inode, file, length); |
320 | if (!error) | 321 | if (!error) |
321 | error = do_truncate(dentry, length, file); | 322 | error = do_truncate(dentry, length, 0, file); |
322 | out_putf: | 323 | out_putf: |
323 | fput(file); | 324 | fput(file); |
324 | out: | 325 | out: |
@@ -970,7 +971,7 @@ out: | |||
970 | 971 | ||
971 | EXPORT_SYMBOL(get_unused_fd); | 972 | EXPORT_SYMBOL(get_unused_fd); |
972 | 973 | ||
973 | static inline void __put_unused_fd(struct files_struct *files, unsigned int fd) | 974 | static void __put_unused_fd(struct files_struct *files, unsigned int fd) |
974 | { | 975 | { |
975 | struct fdtable *fdt = files_fdtable(files); | 976 | struct fdtable *fdt = files_fdtable(files); |
976 | __FD_CLR(fd, fdt->open_fds); | 977 | __FD_CLR(fd, fdt->open_fds); |