Assign a random number to di_gen (for FFS), instead of extracting it
from struct stat. We don't necessarily have permissions to see the generation number and the host OS may not have st_gen in struct stat anyway. Since the kernel assigns random numbers, there's nothing meaningful about the generation that requires us to preserve it when the file system image is created. With this change, all generation numbers come from random() and that makes it easier to add support for reproducible builds at some time in the future (i.e. by adding an argument to makefs that changes the behaviour of random() so that it always returns 0 or some predictable sequence). Differential Revision: https://reviews.freebsd.org/D8418
This commit is contained in:
parent
4f3a4c0163
commit
4ad8d73326
@ -20,7 +20,6 @@ WARNS?= 2
|
||||
.include "${SRCDIR}/ffs/Makefile.inc"
|
||||
|
||||
CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1
|
||||
CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1
|
||||
|
||||
.PATH: ${SRCTOP}/contrib/mtree
|
||||
CFLAGS+=-I${SRCTOP}/contrib/mtree
|
||||
|
@ -666,9 +666,7 @@ ffs_build_dinode1(struct ufs1_dinode *dinp, dirbuf_t *dbufp, fsnode *cur,
|
||||
#if HAVE_STRUCT_STAT_ST_FLAGS
|
||||
dinp->di_flags = cur->inode->st.st_flags;
|
||||
#endif
|
||||
#if HAVE_STRUCT_STAT_ST_GEN
|
||||
dinp->di_gen = cur->inode->st.st_gen;
|
||||
#endif
|
||||
dinp->di_gen = random();
|
||||
dinp->di_uid = cur->inode->st.st_uid;
|
||||
dinp->di_gid = cur->inode->st.st_gid;
|
||||
|
||||
@ -716,9 +714,7 @@ ffs_build_dinode2(struct ufs2_dinode *dinp, dirbuf_t *dbufp, fsnode *cur,
|
||||
#if HAVE_STRUCT_STAT_ST_FLAGS
|
||||
dinp->di_flags = cur->inode->st.st_flags;
|
||||
#endif
|
||||
#if HAVE_STRUCT_STAT_ST_GEN
|
||||
dinp->di_gen = cur->inode->st.st_gen;
|
||||
#endif
|
||||
dinp->di_gen = random();
|
||||
dinp->di_uid = cur->inode->st.st_uid;
|
||||
dinp->di_gid = cur->inode->st.st_gid;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user