summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/dev.c30
-rw-r--r--fs/ext4/ext4_common.c25
-rw-r--r--fs/fat/fat.c4
-rw-r--r--fs/fat/fat_write.c3
-rw-r--r--fs/fs.c12
-rw-r--r--fs/reiserfs/dev.c24
-rw-r--r--fs/ubifs/ubifs.c15
-rw-r--r--fs/zfs/dev.c28
8 files changed, 66 insertions, 75 deletions
diff --git a/fs/ext4/dev.c b/fs/ext4/dev.c
index 20f52566f0..9fd10de077 100644
--- a/fs/ext4/dev.c
+++ b/fs/ext4/dev.c
@@ -76,10 +76,10 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf)
if (byte_offset != 0) {
int readlen;
/* read first part which isn't aligned with start of sector */
- if (ext4fs_block_dev_desc->
- block_read(ext4fs_block_dev_desc->dev,
- part_info->start + sector, 1,
- (unsigned long *) sec_buf) != 1) {
+ if (ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc,
+ part_info->start + sector,
+ 1, (void *)sec_buf)
+ != 1) {
printf(" ** ext2fs_devread() read error **\n");
return 0;
}
@@ -101,18 +101,18 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf)
ALLOC_CACHE_ALIGN_BUFFER(u8, p, ext4fs_block_dev_desc->blksz);
block_len = ext4fs_block_dev_desc->blksz;
- ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc->dev,
+ ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc,
part_info->start + sector,
- 1, (unsigned long *)p);
+ 1, (void *)p);
memcpy(buf, p, byte_len);
return 1;
}
- if (ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc->dev,
- part_info->start + sector,
- block_len >> log2blksz,
- (unsigned long *) buf) !=
- block_len >> log2blksz) {
+ if (ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc,
+ part_info->start + sector,
+ block_len >> log2blksz,
+ (void *)buf) !=
+ block_len >> log2blksz) {
printf(" ** %s read error - block\n", __func__);
return 0;
}
@@ -123,10 +123,10 @@ int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf)
if (byte_len != 0) {
/* read rest of data which are not in whole sector */
- if (ext4fs_block_dev_desc->
- block_read(ext4fs_block_dev_desc->dev,
- part_info->start + sector, 1,
- (unsigned long *) sec_buf) != 1) {
+ if (ext4fs_block_dev_desc->block_read(ext4fs_block_dev_desc,
+ part_info->start + sector,
+ 1, (void *)sec_buf)
+ != 1) {
printf("* %s read error - last part\n", __func__);
return 0;
}
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index e73223ac22..294a46eadf 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -82,26 +82,26 @@ void put_ext4(uint64_t off, void *buf, uint32_t size)
if (remainder) {
if (fs->dev_desc->block_read) {
- fs->dev_desc->block_read(fs->dev_desc->dev,
+ fs->dev_desc->block_read(fs->dev_desc,
startblock, 1, sec_buf);
temp_ptr = sec_buf;
memcpy((temp_ptr + remainder),
(unsigned char *)buf, size);
- fs->dev_desc->block_write(fs->dev_desc->dev,
+ fs->dev_desc->block_write(fs->dev_desc,
startblock, 1, sec_buf);
}
} else {
if (size >> log2blksz != 0) {
- fs->dev_desc->block_write(fs->dev_desc->dev,
+ fs->dev_desc->block_write(fs->dev_desc,
startblock,
size >> log2blksz,
(unsigned long *)buf);
} else {
- fs->dev_desc->block_read(fs->dev_desc->dev,
+ fs->dev_desc->block_read(fs->dev_desc,
startblock, 1, sec_buf);
temp_ptr = sec_buf;
memcpy(temp_ptr, buf, size);
- fs->dev_desc->block_write(fs->dev_desc->dev,
+ fs->dev_desc->block_write(fs->dev_desc,
startblock, 1,
(unsigned long *)sec_buf);
}
@@ -1287,11 +1287,11 @@ static void alloc_triple_indirect_block(struct ext2_inode *file_inode,
ti_gp_blockno = ext4fs_get_new_blk_no();
if (ti_gp_blockno == -1) {
printf("no block left to assign\n");
- goto fail;
+ return;
}
ti_gp_buff = zalloc(fs->blksz);
if (!ti_gp_buff)
- goto fail;
+ return;
ti_gp_buff_start_addr = ti_gp_buff;
(*no_blks_reqd)++;
@@ -1321,11 +1321,11 @@ static void alloc_triple_indirect_block(struct ext2_inode *file_inode,
ti_child_blockno = ext4fs_get_new_blk_no();
if (ti_child_blockno == -1) {
printf("no block left assign\n");
- goto fail;
+ goto fail1;
}
ti_child_buff = zalloc(fs->blksz);
if (!ti_child_buff)
- goto fail;
+ goto fail1;
ti_cbuff_start_addr = ti_child_buff;
*ti_parent_buff = ti_child_blockno;
@@ -1341,7 +1341,8 @@ static void alloc_triple_indirect_block(struct ext2_inode *file_inode,
ext4fs_get_new_blk_no();
if (actual_block_no == -1) {
printf("no block left\n");
- goto fail;
+ free(ti_cbuff_start_addr);
+ goto fail1;
}
*ti_child_buff = actual_block_no;
debug("TIAB %ld: %u\n", actual_block_no,
@@ -1373,7 +1374,11 @@ static void alloc_triple_indirect_block(struct ext2_inode *file_inode,
put_ext4(((uint64_t) ((uint64_t)ti_gp_blockno * (uint64_t)fs->blksz)),
ti_gp_buff_start_addr, fs->blksz);
file_inode->b.blocks.triple_indir_block = ti_gp_blockno;
+ free(ti_gp_buff_start_addr);
+ return;
}
+fail1:
+ free(ti_pbuff_start_addr);
fail:
free(ti_gp_buff_start_addr);
}
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index f939bc5dee..472a63e8bb 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -51,8 +51,8 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
if (!cur_dev || !cur_dev->block_read)
return -1;
- ret = cur_dev->block_read(cur_dev->dev,
- cur_part_info.start + block, nr_blocks, buf);
+ ret = cur_dev->block_read(cur_dev, cur_part_info.start + block,
+ nr_blocks, buf);
if (nr_blocks && ret == 0)
return -1;
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index af828d07bd..5ed324ce1a 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -41,8 +41,7 @@ static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
return -1;
}
- ret = cur_dev->block_write(cur_dev->dev,
- cur_part_info.start + block,
+ ret = cur_dev->block_write(cur_dev, cur_part_info.start + block,
nr_blocks, buf);
if (nr_blocks && ret == 0)
return -1;
diff --git a/fs/fs.c b/fs/fs.c
index a2f1bf5d46..d123d29a08 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1,17 +1,7 @@
/*
* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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, see <http://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: GPL-2.0
*/
#include <config.h>
diff --git a/fs/reiserfs/dev.c b/fs/reiserfs/dev.c
index 68255458d5..7b24d6aa71 100644
--- a/fs/reiserfs/dev.c
+++ b/fs/reiserfs/dev.c
@@ -59,9 +59,11 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
if (byte_offset != 0) {
/* read first part which isn't aligned with start of sector */
- if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc->dev,
- part_info->start + sector, 1,
- (unsigned long *)sec_buf) != 1) {
+ if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc,
+ part_info->start +
+ sector,
+ 1, (void *)sec_buf)
+ != 1) {
printf (" ** reiserfs_devread() read error\n");
return 0;
}
@@ -73,9 +75,11 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
/* read sector aligned part */
block_len = byte_len & ~(SECTOR_SIZE-1);
- if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc->dev,
- part_info->start + sector, block_len/SECTOR_SIZE,
- (unsigned long *)buf) != block_len/SECTOR_SIZE) {
+ if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc,
+ part_info->start + sector,
+ block_len / SECTOR_SIZE,
+ (void *)buf)
+ != block_len/SECTOR_SIZE) {
printf (" ** reiserfs_devread() read error - block\n");
return 0;
}
@@ -85,9 +89,11 @@ int reiserfs_devread (int sector, int byte_offset, int byte_len, char *buf)
if ( byte_len != 0 ) {
/* read rest of data which are not in whole sector */
- if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc->dev,
- part_info->start + sector, 1,
- (unsigned long *)sec_buf) != 1) {
+ if (reiserfs_block_dev_desc->block_read(reiserfs_block_dev_desc,
+ part_info->start +
+ sector,
+ 1, (void *)sec_buf)
+ != 1) {
printf (" ** reiserfs_devread() read error - last part\n");
return 0;
}
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index 50355e988e..a992a00c8f 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -6,21 +6,10 @@
* (C) Copyright 2008-2010
* Stefan Roese, DENX Software Engineering, sr@denx.de.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published by
- * the Free Software Foundation.
- *
- * 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., 51
- * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
* Authors: Artem Bityutskiy (Битюцкий Артём)
* Adrian Hunter
+ *
+ * SPDX-License-Identifier: GPL-2.0
*/
#include <common.h>
diff --git a/fs/zfs/dev.c b/fs/zfs/dev.c
index 3a1fa5685a..67d12652b0 100644
--- a/fs/zfs/dev.c
+++ b/fs/zfs/dev.c
@@ -55,9 +55,10 @@ int zfs_devread(int sector, int byte_offset, int byte_len, char *buf)
if (byte_offset != 0) {
/* read first part which isn't aligned with start of sector */
- if (zfs_block_dev_desc->block_read(zfs_block_dev_desc->dev,
- part_info->start + sector, 1,
- (unsigned long *)sec_buf) != 1) {
+ if (zfs_block_dev_desc->block_read(zfs_block_dev_desc,
+ part_info->start + sector, 1,
+ (void *)sec_buf)
+ != 1) {
printf(" ** zfs_devread() read error **\n");
return 1;
}
@@ -78,16 +79,18 @@ int zfs_devread(int sector, int byte_offset, int byte_len, char *buf)
u8 p[SECTOR_SIZE];
block_len = SECTOR_SIZE;
- zfs_block_dev_desc->block_read(zfs_block_dev_desc->dev,
- part_info->start + sector,
- 1, (unsigned long *)p);
+ zfs_block_dev_desc->block_read(zfs_block_dev_desc,
+ part_info->start + sector,
+ 1, (void *)p);
memcpy(buf, p, byte_len);
return 0;
}
- if (zfs_block_dev_desc->block_read(zfs_block_dev_desc->dev,
- part_info->start + sector, block_len / SECTOR_SIZE,
- (unsigned long *) buf) != block_len / SECTOR_SIZE) {
+ if (zfs_block_dev_desc->block_read(zfs_block_dev_desc,
+ part_info->start + sector,
+ block_len / SECTOR_SIZE,
+ (void *)buf)
+ != block_len / SECTOR_SIZE) {
printf(" ** zfs_devread() read error - block\n");
return 1;
}
@@ -99,10 +102,9 @@ int zfs_devread(int sector, int byte_offset, int byte_len, char *buf)
if (byte_len != 0) {
/* read rest of data which are not in whole sector */
- if (zfs_block_dev_desc->
- block_read(zfs_block_dev_desc->dev,
- part_info->start + sector, 1,
- (unsigned long *) sec_buf) != 1) {
+ if (zfs_block_dev_desc->block_read(zfs_block_dev_desc,
+ part_info->start + sector,
+ 1, (void *)sec_buf) != 1) {
printf(" ** zfs_devread() read error - last part\n");
return 1;
}