• Home
  • Raw
  • Download

Lines Matching refs:stat

33 void generic_fillattr(struct inode *inode, struct kstat *stat)  in generic_fillattr()  argument
35 stat->dev = inode->i_sb->s_dev; in generic_fillattr()
36 stat->ino = inode->i_ino; in generic_fillattr()
37 stat->mode = inode->i_mode; in generic_fillattr()
38 stat->nlink = inode->i_nlink; in generic_fillattr()
39 stat->uid = inode->i_uid; in generic_fillattr()
40 stat->gid = inode->i_gid; in generic_fillattr()
41 stat->rdev = inode->i_rdev; in generic_fillattr()
42 stat->size = i_size_read(inode); in generic_fillattr()
43 stat->atime = inode->i_atime; in generic_fillattr()
44 stat->mtime = inode->i_mtime; in generic_fillattr()
45 stat->ctime = inode->i_ctime; in generic_fillattr()
46 stat->blksize = i_blocksize(inode); in generic_fillattr()
47 stat->blocks = inode->i_blocks; in generic_fillattr()
64 int vfs_getattr_nosec(const struct path *path, struct kstat *stat, in vfs_getattr_nosec() argument
69 memset(stat, 0, sizeof(*stat)); in vfs_getattr_nosec()
70 stat->result_mask |= STATX_BASIC_STATS; in vfs_getattr_nosec()
76 stat->result_mask &= ~STATX_ATIME; in vfs_getattr_nosec()
78 stat->attributes |= STATX_ATTR_AUTOMOUNT; in vfs_getattr_nosec()
81 return inode->i_op->getattr(path, stat, request_mask, in vfs_getattr_nosec()
84 generic_fillattr(inode, stat); in vfs_getattr_nosec()
110 int vfs_getattr(const struct path *path, struct kstat *stat, in vfs_getattr() argument
118 return vfs_getattr_nosec(path, stat, request_mask, query_flags); in vfs_getattr()
134 int vfs_statx_fd(unsigned int fd, struct kstat *stat, in vfs_statx_fd() argument
145 error = vfs_getattr(&f.file->f_path, stat, in vfs_statx_fd()
169 struct kstat *stat, u32 request_mask) in vfs_statx() argument
191 error = vfs_getattr(&path, stat, request_mask, flags); in vfs_statx()
209 static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * statbuf) in cp_old_stat() argument
224 tmp.st_dev = old_encode_dev(stat->dev); in cp_old_stat()
225 tmp.st_ino = stat->ino; in cp_old_stat()
226 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) in cp_old_stat()
228 tmp.st_mode = stat->mode; in cp_old_stat()
229 tmp.st_nlink = stat->nlink; in cp_old_stat()
230 if (tmp.st_nlink != stat->nlink) in cp_old_stat()
232 SET_UID(tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid)); in cp_old_stat()
233 SET_GID(tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid)); in cp_old_stat()
234 tmp.st_rdev = old_encode_dev(stat->rdev); in cp_old_stat()
236 if (stat->size > MAX_NON_LFS) in cp_old_stat()
239 tmp.st_size = stat->size; in cp_old_stat()
240 tmp.st_atime = stat->atime.tv_sec; in cp_old_stat()
241 tmp.st_mtime = stat->mtime.tv_sec; in cp_old_stat()
242 tmp.st_ctime = stat->ctime.tv_sec; in cp_old_stat()
246 SYSCALL_DEFINE2(stat, const char __user *, filename, in SYSCALL_DEFINE2() argument
249 struct kstat stat; in SYSCALL_DEFINE2() local
252 error = vfs_stat(filename, &stat); in SYSCALL_DEFINE2()
256 return cp_old_stat(&stat, statbuf); in SYSCALL_DEFINE2()
262 struct kstat stat; in SYSCALL_DEFINE2() local
265 error = vfs_lstat(filename, &stat); in SYSCALL_DEFINE2()
269 return cp_old_stat(&stat, statbuf); in SYSCALL_DEFINE2()
274 struct kstat stat; in SYSCALL_DEFINE2() local
275 int error = vfs_fstat(fd, &stat); in SYSCALL_DEFINE2()
278 error = cp_old_stat(&stat, statbuf); in SYSCALL_DEFINE2()
300 static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf) in cp_new_stat() argument
302 struct stat tmp; in cp_new_stat()
304 if (!valid_dev(stat->dev) || !valid_dev(stat->rdev)) in cp_new_stat()
307 if (stat->size > MAX_NON_LFS) in cp_new_stat()
312 tmp.st_dev = encode_dev(stat->dev); in cp_new_stat()
313 tmp.st_ino = stat->ino; in cp_new_stat()
314 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) in cp_new_stat()
316 tmp.st_mode = stat->mode; in cp_new_stat()
317 tmp.st_nlink = stat->nlink; in cp_new_stat()
318 if (tmp.st_nlink != stat->nlink) in cp_new_stat()
320 SET_UID(tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid)); in cp_new_stat()
321 SET_GID(tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid)); in cp_new_stat()
322 tmp.st_rdev = encode_dev(stat->rdev); in cp_new_stat()
323 tmp.st_size = stat->size; in cp_new_stat()
324 tmp.st_atime = stat->atime.tv_sec; in cp_new_stat()
325 tmp.st_mtime = stat->mtime.tv_sec; in cp_new_stat()
326 tmp.st_ctime = stat->ctime.tv_sec; in cp_new_stat()
328 tmp.st_atime_nsec = stat->atime.tv_nsec; in cp_new_stat()
329 tmp.st_mtime_nsec = stat->mtime.tv_nsec; in cp_new_stat()
330 tmp.st_ctime_nsec = stat->ctime.tv_nsec; in cp_new_stat()
332 tmp.st_blocks = stat->blocks; in cp_new_stat()
333 tmp.st_blksize = stat->blksize; in cp_new_stat()
338 struct stat __user *, statbuf) in SYSCALL_DEFINE2()
340 struct kstat stat; in SYSCALL_DEFINE2() local
341 int error = vfs_stat(filename, &stat); in SYSCALL_DEFINE2()
345 return cp_new_stat(&stat, statbuf); in SYSCALL_DEFINE2()
349 struct stat __user *, statbuf) in SYSCALL_DEFINE2()
351 struct kstat stat; in SYSCALL_DEFINE2() local
354 error = vfs_lstat(filename, &stat); in SYSCALL_DEFINE2()
358 return cp_new_stat(&stat, statbuf); in SYSCALL_DEFINE2()
363 struct stat __user *, statbuf, int, flag) in SYSCALL_DEFINE4()
365 struct kstat stat; in SYSCALL_DEFINE4() local
368 error = vfs_fstatat(dfd, filename, &stat, flag); in SYSCALL_DEFINE4()
371 return cp_new_stat(&stat, statbuf); in SYSCALL_DEFINE4()
375 SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf) in SYSCALL_DEFINE2()
377 struct kstat stat; in SYSCALL_DEFINE2() local
378 int error = vfs_fstat(fd, &stat); in SYSCALL_DEFINE2()
381 error = cp_new_stat(&stat, statbuf); in SYSCALL_DEFINE2()
443 static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf) in cp_new_stat64() argument
450 tmp.st_dev = new_encode_dev(stat->dev); in cp_new_stat64()
451 tmp.st_rdev = new_encode_dev(stat->rdev); in cp_new_stat64()
453 tmp.st_dev = huge_encode_dev(stat->dev); in cp_new_stat64()
454 tmp.st_rdev = huge_encode_dev(stat->rdev); in cp_new_stat64()
456 tmp.st_ino = stat->ino; in cp_new_stat64()
457 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) in cp_new_stat64()
460 tmp.__st_ino = stat->ino; in cp_new_stat64()
462 tmp.st_mode = stat->mode; in cp_new_stat64()
463 tmp.st_nlink = stat->nlink; in cp_new_stat64()
464 tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid); in cp_new_stat64()
465 tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid); in cp_new_stat64()
466 tmp.st_atime = stat->atime.tv_sec; in cp_new_stat64()
467 tmp.st_atime_nsec = stat->atime.tv_nsec; in cp_new_stat64()
468 tmp.st_mtime = stat->mtime.tv_sec; in cp_new_stat64()
469 tmp.st_mtime_nsec = stat->mtime.tv_nsec; in cp_new_stat64()
470 tmp.st_ctime = stat->ctime.tv_sec; in cp_new_stat64()
471 tmp.st_ctime_nsec = stat->ctime.tv_nsec; in cp_new_stat64()
472 tmp.st_size = stat->size; in cp_new_stat64()
473 tmp.st_blocks = stat->blocks; in cp_new_stat64()
474 tmp.st_blksize = stat->blksize; in cp_new_stat64()
481 struct kstat stat; in SYSCALL_DEFINE2() local
482 int error = vfs_stat(filename, &stat); in SYSCALL_DEFINE2()
485 error = cp_new_stat64(&stat, statbuf); in SYSCALL_DEFINE2()
493 struct kstat stat; in SYSCALL_DEFINE2() local
494 int error = vfs_lstat(filename, &stat); in SYSCALL_DEFINE2()
497 error = cp_new_stat64(&stat, statbuf); in SYSCALL_DEFINE2()
504 struct kstat stat; in SYSCALL_DEFINE2() local
505 int error = vfs_fstat(fd, &stat); in SYSCALL_DEFINE2()
508 error = cp_new_stat64(&stat, statbuf); in SYSCALL_DEFINE2()
516 struct kstat stat; in SYSCALL_DEFINE4() local
519 error = vfs_fstatat(dfd, filename, &stat, flag); in SYSCALL_DEFINE4()
522 return cp_new_stat64(&stat, statbuf); in SYSCALL_DEFINE4()
527 cp_statx(const struct kstat *stat, struct statx __user *buffer) in cp_statx() argument
533 tmp.stx_mask = stat->result_mask; in cp_statx()
534 tmp.stx_blksize = stat->blksize; in cp_statx()
535 tmp.stx_attributes = stat->attributes; in cp_statx()
536 tmp.stx_nlink = stat->nlink; in cp_statx()
537 tmp.stx_uid = from_kuid_munged(current_user_ns(), stat->uid); in cp_statx()
538 tmp.stx_gid = from_kgid_munged(current_user_ns(), stat->gid); in cp_statx()
539 tmp.stx_mode = stat->mode; in cp_statx()
540 tmp.stx_ino = stat->ino; in cp_statx()
541 tmp.stx_size = stat->size; in cp_statx()
542 tmp.stx_blocks = stat->blocks; in cp_statx()
543 tmp.stx_attributes_mask = stat->attributes_mask; in cp_statx()
544 tmp.stx_atime.tv_sec = stat->atime.tv_sec; in cp_statx()
545 tmp.stx_atime.tv_nsec = stat->atime.tv_nsec; in cp_statx()
546 tmp.stx_btime.tv_sec = stat->btime.tv_sec; in cp_statx()
547 tmp.stx_btime.tv_nsec = stat->btime.tv_nsec; in cp_statx()
548 tmp.stx_ctime.tv_sec = stat->ctime.tv_sec; in cp_statx()
549 tmp.stx_ctime.tv_nsec = stat->ctime.tv_nsec; in cp_statx()
550 tmp.stx_mtime.tv_sec = stat->mtime.tv_sec; in cp_statx()
551 tmp.stx_mtime.tv_nsec = stat->mtime.tv_nsec; in cp_statx()
552 tmp.stx_rdev_major = MAJOR(stat->rdev); in cp_statx()
553 tmp.stx_rdev_minor = MINOR(stat->rdev); in cp_statx()
554 tmp.stx_dev_major = MAJOR(stat->dev); in cp_statx()
555 tmp.stx_dev_minor = MINOR(stat->dev); in cp_statx()
576 struct kstat stat; in SYSCALL_DEFINE5() local
584 error = vfs_statx(dfd, filename, flags, &stat, mask); in SYSCALL_DEFINE5()
588 return cp_statx(&stat, buffer); in SYSCALL_DEFINE5()
592 static int cp_compat_stat(struct kstat *stat, struct compat_stat __user *ubuf) in cp_compat_stat() argument
596 if (!old_valid_dev(stat->dev) || !old_valid_dev(stat->rdev)) in cp_compat_stat()
600 tmp.st_dev = old_encode_dev(stat->dev); in cp_compat_stat()
601 tmp.st_ino = stat->ino; in cp_compat_stat()
602 if (sizeof(tmp.st_ino) < sizeof(stat->ino) && tmp.st_ino != stat->ino) in cp_compat_stat()
604 tmp.st_mode = stat->mode; in cp_compat_stat()
605 tmp.st_nlink = stat->nlink; in cp_compat_stat()
606 if (tmp.st_nlink != stat->nlink) in cp_compat_stat()
608 SET_UID(tmp.st_uid, from_kuid_munged(current_user_ns(), stat->uid)); in cp_compat_stat()
609 SET_GID(tmp.st_gid, from_kgid_munged(current_user_ns(), stat->gid)); in cp_compat_stat()
610 tmp.st_rdev = old_encode_dev(stat->rdev); in cp_compat_stat()
611 if ((u64) stat->size > MAX_NON_LFS) in cp_compat_stat()
613 tmp.st_size = stat->size; in cp_compat_stat()
614 tmp.st_atime = stat->atime.tv_sec; in cp_compat_stat()
615 tmp.st_atime_nsec = stat->atime.tv_nsec; in cp_compat_stat()
616 tmp.st_mtime = stat->mtime.tv_sec; in cp_compat_stat()
617 tmp.st_mtime_nsec = stat->mtime.tv_nsec; in cp_compat_stat()
618 tmp.st_ctime = stat->ctime.tv_sec; in cp_compat_stat()
619 tmp.st_ctime_nsec = stat->ctime.tv_nsec; in cp_compat_stat()
620 tmp.st_blocks = stat->blocks; in cp_compat_stat()
621 tmp.st_blksize = stat->blksize; in cp_compat_stat()
628 struct kstat stat; in COMPAT_SYSCALL_DEFINE2() local
631 error = vfs_stat(filename, &stat); in COMPAT_SYSCALL_DEFINE2()
634 return cp_compat_stat(&stat, statbuf); in COMPAT_SYSCALL_DEFINE2()
640 struct kstat stat; in COMPAT_SYSCALL_DEFINE2() local
643 error = vfs_lstat(filename, &stat); in COMPAT_SYSCALL_DEFINE2()
646 return cp_compat_stat(&stat, statbuf); in COMPAT_SYSCALL_DEFINE2()
654 struct kstat stat; in COMPAT_SYSCALL_DEFINE4() local
657 error = vfs_fstatat(dfd, filename, &stat, flag); in COMPAT_SYSCALL_DEFINE4()
660 return cp_compat_stat(&stat, statbuf); in COMPAT_SYSCALL_DEFINE4()
667 struct kstat stat; in COMPAT_SYSCALL_DEFINE2() local
668 int error = vfs_fstat(fd, &stat); in COMPAT_SYSCALL_DEFINE2()
671 error = cp_compat_stat(&stat, statbuf); in COMPAT_SYSCALL_DEFINE2()