aboutsummaryrefslogtreecommitdiffstats
path: root/fs/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/stat.c')
-rw-r--r--fs/stat.c56
1 files changed, 28 insertions, 28 deletions
diff --git a/fs/stat.c b/fs/stat.c
index 2db740a0cfb5..54711662b855 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -109,6 +109,24 @@ int vfs_fstat(unsigned int fd, struct kstat *stat)
109 109
110EXPORT_SYMBOL(vfs_fstat); 110EXPORT_SYMBOL(vfs_fstat);
111 111
112int vfs_fstatat(int dfd, char __user *filename, struct kstat *stat, int flag)
113{
114 int error = -EINVAL;
115
116 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
117 goto out;
118
119 if (flag & AT_SYMLINK_NOFOLLOW)
120 error = vfs_lstat_fd(dfd, filename, stat);
121 else
122 error = vfs_stat_fd(dfd, filename, stat);
123out:
124 return error;
125}
126
127EXPORT_SYMBOL(vfs_fstatat);
128
129
112#ifdef __ARCH_WANT_OLD_STAT 130#ifdef __ARCH_WANT_OLD_STAT
113 131
114/* 132/*
@@ -264,21 +282,12 @@ SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename,
264 struct stat __user *, statbuf, int, flag) 282 struct stat __user *, statbuf, int, flag)
265{ 283{
266 struct kstat stat; 284 struct kstat stat;
267 int error = -EINVAL; 285 int error;
268
269 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
270 goto out;
271
272 if (flag & AT_SYMLINK_NOFOLLOW)
273 error = vfs_lstat_fd(dfd, filename, &stat);
274 else
275 error = vfs_stat_fd(dfd, filename, &stat);
276
277 if (!error)
278 error = cp_new_stat(&stat, statbuf);
279 286
280out: 287 error = vfs_fstatat(dfd, filename, &stat, flag);
281 return error; 288 if (error)
289 return error;
290 return cp_new_stat(&stat, statbuf);
282} 291}
283#endif 292#endif
284 293
@@ -404,21 +413,12 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
404 struct stat64 __user *, statbuf, int, flag) 413 struct stat64 __user *, statbuf, int, flag)
405{ 414{
406 struct kstat stat; 415 struct kstat stat;
407 int error = -EINVAL; 416 int error;
408
409 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0)
410 goto out;
411
412 if (flag & AT_SYMLINK_NOFOLLOW)
413 error = vfs_lstat_fd(dfd, filename, &stat);
414 else
415 error = vfs_stat_fd(dfd, filename, &stat);
416
417 if (!error)
418 error = cp_new_stat64(&stat, statbuf);
419 417
420out: 418 error = vfs_fstatat(dfd, filename, &stat, flag);
421 return error; 419 if (error)
420 return error;
421 return cp_new_stat64(&stat, statbuf);
422} 422}
423#endif /* __ARCH_WANT_STAT64 */ 423#endif /* __ARCH_WANT_STAT64 */
424 424