diff options
-rw-r--r-- | disk-utils/fdisk.c | 6 | ||||
-rw-r--r-- | disk-utils/sfdisk.c | 6 | ||||
-rw-r--r-- | libfdisk/src/dos.c | 4 | ||||
-rw-r--r-- | libfdisk/src/fdiskP.h | 3 | ||||
-rw-r--r-- | libfdisk/src/gpt.c | 4 | ||||
-rw-r--r-- | libfdisk/src/label.c | 2 | ||||
-rw-r--r-- | libfdisk/src/libfdisk.h.in | 5 |
7 files changed, 17 insertions, 13 deletions
diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 6f20a310f..8807940ec 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -568,7 +568,7 @@ static void dump_buffer(off_t base, unsigned char *buf, size_t sz, int all) } static void dump_blkdev(struct fdisk_context *cxt, const char *name, - off_t offset, size_t size, int all) + uint64_t offset, size_t size, int all) { int fd = fdisk_get_devfd(cxt); @@ -577,7 +577,7 @@ static void dump_blkdev(struct fdisk_context *cxt, const char *name, assert(fd >= 0); - if (lseek(fd, offset, SEEK_SET) == (off_t) -1) + if (lseek(fd, (off_t) offset, SEEK_SET) == (off_t) -1) fdisk_warn(cxt, _("cannot seek")); else { unsigned char *buf = xmalloc(size); @@ -604,7 +604,7 @@ void dump_disklabel(struct fdisk_context *cxt) int all = !isatty(STDOUT_FILENO); int i = 0; const char *name = NULL; - off_t offset = 0; + uint64_t offset = 0; size_t size = 0; assert(cxt); diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c index eed9180ab..f9f733b48 100644 --- a/disk-utils/sfdisk.c +++ b/disk-utils/sfdisk.c @@ -225,7 +225,7 @@ static void backup_sectors(struct sfdisk *sf, const char *tpl, const char *name, const char *devname, - off_t offset, size_t size) + uint64_t offset, size_t size) { char *fname; int fd, devfd; @@ -239,7 +239,7 @@ static void backup_sectors(struct sfdisk *sf, if (fd < 0) goto fail; - if (lseek(devfd, offset, SEEK_SET) == (off_t) -1) { + if (lseek(devfd, (off_t) offset, SEEK_SET) == (off_t) -1) { fdisk_warn(sf->cxt, _("cannot seek %s"), devname); goto fail; } else { @@ -269,7 +269,7 @@ static void backup_partition_table(struct sfdisk *sf, const char *devname) { const char *name; char *tpl; - off_t offset = 0; + uint64_t offset = 0; size_t size = 0; int i = 0; diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index 2a067076e..2cb11cb4a 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -1738,7 +1738,7 @@ done: } static int dos_locate_disklabel(struct fdisk_context *cxt, int n, - const char **name, off_t *offset, size_t *size) + const char **name, uint64_t *offset, size_t *size) { assert(cxt); @@ -1760,7 +1760,7 @@ static int dos_locate_disklabel(struct fdisk_context *cxt, int n, assert(pe->private_sectorbuffer); *name = "EBR"; - *offset = pe->offset * cxt->sector_size; + *offset = (uint64_t) pe->offset * cxt->sector_size; *size = 512; } else return 1; diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h index 59ab0c339..dc561f389 100644 --- a/libfdisk/src/fdiskP.h +++ b/libfdisk/src/fdiskP.h @@ -185,7 +185,8 @@ struct fdisk_label_operations { /* list disklabel details */ int (*list)(struct fdisk_context *cxt); /* returns offset and size of the 'n' part of the PT */ - int (*locate)(struct fdisk_context *cxt, int n, const char **name, off_t *offset, size_t *size); + int (*locate)(struct fdisk_context *cxt, int n, const char **name, + uint64_t *offset, size_t *size); /* reorder partitions */ int (*reorder)(struct fdisk_context *cxt); diff --git a/libfdisk/src/gpt.c b/libfdisk/src/gpt.c index 2f1fe2eaa..e7b58f398 100644 --- a/libfdisk/src/gpt.c +++ b/libfdisk/src/gpt.c @@ -927,7 +927,7 @@ invalid: static int gpt_locate_disklabel(struct fdisk_context *cxt, int n, - const char **name, off_t *offset, size_t *size) + const char **name, uint64_t *offset, size_t *size) { struct fdisk_gpt_label *gpt; @@ -945,7 +945,7 @@ static int gpt_locate_disklabel(struct fdisk_context *cxt, int n, break; case 1: *name = _("GPT Header"); - *offset = GPT_PRIMARY_PARTITION_TABLE_LBA * cxt->sector_size; + *offset = (uint64_t) GPT_PRIMARY_PARTITION_TABLE_LBA * cxt->sector_size; *size = sizeof(struct gpt_header); break; case 2: diff --git a/libfdisk/src/label.c b/libfdisk/src/label.c index beff2e827..717a8cd80 100644 --- a/libfdisk/src/label.c +++ b/libfdisk/src/label.c @@ -375,7 +375,7 @@ int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name) * Returns: 0 on succes, <0 on error, 1 no more items. */ int fdisk_locate_disklabel(struct fdisk_context *cxt, int n, const char **name, - off_t *offset, size_t *size) + uint64_t *offset, size_t *size) { if (!cxt || !cxt->label) return -EINVAL; diff --git a/libfdisk/src/libfdisk.h.in b/libfdisk/src/libfdisk.h.in index d15d64f1c..f13c3db5d 100644 --- a/libfdisk/src/libfdisk.h.in +++ b/libfdisk/src/libfdisk.h.in @@ -282,7 +282,10 @@ extern int fdisk_write_disklabel(struct fdisk_context *cxt); extern int fdisk_verify_disklabel(struct fdisk_context *cxt); extern int fdisk_create_disklabel(struct fdisk_context *cxt, const char *name); extern int fdisk_list_disklabel(struct fdisk_context *cxt); -extern int fdisk_locate_disklabel(struct fdisk_context *cxt, int n, const char **name, off_t *offset, size_t *size); +extern int fdisk_locate_disklabel(struct fdisk_context *cxt, int n, + const char **name, + uint64_t *offset, + size_t *size); extern int fdisk_get_disklabel_id(struct fdisk_context *cxt, char **id); extern int fdisk_set_disklabel_id(struct fdisk_context *cxt); |