From owner-svn-src-all@freebsd.org Sat Jun 9 02:41:52 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 67F43FF44C5; Sat, 9 Jun 2018 02:41:52 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 167A27F429; Sat, 9 Jun 2018 02:41:52 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA4EE17DC1; Sat, 9 Jun 2018 02:41:51 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w592fpwc070737; Sat, 9 Jun 2018 02:41:51 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w592fp0S070736; Sat, 9 Jun 2018 02:41:51 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201806090241.w592fp0S070736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sat, 9 Jun 2018 02:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334868 - head/stand/libsa X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/libsa X-SVN-Commit-Revision: 334868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2018 02:41:52 -0000 Author: sjg Date: Sat Jun 9 02:41:51 2018 New Revision: 334868 URL: https://svnweb.freebsd.org/changeset/base/334868 Log: Add st_mtime, st_ino and st_dev for ufs_stat Differential Revision: D15064 Modified: head/stand/libsa/ufs.c Modified: head/stand/libsa/ufs.c ============================================================================== --- head/stand/libsa/ufs.c Sat Jun 9 02:25:18 2018 (r334867) +++ head/stand/libsa/ufs.c Sat Jun 9 02:41:51 2018 (r334868) @@ -124,6 +124,7 @@ struct file { ufs2_daddr_t f_buf_blkno; /* block number of data block */ char *f_buf; /* buffer for data block */ size_t f_buf_size; /* size of data block */ + int f_inumber; /* inumber */ }; #define DIP(fp, field) \ ((fp)->f_fs->fs_magic == FS_UFS1_MAGIC ? \ @@ -190,6 +191,7 @@ read_inode(inumber, f) fp->f_buf_blkno = -1; } fp->f_seekp = 0; + fp->f_inumber = inumber; out: free(buf); return (rc); @@ -836,6 +838,20 @@ ufs_stat(f, sb) sb->st_uid = DIP(fp, di_uid); sb->st_gid = DIP(fp, di_gid); sb->st_size = DIP(fp, di_size); + sb->st_mtime = DIP(fp, di_mtime); + /* + * The items below are ufs specific! + * Other fs types will need their own solution + * if these fields are needed. + */ + sb->st_ino = fp->f_inumber; + /* + * We need something to differentiate devs. + * fs_id is unique but 64bit, we xor the two + * halves to squeeze it into 32bits. + */ + sb->st_dev = (dev_t)(fp->f_fs->fs_id[0] ^ fp->f_fs->fs_id[1]); + return (0); }