Revision 8f354003
b/hw/virtio-9p-debug.c | ||
---|---|---|
602 | 602 |
fprintf(llogfile, "RLOCK: ("); |
603 | 603 |
pprint_int8(pdu, 0, &offset, "status"); |
604 | 604 |
break; |
605 |
case P9_TGETLOCK: |
|
606 |
fprintf(llogfile, "TGETLOCK: ("); |
|
607 |
pprint_int32(pdu, 0, &offset, "fid"); |
|
608 |
pprint_int8(pdu, 0, &offset, ", type"); |
|
609 |
pprint_int64(pdu, 0, &offset, ", start"); |
|
610 |
pprint_int64(pdu, 0, &offset, ", length"); |
|
611 |
pprint_int32(pdu, 0, &offset, ", proc_id"); |
|
612 |
pprint_str(pdu, 0, &offset, ", client_id"); |
|
613 |
break; |
|
614 |
case P9_RGETLOCK: |
|
615 |
fprintf(llogfile, "RGETLOCK: ("); |
|
616 |
pprint_int8(pdu, 0, &offset, "type"); |
|
617 |
pprint_int64(pdu, 0, &offset, ", start"); |
|
618 |
pprint_int64(pdu, 0, &offset, ", length"); |
|
619 |
pprint_int32(pdu, 0, &offset, ", proc_id"); |
|
620 |
pprint_str(pdu, 0, &offset, ", client_id"); |
|
621 |
break; |
|
605 | 622 |
default: |
606 | 623 |
fprintf(llogfile, "unknown(%d): (", pdu->id); |
607 | 624 |
break; |
b/hw/virtio-9p.c | ||
---|---|---|
3203 | 3203 |
qemu_free(vs); |
3204 | 3204 |
} |
3205 | 3205 |
|
3206 |
/* |
|
3207 |
* When a TGETLOCK request comes, always return success because all lock |
|
3208 |
* handling is done by client's VFS layer. |
|
3209 |
*/ |
|
3210 |
|
|
3211 |
static void v9fs_getlock(V9fsState *s, V9fsPDU *pdu) |
|
3212 |
{ |
|
3213 |
int32_t fid, err = 0; |
|
3214 |
V9fsGetlockState *vs; |
|
3215 |
|
|
3216 |
vs = qemu_mallocz(sizeof(*vs)); |
|
3217 |
vs->pdu = pdu; |
|
3218 |
vs->offset = 7; |
|
3219 |
|
|
3220 |
vs->glock = qemu_malloc(sizeof(*vs->glock)); |
|
3221 |
pdu_unmarshal(vs->pdu, vs->offset, "dbqqds", &fid, &vs->glock->type, |
|
3222 |
&vs->glock->start, &vs->glock->length, &vs->glock->proc_id, |
|
3223 |
&vs->glock->client_id); |
|
3224 |
|
|
3225 |
vs->fidp = lookup_fid(s, fid); |
|
3226 |
if (vs->fidp == NULL) { |
|
3227 |
err = -ENOENT; |
|
3228 |
goto out; |
|
3229 |
} |
|
3230 |
|
|
3231 |
err = v9fs_do_fstat(s, vs->fidp->fs.fd, &vs->stbuf); |
|
3232 |
if (err < 0) { |
|
3233 |
err = -errno; |
|
3234 |
goto out; |
|
3235 |
} |
|
3236 |
vs->glock->type = F_UNLCK; |
|
3237 |
vs->offset += pdu_marshal(vs->pdu, vs->offset, "bqqds", vs->glock->type, |
|
3238 |
vs->glock->start, vs->glock->length, vs->glock->proc_id, |
|
3239 |
&vs->glock->client_id); |
|
3240 |
out: |
|
3241 |
complete_pdu(s, vs->pdu, err); |
|
3242 |
qemu_free(vs->glock); |
|
3243 |
qemu_free(vs); |
|
3244 |
} |
|
3245 |
|
|
3206 | 3246 |
static void v9fs_mkdir_post_lstat(V9fsState *s, V9fsMkState *vs, int err) |
3207 | 3247 |
{ |
3208 | 3248 |
if (err == -1) { |
... | ... | |
3466 | 3506 |
[P9_TMKNOD] = v9fs_mknod, |
3467 | 3507 |
[P9_TRENAME] = v9fs_rename, |
3468 | 3508 |
[P9_TLOCK] = v9fs_lock, |
3509 |
[P9_TGETLOCK] = v9fs_getlock, |
|
3469 | 3510 |
[P9_TMKDIR] = v9fs_mkdir, |
3470 | 3511 |
[P9_TVERSION] = v9fs_version, |
3471 | 3512 |
[P9_TLOPEN] = v9fs_open, |
b/hw/virtio-9p.h | ||
---|---|---|
39 | 39 |
P9_RREADDIR, |
40 | 40 |
P9_TLOCK = 52, |
41 | 41 |
P9_RLOCK, |
42 |
P9_TGETLOCK = 54, |
|
43 |
P9_RGETLOCK, |
|
42 | 44 |
P9_TLINK = 70, |
43 | 45 |
P9_RLINK, |
44 | 46 |
P9_TMKDIR = 72, |
... | ... | |
464 | 466 |
V9fsFlock *flock; |
465 | 467 |
} V9fsLockState; |
466 | 468 |
|
469 |
typedef struct V9fsGetlock |
|
470 |
{ |
|
471 |
uint8_t type; |
|
472 |
uint64_t start; /* absolute offset */ |
|
473 |
uint64_t length; |
|
474 |
uint32_t proc_id; |
|
475 |
V9fsString client_id; |
|
476 |
} V9fsGetlock; |
|
477 |
|
|
478 |
typedef struct V9fsGetlockState |
|
479 |
{ |
|
480 |
V9fsPDU *pdu; |
|
481 |
size_t offset; |
|
482 |
struct stat stbuf; |
|
483 |
V9fsFidState *fidp; |
|
484 |
V9fsGetlock *glock; |
|
485 |
} V9fsGetlockState; |
|
486 |
|
|
487 |
|
|
467 | 488 |
extern size_t pdu_packunpack(void *addr, struct iovec *sg, int sg_count, |
468 | 489 |
size_t offset, size_t size, int pack); |
469 | 490 |
|
Also available in: Unified diff