fileio_t -> struct fileio

Remove useless structure typedef.
__archive__
Zachary T Welch 2009-11-13 03:08:29 -08:00
parent f59ec2043b
commit 9f212b01be
11 changed files with 40 additions and 41 deletions

View File

@ -812,7 +812,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
uint32_t offset;
uint8_t *buffer;
uint32_t buf_cnt;
fileio_t fileio;
struct fileio fileio;
if (argc != 3)
return ERROR_COMMAND_SYNTAX_ERROR;

View File

@ -622,7 +622,7 @@ COMMAND_HANDLER(lpc2900_handle_read_custom_command)
target_write_u32( target, FCTR, FCTR_FS_CS | FCTR_FS_WEB );
/* Try and open the file */
fileio_t fileio;
struct fileio fileio;
const char *filename = args[1];
int ret = fileio_open( &fileio, filename, FILEIO_WRITE, FILEIO_BINARY );
if( ret != ERROR_OK )

View File

@ -706,7 +706,7 @@ COMMAND_HANDLER(mg_write_cmd)
{
uint32_t address, buf_cnt, cnt, res, i;
uint8_t *buffer;
fileio_t fileio;
struct fileio fileio;
int ret;
if (argc != 3) {
@ -770,7 +770,7 @@ COMMAND_HANDLER(mg_dump_cmd)
{
uint32_t address, size_written, size, cnt, res, i;
uint8_t *buffer;
fileio_t fileio;
struct fileio fileio;
int ret;
if (argc != 4) {

View File

@ -1292,7 +1292,7 @@ COMMAND_HANDLER(handle_nand_write_command)
uint32_t buf_cnt;
enum oob_formats oob_format = NAND_OOB_NONE;
fileio_t fileio;
struct fileio fileio;
if (argc < 3)
@ -1469,7 +1469,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
return ERROR_OK;
}
fileio_t fileio;
struct fileio fileio;
uint8_t *page = NULL;
uint32_t page_size = 0;

View File

@ -31,7 +31,7 @@
#include "configuration.h"
#include "fileio.h"
static inline int fileio_open_local(fileio_t *fileio)
static inline int fileio_open_local(struct fileio *fileio)
{
char access[4];
@ -98,7 +98,7 @@ static inline int fileio_open_local(fileio_t *fileio)
return ERROR_OK;
}
int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, enum fileio_type type)
int fileio_open(struct fileio *fileio, const char *url, enum fileio_access access, enum fileio_type type)
{
int retval = ERROR_OK;
@ -111,7 +111,7 @@ int fileio_open(fileio_t *fileio, const char *url, enum fileio_access access, en
return retval;
}
static inline int fileio_close_local(fileio_t *fileio)
static inline int fileio_close_local(struct fileio *fileio)
{
int retval;
if ((retval = fclose(fileio->file)) != 0)
@ -131,7 +131,7 @@ static inline int fileio_close_local(fileio_t *fileio)
return ERROR_OK;
}
int fileio_close(fileio_t *fileio)
int fileio_close(struct fileio *fileio)
{
int retval;
@ -143,7 +143,7 @@ int fileio_close(fileio_t *fileio)
return retval;
}
int fileio_seek(fileio_t *fileio, uint32_t position)
int fileio_seek(struct fileio *fileio, uint32_t position)
{
int retval;
if ((retval = fseek(fileio->file, position, SEEK_SET)) != 0)
@ -155,19 +155,19 @@ int fileio_seek(fileio_t *fileio, uint32_t position)
return ERROR_OK;
}
static inline int fileio_local_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
static inline int fileio_local_read(struct fileio *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
{
*size_read = fread(buffer, 1, size, fileio->file);
return ERROR_OK;
}
int fileio_read(fileio_t *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
int fileio_read(struct fileio *fileio, uint32_t size, uint8_t *buffer, uint32_t *size_read)
{
return fileio_local_read(fileio, size, buffer, size_read);
}
int fileio_read_u32(fileio_t *fileio, uint32_t *data)
int fileio_read_u32(struct fileio *fileio, uint32_t *data)
{
uint8_t buf[4];
uint32_t size_read;
@ -180,7 +180,7 @@ int fileio_read_u32(fileio_t *fileio, uint32_t *data)
return ERROR_OK;
}
static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buffer)
static inline int fileio_local_fgets(struct fileio *fileio, uint32_t size, char *buffer)
{
if (fgets(buffer, size, fileio->file) == NULL)
return ERROR_FILEIO_OPERATION_FAILED;
@ -188,19 +188,19 @@ static inline int fileio_local_fgets(fileio_t *fileio, uint32_t size, char *buff
return ERROR_OK;
}
int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer)
int fileio_fgets(struct fileio *fileio, uint32_t size, char *buffer)
{
return fileio_local_fgets(fileio, size, buffer);
}
static inline int fileio_local_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
static inline int fileio_local_write(struct fileio *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
{
*size_written = fwrite(buffer, 1, size, fileio->file);
return ERROR_OK;
}
int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
int fileio_write(struct fileio *fileio, uint32_t size, const uint8_t *buffer, uint32_t *size_written)
{
int retval;
@ -212,7 +212,7 @@ int fileio_write(fileio_t *fileio, uint32_t size, const uint8_t *buffer, uint32_
return retval;;
}
int fileio_write_u32(fileio_t *fileio, uint32_t data)
int fileio_write_u32(struct fileio *fileio, uint32_t data)
{
uint8_t buf[4];
uint32_t size_written;

View File

@ -45,29 +45,28 @@ enum fileio_access
FILEIO_APPENDREAD, /* open for writing, position at end, allow reading */
};
typedef struct fileio_s
{
struct fileio {
char *url;
long long size;
enum fileio_type type;
enum fileio_access access;
FILE *file;
} fileio_t;
};
int fileio_open(fileio_t *fileio,
int fileio_open(struct fileio *fileio,
const char *url, enum fileio_access access, enum fileio_type type);
int fileio_close(fileio_t *fileio);
int fileio_close(struct fileio *fileio);
int fileio_seek(fileio_t *fileio, uint32_t position);
int fileio_fgets(fileio_t *fileio, uint32_t size, char *buffer);
int fileio_seek(struct fileio *fileio, uint32_t position);
int fileio_fgets(struct fileio *fileio, uint32_t size, char *buffer);
int fileio_read(fileio_t *fileio,
int fileio_read(struct fileio *fileio,
uint32_t size, uint8_t *buffer, uint32_t *size_read);
int fileio_write(fileio_t *fileio,
int fileio_write(struct fileio *fileio,
uint32_t size, const uint8_t *buffer, uint32_t *size_written);
int fileio_read_u32(fileio_t *fileio, uint32_t *data);
int fileio_write_u32(fileio_t *fileio, uint32_t data);
int fileio_read_u32(struct fileio *fileio, uint32_t *data);
int fileio_write_u32(struct fileio *fileio, uint32_t data);
#define ERROR_FILEIO_LOCATION_UNKNOWN (-1200)
#define ERROR_FILEIO_NOT_FOUND (-1201)

View File

@ -1788,7 +1788,7 @@ COMMAND_HANDLER(handle_etm_image_command)
COMMAND_HANDLER(handle_etm_dump_command)
{
fileio_t file;
struct fileio file;
target_t *target;
struct arm *arm;
etm_context_t *etm_ctx;
@ -1856,7 +1856,7 @@ COMMAND_HANDLER(handle_etm_dump_command)
COMMAND_HANDLER(handle_etm_load_command)
{
fileio_t file;
struct fileio file;
target_t *target;
struct arm *arm;
etm_context_t *etm_ctx;

View File

@ -47,7 +47,7 @@
static int autodetect_image_type(image_t *image, const char *url)
{
int retval;
fileio_t fileio;
struct fileio fileio;
uint32_t read_bytes;
uint8_t buffer[9];
@ -150,7 +150,7 @@ static int identify_image_type(image_t *image, const char *type_string, const ch
static int image_ihex_buffer_complete(image_t *image)
{
image_ihex_t *ihex = image->type_private;
fileio_t *fileio = &ihex->fileio;
struct fileio *fileio = &ihex->fileio;
uint32_t full_address = 0x0;
uint32_t cooked_bytes;
int i;
@ -502,7 +502,7 @@ static int image_elf_read_section(image_t *image, int section, uint32_t offset,
static int image_mot_buffer_complete(image_t *image)
{
image_mot_t *mot = image->type_private;
fileio_t *fileio = &mot->fileio;
struct fileio *fileio = &mot->fileio;
uint32_t full_address = 0x0;
uint32_t cooked_bytes;
int i;

View File

@ -69,12 +69,12 @@ typedef struct image_s
typedef struct image_binary_s
{
fileio_t fileio;
struct fileio fileio;
} image_binary_t;
typedef struct image_ihex_s
{
fileio_t fileio;
struct fileio fileio;
uint8_t *buffer;
} image_ihex_t;
@ -87,7 +87,7 @@ typedef struct image_memory_s
typedef struct fileio_elf_s
{
fileio_t fileio;
struct fileio fileio;
Elf32_Ehdr *header;
Elf32_Phdr *segments;
uint32_t segment_count;
@ -96,7 +96,7 @@ typedef struct fileio_elf_s
typedef struct image_mot_s
{
fileio_t fileio;
struct fileio fileio;
uint8_t *buffer;
} image_mot_t;

View File

@ -2493,7 +2493,7 @@ COMMAND_HANDLER(handle_load_image_command)
COMMAND_HANDLER(handle_dump_image_command)
{
fileio_t fileio;
struct fileio fileio;
uint8_t buffer[560];
int retvaltemp;

View File

@ -3420,7 +3420,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
target_t *target = get_current_target(cmd_ctx);
struct xscale_common_s *xscale = target_to_xscale(target);
xscale_trace_data_t *trace_data;
fileio_t file;
struct fileio file;
int retval;
retval = xscale_verify_pointer(cmd_ctx, xscale);