stat.c (761e28fa270a3cc0f2ae9a0f4f778239b91a9df2) stat.c (fa2fcf4f1df1559a0a4ee0f46915b496cc2ebf60)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/stat.c
4 *
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 */
7
8#include <linux/export.h>

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

17#include <linux/syscalls.h>
18#include <linux/pagemap.h>
19#include <linux/compat.h>
20
21#include <linux/uaccess.h>
22#include <asm/unistd.h>
23
24#include "internal.h"
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * linux/fs/stat.c
4 *
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 */
7
8#include <linux/export.h>

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

17#include <linux/syscalls.h>
18#include <linux/pagemap.h>
19#include <linux/compat.h>
20
21#include <linux/uaccess.h>
22#include <asm/unistd.h>
23
24#include "internal.h"
25#include "mount.h"
25
26/**
27 * generic_fillattr - Fill in the basic attributes from the inode struct
28 * @inode: Inode to use as the source
29 * @stat: Where to fill in the attributes
30 *
31 * Fill in the basic attributes in the kstat structure from data that's to be
32 * found on the VFS inode structure. This is the default if no getattr inode

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

194 if (vfs_stat_set_lookup_flags(&lookup_flags, flags))
195 return -EINVAL;
196retry:
197 error = user_path_at(dfd, filename, lookup_flags, &path);
198 if (error)
199 goto out;
200
201 error = vfs_getattr(&path, stat, request_mask, flags);
26
27/**
28 * generic_fillattr - Fill in the basic attributes from the inode struct
29 * @inode: Inode to use as the source
30 * @stat: Where to fill in the attributes
31 *
32 * Fill in the basic attributes in the kstat structure from data that's to be
33 * found on the VFS inode structure. This is the default if no getattr inode

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

195 if (vfs_stat_set_lookup_flags(&lookup_flags, flags))
196 return -EINVAL;
197retry:
198 error = user_path_at(dfd, filename, lookup_flags, &path);
199 if (error)
200 goto out;
201
202 error = vfs_getattr(&path, stat, request_mask, flags);
203 stat->mnt_id = real_mount(path.mnt)->mnt_id;
204 stat->result_mask |= STATX_MNT_ID;
202 path_put(&path);
203 if (retry_estale(error, lookup_flags)) {
204 lookup_flags |= LOOKUP_REVAL;
205 goto retry;
206 }
207out:
208 return error;
209}

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

558 tmp.stx_ctime.tv_sec = stat->ctime.tv_sec;
559 tmp.stx_ctime.tv_nsec = stat->ctime.tv_nsec;
560 tmp.stx_mtime.tv_sec = stat->mtime.tv_sec;
561 tmp.stx_mtime.tv_nsec = stat->mtime.tv_nsec;
562 tmp.stx_rdev_major = MAJOR(stat->rdev);
563 tmp.stx_rdev_minor = MINOR(stat->rdev);
564 tmp.stx_dev_major = MAJOR(stat->dev);
565 tmp.stx_dev_minor = MINOR(stat->dev);
205 path_put(&path);
206 if (retry_estale(error, lookup_flags)) {
207 lookup_flags |= LOOKUP_REVAL;
208 goto retry;
209 }
210out:
211 return error;
212}

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

561 tmp.stx_ctime.tv_sec = stat->ctime.tv_sec;
562 tmp.stx_ctime.tv_nsec = stat->ctime.tv_nsec;
563 tmp.stx_mtime.tv_sec = stat->mtime.tv_sec;
564 tmp.stx_mtime.tv_nsec = stat->mtime.tv_nsec;
565 tmp.stx_rdev_major = MAJOR(stat->rdev);
566 tmp.stx_rdev_minor = MINOR(stat->rdev);
567 tmp.stx_dev_major = MAJOR(stat->dev);
568 tmp.stx_dev_minor = MINOR(stat->dev);
569 tmp.stx_mnt_id = stat->mnt_id;
566
567 return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0;
568}
569
570/**
571 * sys_statx - System call to get enhanced stats
572 * @dfd: Base directory to pathwalk from *or* fd to stat.
573 * @filename: File to stat or "" with AT_EMPTY_PATH

--- 177 unchanged lines hidden ---
570
571 return copy_to_user(buffer, &tmp, sizeof(tmp)) ? -EFAULT : 0;
572}
573
574/**
575 * sys_statx - System call to get enhanced stats
576 * @dfd: Base directory to pathwalk from *or* fd to stat.
577 * @filename: File to stat or "" with AT_EMPTY_PATH

--- 177 unchanged lines hidden ---