struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,

                                          int64_t whence, Error **errp)

{

    GuestFileHandle *gfh = guest_file_handle_find(handle, errp);

    GuestFileSeek *seek_data = NULL;

    FILE *fh;

    int ret;



    if (!gfh) {

        return NULL;




    fh = gfh->fh;

    ret = fseek(fh, offset, whence);

    if (ret == -1) {

        error_setg_errno(errp, errno, "failed to seek file");





    } else {

        seek_data = g_new0(GuestFileSeek, 1);

        seek_data->position = ftell(fh);

        seek_data->eof = feof(fh);



    clearerr(fh);



    return seek_data;

struct GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,

                                          int64_t whence, Error **errp)

{

    GuestFileHandle *gfh = guest_file_handle_find(handle, errp);

    GuestFileSeek *seek_data = NULL;

    FILE *fh;

    int ret;



    if (!gfh) {

        return NULL;




    fh = gfh->fh;

    ret = fseek(fh, offset, whence);

    if (ret == -1) {

        error_setg_errno(errp, errno, "failed to seek file");





    } else {

        seek_data = g_new0(GuestFileSeek, 1);

        seek_data->position = ftell(fh);

        seek_data->eof = feof(fh);



    clearerr(fh);



    return seek_data;

struct GuestFileSeek *FUNC_0(int64_t VAR_0, int64_t VAR_1,

                                          int64_t VAR_2, Error **VAR_3)

{

    GuestFileHandle *gfh = guest_file_handle_find(VAR_0, VAR_3);

    GuestFileSeek *VAR_4 = NULL;

    FILE *fh;

    int VAR_5;



    if (!gfh) {

        return NULL;




    fh = gfh->fh;

    VAR_5 = fseek(fh, VAR_1, VAR_2);

    if (VAR_5 == -1) {

        error_setg_errno(VAR_3, errno, "failed to seek file");





    } else {

        VAR_4 = g_new0(GuestFileSeek, 1);

        VAR_4->position = ftell(fh);

        VAR_4->eof = feof(fh);



    clearerr(fh);



    return VAR_4;

struct GuestFileSeek *FUNC_0(int64_t VAR_0, int64_t VAR_1,
int64_t VAR_2, Error **VAR_3)
{ GuestFileHandle *gfh = guest_file_handle_find(VAR_0, VAR_3); GuestFileSeek *VAR_4 = NULL; FILE *fh; int VAR_5; if (!gfh) { return NULL; fh = gfh->fh; VAR_5 = fseek(fh, VAR_1, VAR_2); if (VAR_5 == -1) { error_setg_errno(VAR_3, errno, "failed to seek file"); } else { VAR_4 = g_new0(GuestFileSeek, 1); VAR_4->position = ftell(fh); VAR_4->eof = feof(fh); clearerr(fh); return VAR_4;