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
This commit is contained in:
parent
f1519c0157
commit
12be646525
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user