Browse Source

Change ext4_fread & ext4_fwrite prototypes

It is better idea  to pass size_t type to fwrite & fread instead of uint32_t.
pull/4/head
gkostka 9 years ago
committed by root
parent
commit
11246ef8f6
  1. 2
      demos/chibios/common/test_lwext4.c
  2. 2
      demos/generic/main.c
  3. 2
      demos/stm32f429_disco/main.c
  4. 15
      fs_test/lwext4_server.c
  5. 4
      lwext4/ext4.c
  6. 5
      lwext4/ext4.h

2
demos/chibios/common/test_lwext4.c

@ -222,7 +222,7 @@ static int verify_buf(const unsigned char *b, size_t len, unsigned char c)
bool test_lwext4_file_test(uint32_t rw_szie, uint32_t rw_count)
{
int r;
uint32_t size;
size_t size;
uint32_t i;
clock_t start;
clock_t stop;

2
demos/generic/main.c

@ -256,7 +256,7 @@ static bool dir_test(int len)
static bool file_test(void)
{
int r;
uint32_t size;
size_t size;
ext4_file f;
int i;
clock_t start;

2
demos/stm32f429_disco/main.c

@ -247,7 +247,7 @@ static bool dir_test(int len)
static bool file_test(void)
{
int r;
uint32_t size;
size_t size;
ext4_file f;
int i;
clock_t start;

15
fs_test/lwext4_server.c

@ -550,7 +550,7 @@ int _fread(char *p)
int len;
int d;
int rc;
int rb;
size_t rb;
if (sscanf(p, "%d %d %d %d", &fid, &d, &len, &d) != 4) {
printf("Param list error\n");
@ -595,10 +595,11 @@ int _fread(char *p)
int _fwrite(char *p)
{
int fid = MAX_FILES;
int len;
int d;
int rc;
int wb;
size_t len;
size_t wb;
if (sscanf(p, "%d %d %d %d", &fid, &d, &len, &d) != 4) {
printf("Param list error\n");
@ -867,10 +868,10 @@ int _multi_fwrite(char *p)
char path[256];
char path1[256];
char prefix[32];
int cnt;
int cnt, i;
int len, ll;
int rc;
int i, d, wb;
size_t d, wb;
ext4_file fd;
if (sscanf(p, "%s %s %d %d", path, prefix, &cnt, &ll) != 4) {
@ -912,8 +913,8 @@ int _multi_fread(char *p)
char prefix[32];
int cnt;
int len, ll;
int rc;
int i, d, rb;
int rc ,i, d;
size_t rb;
ext4_file fd;
if (sscanf(p, "%s %s %d %d", path, prefix, &cnt, &ll) != 4) {

4
lwext4/ext4.c

@ -1236,7 +1236,7 @@ int ext4_ftruncate(ext4_file *f, uint64_t size)
return r;
}
int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt)
int ext4_fread(ext4_file *f, void *buf, size_t size, size_t *rcnt)
{
uint32_t u;
uint32_t fblock;
@ -1370,7 +1370,7 @@ Finish:
return r;
}
int ext4_fwrite(ext4_file *f, const void *buf, uint32_t size, uint32_t *wcnt)
int ext4_fwrite(ext4_file *f, const void *buf, size_t size, size_t *wcnt)
{
uint32_t u;
uint32_t fblock;

5
lwext4/ext4.h

@ -43,6 +43,7 @@
#include "ext4_blockdev.h"
#include <stdint.h>
#include <stddef.h>
/********************************FILE OPEN FLAGS*****************************/
@ -323,7 +324,7 @@ int ext4_ftruncate(ext4_file *f, uint64_t size);
* @param size bytes to read
* @param rcnt bytes read (may be NULL)
* @return standard error code*/
int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt);
int ext4_fread(ext4_file *f, void *buf, size_t size, size_t *rcnt);
/**@brief Write data to file.
* @param f file handle
@ -331,7 +332,7 @@ int ext4_fread(ext4_file *f, void *buf, uint32_t size, uint32_t *rcnt);
* @param size write length
* @param wcnt bytes written (may be NULL)
* @return standard error code*/
int ext4_fwrite(ext4_file *f, const void *buf, uint32_t size, uint32_t *wcnt);
int ext4_fwrite(ext4_file *f, const void *buf, size_t size, size_t *wcnt);
/**@brief File seek operation.
* @param f file handle

Loading…
Cancel
Save