*
* This code handles user interaction with the configuration interface
* to the Lustre file system to fine tune it.
+ *
+ * Copyright (c) 2016, Intel Corporation.
*/
#include <errno.h>
#include <stdint.h>
#include <libcfs/util/param.h>
-#include <lustre/lustre_user.h>
+#include <linux/lustre/lustre_user.h>
#include <lustre/lustreapi.h>
#include "lustreapi_internal.h"
char pattern[PATH_MAX];
int rc = 0;
- if (filter == NULL || obd_type == NULL)
+ if (filter == NULL && type != FILTER_BY_NONE)
return -EINVAL;
switch (type) {
}
if (strlen(pattern) + 3 > sizeof(pattern))
return -E2BIG;
- strncat(pattern, "-*", sizeof(pattern));
+ strncat(pattern, "-*", sizeof(pattern) - 1);
break;
case FILTER_BY_FS_NAME:
rc = snprintf(pattern, sizeof(pattern) - 1, "%s-*", filter);
return -EINVAL;
rc = 0;
break;
- default:
+ case FILTER_BY_EXACT:
if (strlen(filter) + 1 > sizeof(pattern))
return -E2BIG;
strncpy(pattern, filter, sizeof(pattern));
break;
+ case FILTER_BY_NONE:
+ default:
+ break;
}
- if (param_name != NULL) {
+ if (type == FILTER_BY_NONE) {
+ if (cfs_get_param_paths(param, "%s", param_name) != 0)
+ rc = -errno;
+ } else if (param_name != NULL) {
if (cfs_get_param_paths(param, "%s/%s/%s",
obd_type, pattern, param_name) != 0)
rc = -errno;