Whamcloud - gitweb
LU-4020 hsm: allow copytool event monitoring with JSON
[fs/lustre-release.git] / lustre / utils / liblustreapi.c
index eabe1d5..402c44e 100644 (file)
@@ -379,6 +379,24 @@ static int find_poolpath(char *fsname, char *poolname, char *poolpath)
         return 0;
 }
 
+/*
+ * Trim a trailing newline from a string, if it exists.
+ */
+int llapi_chomp_string(char *buf)
+{
+       if (!buf || !*buf)
+               return 0;
+
+       while (buf[1])
+               buf++;
+
+       if (*buf != '\n')
+               return 0;
+
+       *buf = '\0';
+       return '\n';
+}
+
 /**
   * return a parameter string for a specific device type or mountpoint
   *
@@ -599,6 +617,11 @@ out:
        return md_size;
 }
 
+int llapi_get_agent_uuid(char *path, char *buf, size_t bufsize)
+{
+       return get_param_lmv(path, "uuid", buf, bufsize);
+}
+
 /*
  * if pool is NULL, search ostname in target_obd
  * if pool is not NULL: