mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-24 14:25:56 +00:00
fs: fat: fix link error when building with DEBUG=1
When compiling with DEBUG=1 an error
fs/fat/fat_write.c:831: undefined reference to `__aeabi_ldivmod'
occurred.
We should use do_div() instead of the modulus operator.
filesize and cur_pos cannot be negative. So let's use u64 to avoid
warnings.
Fixes: cb8af8af5b
("fs: fat: support write with non-zero offset")
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
parent
a319229fda
commit
7274b7638a
1 changed files with 3 additions and 3 deletions
|
@ -696,11 +696,11 @@ static int
|
||||||
set_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, __u8 *buffer,
|
set_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, __u8 *buffer,
|
||||||
loff_t maxsize, loff_t *gotsize)
|
loff_t maxsize, loff_t *gotsize)
|
||||||
{
|
{
|
||||||
loff_t filesize;
|
|
||||||
unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
|
unsigned int bytesperclust = mydata->clust_size * mydata->sect_size;
|
||||||
__u32 curclust = START(dentptr);
|
__u32 curclust = START(dentptr);
|
||||||
__u32 endclust = 0, newclust = 0;
|
__u32 endclust = 0, newclust = 0;
|
||||||
loff_t cur_pos, offset, actsize, wsize;
|
u64 cur_pos, filesize;
|
||||||
|
loff_t offset, actsize, wsize;
|
||||||
|
|
||||||
*gotsize = 0;
|
*gotsize = 0;
|
||||||
filesize = pos + maxsize;
|
filesize = pos + maxsize;
|
||||||
|
@ -828,7 +828,7 @@ set_contents(fsdata *mydata, dir_entry *dentptr, loff_t pos, __u8 *buffer,
|
||||||
|
|
||||||
curclust = endclust;
|
curclust = endclust;
|
||||||
filesize -= cur_pos;
|
filesize -= cur_pos;
|
||||||
assert(!(cur_pos % bytesperclust));
|
assert(!do_div(cur_pos, bytesperclust));
|
||||||
|
|
||||||
set_clusters:
|
set_clusters:
|
||||||
/* allocate and write */
|
/* allocate and write */
|
||||||
|
|
Loading…
Add table
Reference in a new issue