void *fw_cfg_modify_file(FWCfgState *s, const char *filename,

                        void *data, size_t len)

{

    int i, index;

    void *ptr = NULL;



    assert(s->files);



    index = be32_to_cpu(s->files->count);

    assert(index < fw_cfg_file_slots(s));



    for (i = 0; i < index; i++) {

        if (strcmp(filename, s->files->f[i].name) == 0) {

            ptr = fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i,

                                           data, len);

            s->files->f[i].size   = cpu_to_be32(len);

            return ptr;

        }

    }

    /* add new one */

    fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);

    return NULL;

}

void *fw_cfg_modify_file(FWCfgState *s, const char *filename,

                        void *data, size_t len)

{

    int i, index;

    void *ptr = NULL;



    assert(s->files);



    index = be32_to_cpu(s->files->count);

    assert(index < fw_cfg_file_slots(s));



    for (i = 0; i < index; i++) {

        if (strcmp(filename, s->files->f[i].name) == 0) {

            ptr = fw_cfg_modify_bytes_read(s, FW_CFG_FILE_FIRST + i,

                                           data, len);

            s->files->f[i].size   = cpu_to_be32(len);

            return ptr;

        }

    }

    

    fw_cfg_add_file_callback(s, filename, NULL, NULL, NULL, data, len, true);

    return NULL;

}

    assert(index < fw_cfg_file_slots(s));
void *FUNC_0(FWCfgState *VAR_0, const char *VAR_1,

                        void *VAR_2, size_t VAR_3)

{

    int VAR_4, VAR_5;

    void *VAR_6 = NULL;



    assert(VAR_0->files);



    VAR_5 = be32_to_cpu(VAR_0->files->count);

    assert(VAR_5 < fw_cfg_file_slots(VAR_0));



    for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) {

        if (strcmp(VAR_1, VAR_0->files->f[VAR_4].name) == 0) {

            VAR_6 = fw_cfg_modify_bytes_read(VAR_0, FW_CFG_FILE_FIRST + VAR_4,

                                           VAR_2, VAR_3);

            VAR_0->files->f[VAR_4].size   = cpu_to_be32(VAR_3);

            return VAR_6;

        }

    }

    

    fw_cfg_add_file_callback(VAR_0, VAR_1, NULL, NULL, NULL, VAR_2, VAR_3, true);

    return NULL;

}

void *FUNC_0(FWCfgState *VAR_0, const char *VAR_1,
void *VAR_2, size_t VAR_3)
{ int VAR_4, VAR_5; void *VAR_6 = NULL; assert(VAR_0->files); VAR_5 = be32_to_cpu(VAR_0->files->count); assert(VAR_5 < fw_cfg_file_slots(VAR_0)); for (VAR_4 = 0; VAR_4 < VAR_5; VAR_4++) { if (strcmp(VAR_1, VAR_0->files->f[VAR_4].name) == 0) { VAR_6 = fw_cfg_modify_bytes_read(VAR_0, FW_CFG_FILE_FIRST + VAR_4,
VAR_2, VAR_3); VAR_0->files->f[VAR_4].size   = cpu_to_be32(VAR_3); return VAR_6; } } fw_cfg_add_file_callback(VAR_0, VAR_1, NULL, NULL, NULL, VAR_2, VAR_3, true); return NULL; }