Commit e7adc681 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] size_t portability fixes

A lot of places assumed that size_t == unsigned; on 64bit boxen that is not
true.
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent fe29f768
......@@ -389,7 +389,7 @@ static ssize_t mwave_read(struct file *file, char __user *buf, size_t count,
loff_t * ppos)
{
PRINTK_5(TRACE_MWAVE,
"mwavedd::mwave_read entry file %p, buf %p, count %x ppos %p\n",
"mwavedd::mwave_read entry file %p, buf %p, count %zx ppos %p\n",
file, buf, count, ppos);
return -EINVAL;
......@@ -401,7 +401,7 @@ static ssize_t mwave_write(struct file *file, const char __user *buf,
{
PRINTK_5(TRACE_MWAVE,
"mwavedd::mwave_write entry file %p, buf %p,"
" count %x ppos %p\n",
" count %zx ppos %p\n",
file, buf, count, ppos);
return -EINVAL;
......
......@@ -1681,7 +1681,7 @@ static int cfi_amdstd_lock_varsize(struct mtd_info *mtd,
int ret;
DEBUG(MTD_DEBUG_LEVEL3,
"%s: lock status before, ofs=0x%08llx, len=0x%08X\n",
"%s: lock status before, ofs=0x%08llx, len=0x%08zX\n",
__func__, ofs, len);
debug_dump_locks(mtd, do_printlockstatus_oneblock, ofs, len, 0);
......@@ -1705,7 +1705,7 @@ static int cfi_amdstd_unlock_varsize(struct mtd_info *mtd,
int ret;
DEBUG(MTD_DEBUG_LEVEL3,
"%s: lock status before, ofs=0x%08llx, len=0x%08X\n",
"%s: lock status before, ofs=0x%08llx, len=0x%08zX\n",
__func__, ofs, len);
debug_dump_locks(mtd, do_printlockstatus_oneblock, ofs, len, 0);
......
......@@ -246,7 +246,7 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
pagenr = to >> PAGE_SHIFT;
offset = to & ~PAGE_MASK;
DEBUG(2, "blkmtd: write_pages: buf = %p to = %ld len = %d pagenr = %d offset = %d\n",
DEBUG(2, "blkmtd: write_pages: buf = %p to = %ld len = %zd pagenr = %d offset = %d\n",
buf, (long)to, len, pagenr, offset);
/* see if we have to do a partial write at the start */
......@@ -270,21 +270,21 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
down(&dev->wrbuf_mutex);
DEBUG(3, "blkmtd: write: start_len = %d len = %d end_len = %d pagecnt = %d\n",
DEBUG(3, "blkmtd: write: start_len = %zd len = %zd end_len = %zd pagecnt = %d\n",
start_len, len, end_len, pagecnt);
if(start_len) {
/* do partial start region */
struct page *page;
DEBUG(3, "blkmtd: write: doing partial start, page = %d len = %d offset = %d\n",
DEBUG(3, "blkmtd: write: doing partial start, page = %d len = %zd offset = %d\n",
pagenr, start_len, offset);
BUG_ON(!buf);
page = read_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr, (filler_t *)blkmtd_readpage, dev);
lock_page(page);
if(PageDirty(page)) {
err("to = %lld start_len = %d len = %d end_len = %d pagenr = %d\n",
err("to = %lld start_len = %zd len = %zd end_len = %zd pagenr = %d\n",
to, start_len, len, end_len, pagenr);
BUG();
}
......@@ -346,13 +346,13 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
if(end_len) {
/* do the third region */
struct page *page;
DEBUG(3, "blkmtd: write: doing partial end, page = %d len = %d\n",
DEBUG(3, "blkmtd: write: doing partial end, page = %d len = %zd\n",
pagenr, end_len);
BUG_ON(!buf);
page = read_cache_page(dev->blkdev->bd_inode->i_mapping, pagenr, (filler_t *)blkmtd_readpage, dev);
lock_page(page);
if(PageDirty(page)) {
err("to = %lld start_len = %d len = %d end_len = %d pagenr = %d\n",
err("to = %lld start_len = %zd len = %zd end_len = %zd pagenr = %d\n",
to, start_len, len, end_len, pagenr);
BUG();
}
......@@ -375,7 +375,7 @@ static int write_pages(struct blkmtd_dev *dev, const u_char *buf, loff_t to,
if(bio)
blkmtd_write_out(bio);
DEBUG(2, "blkmtd: write: end, retlen = %d, err = %d\n", *retlen, err);
DEBUG(2, "blkmtd: write: end, retlen = %zd, err = %d\n", *retlen, err);
up(&dev->wrbuf_mutex);
if(retlen)
......@@ -393,14 +393,14 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
size_t from;
u_long len;
int err = -EIO;
int retlen;
size_t retlen;
instr->state = MTD_ERASING;
from = instr->addr;
len = instr->len;
/* check erase region has valid start and length */
DEBUG(2, "blkmtd: erase: dev = `%s' from = 0x%x len = 0x%lx\n",
DEBUG(2, "blkmtd: erase: dev = `%s' from = 0x%zx len = 0x%lx\n",
mtd->name+9, from, len);
while(numregions) {
DEBUG(3, "blkmtd: checking erase region = 0x%08X size = 0x%X num = 0x%x\n",
......@@ -417,14 +417,14 @@ static int blkmtd_erase(struct mtd_info *mtd, struct erase_info *instr)
if(!numregions) {
/* Not a valid erase block */
err("erase: invalid erase request 0x%lX @ 0x%08X", len, from);
err("erase: invalid erase request 0x%lX @ 0x%08zX", len, from);
instr->state = MTD_ERASE_FAILED;
err = -EIO;
}
if(instr->state != MTD_ERASE_FAILED) {
/* do the erase */
DEBUG(3, "Doing erase from = %d len = %ld\n", from, len);
DEBUG(3, "Doing erase from = %zd len = %ld\n", from, len);
err = write_pages(dev, NULL, from, len, &retlen);
if(err || retlen != len) {
err("erase failed err = %d", err);
......@@ -453,8 +453,8 @@ static int blkmtd_read(struct mtd_info *mtd, loff_t from, size_t len,
int pagenr, pages;
size_t thislen = 0;
DEBUG(2, "blkmtd: read: dev = `%s' from = %ld len = %d buf = %p\n",
mtd->name+9, (long int)from, len, buf);
DEBUG(2, "blkmtd: read: dev = `%s' from = %lld len = %zd buf = %p\n",
mtd->name+9, from, len, buf);
if(from > mtd->size)
return -EINVAL;
......@@ -496,7 +496,7 @@ static int blkmtd_read(struct mtd_info *mtd, loff_t from, size_t len,
readerr:
if(retlen)
*retlen = thislen;
DEBUG(2, "blkmtd: end read: retlen = %d, err = %d\n", thislen, err);
DEBUG(2, "blkmtd: end read: retlen = %zd, err = %d\n", thislen, err);
return err;
}
......@@ -511,8 +511,8 @@ static int blkmtd_write(struct mtd_info *mtd, loff_t to, size_t len,
if(!len)
return 0;
DEBUG(2, "blkmtd: write: dev = `%s' to = %ld len = %d buf = %p\n",
mtd->name+9, (long int)to, len, buf);
DEBUG(2, "blkmtd: write: dev = `%s' to = %lld len = %zd buf = %p\n",
mtd->name+9, to, len, buf);
if(to >= mtd->size) {
return -ENOSPC;
......@@ -565,7 +565,7 @@ static struct mtd_erase_region_info *calc_erase_regions(
{
struct mtd_erase_region_info *info = NULL;
DEBUG(2, "calc_erase_regions, es = %d size = %d regions = %d\n",
DEBUG(2, "calc_erase_regions, es = %zd size = %zd regions = %d\n",
erase_size, total_size, *regions);
/* Make any user specified erasesize be a power of 2
and at least PAGE_SIZE */
......@@ -613,7 +613,7 @@ static struct mtd_erase_region_info *calc_erase_regions(
break;
}
} while(!(*regions));
DEBUG(2, "calc_erase_regions done, es = %d size = %d regions = %d\n",
DEBUG(2, "calc_erase_regions done, es = %zd size = %zd regions = %d\n",
erase_size, total_size, *regions);
return info;
}
......
......@@ -167,7 +167,8 @@ static int scan_header(partition_t *part)
{
erase_unit_header_t header;
loff_t offset, max_offset;
int ret;
size_t ret;
int err;
part->header.FormattedSize = 0;
max_offset = (0x100000<part->mbd.mtd->size)?0x100000:part->mbd.mtd->size;
/* Search first megabyte for a valid FTL header */
......@@ -175,11 +176,11 @@ static int scan_header(partition_t *part)
(offset + sizeof(header)) < max_offset;
offset += part->mbd.mtd->erasesize ? : 0x2000) {
ret = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &ret,
err = part->mbd.mtd->read(part->mbd.mtd, offset, sizeof(header), &ret,
(unsigned char *)&header);
if (ret)
return ret;
if (err)
return err;
if (strcmp(header.DataOrgTuple+3, "FTL100") == 0) break;
}
......@@ -958,7 +959,7 @@ static int ftl_write(partition_t *part, caddr_t buffer,
if (ret) {
printk(KERN_NOTICE "ftl_cs: block write failed!\n");
printk(KERN_NOTICE "ftl_cs: log_addr = 0x%x, virt_addr"
" = 0x%x, Offset = 0x%x\n", log_addr, virt_addr,
" = 0x%x, Offset = 0x%zx\n", log_addr, virt_addr,
offset);
return -EIO;
}
......
......@@ -58,7 +58,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
u8 buf[SECTORSIZE];
struct INFTLMediaHeader *mh = &inftl->MediaHdr;
struct INFTLPartition *ip;
int retlen;
size_t retlen;
DEBUG(MTD_DEBUG_LEVEL3, "INFTL: find_boot_record(inftl=0x%x)\n",
(int)inftl);
......@@ -288,7 +288,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
inftl->PUtable = kmalloc(inftl->nb_blocks * sizeof(u16), GFP_KERNEL);
if (!inftl->PUtable) {
printk(KERN_WARNING "INFTL: allocation of PUtable "
"failed (%d bytes)\n",
"failed (%zd bytes)\n",
inftl->nb_blocks * sizeof(u16));
return -ENOMEM;
}
......@@ -297,7 +297,7 @@ static int find_boot_record(struct INFTLrecord *inftl)
if (!inftl->VUtable) {
kfree(inftl->PUtable);
printk(KERN_WARNING "INFTL: allocation of VUtable "
"failed (%d bytes)\n",
"failed (%zd bytes)\n",
inftl->nb_blocks * sizeof(u16));
return -ENOMEM;
}
......@@ -348,8 +348,9 @@ static int memcmpb(void *a, int c, int n)
static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
int len, int check_oob)
{
int i, retlen;
u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
size_t retlen;
int i;
DEBUG(MTD_DEBUG_LEVEL3, "INFTL: check_free_sectors(inftl=0x%x,"
"address=0x%x,len=%d,check_oob=%d)\n", (int)inftl,
......@@ -382,7 +383,7 @@ static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address,
*/
int INFTL_formatblock(struct INFTLrecord *inftl, int block)
{
int retlen;
size_t retlen;
struct inftl_unittail uci;
struct erase_info *instr = &inftl->instr;
int physblock;
......@@ -551,7 +552,8 @@ int INFTL_mount(struct INFTLrecord *s)
int chain_length, do_format_chain;
struct inftl_unithead1 h0;
struct inftl_unittail h1;
int i, retlen;
size_t retlen;
int i;
u8 *ANACtable, ANAC;
DEBUG(MTD_DEBUG_LEVEL3, "INFTL: INFTL_mount(inftl=0x%x)\n", (int)s);
......
......@@ -652,7 +652,8 @@ static int __init find_media_headers(struct mtd_info *mtd, u_char *buf,
struct nand_chip *this = mtd->priv;
struct doc_priv *doc = (void *)this->priv;
int offs, end = (MAX_MEDIAHEADER_SCAN << this->phys_erase_shift);
int ret, retlen;
int ret;
size_t retlen;
end = min(end, (int)mtd->size); // paranoia
for (offs = 0; offs < end; offs += mtd->erasesize) {
......
......@@ -1150,7 +1150,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf,
DECLARE_WAITQUEUE(wait, current);
int bytes_to_read;
Trace(TRACE_READ, "video_read(0x%p, %p, %d) called.\n", vdev, buf, count);
Trace(TRACE_READ, "video_read(0x%p, %p, %zd) called.\n", vdev, buf, count);
if (vdev == NULL)
return -EFAULT;
pdev = vdev->priv;
......
......@@ -49,7 +49,7 @@ struct w1_master * w1_alloc_dev(u32 id, int slave_count,
dev = kmalloc(sizeof(struct w1_master) + sizeof(struct w1_bus_master), GFP_KERNEL);
if (!dev) {
printk(KERN_ERR
"Failed to allocate %d bytes for new w1 device.\n",
"Failed to allocate %zd bytes for new w1 device.\n",
sizeof(struct w1_master));
return NULL;
}
......
......@@ -402,7 +402,7 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
goto bad2;
}
if (retlen != sizeof(marker)) {
printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %d, got %zd\n",
printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n",
jeb->offset, sizeof(marker), retlen);
goto bad2;
}
......
......@@ -824,7 +824,7 @@ static int jffs2_garbage_collect_deletion_dirent(struct jffs2_sb_info *c, struct
continue;
}
if (retlen != rawlen) {
printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%zd not %zd) reading header from obsolete node at %08x\n",
printk(KERN_WARNING "jffs2_g_c_deletion_dirent(): Short read (%zd not %u) reading header from obsolete node at %08x\n",
retlen, rawlen, ref_offset(raw));
continue;
}
......
......@@ -195,7 +195,7 @@ static int ntfs_decompress(struct page *dest_pages[], int *dest_index,
ntfs_debug("Entering, cb_size = 0x%x.", cb_size);
do_next_sb:
ntfs_debug("Beginning sub-block at offset = 0x%x in the cb.",
ntfs_debug("Beginning sub-block at offset = 0x%zx in the cb.",
cb - cb_start);
/*
* Have we reached the end of the compression block or the end of the
......
......@@ -1222,7 +1222,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
* or signals an error (both covered by the rc test).
*/
for (;; ie = (INDEX_ENTRY*)((u8*)ie + le16_to_cpu(ie->length))) {
ntfs_debug("In index root, offset 0x%x.", (u8*)ie - (u8*)ir);
ntfs_debug("In index root, offset 0x%zx.", (u8*)ie - (u8*)ir);
/* Bounds checks. */
if (unlikely((u8*)ie < (u8*)ir || (u8*)ie +
sizeof(INDEX_ENTRY_HEADER) > index_end ||
......
......@@ -1190,7 +1190,7 @@ static BOOL load_and_init_upcase(ntfs_volume *vol)
goto read_partial_upcase_page;
}
vol->upcase_len = ino->i_size >> UCHAR_T_SIZE_BITS;
ntfs_debug("Read %llu bytes from $UpCase (expected %u bytes).",
ntfs_debug("Read %llu bytes from $UpCase (expected %zu bytes).",
ino->i_size, 64 * 1024 * sizeof(ntfschar));
iput(ino);
down(&ntfs_lock);
......
......@@ -1266,7 +1266,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
unsigned char *asmptr;
int err;
IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
/* Note : socket.c set MSG_EOR on SEQPACKET sockets */
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))
......@@ -1295,7 +1295,7 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock,
/* Check that we don't send out to big frames */
if (len > self->max_data_size) {
IRDA_DEBUG(2, "%s(), Chopping frame from %d to %d bytes!\n",
IRDA_DEBUG(2, "%s(), Chopping frame from %zd to %d bytes!\n",
__FUNCTION__, len, self->max_data_size);
len = self->max_data_size;
}
......@@ -1355,7 +1355,7 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock,
copied = skb->len;
if (copied > size) {
IRDA_DEBUG(2, "%s(), Received truncated frame (%d < %d)!\n",
IRDA_DEBUG(2, "%s(), Received truncated frame (%zd < %zd)!\n",
__FUNCTION__, copied, size);
copied = size;
msg->msg_flags |= MSG_TRUNC;
......@@ -1519,7 +1519,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
unsigned char *asmptr;
int err;
IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return -EINVAL;
......@@ -1541,7 +1541,7 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock,
*/
if (len > self->max_data_size) {
IRDA_DEBUG(0, "%s(), Warning to much data! "
"Chopping frame from %d to %d bytes!\n",
"Chopping frame from %zd to %d bytes!\n",
__FUNCTION__, len, self->max_data_size);
len = self->max_data_size;
}
......@@ -1591,7 +1591,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
unsigned char *asmptr;
int err;
IRDA_DEBUG(4, "%s(), len=%d\n", __FUNCTION__, len);
IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len);
if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT))
return -EINVAL;
......@@ -1637,7 +1637,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock,
*/
if (len > self->max_data_size) {
IRDA_DEBUG(0, "%s(), Warning to much data! "
"Chopping frame from %d to %d bytes!\n",
"Chopping frame from %zd to %d bytes!\n",
__FUNCTION__, len, self->max_data_size);
len = self->max_data_size;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment