Whamcloud - gitweb
LU-11394 utils: Adjust HOSTID constant 78/34278/3
authorNathaniel Clark <nclark@whamcloud.com>
Tue, 19 Feb 2019 22:22:41 +0000 (17:22 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 13 Apr 2019 04:51:03 +0000 (04:51 +0000)
Use constant defined in spl / post-0.8.0 libspl, for HOSTID file.
Also allows get_system_hostid() to be pulled in from ZFS 0.8.x

Test-Parameters: trivial
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Change-Id: Iba70d4f3b7f237260bdc964b28b601deeee81208
Reviewed-on: https://review.whamcloud.com/34278
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Olaf Faaland-LLNL <faaland1@llnl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/libmount_utils_zfs.c

index ebbee5c..770a053 100644 (file)
@@ -31,8 +31,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <libzfs.h>
-
-#define HOSTID_PATH "/etc/hostid"
+#include <sys/systeminfo.h>
 
 /* Persistent mount data is stored in these user attributes */
 #define LDD_PREFIX             "lustre:"
@@ -273,7 +272,7 @@ static int zfs_check_hostid(struct mkfs_opts *mop)
        if (hostid != 0)
                return 0;
 
-       f = fopen(HOSTID_PATH, "r");
+       f = fopen(HW_HOSTID_PATH, "r");
        if (f == NULL)
                goto out;
 
@@ -281,7 +280,7 @@ static int zfs_check_hostid(struct mkfs_opts *mop)
        fclose(f);
 
        if (rc != 1) {
-               fprintf(stderr, "Failed to read "HOSTID_PATH": %d\n",
+               fprintf(stderr, "Failed to read "HW_HOSTID_PATH": %d\n",
                       rc);
                hostid = 0;
        }