Page MenuHomeFreeBSD

D50078.id154958.diff
No OneTemporary

D50078.id154958.diff

diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -685,9 +685,7 @@
dinp->di_mode = cur->inode->st.st_mode;
dinp->di_nlink = cur->inode->nlink;
dinp->di_size = cur->inode->st.st_size;
-#if HAVE_STRUCT_STAT_ST_FLAGS
- dinp->di_flags = cur->inode->st.st_flags;
-#endif
+ dinp->di_flags = FSINODE_ST_FLAGS(*cur->inode);
dinp->di_gen = random();
dinp->di_uid = cur->inode->st.st_uid;
dinp->di_gid = cur->inode->st.st_gid;
@@ -733,9 +731,7 @@
dinp->di_mode = cur->inode->st.st_mode;
dinp->di_nlink = cur->inode->nlink;
dinp->di_size = cur->inode->st.st_size;
-#if HAVE_STRUCT_STAT_ST_FLAGS
- dinp->di_flags = cur->inode->st.st_flags;
-#endif
+ dinp->di_flags = FSINODE_ST_FLAGS(*cur->inode);
dinp->di_gen = random();
dinp->di_uid = cur->inode->st.st_uid;
dinp->di_gid = cur->inode->st.st_gid;
diff --git a/usr.sbin/makefs/makefs.h b/usr.sbin/makefs/makefs.h
--- a/usr.sbin/makefs/makefs.h
+++ b/usr.sbin/makefs/makefs.h
@@ -40,6 +40,12 @@
#ifndef _MAKEFS_H
#define _MAKEFS_H
+#if HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#else
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+#endif
+
#include <sys/stat.h>
#include <err.h>
@@ -85,8 +91,17 @@
enum fi_flags flags; /* flags used by fs specific code */
void *param; /* for use by individual fs impls */
struct stat st; /* stat entry */
+#if !HAVE_STRUCT_STAT_ST_FLAGS
+ uint32_t st_flags; /* stand-in for st.st_flags */
+#endif
} fsinode;
+#if HAVE_STRUCT_STAT_ST_FLAGS
+#define FSINODE_ST_FLAGS(inode) (inode).st.st_flags
+#else
+#define FSINODE_ST_FLAGS(inode) (inode).st_flags
+#endif
+
typedef struct _fsnode {
struct _fsnode *parent; /* parent (NULL if root) */
struct _fsnode *child; /* child (if type == S_IFDIR) */
diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c
--- a/usr.sbin/makefs/mtree.c
+++ b/usr.sbin/makefs/mtree.c
@@ -533,13 +533,11 @@
break;
}
flset = flclr = 0;
-#if HAVE_STRUCT_STAT_ST_FLAGS
if (!strtofflags(&value, &flset, &flclr)) {
- st->st_flags &= ~flclr;
- st->st_flags |= flset;
+ FSINODE_ST_FLAGS(*node->inode) &= ~flclr;
+ FSINODE_ST_FLAGS(*node->inode) |= flset;
} else
error = errno;
-#endif
} else
error = ENOSYS;
break;
diff --git a/usr.sbin/makefs/walk.c b/usr.sbin/makefs/walk.c
--- a/usr.sbin/makefs/walk.c
+++ b/usr.sbin/makefs/walk.c
@@ -530,14 +530,12 @@
dirnode->inode->st.st_uid, specnode->st_uid);
dirnode->inode->st.st_uid = specnode->st_uid;
}
-#if HAVE_STRUCT_STAT_ST_FLAGS
if (specnode->flags & F_FLAGS) {
ASEPRINT("flags", "%#lX",
- (unsigned long)dirnode->inode->st.st_flags,
+ (unsigned long)FSINODE_ST_FLAGS(*dirnode->inode),
(unsigned long)specnode->st_flags);
- dirnode->inode->st.st_flags = specnode->st_flags;
+ FSINODE_ST_FLAGS(*dirnode->inode) = specnode->st_flags;
}
-#endif
/* if (specnode->flags & F_DEV) {
ASEPRINT("rdev", "%#llx",
(unsigned long long)dirnode->inode->st.st_rdev,

File Metadata

Mime Type
text/plain
Expires
Fri, Feb 20, 7:21 AM (4 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28896074
Default Alt Text
D50078.id154958.diff (2 KB)

Event Timeline