Skip to content

Commit

Permalink
7641 loader: disk/part api needs to use uint64_t offsets
Browse files Browse the repository at this point in the history
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Juraj Lutter <juraj@lutter.sk>
Approved by: Dan McDonald <danmcd@omniti.com>
  • Loading branch information
tsoome authored and Dan McDonald committed Dec 12, 2016
1 parent b7f0713 commit 79bea51
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 17 deletions.
8 changes: 4 additions & 4 deletions usr/src/boot/sys/boot/common/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ display_size(uint64_t size, u_int sectorsize)
}

static int
ptblread(void *d, void *buf, size_t blocks, off_t offset)
ptblread(void *d, void *buf, size_t blocks, uint64_t offset)
{
struct disk_devdesc *dev;
struct open_disk *od;
Expand Down Expand Up @@ -237,7 +237,7 @@ disk_print(struct disk_devdesc *dev, char *prefix, int verbose)
}

int
disk_read(struct disk_devdesc *dev, void *buf, off_t offset, u_int blocks)
disk_read(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
{
struct open_disk *od;
int ret;
Expand All @@ -250,7 +250,7 @@ disk_read(struct disk_devdesc *dev, void *buf, off_t offset, u_int blocks)
}

int
disk_write(struct disk_devdesc *dev, void *buf, off_t offset, u_int blocks)
disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset, u_int blocks)
{
struct open_disk *od;
int ret;
Expand All @@ -273,7 +273,7 @@ disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *buf)
}

int
disk_open(struct disk_devdesc *dev, off_t mediasize, u_int sectorsize,
disk_open(struct disk_devdesc *dev, uint64_t mediasize, u_int sectorsize,
u_int flags)
{
struct open_disk *od;
Expand Down
8 changes: 4 additions & 4 deletions usr/src/boot/sys/boot/common/disk.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ struct disk_devdesc
void *d_opendata;
int d_slice;
int d_partition;
off_t d_offset;
uint64_t d_offset;
};

enum disk_ioctl {
Expand All @@ -102,15 +102,15 @@ enum disk_ioctl {
/*
* Parse disk metadata and initialise dev->d_offset.
*/
extern int disk_open(struct disk_devdesc *dev, off_t mediasize,
extern int disk_open(struct disk_devdesc *dev, uint64_t mediasize,
u_int sectorsize, u_int flags);
#define DISK_F_NOCACHE 0x0001 /* Do not use metadata caching */
extern int disk_close(struct disk_devdesc *dev);
extern void disk_cleanup(const struct devsw *d_dev);
extern int disk_ioctl(struct disk_devdesc *dev, u_long cmd, void *buf);
extern int disk_read(struct disk_devdesc *dev, void *buf, off_t offset,
extern int disk_read(struct disk_devdesc *dev, void *buf, uint64_t offset,
u_int blocks);
extern int disk_write(struct disk_devdesc *dev, void *buf, off_t offset,
extern int disk_write(struct disk_devdesc *dev, void *buf, uint64_t offset,
u_int blocks);

/*
Expand Down
3 changes: 1 addition & 2 deletions usr/src/boot/sys/boot/common/part.c
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,7 @@ ptable_dklabelread(struct ptable *table, void *dev, diskread_t dread)
}

struct ptable*
ptable_open(void *dev, off_t sectors, uint16_t sectorsize,
diskread_t *dread)
ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize, diskread_t *dread)
{
struct dos_partition *dp;
struct ptable *table;
Expand Down
4 changes: 2 additions & 2 deletions usr/src/boot/sys/boot/common/part.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ struct ptable_entry {
};

/* The offset and size are in sectors */
typedef int (diskread_t)(void *arg, void *buf, size_t blocks, off_t offset);
typedef int (diskread_t)(void *arg, void *buf, size_t blocks, uint64_t offset);
typedef int (ptable_iterate_t)(void *arg, const char *partname,
const struct ptable_entry *part);

struct ptable *ptable_open(void *dev, off_t sectors, uint16_t sectorsize,
struct ptable *ptable_open(void *dev, uint64_t sectors, uint16_t sectorsize,
diskread_t *dread);
void ptable_close(struct ptable *table);
enum ptable_type ptable_gettype(const struct ptable *table);
Expand Down
4 changes: 2 additions & 2 deletions usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct probe_args {
* strategy() directly.
*/
static int
parttblread(void *arg, void *buf, size_t blocks, off_t offset)
parttblread(void *arg, void *buf, size_t blocks, uint64_t offset)
{
struct probe_args *ppa = arg;
size_t size = ppa->secsz * blocks;
Expand Down Expand Up @@ -208,7 +208,7 @@ probe_disk(char *devname)
{
struct ptable *table;
struct probe_args pa;
off_t mediasz;
uint64_t mediasz;
int ret;

pa.offset = 0;
Expand Down
2 changes: 1 addition & 1 deletion usr/src/boot/sys/boot/i386/libi386/biosdisk.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ bd_ioctl(struct open_file *f, u_long cmd, void *data)
*(u_int *)data = BD(dev).bd_sectorsize;
break;
case DIOCGMEDIASIZE:
*(off_t *)data = BD(dev).bd_sectors * BD(dev).bd_sectorsize;
*(uint64_t *)data = BD(dev).bd_sectors * BD(dev).bd_sectorsize;
break;
default:
return (ENOTTY);
Expand Down
2 changes: 1 addition & 1 deletion usr/src/boot/sys/boot/zfs/zfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ struct zfs_probe_args {
};

static int
zfs_diskread(void *arg, void *buf, size_t blocks, off_t offset)
zfs_diskread(void *arg, void *buf, size_t blocks, uint64_t offset)
{
struct zfs_probe_args *ppa;

Expand Down
2 changes: 1 addition & 1 deletion usr/src/boot/sys/sys/disk.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void disk_err(struct bio *bp, const char *what, int blkdone, int nl);
* Usually this is a power of 2 but it might not be (i.e. CDROM audio).
*/

#define DIOCGMEDIASIZE _IOR('d', 129, off_t) /* Get media size in bytes */
#define DIOCGMEDIASIZE _IOR('d', 129, uint64_t) /* Get media size in bytes */
/*
* Get the size of the entire device in bytes. This should be a
* multiple of the sector size.
Expand Down

0 comments on commit 79bea51

Please sign in to comment.