Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ac263d37 authored by Andrey Markovytch's avatar Andrey Markovytch Committed by Gerrit - the friendly Code Review server
Browse files

pfk: added some additional debug prints



Also added useful function for translation between inode to filename

Change-Id: If0d5db3545a71c85223ef53980ee61f9dbd002d9
Signed-off-by: default avatarAndrey Markovytch <andreym@codeaurora.org>
parent 30eb189a
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -65,6 +65,29 @@ static int g_events_handle;
#define PFK_SUPPORTED_KEY_SIZE 32
#define PFK_SUPPORTED_SALT_SIZE 32


/**
 * inode_to_filename() - get the filename from inode pointer.
 * @inode: inode pointer
 *
 * it is used for debug prints.
 *
 * Return: filename string or "unknown".
 */
static char *inode_to_filename(struct inode *inode)
{
	struct dentry *dentry = NULL;
	char *filename = NULL;

	if (hlist_empty(&inode->i_dentry))
		return "unknown";

	dentry = hlist_entry(inode->i_dentry.first, struct dentry, d_u.d_alias);
	filename = dentry->d_iname;

	return filename;
}

static int pfk_inode_alloc_security(struct inode *inode)
{
	struct inode_security_struct *i_sec = NULL;
@@ -370,6 +393,8 @@ int pfk_load_key(const struct bio *bio, struct ice_crypto_setting *ice_setting)
		goto end;
	}

	pr_debug("loading key for file %s\n", inode_to_filename(inode));

	ret = pfk_get_page_index(bio, &offset);
	if (ret != 0) {
		pr_err("could not get page index from bio, probably bug %d\n",