3049 |
3049 |
* When a TGETLOCK request comes, always return success because all lock
|
3050 |
3050 |
* handling is done by client's VFS layer.
|
3051 |
3051 |
*/
|
3052 |
|
|
3053 |
3052 |
static void v9fs_getlock(void *opaque)
|
3054 |
3053 |
{
|
|
3054 |
size_t offset = 7;
|
|
3055 |
struct stat stbuf;
|
|
3056 |
V9fsFidState *fidp;
|
|
3057 |
V9fsGetlock *glock;
|
|
3058 |
int32_t fid, err = 0;
|
3055 |
3059 |
V9fsPDU *pdu = opaque;
|
3056 |
3060 |
V9fsState *s = pdu->s;
|
3057 |
|
int32_t fid, err = 0;
|
3058 |
|
V9fsGetlockState *vs;
|
3059 |
3061 |
|
3060 |
|
vs = g_malloc0(sizeof(*vs));
|
3061 |
|
vs->pdu = pdu;
|
3062 |
|
vs->offset = 7;
|
3063 |
|
|
3064 |
|
vs->glock = g_malloc(sizeof(*vs->glock));
|
3065 |
|
pdu_unmarshal(vs->pdu, vs->offset, "dbqqds", &fid, &vs->glock->type,
|
3066 |
|
&vs->glock->start, &vs->glock->length, &vs->glock->proc_id,
|
3067 |
|
&vs->glock->client_id);
|
|
3062 |
glock = g_malloc(sizeof(*glock));
|
|
3063 |
pdu_unmarshal(pdu, offset, "dbqqds", &fid, &glock->type,
|
|
3064 |
&glock->start, &glock->length, &glock->proc_id,
|
|
3065 |
&glock->client_id);
|
3068 |
3066 |
|
3069 |
|
vs->fidp = lookup_fid(s, fid);
|
3070 |
|
if (vs->fidp == NULL) {
|
|
3067 |
fidp = lookup_fid(s, fid);
|
|
3068 |
if (fidp == NULL) {
|
3071 |
3069 |
err = -ENOENT;
|
3072 |
3070 |
goto out;
|
3073 |
3071 |
}
|
3074 |
|
|
3075 |
|
err = v9fs_do_fstat(s, vs->fidp->fs.fd, &vs->stbuf);
|
|
3072 |
err = v9fs_co_fstat(s, fidp->fs.fd, &stbuf);
|
3076 |
3073 |
if (err < 0) {
|
3077 |
|
err = -errno;
|
3078 |
3074 |
goto out;
|
3079 |
3075 |
}
|
3080 |
|
vs->glock->type = F_UNLCK;
|
3081 |
|
vs->offset += pdu_marshal(vs->pdu, vs->offset, "bqqds", vs->glock->type,
|
3082 |
|
vs->glock->start, vs->glock->length, vs->glock->proc_id,
|
3083 |
|
&vs->glock->client_id);
|
|
3076 |
glock->type = F_UNLCK;
|
|
3077 |
offset += pdu_marshal(pdu, offset, "bqqds", glock->type,
|
|
3078 |
glock->start, glock->length, glock->proc_id,
|
|
3079 |
&glock->client_id);
|
|
3080 |
err = offset;
|
3084 |
3081 |
out:
|
3085 |
|
complete_pdu(s, vs->pdu, err);
|
3086 |
|
g_free(vs->glock);
|
3087 |
|
g_free(vs);
|
|
3082 |
complete_pdu(s, pdu, err);
|
|
3083 |
g_free(glock);
|
3088 |
3084 |
}
|
3089 |
3085 |
|
3090 |
3086 |
static void v9fs_mkdir(void *opaque)
|