static void v9fs_symlink(void *opaque)

{

    V9fsPDU *pdu = opaque;

    V9fsString name;

    V9fsString symname;

    V9fsString fullname;

    V9fsFidState *dfidp;

    V9fsQID qid;

    struct stat stbuf;

    int32_t dfid;

    int err = 0;

    gid_t gid;

    size_t offset = 7;



    v9fs_string_init(&fullname);

    pdu_unmarshal(pdu, offset, "dssd", &dfid, &name, &symname, &gid);



    dfidp = get_fid(pdu->s, dfid);

    if (dfidp == NULL) {

        err = -EINVAL;

        goto out_nofid;

    }



    v9fs_string_sprintf(&fullname, "%s/%s", dfidp->path.data, name.data);

    err = v9fs_co_symlink(pdu->s, dfidp, symname.data, fullname.data, gid);

    if (err < 0) {

        goto out;

    }

    err = v9fs_co_lstat(pdu->s, &fullname, &stbuf);

    if (err < 0) {

        goto out;

    }

    stat_to_qid(&stbuf, &qid);

    offset += pdu_marshal(pdu, offset, "Q", &qid);

    err = offset;

out:

    put_fid(pdu->s, dfidp);

out_nofid:

    complete_pdu(pdu->s, pdu, err);

    v9fs_string_free(&name);

    v9fs_string_free(&symname);

    v9fs_string_free(&fullname);

}

static void v9fs_symlink(void *opaque)

{

    V9fsPDU *pdu = opaque;

    V9fsString name;

    V9fsString symname;

    V9fsString fullname;

    V9fsFidState *dfidp;

    V9fsQID qid;

    struct stat stbuf;

    int32_t dfid;

    int err = 0;

    gid_t gid;

    size_t offset = 7;



    v9fs_string_init(&fullname);

    pdu_unmarshal(pdu, offset, "dssd", &dfid, &name, &symname, &gid);



    dfidp = get_fid(pdu->s, dfid);

    if (dfidp == NULL) {

        err = -EINVAL;

        goto out_nofid;

    }



    v9fs_string_sprintf(&fullname, "%s/%s", dfidp->path.data, name.data);

    err = v9fs_co_symlink(pdu->s, dfidp, symname.data, fullname.data, gid);

    if (err < 0) {

        goto out;

    }

    err = v9fs_co_lstat(pdu->s, &fullname, &stbuf);

    if (err < 0) {

        goto out;

    }

    stat_to_qid(&stbuf, &qid);

    offset += pdu_marshal(pdu, offset, "Q", &qid);

    err = offset;

out:

    put_fid(pdu->s, dfidp);

out_nofid:

    complete_pdu(pdu->s, pdu, err);

    v9fs_string_free(&name);

    v9fs_string_free(&symname);

    v9fs_string_free(&fullname);

}

static void FUNC_0(void *VAR_0)

{

    V9fsPDU *pdu = VAR_0;

    V9fsString name;

    V9fsString symname;

    V9fsString fullname;

    V9fsFidState *dfidp;

    V9fsQID qid;

    struct stat VAR_1;

    int32_t dfid;

    int VAR_2 = 0;

    gid_t gid;

    size_t offset = 7;



    v9fs_string_init(&fullname);

    pdu_unmarshal(pdu, offset, "dssd", &dfid, &name, &symname, &gid);



    dfidp = get_fid(pdu->s, dfid);

    if (dfidp == NULL) {

        VAR_2 = -EINVAL;

        goto out_nofid;

    }



    v9fs_string_sprintf(&fullname, "%s/%s", dfidp->path.data, name.data);

    VAR_2 = v9fs_co_symlink(pdu->s, dfidp, symname.data, fullname.data, gid);

    if (VAR_2 < 0) {

        goto out;

    }

    VAR_2 = v9fs_co_lstat(pdu->s, &fullname, &VAR_1);

    if (VAR_2 < 0) {

        goto out;

    }

    stat_to_qid(&VAR_1, &qid);

    offset += pdu_marshal(pdu, offset, "Q", &qid);

    VAR_2 = offset;

out:

    put_fid(pdu->s, dfidp);

out_nofid:

    complete_pdu(pdu->s, pdu, VAR_2);

    v9fs_string_free(&name);

    v9fs_string_free(&symname);

    v9fs_string_free(&fullname);

}

static void FUNC_0(void *VAR_0)
{ V9fsPDU *pdu = VAR_0; V9fsString name; V9fsString symname; V9fsString fullname; V9fsFidState *dfidp; V9fsQID qid; struct stat VAR_1; int32_t dfid; int VAR_2 = 0; gid_t gid; size_t offset = 7; v9fs_string_init(&fullname); pdu_unmarshal(pdu, offset, "dssd", &dfid, &name, &symname, &gid); dfidp = get_fid(pdu->s, dfid); if (dfidp == NULL) { VAR_2 = -EINVAL; goto out_nofid; } v9fs_string_sprintf(&fullname, "%s/%s", dfidp->path.data, name.data); VAR_2 = v9fs_co_symlink(pdu->s, dfidp, symname.data, fullname.data, gid); if (VAR_2 < 0) { goto out; } VAR_2 = v9fs_co_lstat(pdu->s, &fullname, &VAR_1); if (VAR_2 < 0) { goto out; } stat_to_qid(&VAR_1, &qid); offset += pdu_marshal(pdu, offset, "Q", &qid); VAR_2 = offset; out:
put_fid(pdu->s, dfidp); out_nofid:
complete_pdu(pdu->s, pdu, VAR_2); v9fs_string_free(&name); v9fs_string_free(&symname); v9fs_string_free(&fullname); }