From nobody Thu Jan 23 09:52:00 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Ydx745kXQz5lvwB; Thu, 23 Jan 2025 09:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ydx745Bcmz3s3c; Thu, 23 Jan 2025 09:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737625920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=02UE+NO1VoGMw6B7aHzBATQOItsWPKhCjHJZxmtRFK8=; b=uR6G/ifC+euvKvJ4bNNqUSRi8oelTlhq5Hfhx4F+ZmnRXWWo7mdBfpO/N5bVHFXvflaD/s 3cwpjDNDrGYv921UedOtsu4JdTGkw/rINwU0lPaN0OfYti0UX8GgsqrpSkauT+1O9XCqez xVhpxLECEZ4N19Qq8jc3+Rb4OOx4OqVLjuc9ugIbIQyxSyM9RXt52t9Pv7y5Va/c4zozZ+ 3AqT6DuO+OeJrRjwNWrIOD2g2hdQApuNduic1zw8CyjxTE+3Ae0DgRHbZ/7LVKGQ6KAJpZ qF+CElcUr48lf/uizvU3KSxzXgSjcBmXK2PWtEnnw6x7FX0jZ5f4a+sfsYTyzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737625920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=02UE+NO1VoGMw6B7aHzBATQOItsWPKhCjHJZxmtRFK8=; b=GvMeRBVmueoiRRDHqeTpkZEG44wuO1fL7zrlE5Kxp+S76JgjauOCB5x1gx2hEUmbKmlHg+ R8wA/mEed6XVpRKyYS9Z9h+IU1JLvic+cgOBnRosirld0e3JuiVhGCYBZ8fvB1OW9rqZeV WyYXwJmFjc1QN3MDH7WaLTyBKb4WO1o+h68bgo96wdsEvz3mi4usy8wM2wBbAxP9xQyzfb aEpEHP4+Is/P6LEfZ6RGheSjpNIwgLumaPt9lvgHv3WGFb7d+a6vtNBH961vbkh/7iLMfg 8UKIMyzlOKN11TWlHLwg2TjEkEC6eGuDv347PL9G/W/KBjfyOvnaek8IalNgaQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737625920; a=rsa-sha256; cv=none; b=rxoqmuPNvw6b/z+qSdrEzt+afkD8s+527ioMGmOesERsuDk9gL7f5UVacdtVZsw891t8mL UjU89kp804kIDUMyY8yX0ybQFOK/gucSN+pWk6cTrkv2c4sv2C4UFPbC6HnrIdZeTjkUdi tUWa/GDyjlYICZoJkdTOfzZ2omaDo5Xd1GWo26CHKQJsCh/vyFQQ9dl46IeiUwaGQ3LFJA iZrmikJY1WxC+EhxGJ9ZeiSiSz6afVkEsmu7/v71N4WHMaedXJUqFTRXvBgPhcKmf9gA/H 4LRwy5o34SZFpfYFDKf1KCo6dqIt9b1iuH0psT/JtLpcfRhevwtE2oiNYcpqRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Ydx744crXzZpt; Thu, 23 Jan 2025 09:52:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50N9q0VU073402; Thu, 23 Jan 2025 09:52:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50N9q0qY073399; Thu, 23 Jan 2025 09:52:00 GMT (envelope-from git) Date: Thu, 23 Jan 2025 09:52:00 GMT Message-Id: <202501230952.50N9q0qY073399@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 86e95bb26ad8 - stable/14 - stat(2): add st_filerev List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 86e95bb26ad8f357ddc6aef655b56d695b01fa7e Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=86e95bb26ad8f357ddc6aef655b56d695b01fa7e commit 86e95bb26ad8f357ddc6aef655b56d695b01fa7e Author: Konstantin Belousov AuthorDate: 2025-01-13 21:14:04 +0000 Commit: Konstantin Belousov CommitDate: 2025-01-23 09:46:57 +0000 stat(2): add st_filerev (cherry picked from commit b4663a8d111767206bb3ebcfec5b95a6b88bc720) --- sys/compat/freebsd32/freebsd32.h | 3 ++- sys/compat/freebsd32/freebsd32_misc.c | 1 + sys/fs/tmpfs/tmpfs_vnops.c | 1 + sys/kern/kern_descrip.c | 1 + sys/kern/vfs_default.c | 2 ++ sys/kern/vfs_subr.c | 1 + sys/sys/stat.h | 3 ++- sys/sys/vnode.h | 1 + sys/ufs/ufs/ufs_vnops.c | 2 ++ 9 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index e1bfe282c4b1..3dbf1b5a876d 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -240,7 +240,8 @@ struct stat32 { uint32_t st_blksize; uint32_t st_flags; uint64_t st_gen; - uint64_t st_spare[10]; + uint64_t st_filerev; + uint64_t st_spare[9]; }; struct freebsd11_stat32 { uint32_t st_dev; diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c index facbf00a4c51..c4872373735c 100644 --- a/sys/compat/freebsd32/freebsd32_misc.c +++ b/sys/compat/freebsd32/freebsd32_misc.c @@ -2249,6 +2249,7 @@ copy_stat(struct stat *in, struct stat32 *out) CP(*in, *out, st_blksize); CP(*in, *out, st_flags); CP(*in, *out, st_gen); + CP(*in, *out, st_filerev); TS_CP(*in, *out, st_birthtim); out->st_padding0 = 0; out->st_padding1 = 0; diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index a42ada6a5469..d67f71202228 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -476,6 +476,7 @@ tmpfs_stat(struct vop_stat_args *v) sb->st_blksize = PAGE_SIZE; sb->st_flags = node->tn_flags; sb->st_gen = node->tn_gen; + sb->st_filerev = 0; if (vp->v_type == VREG) { #ifdef __ILP32__ vm_object_t obj = node->tn_reg.tn_aobj; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 61cf7fc845a2..b054bb43074c 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1622,6 +1622,7 @@ kern_fstat(struct thread *td, int fd, struct stat *sbp) AUDIT_ARG_FILE(td->td_proc, fp); + sbp->st_filerev = 0; error = fo_stat(fp, sbp, td->td_ucred); fdrop(fp, td); #ifdef __STAT_TIME_T_EXT diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 69a7a2cb472c..d044a52bce2d 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -1514,6 +1514,7 @@ vop_stdstat(struct vop_stat_args *a) vap->va_fsid = VNOVAL; vap->va_gen = 0; vap->va_rdev = NODEV; + vap->va_filerev = 0; error = VOP_GETATTR(vp, vap, a->a_active_cred); if (error) @@ -1590,6 +1591,7 @@ vop_stdstat(struct vop_stat_args *a) sb->st_flags = vap->va_flags; sb->st_blocks = vap->va_bytes / S_BLKSIZE; sb->st_gen = vap->va_gen; + sb->st_filerev = vap->va_filerev; out: return (vop_stat_helper_post(a, error)); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 404c51b7db77..729741ea901f 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1165,6 +1165,7 @@ vattr_null(struct vattr *vap) vap->va_flags = VNOVAL; vap->va_gen = VNOVAL; vap->va_vaflags = 0; + vap->va_filerev = VNOVAL; } /* diff --git a/sys/sys/stat.h b/sys/sys/stat.h index d083b877e6dd..bbdf485581c6 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -187,7 +187,8 @@ struct stat { blksize_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint64_t st_gen; /* file generation number */ - __uint64_t st_spare[10]; + __uint64_t st_filerev; /* file revision, incr on changes */ + __uint64_t st_spare[9]; }; #ifdef _KERNEL diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 2cf62a51e101..404121ecabc2 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -994,6 +994,7 @@ void vop_rename_fail(struct vop_rename_args *ap); ap->a_sb->st_padding0 = 0; \ ap->a_sb->st_padding1 = 0; \ bzero(_ap->a_sb->st_spare, sizeof(_ap->a_sb->st_spare)); \ + ap->a_sb->st_filerev = 0; \ } \ _error; \ }) diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index fcd5e7478cad..1a50089781ee 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -551,6 +551,7 @@ ufs_stat(struct vop_stat_args *ap) sb->st_birthtim.tv_sec = -1; sb->st_birthtim.tv_nsec = 0; sb->st_blocks = dbtob((uint64_t)ip->i_din1->di_blocks) / S_BLKSIZE; + sb->st_filerev = ip->i_din1->di_modrev; } else { sb->st_rdev = ip->i_din2->di_rdev; sb->st_size = ip->i_din2->di_size; @@ -561,6 +562,7 @@ ufs_stat(struct vop_stat_args *ap) sb->st_birthtim.tv_sec = ip->i_din2->di_birthtime; sb->st_birthtim.tv_nsec = ip->i_din2->di_birthnsec; sb->st_blocks = dbtob((uint64_t)ip->i_din2->di_blocks) / S_BLKSIZE; + sb->st_filerev = ip->i_din2->di_modrev; } sb->st_blksize = max(PAGE_SIZE, vp->v_mount->mnt_stat.f_iosize);