Page MenuHomeFreeBSD

D48794.diff
No OneTemporary

D48794.diff

diff --git a/lib/libufs/Makefile b/lib/libufs/Makefile
--- a/lib/libufs/Makefile
+++ b/lib/libufs/Makefile
@@ -3,8 +3,8 @@
SHLIBDIR?= /lib
SHLIB_MAJOR= 8
-SRCS= block.c cgroup.c gsb_crc32.c inode.c sblock.c type.c ffs_subr.c
-SRCS+= ffs_tables.c
+SRCS= block.c cgroup.c gsb_crc32.c inode.c sblock.c type.c ffs_compat.c
+SRCS+= ffs_subr.c ffs_tables.c
INCS= libufs.h
MAN= bread.3 cgread.3 getinode.3 libufs.3 sbread.3 ufs_disk_close.3
diff --git a/sys/conf/files b/sys/conf/files
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -5222,6 +5222,7 @@
teken/teken.c optional sc !SC_NO_TERM_TEKEN | vt
ufs/ffs/ffs_alloc.c optional ffs
ufs/ffs/ffs_balloc.c optional ffs
+ufs/ffs/ffs_compat.c optional ffs
ufs/ffs/ffs_inode.c optional ffs
ufs/ffs/ffs_snapshot.c optional ffs
ufs/ffs/ffs_softdep.c optional ffs
diff --git a/sys/modules/ufs/Makefile b/sys/modules/ufs/Makefile
--- a/sys/modules/ufs/Makefile
+++ b/sys/modules/ufs/Makefile
@@ -4,9 +4,9 @@
SRCS= opt_ddb.h opt_directio.h opt_ffs.h opt_quota.h opt_suiddir.h opt_ufs.h \
vnode_if.h ufs_acl.c ufs_bmap.c ufs_dirhash.c ufs_extattr.c \
ufs_gjournal.c ufs_inode.c ufs_lookup.c ufs_quota.c ufs_vfsops.c \
- ufs_vnops.c ffs_alloc.c ffs_balloc.c ffs_inode.c ffs_rawread.c \
- ffs_snapshot.c ffs_softdep.c ffs_subr.c ffs_suspend.c ffs_tables.c \
- ffs_vfsops.c ffs_vnops.c
+ ufs_vnops.c ffs_alloc.c ffs_balloc.c ffs_compat.c ffs_inode.c \
+ ffs_rawread.c ffs_snapshot.c ffs_softdep.c ffs_subr.c ffs_suspend.c \
+ ffs_tables.c ffs_vfsops.c ffs_vnops.c
.if !defined(KERNBUILDDIR)
CFLAGS+= -DSOFTUPDATES -DUFS_DIRHASH
diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c
--- a/sys/ufs/ffs/ffs_alloc.c
+++ b/sys/ufs/ffs/ffs_alloc.c
@@ -489,7 +489,8 @@
* allocation will be used.
*/
-SYSCTL_DECL(_vfs_ffs);
+SYSCTL_NODE(_vfs, OID_AUTO, ffs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
+ "FFS filesystem");
static int doasyncfree = 1;
SYSCTL_INT(_vfs_ffs, OID_AUTO, doasyncfree, CTLFLAG_RW, &doasyncfree, 0,
diff --git a/sys/ufs/ffs/ffs_compat.c b/sys/ufs/ffs/ffs_compat.c
new file mode 100644
--- /dev/null
+++ b/sys/ufs/ffs/ffs_compat.c
@@ -0,0 +1,106 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1982, 1986, 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _KERNEL
+#include <stdio.h>
+#include <stdbool.h>
+
+#include <ufs/ffs/fs.h>
+
+#else /* _KERNEL */
+#include <sys/systm.h>
+#include <sys/mount.h>
+#include <sys/vnode.h>
+#include <sys/sysctl.h>
+
+#include <ufs/ufs/quota.h>
+#include <ufs/ufs/inode.h>
+#include <ufs/ffs/ffs_extern.h>
+#include <ufs/ffs/fs.h>
+
+#endif /* _KERNEL */
+
+/*
+ * Sanity checks for loading old filesystem inodes.
+ *
+ * XXX - Parts get retired eventually.
+ * Unfortunately new bits get added.
+ */
+static int prttimechgs = 0;
+#ifdef _KERNEL
+SYSCTL_DECL(_vfs_ffs);
+SYSCTL_INT(_vfs_ffs, OID_AUTO, prttimechgs, CTLFLAG_RWTUN, &prttimechgs, 0,
+ "print UFS1 time changes made to inodes");
+#endif /* _KERNEL */
+bool
+ffs_oldfscompat_inode_read(struct fs *fs, union dinodep dp, time_t now)
+{
+ bool change;
+
+ change = false;
+ switch (fs->fs_magic) {
+ case FS_UFS2_MAGIC:
+ /* No changes for now */
+ break;
+
+ case FS_UFS1_MAGIC:
+ /*
+ * With the change to unsigned time values in UFS1, times set
+ * before Jan 1, 1970 will appear to be in the future. Check
+ * for future times and set them to be the current time.
+ */
+ if (dp.dp1->di_ctime > now) {
+ if (prttimechgs)
+ printf("ctime %ud changed to %ld\n",
+ dp.dp1->di_ctime, (long)now);
+ dp.dp1->di_ctime = now;
+ change = true;
+ }
+ if (dp.dp1->di_mtime > now) {
+ if (prttimechgs)
+ printf("mtime %ud changed to %ld\n",
+ dp.dp1->di_mtime, (long)now);
+ dp.dp1->di_mtime = now;
+ dp.dp1->di_ctime = now;
+ change = true;
+ }
+ if (dp.dp1->di_atime > now) {
+ if (prttimechgs)
+ printf("atime %ud changed to %ld\n",
+ dp.dp1->di_atime, (long)now);
+ dp.dp1->di_atime = now;
+ dp.dp1->di_ctime = now;
+ change = true;
+ }
+ break;
+ }
+ return (change);
+}
diff --git a/sys/ufs/ffs/ffs_subr.c b/sys/ufs/ffs/ffs_subr.c
--- a/sys/ufs/ffs/ffs_subr.c
+++ b/sys/ufs/ffs/ffs_subr.c
@@ -34,7 +34,6 @@
#include <sys/limits.h>
#ifndef _KERNEL
-#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -60,7 +59,6 @@
#include <sys/bio.h>
#include <sys/buf.h>
#include <sys/ucred.h>
-#include <sys/sysctl.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
@@ -397,65 +395,6 @@
}
}
-/*
- * Sanity checks for loading old filesystem inodes.
- *
- * XXX - Parts get retired eventually.
- * Unfortunately new bits get added.
- */
-static int prttimechgs = 0;
-#ifdef _KERNEL
-SYSCTL_NODE(_vfs, OID_AUTO, ffs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
- "FFS filesystem");
-
-SYSCTL_INT(_vfs_ffs, OID_AUTO, prttimechgs, CTLFLAG_RWTUN, &prttimechgs, 0,
- "print UFS1 time changes made to inodes");
-#endif /* _KERNEL */
-bool
-ffs_oldfscompat_inode_read(struct fs *fs, union dinodep dp, time_t now)
-{
- bool change;
-
- change = false;
- switch (fs->fs_magic) {
- case FS_UFS2_MAGIC:
- /* No changes for now */
- break;
-
- case FS_UFS1_MAGIC:
- /*
- * With the change to unsigned time values in UFS1, times set
- * before Jan 1, 1970 will appear to be in the future. Check
- * for future times and set them to be the current time.
- */
- if (dp.dp1->di_ctime > now) {
- if (prttimechgs)
- printf("ctime %ud changed to %ld\n",
- dp.dp1->di_ctime, (long)now);
- dp.dp1->di_ctime = now;
- change = true;
- }
- if (dp.dp1->di_mtime > now) {
- if (prttimechgs)
- printf("mtime %ud changed to %ld\n",
- dp.dp1->di_mtime, (long)now);
- dp.dp1->di_mtime = now;
- dp.dp1->di_ctime = now;
- change = true;
- }
- if (dp.dp1->di_atime > now) {
- if (prttimechgs)
- printf("atime %ud changed to %ld\n",
- dp.dp1->di_atime, (long)now);
- dp.dp1->di_atime = now;
- dp.dp1->di_ctime = now;
- change = true;
- }
- break;
- }
- return (change);
-}
-
/*
* Verify the filesystem values.
*/

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 3, 8:34 PM (21 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16442164
Default Alt Text
D48794.diff (7 KB)

Event Timeline