summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-06-28 01:36:37 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2014-06-28 01:36:37 +0200
commitec572a53a9acb392df42fa69f4051898480acad7 (patch)
treedd43d44b54fc39a734a8375e91edf3d6459389a3
parenta1dad874469ff664375e9165d41034a1ee92b505 (diff)
downloadplan9front-ec572a53a9acb392df42fa69f4051898480acad7.tar.xz
ptp: fix alignment assumptions for amd64
-rw-r--r--sys/src/cmd/nusb/ptp/ptp.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/sys/src/cmd/nusb/ptp/ptp.c b/sys/src/cmd/nusb/ptp/ptp.c
index 8e618bb63..c43ef802c 100644
--- a/sys/src/cmd/nusb/ptp/ptp.c
+++ b/sys/src/cmd/nusb/ptp/ptp.c
@@ -45,10 +45,7 @@ struct Ptprpc
uchar type[2];
uchar code[2];
uchar transid[4];
- union {
- uchar p[5][4];
- uchar d[52];
- };
+ uchar d[52];
};
struct Node
@@ -225,7 +222,7 @@ vptprpc(Ioproc *io, int code, int flags, va_list a)
for(i=0; i<np; i++){
int x = va_arg(a, int);
- PUT4(rpc.p[i], x);
+ PUT4(rpc.d + i*4, x);
}
if(debug)
hexdump("req>", (uchar*)&rpc, n);
@@ -351,10 +348,10 @@ Resp1:
if(flags & OutParam){
int *pp;
- for(i=0; i<nelem(rpc.p); i++){
+ for(i=0; i<5; i++){
if((pp = va_arg(a, int*)) == nil)
break;
- *pp = GET4(rpc.p[i]);
+ *pp = GET4(rpc.d + i*4);
}
}
return 0;
@@ -1040,7 +1037,7 @@ threadmain(int argc, char **argv)
time0 = time(0);
- snprint(name, sizeof name, "sdU%d.0", d->id);
+ snprint(name, sizeof name, "sdU%d", d->id);
snprint(desc, sizeof desc, "%d.ptp", d->id);
threadpostsharesrv(&fs, nil, name, desc);