Page MenuHomeFreeBSD

D41063.id124791.diff
No OneTemporary

D41063.id124791.diff

diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile
--- a/lib/libsysdecode/Makefile
+++ b/lib/libsysdecode/Makefile
@@ -121,6 +121,11 @@
CFLAGS+=-DPF
.endif
+ZFSINC= ${SRCTOP}/sys/contrib/openzfs/include
+.if ${MK_ZFS} != "no"
+CFLAGS+=-DZFS -I${ZFSINC}
+.endif
+
# Workaround duplicate declarations in <netinet/ip_compat.h>
CFLAGS.gcc.ioctl.c+= -Wno-redundant-decls
@@ -139,6 +144,7 @@
.endif
ioctl.c.tmp: mkioctls .META
env CPP="${CPP}" MK_PF="${MK_PF}" \
+ MK_ZFS="${MK_ZFS}" ZFSINC="${ZFSINC}" \
/bin/sh ${.CURDIR}/mkioctls ${SYSROOT:U${DESTDIR}}${INCLUDEDIR} > ${.TARGET}
ioctl.c: ioctl.c.tmp
diff --git a/lib/libsysdecode/mkioctls b/lib/libsysdecode/mkioctls
--- a/lib/libsysdecode/mkioctls
+++ b/lib/libsysdecode/mkioctls
@@ -75,6 +75,11 @@
print "#include <stddef.h>"
print "#include <stdint.h>"
print "#include <sysdecode.h>"
+ print "#ifdef ZFS"
+ print "#define boolean_t int"
+ print "#define hrtime_t int"
+ print "#include <sys/fs/zfs.h>"
+ print "#endif"
print ""
print ioctl_includes
print ""
@@ -99,9 +104,17 @@
printf("if (val == %s)\n", $i);
printf("\t\tstr = \"%s\";\n", $i);
}
-END {
- print ""
- print "\treturn (str);"
- print "}"
-}
'
+# ZFS is special
+if [ "${MK_ZFS}" = "yes" ]; then
+ sed -nE 's/^ (ZFS_IOC_[A-Z0-9_]+).*$/\1/p' ${ZFSINC}/sys/fs/zfs.h |
+ sort -u | grep -vE 'ZFS_IOC_(FIRST|LAST)' |
+ while read ioc; do
+ printf "\telse if ((val & 0xffff) == $ioc + ('Z' << 8))\n"
+ printf "\t\tstr = \"$ioc\";\n"
+ done
+fi
+
+printf ""
+printf "\treturn (str);"
+printf "}"

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 26, 6:05 AM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32167590
Default Alt Text
D41063.id124791.diff (1 KB)

Event Timeline