Fix possible 32 bit issues. In practice hard to reach but better be safe than
sorry.
This commit is contained in:
parent
eef8c2bab2
commit
857cc1af09
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: newfs_udf.c,v 1.17 2013/08/06 13:15:30 reinoud Exp $ */
|
||||
/* $NetBSD: newfs_udf.c,v 1.18 2013/08/09 15:11:08 reinoud Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
|
||||
|
@ -75,7 +75,7 @@ static void usage(void) __attribute__((__noreturn__));
|
|||
|
||||
/* queue for temporary storage of sectors to be written out */
|
||||
struct wrsect {
|
||||
uint32_t sectornr;
|
||||
uint64_t sectornr;
|
||||
uint8_t *sector_data;
|
||||
TAILQ_ENTRY(wrsect) next;
|
||||
};
|
||||
|
@ -108,7 +108,7 @@ float meta_fract = (float) UDF_META_PERC / 100.0;
|
|||
*/
|
||||
|
||||
int
|
||||
udf_write_sector(void *sector, uint32_t location)
|
||||
udf_write_sector(void *sector, uint64_t location)
|
||||
{
|
||||
struct wrsect *pos, *seekpos;
|
||||
|
||||
|
@ -155,8 +155,8 @@ writeout_write_queue(void)
|
|||
{
|
||||
struct wrsect *pos;
|
||||
uint64_t offset;
|
||||
uint32_t line_len, line_offset;
|
||||
uint32_t line_start, new_line_start, relpos;
|
||||
uint64_t line_start, new_line_start;
|
||||
uint32_t line_len, line_offset, relpos;
|
||||
uint32_t blockingnr;
|
||||
uint8_t *linebuf, *adr;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ struct udf_create_context context;
|
|||
struct udf_disclayout layout;
|
||||
|
||||
/* prototypes */
|
||||
int udf_write_sector(void *sector, uint32_t location);
|
||||
int udf_write_sector(void *sector, uint64_t location);
|
||||
int udf_update_trackinfo(struct mmc_discinfo *di, struct mmc_trackinfo *ti);
|
||||
|
||||
/* tmp */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: udf_create.h,v 1.6 2013/08/06 12:49:13 reinoud Exp $ */
|
||||
/* $NetBSD: udf_create.h,v 1.7 2013/08/09 15:11:08 reinoud Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2008 Reinoud Zandijk
|
||||
|
@ -83,10 +83,10 @@
|
|||
|
||||
/* handys */
|
||||
#define UDF_ROUNDUP(val, gran) \
|
||||
((gran) * (((uint64_t)(val) + (gran)-1) / (gran)))
|
||||
((uint64_t) (gran) * (((uint64_t)(val) + (gran)-1) / (gran)))
|
||||
|
||||
#define UDF_ROUNDDOWN(val, gran) \
|
||||
((gran) * (((uint64_t)(val)) / (gran)))
|
||||
((uint64_t) (gran) * (((uint64_t)(val)) / (gran)))
|
||||
|
||||
|
||||
/* disc offsets for various structures and their sizes */
|
||||
|
@ -182,7 +182,7 @@ struct udf_create_context {
|
|||
/* logical to physical translations */
|
||||
int vtop[UDF_PMAPS+1]; /* vpartnr trans */
|
||||
int vtop_tp[UDF_PMAPS+1]; /* type of trans */
|
||||
int vtop_offset[UDF_PMAPS+1]; /* offset in lb */
|
||||
uint64_t vtop_offset[UDF_PMAPS+1]; /* offset in lb */
|
||||
|
||||
/* sparable */
|
||||
struct udf_sparing_table*sparing_table; /* replacements */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: udf.c,v 1.11 2013/08/09 11:29:44 reinoud Exp $ */
|
||||
/* $NetBSD: udf.c,v 1.12 2013/08/09 15:11:08 reinoud Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006, 2008, 2013 Reinoud Zandijk
|
||||
|
@ -30,7 +30,7 @@
|
|||
#endif
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: udf.c,v 1.11 2013/08/09 11:29:44 reinoud Exp $");
|
||||
__RCSID("$NetBSD: udf.c,v 1.12 2013/08/09 15:11:08 reinoud Exp $");
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -90,7 +90,7 @@ int req_enable, req_disable;
|
|||
/* --------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
udf_write_sector(void *sector, uint32_t location)
|
||||
udf_write_sector(void *sector, uint64_t location)
|
||||
{
|
||||
uint64_t wpos;
|
||||
ssize_t ret;
|
||||
|
@ -635,8 +635,8 @@ udf_append_file_mapping(union dscrptr *dscr, struct long_ad *piece)
|
|||
uint64_t inf_len, obj_size, logblks_rec;
|
||||
uint32_t l_ea, l_ad, size;
|
||||
uint32_t last_lb_num, piece_lb_num;
|
||||
uint32_t last_len, piece_len, last_flags;
|
||||
uint32_t rest_len, merge_len, last_end;
|
||||
uint64_t last_len, piece_len, last_flags;
|
||||
uint64_t rest_len, merge_len, last_end;
|
||||
uint16_t last_part_num, piece_part_num;
|
||||
uint16_t crclen, cur_alloc;
|
||||
uint8_t *data, *pos;
|
||||
|
@ -710,7 +710,7 @@ udf_append_file_mapping(union dscrptr *dscr, struct long_ad *piece)
|
|||
/* try merging */
|
||||
rest_len = max_len - last_len;
|
||||
|
||||
merge_len = MIN(udf_rw32(piece->len), rest_len);
|
||||
merge_len = MIN(piece_len, rest_len);
|
||||
last_end = last_lb_num + (last_len / sector_size);
|
||||
|
||||
if ((piece_lb_num == last_end) && (last_part_num == piece_part_num)) {
|
||||
|
@ -773,7 +773,7 @@ udf_append_file_contents(union dscrptr *dscr, struct long_ad *data_icb,
|
|||
{
|
||||
struct long_ad icb;
|
||||
uint32_t location;
|
||||
uint32_t phys;
|
||||
uint64_t phys;
|
||||
uint16_t vpart;
|
||||
uint8_t *bpos;
|
||||
int cnt, sects;
|
||||
|
|
Loading…
Reference in New Issue