]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - fs/ext4/ext4_write.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[karo-tx-uboot.git] / fs / ext4 / ext4_write.c
index 0c1f62b60caf5d1ab82c2a5800700b14481e744f..1e1924c80626f4835f61e7f6dc9aa6f9b4682a7e 100644 (file)
  *
  * ext4write : Based on generic ext4 protocol.
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 
@@ -88,8 +76,8 @@ int ext4fs_get_bgdtable(void)
        if (!fs->gdtable)
                return -ENOMEM;
        /* read the group descriptor table */
-       status = ext4fs_devread(fs->gdtable_blkno * fs->sect_perblk, 0,
-                               fs->blksz * fs->no_blk_pergdt, fs->gdtable);
+       status = ext4fs_devread((lbaint_t)fs->gdtable_blkno * fs->sect_perblk,
+                               0, fs->blksz * fs->no_blk_pergdt, fs->gdtable);
        if (status == 0)
                goto fail;
 
@@ -142,7 +130,7 @@ static void delete_single_indirect_block(struct ext2_inode *inode)
                /* journal backup */
                if (prev_bg_bmap_idx != bg_idx) {
                        status =
-                           ext4fs_devread(bgd[bg_idx].block_id *
+                           ext4fs_devread((lbaint_t)bgd[bg_idx].block_id *
                                           fs->sect_perblk, 0, fs->blksz,
                                           journal_buffer);
                        if (status == 0)
@@ -186,8 +174,8 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
                }
                DIB_start_addr = (unsigned int *)di_buffer;
                blknr = inode->b.blocks.double_indir_block;
-               status = ext4fs_devread(blknr * fs->sect_perblk, 0, fs->blksz,
-                                       (char *)di_buffer);
+               status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, 0,
+                                       fs->blksz, (char *)di_buffer);
                for (i = 0; i < fs->blksz / sizeof(int); i++) {
                        if (*di_buffer == 0)
                                break;
@@ -208,7 +196,8 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
                        fs->sb->free_blocks++;
                        /* journal backup */
                        if (prev_bg_bmap_idx != bg_idx) {
-                               status = ext4fs_devread(bgd[bg_idx].block_id
+                               status = ext4fs_devread((lbaint_t)
+                                                       bgd[bg_idx].block_id
                                                        * fs->sect_perblk, 0,
                                                        fs->blksz,
                                                        journal_buffer);
@@ -238,7 +227,7 @@ static void delete_double_indirect_block(struct ext2_inode *inode)
                /* journal backup */
                if (prev_bg_bmap_idx != bg_idx) {
                        memset(journal_buffer, '\0', fs->blksz);
-                       status = ext4fs_devread(bgd[bg_idx].block_id *
+                       status = ext4fs_devread((lbaint_t)bgd[bg_idx].block_id *
                                                fs->sect_perblk, 0, fs->blksz,
                                                journal_buffer);
                        if (status == 0)
@@ -287,8 +276,8 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
                }
                tib_start_addr = (unsigned int *)tigp_buffer;
                blknr = inode->b.blocks.triple_indir_block;
-               status = ext4fs_devread(blknr * fs->sect_perblk, 0, fs->blksz,
-                                       (char *)tigp_buffer);
+               status = ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, 0,
+                                       fs->blksz, (char *)tigp_buffer);
                for (i = 0; i < fs->blksz / sizeof(int); i++) {
                        if (*tigp_buffer == 0)
                                break;
@@ -298,7 +287,7 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
                        if (!tip_buffer)
                                goto fail;
                        tipb_start_addr = (unsigned int *)tip_buffer;
-                       status = ext4fs_devread((*tigp_buffer) *
+                       status = ext4fs_devread((lbaint_t)(*tigp_buffer) *
                                                fs->sect_perblk, 0, fs->blksz,
                                                (char *)tip_buffer);
                        for (j = 0; j < fs->blksz / sizeof(int); j++) {
@@ -325,6 +314,7 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
                                if (prev_bg_bmap_idx != bg_idx) {
                                        status =
                                            ext4fs_devread(
+                                                       (lbaint_t)
                                                        bgd[bg_idx].block_id *
                                                        fs->sect_perblk, 0,
                                                        fs->blksz,
@@ -365,7 +355,8 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
                        if (prev_bg_bmap_idx != bg_idx) {
                                memset(journal_buffer, '\0', fs->blksz);
                                status =
-                                   ext4fs_devread(bgd[bg_idx].block_id *
+                                   ext4fs_devread((lbaint_t)
+                                                  bgd[bg_idx].block_id *
                                                   fs->sect_perblk, 0,
                                                   fs->blksz, journal_buffer);
                                if (status == 0)
@@ -394,7 +385,7 @@ static void delete_triple_indirect_block(struct ext2_inode *inode)
                /* journal backup */
                if (prev_bg_bmap_idx != bg_idx) {
                        memset(journal_buffer, '\0', fs->blksz);
-                       status = ext4fs_devread(bgd[bg_idx].block_id *
+                       status = ext4fs_devread((lbaint_t)bgd[bg_idx].block_id *
                                                fs->sect_perblk, 0, fs->blksz,
                                                journal_buffer);
                        if (status == 0)
@@ -480,7 +471,8 @@ static int ext4fs_delete_file(int inodeno)
                        /* journal backup */
                        if (prev_bg_bmap_idx != bg_idx) {
                                status =
-                                   ext4fs_devread(bgd[bg_idx].block_id *
+                                   ext4fs_devread((lbaint_t)
+                                                  bgd[bg_idx].block_id *
                                                   fs->sect_perblk, 0,
                                                   fs->blksz, journal_buffer);
                                if (status == 0)
@@ -524,7 +516,8 @@ static int ext4fs_delete_file(int inodeno)
                        /* journal backup */
                        if (prev_bg_bmap_idx != bg_idx) {
                                memset(journal_buffer, '\0', fs->blksz);
-                               status = ext4fs_devread(bgd[bg_idx].block_id
+                               status = ext4fs_devread((lbaint_t)
+                                                       bgd[bg_idx].block_id
                                                        * fs->sect_perblk,
                                                        0, fs->blksz,
                                                        journal_buffer);
@@ -555,7 +548,7 @@ static int ext4fs_delete_file(int inodeno)
        if (!read_buffer)
                goto fail;
        start_block_address = read_buffer;
-       status = ext4fs_devread(blkno * fs->sect_perblk,
+       status = ext4fs_devread((lbaint_t)blkno * fs->sect_perblk,
                                0, fs->blksz, read_buffer);
        if (status == 0)
                goto fail;
@@ -578,7 +571,7 @@ static int ext4fs_delete_file(int inodeno)
        fs->sb->free_inodes++;
        /* journal backup */
        memset(journal_buffer, '\0', fs->blksz);
-       status = ext4fs_devread(bgd[ibmap_idx].inode_id *
+       status = ext4fs_devread((lbaint_t)bgd[ibmap_idx].inode_id *
                                fs->sect_perblk, 0, fs->blksz, journal_buffer);
        if (status == 0)
                goto fail;
@@ -653,7 +646,8 @@ int ext4fs_init(void)
 
        for (i = 0; i < fs->no_blkgrp; i++) {
                status =
-                   ext4fs_devread(fs->bgd[i].block_id * fs->sect_perblk, 0,
+                   ext4fs_devread((lbaint_t)fs->bgd[i].block_id *
+                                  fs->sect_perblk, 0,
                                   fs->blksz, (char *)fs->blk_bmaps[i]);
                if (status == 0)
                        goto fail;
@@ -670,7 +664,8 @@ int ext4fs_init(void)
        }
 
        for (i = 0; i < fs->no_blkgrp; i++) {
-               status = ext4fs_devread(fs->bgd[i].inode_id * fs->sect_perblk,
+               status = ext4fs_devread((lbaint_t)fs->bgd[i].inode_id *
+                                       fs->sect_perblk,
                                        0, fs->blksz,
                                        (char *)fs->inode_bmaps[i]);
                if (status == 0)
@@ -710,7 +705,7 @@ void ext4fs_deinit(void)
                                  &inode_journal);
                blknr = read_allocated_block(&inode_journal,
                                        EXT2_JOURNAL_SUPERBLOCK);
-               ext4fs_devread(blknr * fs->sect_perblk, 0, fs->blksz,
+               ext4fs_devread((lbaint_t)blknr * fs->sect_perblk, 0, fs->blksz,
                               temp_buff);
                jsb = (struct journal_superblock_t *)temp_buff;
                jsb->s_start = cpu_to_be32(0);
@@ -934,7 +929,8 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
                        (inodeno % __le32_to_cpu(sblock->inodes_per_group)) /
                        inodes_per_block;
        blkoff = (inodeno % inodes_per_block) * fs->inodesz;
-       ext4fs_devread(itable_blkno * fs->sect_perblk, 0, fs->blksz, temp_ptr);
+       ext4fs_devread((lbaint_t)itable_blkno * fs->sect_perblk, 0, fs->blksz,
+                      temp_ptr);
        if (ext4fs_log_journal(temp_ptr, itable_blkno))
                goto fail;
 
@@ -954,7 +950,7 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
        blkoff = (parent_inodeno % inodes_per_block) * fs->inodesz;
        if (parent_itable_blkno != itable_blkno) {
                memset(temp_ptr, '\0', fs->blksz);
-               ext4fs_devread(parent_itable_blkno * fs->sect_perblk,
+               ext4fs_devread((lbaint_t)parent_itable_blkno * fs->sect_perblk,
                               0, fs->blksz, temp_ptr);
                if (ext4fs_log_journal(temp_ptr, parent_itable_blkno))
                        goto fail;