static void v9fs_lock(void *opaque)

{

    int8_t status;

    V9fsFlock *flock;

    size_t offset = 7;

    struct stat stbuf;

    V9fsFidState *fidp;

    int32_t fid, err = 0;

    V9fsPDU *pdu = opaque;

    V9fsState *s = pdu->s;



    flock = g_malloc(sizeof(*flock));

    pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type,

                  &flock->flags, &flock->start, &flock->length,

                  &flock->proc_id, &flock->client_id);



    trace_v9fs_lock(pdu->tag, pdu->id, fid,

                    flock->type, flock->start, flock->length);



    status = P9_LOCK_ERROR;



    /* We support only block flag now (that too ignored currently) */

    if (flock->flags & ~P9_LOCK_FLAGS_BLOCK) {

        err = -EINVAL;

        goto out_nofid;

    }

    fidp = get_fid(pdu, fid);

    if (fidp == NULL) {

        err = -ENOENT;

        goto out_nofid;

    }

    err = v9fs_co_fstat(pdu, fidp, &stbuf);

    if (err < 0) {

        goto out;

    }

    status = P9_LOCK_SUCCESS;

out:

    put_fid(pdu, fidp);

out_nofid:

    err = offset;

    err += pdu_marshal(pdu, offset, "b", status);

    trace_v9fs_lock_return(pdu->tag, pdu->id, status);

    complete_pdu(s, pdu, err);

    v9fs_string_free(&flock->client_id);

    g_free(flock);

}

static void v9fs_lock(void *opaque)

{

    int8_t status;

    V9fsFlock *flock;

    size_t offset = 7;

    struct stat stbuf;

    V9fsFidState *fidp;

    int32_t fid, err = 0;

    V9fsPDU *pdu = opaque;

    V9fsState *s = pdu->s;



    flock = g_malloc(sizeof(*flock));

    pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type,

                  &flock->flags, &flock->start, &flock->length,

                  &flock->proc_id, &flock->client_id);



    trace_v9fs_lock(pdu->tag, pdu->id, fid,

                    flock->type, flock->start, flock->length);



    status = P9_LOCK_ERROR;



    

    if (flock->flags & ~P9_LOCK_FLAGS_BLOCK) {

        err = -EINVAL;

        goto out_nofid;

    }

    fidp = get_fid(pdu, fid);

    if (fidp == NULL) {

        err = -ENOENT;

        goto out_nofid;

    }

    err = v9fs_co_fstat(pdu, fidp, &stbuf);

    if (err < 0) {

        goto out;

    }

    status = P9_LOCK_SUCCESS;

out:

    put_fid(pdu, fidp);

out_nofid:

    err = offset;

    err += pdu_marshal(pdu, offset, "b", status);

    trace_v9fs_lock_return(pdu->tag, pdu->id, status);

    complete_pdu(s, pdu, err);

    v9fs_string_free(&flock->client_id);

    g_free(flock);

}

static void FUNC_0(void *VAR_0)

{

    int8_t status;

    V9fsFlock *flock;

    size_t offset = 7;

    struct stat VAR_1;

    V9fsFidState *fidp;

    int32_t fid, err = 0;

    V9fsPDU *pdu = VAR_0;

    V9fsState *s = pdu->s;



    flock = g_malloc(sizeof(*flock));

    pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type,

                  &flock->flags, &flock->start, &flock->length,

                  &flock->proc_id, &flock->client_id);



    trace_v9fs_lock(pdu->tag, pdu->id, fid,

                    flock->type, flock->start, flock->length);



    status = P9_LOCK_ERROR;



    

    if (flock->flags & ~P9_LOCK_FLAGS_BLOCK) {

        err = -EINVAL;

        goto out_nofid;

    }

    fidp = get_fid(pdu, fid);

    if (fidp == NULL) {

        err = -ENOENT;

        goto out_nofid;

    }

    err = v9fs_co_fstat(pdu, fidp, &VAR_1);

    if (err < 0) {

        goto out;

    }

    status = P9_LOCK_SUCCESS;

out:

    put_fid(pdu, fidp);

out_nofid:

    err = offset;

    err += pdu_marshal(pdu, offset, "b", status);

    trace_v9fs_lock_return(pdu->tag, pdu->id, status);

    complete_pdu(s, pdu, err);

    v9fs_string_free(&flock->client_id);

    g_free(flock);

}

static void FUNC_0(void *VAR_0)
{ int8_t status; V9fsFlock *flock; size_t offset = 7; struct stat VAR_1; V9fsFidState *fidp; int32_t fid, err = 0; V9fsPDU *pdu = VAR_0; V9fsState *s = pdu->s; flock = g_malloc(sizeof(*flock)); pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type,
&flock->flags, &flock->start, &flock->length,
&flock->proc_id, &flock->client_id); trace_v9fs_lock(pdu->tag, pdu->id, fid,
flock->type, flock->start, flock->length); status = P9_LOCK_ERROR; if (flock->flags & ~P9_LOCK_FLAGS_BLOCK) { err = -EINVAL; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_fstat(pdu, fidp, &VAR_1); if (err < 0) { goto out; } status = P9_LOCK_SUCCESS; out:
put_fid(pdu, fidp); out_nofid:
err = offset; err += pdu_marshal(pdu, offset, "b", status); trace_v9fs_lock_return(pdu->tag, pdu->id, status); complete_pdu(s, pdu, err); v9fs_string_free(&flock->client_id); g_free(flock); }