Exemple #1
0
static int seq_client_debugfs_init(struct lu_client_seq *seq)
{
	int rc;

	seq->lcs_debugfs_entry = ldebugfs_register(seq->lcs_name,
						   seq_debugfs_dir,
						   NULL, NULL);

	if (IS_ERR_OR_NULL(seq->lcs_debugfs_entry)) {
		CERROR("%s: LdebugFS failed in seq-init\n", seq->lcs_name);
		rc = seq->lcs_debugfs_entry ? PTR_ERR(seq->lcs_debugfs_entry)
					    : -ENOMEM;
		seq->lcs_debugfs_entry = NULL;
		return rc;
	}

	rc = ldebugfs_add_vars(seq->lcs_debugfs_entry,
			       seq_client_debugfs_list, seq);
	if (rc) {
		CERROR("%s: Can't init sequence manager debugfs, rc %d\n",
		       seq->lcs_name, rc);
		goto out_cleanup;
	}

	return 0;

out_cleanup:
	seq_client_debugfs_fini(seq);
	return rc;
}
Exemple #2
0
int ldlm_debugfs_setup(void)
{
	int rc;

	ldlm_debugfs_dir = ldebugfs_register(OBD_LDLM_DEVICENAME,
					     debugfs_lustre_root,
					     NULL, NULL);
	if (IS_ERR_OR_NULL(ldlm_debugfs_dir)) {
		CERROR("LProcFS failed in ldlm-init\n");
		rc = ldlm_debugfs_dir ? PTR_ERR(ldlm_debugfs_dir) : -ENOMEM;
		goto err;
	}

	ldlm_ns_debugfs_dir = ldebugfs_register("namespaces",
						ldlm_debugfs_dir,
						NULL, NULL);
	if (IS_ERR_OR_NULL(ldlm_ns_debugfs_dir)) {
		CERROR("LProcFS failed in ldlm-init\n");
		rc = ldlm_ns_debugfs_dir ? PTR_ERR(ldlm_ns_debugfs_dir)
					 : -ENOMEM;
		goto err_type;
	}

	ldlm_svc_debugfs_dir = ldebugfs_register("services",
						 ldlm_debugfs_dir,
						 NULL, NULL);
	if (IS_ERR_OR_NULL(ldlm_svc_debugfs_dir)) {
		CERROR("LProcFS failed in ldlm-init\n");
		rc = ldlm_svc_debugfs_dir ? PTR_ERR(ldlm_svc_debugfs_dir)
					  : -ENOMEM;
		goto err_ns;
	}

	rc = ldebugfs_add_vars(ldlm_debugfs_dir, ldlm_debugfs_list, NULL);
	if (rc) {
		CERROR("LProcFS failed in ldlm-init\n");
		goto err_svc;
	}

	return 0;

err_svc:
	ldebugfs_remove(&ldlm_svc_debugfs_dir);
err_ns:
	ldebugfs_remove(&ldlm_ns_debugfs_dir);
err_type:
	ldebugfs_remove(&ldlm_debugfs_dir);
err:
	ldlm_svc_debugfs_dir = NULL;
	ldlm_ns_debugfs_dir = NULL;
	ldlm_debugfs_dir = NULL;
	return rc;
}
Exemple #3
0
struct dentry *ldebugfs_register(const char *name,
				 struct dentry *parent,
				 struct lprocfs_vars *list, void *data)
{
	struct dentry *entry;

	entry = debugfs_create_dir(name, parent);
	if (IS_ERR_OR_NULL(entry)) {
		entry = entry ?: ERR_PTR(-ENOMEM);
		goto out;
	}

	if (!IS_ERR_OR_NULL(list)) {
		int rc;

		rc = ldebugfs_add_vars(entry, list, data);
		if (rc != 0) {
			debugfs_remove(entry);
			entry = ERR_PTR(rc);
		}
	}
out:
	return entry;
}