[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] tpmif: fix identifier prefixes



On Thu, Jun 20, 2013 at 8:33 AM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
The definitions here shouldn't use vtpm_ or VPTM_ as their prefixes,
the interface should instead make use of tpmif_ and TPMIF_. This
fixes a build failure after syncing the public headers to
linux-2.6.18-xen.hg (where a struct vtpm_state already exists).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Â
--- a/extras/mini-os/include/tpmfront.h
+++ b/extras/mini-os/include/tpmfront.h
@@ -37,7 +37,7 @@ struct tpmfront_dev {
  grant_ref_t ring_ref;
  evtchn_port_t evtchn;

- Â vtpm_shared_page_t *page;
+ Â tpmif_shared_page_t *page;

  domid_t bedomid;
  char* nodename;
--- a/extras/mini-os/tpmback.c
+++ b/extras/mini-os/tpmback.c
@@ -86,7 +86,7 @@ struct tpmif {
  evtchn_port_t evtchn;

  /* Shared page */
- Â vtpm_shared_page_t *page;
+ Â tpmif_shared_page_t *page;

  enum xenbus_state state;
  enum { DISCONNECTED, DISCONNECTING, CONNECTED } status;
@@ -524,21 +524,21 @@ void free_tpmif(tpmif_t* tpmif)
Âvoid tpmback_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
Â{
  tpmif_t* tpmif = (tpmif_t*) data;
- Â vtpm_shared_page_t* pg = tpmif->page;
+ Â tpmif_shared_page_t *pg = tpmif->page;

  switch (pg->state)
  {
- Â case VTPM_STATE_SUBMIT:
+ Â case TPMIF_STATE_SUBMIT:
   ÂTPMBACK_DEBUG("EVENT CHANNEL FIRE %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
   Âtpmif_req_ready(tpmif);
   Âwake_up(&waitq);
   Âbreak;
- Â case VTPM_STATE_CANCEL:
+ Â case TPMIF_STATE_CANCEL:
   Â/* If we are busy with a request, do nothing */
   Âif (tpmif->flags & TPMIF_REQ_READY)
     return;
   Â/* Acknowledge the cancellation if we are idle */
- Â Â Âpg->state = VTPM_STATE_IDLE;
+ Â Â Âpg->state = TPMIF_STATE_IDLE;
   Âwmb();
   Ânotify_remote_via_evtchn(tpmif->evtchn);
   Âreturn;
@@ -940,7 +940,7 @@ static void init_tpmcmd(tpmcmd_t* tpmcmd

Âtpmcmd_t* get_request(tpmif_t* tpmif) {
  tpmcmd_t* cmd;
- Â vtpm_shared_page_t* shr;
+ Â tpmif_shared_page_t *shr;
  unsigned int offset;
  int flags;
Â#ifdef TPMBACK_PRINT_DEBUG
@@ -1001,7 +1001,7 @@ error:

Âvoid send_response(tpmcmd_t* cmd, tpmif_t* tpmif)
Â{
- Â vtpm_shared_page_t* shr;
+ Â tpmif_shared_page_t *shr;
  unsigned int offset;
  int flags;
Â#ifdef TPMBACK_PRINT_DEBUG
@@ -1033,7 +1033,7 @@ int i;
  /* clear the ready flag and send the event channel notice to the frontend */
  tpmif_req_finished(tpmif);
  barrier();
- Â shr->state = VTPM_STATE_FINISH;
+ Â shr->state = TPMIF_STATE_FINISH;
  wmb();
  notify_remote_via_evtchn(tpmif->evtchn);
Âerror:
--- a/extras/mini-os/tpmfront.c
+++ b/extras/mini-os/tpmfront.c
@@ -47,15 +47,15 @@

Âvoid tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void *data) {
  struct tpmfront_dev* dev = (struct tpmfront_dev*) data;
- Â vtpm_shared_page_t* shr = dev->page;
+ Â tpmif_shared_page_t *shr = dev->page;
  /*If we get a response when we didnt make a request, just ignore it */
  if(!dev->waiting) {
   Âreturn;
  }

  switch (shr->state) {
- Â case VTPM_STATE_FINISH: /* request was completed */
- Â case VTPM_STATE_IDLE: Â /* request was cancelled */
+ Â case TPMIF_STATE_FINISH: /* request was completed */
+ Â case TPMIF_STATE_IDLE: Â /* request was cancelled */
   Âbreak;
  default:
   Â/* Spurious wakeup; do nothing, request is still pending */
@@ -203,7 +203,7 @@ static int tpmfront_connect(struct tpmfr
Â{
  char* err;
  /* Create shared page */
- Â dev->page = (vtpm_shared_page_t*) alloc_page();
+ Â dev->page = (tpmif_shared_page_t *)alloc_page();
  if(dev->page == NULL) {
   ÂTPMFRONT_ERR("Unable to allocate page for shared memory\n");
   Âgoto error;
@@ -400,7 +400,7 @@ void shutdown_tpmfront(struct tpmfront_d
Âint tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t length)
Â{
  unsigned int offset;
- Â vtpm_shared_page_t* shr = NULL;
+ Â tpmif_shared_page_t *shr = NULL;
Â#ifdef TPMFRONT_PRINT_DEBUG
  int i;
Â#endif
@@ -431,7 +431,7 @@ int tpmfront_send(struct tpmfront_dev* d
  memcpy(offset + (uint8_t*)shr, msg, length);
  shr->length = length;
  barrier();
- Â shr->state = VTPM_STATE_SUBMIT;
+ Â shr->state = TPMIF_STATE_SUBMIT;

  dev->waiting = 1;
  dev->resplen = 0;
@@ -449,7 +449,7 @@ int tpmfront_send(struct tpmfront_dev* d
Âint tpmfront_recv(struct tpmfront_dev* dev, uint8_t** msg, size_t *length)
Â{
  unsigned int offset;
- Â vtpm_shared_page_t* shr = NULL;
+ Â tpmif_shared_page_t *shr = NULL;
Â#ifdef TPMFRONT_PRINT_DEBUG
Âint i;
Â#endif
@@ -466,7 +466,7 @@ int i;
  *length = 0;
  offset = sizeof(*shr);

- Â if (shr->state != VTPM_STATE_FINISH)
+ Â if (shr->state != TPMIF_STATE_FINISH)
   Âgoto quit;

  *length = shr->length;
--- a/xen/include/public/io/tpmif.h
+++ b/xen/include/public/io/tpmif.h
@@ -75,15 +75,15 @@ typedef struct tpmif_tx_interface tpmif_
 * the backend only processes commands as requested by the frontend.
 *
 * The frontend sends a request to the TPM by populating the shared page with
- * the request packet, changing the state to VTPM_STATE_SUBMIT, and sending
+ * the request packet, changing the state to TPMIF_STATE_SUBMIT, and sending
 * and event channel notification. When the backend is finished, it will set
- * the state to VTPM_STATE_FINISH and send an event channel notification.
+ * the state to TPMIF_STATE_FINISH and send an event channel notification.
 *
 * In order to allow long-running commands to be canceled, the frontend can
- * at any time change the state to VTPM_STATE_CANCEL and send a notification.
- * The TPM can either finish the command (changing state to VTPM_STATE_FINISH)
- * or can cancel the command and change the state to VTPM_STATE_IDLE. The TPM
- * can also change the state to VTPM_STATE_IDLE instead of VTPM_STATE_FINISH
+ * at any time change the state to TPMIF_STATE_CANCEL and send a notification.
+ * The TPM can either finish the command (changing state to TPMIF_STATE_FINISH)
+ * or can cancel the command and change the state to TPMIF_STATE_IDLE. The TPM
+ * can also change the state to TPMIF_STATE_IDLE instead of TPMIF_STATE_FINISH
 * if another reason for cancellation is required - for example, a physical
 * TPM may cancel a command if the interface is seized by another locality.
 *
@@ -91,11 +91,11 @@ typedef struct tpmif_tx_interface tpmif_
 * http://www.trustedcomputinggroup.org/resources/tpm_main_specification
 */

-enum vtpm_state {
- Â ÂVTPM_STATE_IDLE, Â Â Â Â /* no contents / vTPM idle / cancel complete */
- Â ÂVTPM_STATE_SUBMIT, Â Â Â /* request ready / vTPM working */
- Â ÂVTPM_STATE_FINISH, Â Â Â /* response ready / vTPM idle */
- Â ÂVTPM_STATE_CANCEL, Â Â Â /* cancel requested / vTPM working */
+enum tpmif_state {
+ Â ÂTPMIF_STATE_IDLE, Â Â Â Â/* no contents / vTPM idle / cancel complete */
+ Â ÂTPMIF_STATE_SUBMIT, Â Â Â/* request ready / vTPM working */
+ Â ÂTPMIF_STATE_FINISH, Â Â Â/* response ready / vTPM idle */
+ Â ÂTPMIF_STATE_CANCEL, Â Â Â/* cancel requested / vTPM working */
Â};
Â/* Note: The backend should only change state to IDLE or FINISH, while the
 * frontend should only change to SUBMIT or CANCEL. Status changes do not need
@@ -107,7 +107,7 @@ enum vtpm_state {
 *
 * ÂOffset        Contents
 * Â=================================================
- * Â0 Â Â Â Â Â Â Â Â Â Âstruct vtpm_shared_page
+ * Â0 Â Â Â Â Â Â Â Â Â Âstruct tpmif_shared_page
 * Â16          [optional] List of grant IDs
 * Â16+4*nr_extra_pages ÂTPM packet data
 *
@@ -118,17 +118,17 @@ enum vtpm_state {
 * frontend should verify that the TPM supports such large requests by querying
 * the TPM_CAP_PROP_INPUT_BUFFER property from the TPM.
 */
-struct vtpm_shared_page {
+struct tpmif_shared_page {
  Âuint32_t length;     /* request/response length in bytes */

- Â Âuint8_t state; Â Â Â Â Â /* enum vtpm_state */
+ Â Âuint8_t state; Â Â Â Â Â /* enum tpmif_state */
  Âuint8_t locality;    Â/* for the current request */
  Âuint8_t pad;       /* should be zero */

  Âuint8_t nr_extra_pages; Â/* extra pages for long packets; may be zero */
  Âuint32_t extra_pages[0]; /* grant IDs; length is actually nr_extra_pages */
Â};
-typedef struct vtpm_shared_page vtpm_shared_page_t;
+typedef struct tpmif_shared_page tpmif_shared_page_t;

Â#endif




_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.