From: "Jan Beulich" Subject: [PATCH] tpmif: fix identifier prefixes Date: Thu, 20 Jun 2013 13:33:15 +0100 Message-ID: <51C312AB02000078000DF5DC@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part96A6089B.2__=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel Cc: George Dunlap , Samuel Thibault , dgdegra@tycho.nsa.gov, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part96A6089B.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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; =20 - vtpm_shared_page_t *page; + tpmif_shared_page_t *page; =20 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; =20 /* Shared page */ - vtpm_shared_page_t *page; + tpmif_shared_page_t *page; =20 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 =3D (tpmif_t*) data; - vtpm_shared_page_t* pg =3D tpmif->page; + tpmif_shared_page_t *pg =3D tpmif->page; =20 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 =3D VTPM_STATE_IDLE; + pg->state =3D TPMIF_STATE_IDLE; wmb(); notify_remote_via_evtchn(tpmif->evtchn); return; @@ -940,7 +940,7 @@ static void init_tpmcmd(tpmcmd_t* tpmcmd =20 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: =20 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 =3D VTPM_STATE_FINISH; + shr->state =3D 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 @@ =20 void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void = *data) { struct tpmfront_dev* dev =3D (struct tpmfront_dev*) data; - vtpm_shared_page_t* shr =3D dev->page; + tpmif_shared_page_t *shr =3D dev->page; /*If we get a response when we didnt make a request, just ignore it */ if(!dev->waiting) { return; } =20 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 =3D (vtpm_shared_page_t*) alloc_page(); + dev->page =3D (tpmif_shared_page_t *)alloc_page(); if(dev->page =3D=3D 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 =3D NULL; + tpmif_shared_page_t *shr =3D 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 =3D length; barrier(); - shr->state =3D VTPM_STATE_SUBMIT; + shr->state =3D TPMIF_STATE_SUBMIT; =20 dev->waiting =3D 1; dev->resplen =3D 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 =3D NULL; + tpmif_shared_page_t *shr =3D NULL; #ifdef TPMFRONT_PRINT_DEBUG int i; #endif @@ -466,7 +466,7 @@ int i; *length =3D 0; offset =3D sizeof(*shr); =20 - if (shr->state !=3D VTPM_STATE_FINISH) + if (shr->state !=3D TPMIF_STATE_FINISH) goto quit; =20 *length =3D 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 notificati= on. - * The TPM can either finish the command (changing state to VTPM_STATE_FIN= ISH) - * 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_FINI= SH + * 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_FI= NISH) + * 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_FI= NISH * 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= =20 */ =20 -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 * =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D - * 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 */ =20 - 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 */ =20 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_pag= es */ }; -typedef struct vtpm_shared_page vtpm_shared_page_t; +typedef struct tpmif_shared_page tpmif_shared_page_t; =20 #endif =20 --=__Part96A6089B.2__= Content-Type: text/plain; name="tpmif-naming.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="tpmif-naming.patch" tpmif: fix identifier prefixes=0A=0AThe definitions here shouldn't use = vtpm_ or VPTM_ as their prefixes,=0Athe interface should instead make use = of tpmif_ and TPMIF_. This=0Afixes a build failure after syncing the = public headers to=0Alinux-2.6.18-xen.hg (where a struct vtpm_state already = exists).=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/extras/mini-os/include/tpmfront.h=0A+++ b/extras/mini-os/include/tpmfront= .h=0A@@ -37,7 +37,7 @@ struct tpmfront_dev {=0A grant_ref_t ring_ref;=0A= evtchn_port_t evtchn;=0A =0A- vtpm_shared_page_t *page;=0A+ = tpmif_shared_page_t *page;=0A =0A domid_t bedomid;=0A char* = nodename;=0A--- a/extras/mini-os/tpmback.c=0A+++ b/extras/mini-os/tpmback.c= =0A@@ -86,7 +86,7 @@ struct tpmif {=0A evtchn_port_t evtchn;=0A =0A = /* Shared page */=0A- vtpm_shared_page_t *page;=0A+ tpmif_shared_page_t= *page;=0A =0A enum xenbus_state state;=0A enum { DISCONNECTED, = DISCONNECTING, CONNECTED } status;=0A@@ -524,21 +524,21 @@ void free_tpmif(= tpmif_t* tpmif)=0A void tpmback_handler(evtchn_port_t port, struct pt_regs = *regs, void *data)=0A {=0A tpmif_t* tpmif =3D (tpmif_t*) data;=0A- = vtpm_shared_page_t* pg =3D tpmif->page;=0A+ tpmif_shared_page_t *pg =3D = tpmif->page;=0A =0A switch (pg->state)=0A {=0A- case VTPM_STATE_SUB= MIT:=0A+ case TPMIF_STATE_SUBMIT:=0A TPMBACK_DEBUG("EVENT CHANNEL = FIRE %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);=0A = tpmif_req_ready(tpmif);=0A wake_up(&waitq);=0A break;=0A- = case VTPM_STATE_CANCEL:=0A+ case TPMIF_STATE_CANCEL:=0A /* If we = are busy with a request, do nothing */=0A if (tpmif->flags & = TPMIF_REQ_READY)=0A return;=0A /* Acknowledge the cancellati= on if we are idle */=0A- pg->state =3D VTPM_STATE_IDLE;=0A+ = pg->state =3D TPMIF_STATE_IDLE;=0A wmb();=0A notify_remote_via_= evtchn(tpmif->evtchn);=0A return;=0A@@ -940,7 +940,7 @@ static void = init_tpmcmd(tpmcmd_t* tpmcmd=0A =0A tpmcmd_t* get_request(tpmif_t* tpmif) = {=0A tpmcmd_t* cmd;=0A- vtpm_shared_page_t* shr;=0A+ tpmif_shared_pa= ge_t *shr;=0A unsigned int offset;=0A int flags;=0A #ifdef TPMBACK_PR= INT_DEBUG=0A@@ -1001,7 +1001,7 @@ error:=0A =0A void send_response(tpmcmd_t= * cmd, tpmif_t* tpmif)=0A {=0A- vtpm_shared_page_t* shr;=0A+ tpmif_shar= ed_page_t *shr;=0A unsigned int offset;=0A int flags;=0A #ifdef = TPMBACK_PRINT_DEBUG=0A@@ -1033,7 +1033,7 @@ int i;=0A /* clear the = ready flag and send the event channel notice to the frontend */=0A = tpmif_req_finished(tpmif);=0A barrier();=0A- shr->state =3D VTPM_STATE= _FINISH;=0A+ shr->state =3D TPMIF_STATE_FINISH;=0A wmb();=0A = notify_remote_via_evtchn(tpmif->evtchn);=0A error:=0A--- a/extras/mini-os/t= pmfront.c=0A+++ b/extras/mini-os/tpmfront.c=0A@@ -47,15 +47,15 @@=0A =0A = void tpmfront_handler(evtchn_port_t port, struct pt_regs *regs, void = *data) {=0A struct tpmfront_dev* dev =3D (struct tpmfront_dev*) = data;=0A- vtpm_shared_page_t* shr =3D dev->page;=0A+ tpmif_shared_page_= t *shr =3D dev->page;=0A /*If we get a response when we didnt make a = request, just ignore it */=0A if(!dev->waiting) {=0A return;=0A = }=0A =0A switch (shr->state) {=0A- case VTPM_STATE_FINISH: /* = request was completed */=0A- case VTPM_STATE_IDLE: /* request was = cancelled */=0A+ case TPMIF_STATE_FINISH: /* request was completed = */=0A+ case TPMIF_STATE_IDLE: /* request was cancelled */=0A = break;=0A default:=0A /* Spurious wakeup; do nothing, request is = still pending */=0A@@ -203,7 +203,7 @@ static int tpmfront_connect(struct = tpmfr=0A {=0A char* err;=0A /* Create shared page */=0A- dev->page = =3D (vtpm_shared_page_t*) alloc_page();=0A+ dev->page =3D (tpmif_shared_p= age_t *)alloc_page();=0A if(dev->page =3D=3D NULL) {=0A TPMFRONT_E= RR("Unable to allocate page for shared memory\n");=0A goto error;=0A@= @ -400,7 +400,7 @@ void shutdown_tpmfront(struct tpmfront_d=0A int = tpmfront_send(struct tpmfront_dev* dev, const uint8_t* msg, size_t = length)=0A {=0A unsigned int offset;=0A- vtpm_shared_page_t* shr =3D = NULL;=0A+ tpmif_shared_page_t *shr =3D NULL;=0A #ifdef TPMFRONT_PRINT_DEB= UG=0A int i;=0A #endif=0A@@ -431,7 +431,7 @@ int tpmfront_send(struct = tpmfront_dev* d=0A memcpy(offset + (uint8_t*)shr, msg, length);=0A = shr->length =3D length;=0A barrier();=0A- shr->state =3D VTPM_STATE_SU= BMIT;=0A+ shr->state =3D TPMIF_STATE_SUBMIT;=0A =0A dev->waiting =3D = 1;=0A dev->resplen =3D 0;=0A@@ -449,7 +449,7 @@ int tpmfront_send(struct= tpmfront_dev* d=0A int tpmfront_recv(struct tpmfront_dev* dev, uint8_t** = msg, size_t *length)=0A {=0A unsigned int offset;=0A- vtpm_shared_page= _t* shr =3D NULL;=0A+ tpmif_shared_page_t *shr =3D NULL;=0A #ifdef = TPMFRONT_PRINT_DEBUG=0A int i;=0A #endif=0A@@ -466,7 +466,7 @@ int i;=0A = *length =3D 0;=0A offset =3D sizeof(*shr);=0A =0A- if (shr->state = !=3D VTPM_STATE_FINISH)=0A+ if (shr->state !=3D TPMIF_STATE_FINISH)=0A = goto quit;=0A =0A *length =3D shr->length;=0A--- a/xen/include/publi= c/io/tpmif.h=0A+++ b/xen/include/public/io/tpmif.h=0A@@ -75,15 +75,15 @@ = typedef struct tpmif_tx_interface tpmif_=0A * the backend only processes = commands as requested by the frontend.=0A *=0A * The frontend sends a = request to the TPM by populating the shared page with=0A- * the request = packet, changing the state to VTPM_STATE_SUBMIT, and sending=0A+ * the = request packet, changing the state to TPMIF_STATE_SUBMIT, and sending=0A = * and event channel notification. When the backend is finished, it will = set=0A- * the state to VTPM_STATE_FINISH and send an event channel = notification.=0A+ * the state to TPMIF_STATE_FINISH and send an event = channel notification.=0A *=0A * In order to allow long-running commands = to be canceled, the frontend can=0A- * at any time change the state to = VTPM_STATE_CANCEL and send a notification.=0A- * The TPM can either finish = the command (changing state to VTPM_STATE_FINISH)=0A- * or can cancel the = command and change the state to VTPM_STATE_IDLE. The TPM=0A- * can also = change the state to VTPM_STATE_IDLE instead of VTPM_STATE_FINISH=0A+ * at = any time change the state to TPMIF_STATE_CANCEL and send a notification.=0A= + * The TPM can either finish the command (changing state to TPMIF_STATE_FI= NISH)=0A+ * or can cancel the command and change the state to TPMIF_STATE_I= DLE. The TPM=0A+ * can also change the state to TPMIF_STATE_IDLE instead = of TPMIF_STATE_FINISH=0A * if another reason for cancellation is required = - for example, a physical=0A * TPM may cancel a command if the interface = is seized by another locality.=0A *=0A@@ -91,11 +91,11 @@ typedef struct = tpmif_tx_interface tpmif_=0A * http://www.trustedcomputinggroup.org/resour= ces/tpm_main_specification=0A */=0A =0A-enum vtpm_state {=0A- = VTPM_STATE_IDLE, /* no contents / vTPM idle / cancel complete = */=0A- VTPM_STATE_SUBMIT, /* request ready / vTPM working */=0A- = VTPM_STATE_FINISH, /* response ready / vTPM idle */=0A- = VTPM_STATE_CANCEL, /* cancel requested / vTPM working */=0A+enum = tpmif_state {=0A+ TPMIF_STATE_IDLE, /* no contents / vTPM idle / = cancel complete */=0A+ TPMIF_STATE_SUBMIT, /* request ready / vTPM = working */=0A+ TPMIF_STATE_FINISH, /* response ready / vTPM idle = */=0A+ TPMIF_STATE_CANCEL, /* cancel requested / vTPM working = */=0A };=0A /* Note: The backend should only change state to IDLE or = FINISH, while the=0A * frontend should only change to SUBMIT or CANCEL. = Status changes do not need=0A@@ -107,7 +107,7 @@ enum vtpm_state {=0A = *=0A * Offset Contents=0A * =3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A- * 0 = struct vtpm_shared_page=0A+ * 0 struct tpmif_shared_pag= e=0A * 16 [optional] List of grant IDs=0A * = 16+4*nr_extra_pages TPM packet data=0A *=0A@@ -118,17 +118,17 @@ enum = vtpm_state {=0A * frontend should verify that the TPM supports such large = requests by querying=0A * the TPM_CAP_PROP_INPUT_BUFFER property from the = TPM.=0A */=0A-struct vtpm_shared_page {=0A+struct tpmif_shared_page {=0A = uint32_t length; /* request/response length in bytes */=0A =0A- = uint8_t state; /* enum vtpm_state */=0A+ uint8_t state; = /* enum tpmif_state */=0A uint8_t locality; /* for the = current request */=0A uint8_t pad; /* should be zero */=0A = =0A uint8_t nr_extra_pages; /* extra pages for long packets; may be = zero */=0A uint32_t extra_pages[0]; /* grant IDs; length is actually = nr_extra_pages */=0A };=0A-typedef struct vtpm_shared_page vtpm_shared_page= _t;=0A+typedef struct tpmif_shared_page tpmif_shared_page_t;=0A =0A = #endif=0A =0A --=__Part96A6089B.2__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part96A6089B.2__=--