svn commit: r307196 - head/contrib/netbsd-tests/fs/tmpfs

Ngie Cooper ngie at FreeBSD.org
Thu Oct 13 07:32:26 UTC 2016


Author: ngie
Date: Thu Oct 13 07:32:25 2016
New Revision: 307196
URL: https://svnweb.freebsd.org/changeset/base/307196

Log:
  Port contrib/netbsd-tests/fs/tmpfs/h_tools.c to FreeBSD
  
  - Add inttypes.h #include for PRId64 macro
  - Use FreeBSD's copy of getfh(2), which doesn't include a `fh_size` parameter.
    Use sizeof(fhandle_t) instead as the size of fhp is always fixed as
    fhandle_t, unlike NetBSD's copy of fhp, which is void*.
  
  MFC after:	2 weeks
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/contrib/netbsd-tests/fs/tmpfs/h_tools.c

Modified: head/contrib/netbsd-tests/fs/tmpfs/h_tools.c
==============================================================================
--- head/contrib/netbsd-tests/fs/tmpfs/h_tools.c	Thu Oct 13 07:25:18 2016	(r307195)
+++ head/contrib/netbsd-tests/fs/tmpfs/h_tools.c	Thu Oct 13 07:32:25 2016	(r307196)
@@ -50,6 +50,10 @@
 #include <string.h>
 #include <unistd.h>
 
+#ifdef __FreeBSD__
+#include <inttypes.h>
+#endif
+
 /* --------------------------------------------------------------------- */
 
 static int getfh_main(int, char **);
@@ -70,7 +74,12 @@ getfh_main(int argc, char **argv)
 	if (argc < 2)
 		return EXIT_FAILURE;
 
+#ifdef __FreeBSD__
+	fh_size = sizeof(fhandle_t);
+#else
 	fh_size = 0;
+#endif
+
 	fh = NULL;
 	for (;;) {
 		if (fh_size) {
@@ -85,7 +94,11 @@ getfh_main(int argc, char **argv)
 		 * but it may change if someone moves things around,
 		 * so retry untill we have enough memory.
 		 */
+#ifdef __FreeBSD__
+		error = getfh(argv[1], fh);
+#else
 		error = getfh(argv[1], fh, &fh_size);
+#endif
 		if (error == 0) {
 			break;
 		} else {


More information about the svn-src-head mailing list