Whamcloud - gitweb
LU-11394 utils: Adjust HOSTID constant 54/34654/3
authorNathaniel Clark <nclark@whamcloud.com>
Tue, 19 Feb 2019 22:22:41 +0000 (17:22 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 16 Apr 2019 20:50:10 +0000 (20:50 +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

Lustre-change: https://review.whamcloud.com/34278
Lustre-commit: dce29976d14ca5aeba2dc8f0c464931c3826a6de

Test-Parameters: trivial
Signed-off-by: Nathaniel Clark <nclark@whamcloud.com>
Change-Id: Iba70d4f3b7f237260bdc964b28b601deeee81208
Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/34654
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@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>
 #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:"
 
 /* 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;
 
        if (hostid != 0)
                return 0;
 
-       f = fopen(HOSTID_PATH, "r");
+       f = fopen(HW_HOSTID_PATH, "r");
        if (f == NULL)
                goto out;
 
        if (f == NULL)
                goto out;
 
@@ -281,7 +280,7 @@ static int zfs_check_hostid(struct mkfs_opts *mop)
        fclose(f);
 
        if (rc != 1) {
        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;
        }
                       rc);
                hostid = 0;
        }