From: Greg KH <greg@kroah.com>
To: Kylene Jo Hall <kjhall@us.ibm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
akpm@osdl.org,
TPM Device Driver List <tpmdd-devel@lists.sourceforge.net>,
Marcel Selhorst <selhorst@crypto.rub.de>
Subject: Re: PATCH 6/7] tpm: new 1.2 sysfs files
Date: Mon, 3 Apr 2006 14:47:25 -0700 [thread overview]
Message-ID: <20060403214725.GA29414@kroah.com> (raw)
In-Reply-To: <1144082562.29910.12.camel@localhost.localdomain>
On Mon, Apr 03, 2006 at 11:42:41AM -0500, Kylene Jo Hall wrote:
> +ssize_t tpm_show_state(struct device * dev, struct device_attribute * attr,
> + char *buf)
> +{
> + u8 data[35];
> + ssize_t len;
> + char *str = buf;
> +
> + struct tpm_chip *chip = dev_get_drvdata(dev);
> + if (chip == NULL)
> + return -ENODEV;
> +
> + memcpy(data, tpm_cap, sizeof(tpm_cap));
> + data[TPM_CAP_IDX] = TPM_CAP_FLAG;
> + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_PERM;
> +
> + if ((len = tpm_transmit(chip, data, sizeof(data)))
> + <= TPM_ERROR_SIZE)
> + dev_dbg(chip->dev, "A TPM error (%d) occurred "
> + "attempting to determine the permanent state\n",
> + be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX))));
> + else {
> + str +=
> + sprintf(str, "%s\n",
> + (data[TPM_GET_CAP_PERM_DISABLE_IDX] ==
> + 1) ? "Disabled" : "Enabled");
> + str +=
> + sprintf(str, "%s\n",
> + (data[TPM_GET_CAP_PERM_INACTIVE_IDX] ==
> + 1) ? "Inactive" : "Active");
> + }
> + memcpy(data, tpm_cap, sizeof(tpm_cap));
> + data[TPM_CAP_IDX] = TPM_CAP_PROP;
> + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_PROP_OWNER;
> +
> + if ((len = tpm_transmit(chip, data, sizeof(data)))
> + <= TPM_ERROR_SIZE)
> + dev_dbg(chip->dev, "A TPM error (%d) occurred "
> + "attempting to determine the owner state\n",
> + be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX))));
> + else
> + str +=
> + sprintf(str, "%s\n",
> + (data[TPM_GET_CAP_RET_BOOL_1_IDX] ==
> + 1) ? "Owned" : "Unowned");
> +
> + memcpy(data, tpm_cap, sizeof(tpm_cap));
> + data[TPM_CAP_IDX] = TPM_CAP_FLAG;
> + data[TPM_CAP_SUBCAP_IDX] = TPM_CAP_FLAG_VOL;
> +
> + if ((len = tpm_transmit(chip, data, sizeof(data)))
> + <= TPM_ERROR_SIZE) {
> + dev_dbg(chip->dev, "A TPM error (%d) occurred "
> + "attempting to determine the temporary state\n",
> + be32_to_cpu(*((__be32 *) (data + TPM_RET_CODE_IDX))));
> + goto out;
> + }
> +
> + if (data[TPM_GET_CAP_TEMP_INACTIVE_IDX] != 0)
> + str += sprintf(str, "Deactivated for this boot\n");
> +out:
> + return str - buf;
> +}
> +EXPORT_SYMBOL_GPL(tpm_show_state);
That is more than one value per file. Please make unique files for the
different capabilities. As it stands the file doesn't make too much
sense for someone reading it and not understanding that each line is a
different portion of the state.
thanks,
greg k-h
prev parent reply other threads:[~2006-04-03 21:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1143823501.2992.170.camel@localhost.localdomain>
[not found] ` <20060331202714.GC22987@sergelap.austin.ibm.com>
2006-04-03 16:42 ` PATCH 6/7] tpm: new 1.2 sysfs files Kylene Jo Hall
2006-04-03 21:47 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060403214725.GA29414@kroah.com \
--to=greg@kroah.com \
--cc=akpm@osdl.org \
--cc=kjhall@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=selhorst@crypto.rub.de \
--cc=tpmdd-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.