* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2016, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <lustre_log.h>
#include <lustre_disk.h>
#include <lustre_dlm.h>
-#include <lustre_param.h>
+#include <uapi/linux/lustre/lustre_param.h>
#include <lustre_sec.h>
#include "ptlrpc_internal.h"
static struct mutex sptlrpc_conf_lock;
static struct list_head sptlrpc_confs;
-static inline int is_hex(char c)
-{
- return ((c >= '0' && c <= '9') ||
- (c >= 'a' && c <= 'f'));
-}
-
-static void target2fsname(const char *tgt, char *fsname, int buflen)
-{
- const char *ptr;
- int len;
-
- ptr = strrchr(tgt, '-');
- if (ptr) {
- if ((strncmp(ptr, "-MDT", 4) != 0 &&
- strncmp(ptr, "-OST", 4) != 0) ||
- !is_hex(ptr[4]) || !is_hex(ptr[5]) ||
- !is_hex(ptr[6]) || !is_hex(ptr[7]))
- ptr = NULL;
- }
-
- /* if we didn't find the pattern, treat the whole string as fsname */
- if (ptr == NULL)
- len = strlen(tgt);
- else
- len = ptr - tgt;
-
- len = min(len, buflen - 1);
- memcpy(fsname, tgt, len);
- fsname[len] = '\0';
-}
-
static void sptlrpc_conf_free_rsets(struct sptlrpc_conf *conf)
{
struct sptlrpc_conf_tgt *conf_tgt, *conf_tgt_next;
char fsname[MTI_NAME_MAXLEN];
struct sptlrpc_rule rule;
int rc;
- ENTRY;
+
+ ENTRY;
+ print_lustre_cfg(lcfg);
target = lustre_cfg_string(lcfg, 1);
if (target == NULL) {
RETURN(-EINVAL);
if (conf == NULL) {
- target2fsname(target, fsname, sizeof(fsname));
+ obdname2fsname(target, fsname, sizeof(fsname));
mutex_lock(&sptlrpc_conf_lock);
conf = sptlrpc_conf_get(fsname, 0);
char name[MTI_NAME_MAXLEN];
int len, rc = 0;
- target2fsname(target->uuid, name, sizeof(name));
+ obd_uuid2fsname(name, target->uuid, sizeof(name));
mutex_lock(&sptlrpc_conf_lock);
RETURN(-EINVAL);
}
- target2fsname(obd->obd_uuid.uuid, fsname, sizeof(fsname));
+ obd_uuid2fsname(fsname, obd->obd_uuid.uuid, sizeof(fsname));
mutex_lock(&sptlrpc_conf_lock);
conf = sptlrpc_conf_get(fsname, 0);