Page MenuHomeFreeBSD

D34923.id105073.diff
No OneTemporary

D34923.id105073.diff

Index: stand/common/dev_net.c
===================================================================
--- stand/common/dev_net.c
+++ stand/common/dev_net.c
@@ -77,7 +77,7 @@
static int netdev_opens;
static int net_init(void);
-static int net_open(struct open_file *, ...);
+static int net_open(struct open_file *, struct devdesc *);
static int net_close(struct open_file *);
static void net_cleanup(void);
static int net_strategy(void *, int, daddr_t, size_t, char *, size_t *);
@@ -115,21 +115,14 @@
/*
* Called by devopen after it sets f->f_dev to our devsw entry.
* This opens the low-level device and sets dev->d_opendata.
- * This is declared with variable arguments...
*/
static int
-net_open(struct open_file *f, ...)
+net_open(struct open_file *f, struct devdesc *dev)
{
struct iodesc *d;
- va_list args;
- struct devdesc *dev;
const char *devname; /* Device part of file name (or NULL). */
int error = 0;
- va_start(args, f);
- dev = va_arg(args, struct devdesc *);
- va_end(args);
-
devname = dev->d_dev->dv_name;
/* Before opening another interface, close the previous one first. */
if (netdev_sock >= 0 && strcmp(devname, netdev_name) != 0)
Index: stand/common/md.c
===================================================================
--- stand/common/md.c
+++ stand/common/md.c
@@ -61,7 +61,7 @@
/* devsw I/F */
static int md_init(void);
static int md_strategy(void *, int, daddr_t, size_t, char *, size_t *);
-static int md_open(struct open_file *, ...);
+static int md_open(struct open_file *, struct devdesc *);
static int md_close(struct open_file *);
static int md_print(int);
@@ -120,14 +120,8 @@
}
static int
-md_open(struct open_file *f, ...)
+md_open(struct open_file *f, struct devdesc *dev)
{
- va_list ap;
- struct devdesc *dev;
-
- va_start(ap, f);
- dev = va_arg(ap, struct devdesc *);
- va_end(ap);
if (dev->d_unit != 0)
return (ENXIO);
Index: stand/common/vdisk.c
===================================================================
--- stand/common/vdisk.c
+++ stand/common/vdisk.c
@@ -38,7 +38,7 @@
static int vdisk_init(void);
static int vdisk_strategy(void *, int, daddr_t, size_t, char *, size_t *);
-static int vdisk_open(struct open_file *, ...);
+static int vdisk_open(struct open_file *, struct devdesc *);
static int vdisk_close(struct open_file *);
static int vdisk_ioctl(struct open_file *, u_long, void *);
static int vdisk_print(int);
@@ -291,24 +291,18 @@
}
static int
-vdisk_open(struct open_file *f, ...)
+vdisk_open(struct open_file *f, struct devdesc *dev)
{
- va_list args;
- struct disk_devdesc *dev;
vdisk_info_t *vd;
int rc = 0;
- va_start(args, f);
- dev = va_arg(args, struct disk_devdesc *);
- va_end(args);
- if (dev == NULL)
- return (EINVAL);
- vd = vdisk_get_info((struct devdesc *)dev);
+ vd = vdisk_get_info(dev);
if (vd == NULL)
return (EINVAL);
- if (dev->dd.d_dev->dv_type == DEVT_DISK) {
- rc = disk_open(dev, vd->vdisk_size, vd->vdisk_sectorsz);
+ if (dev->d_dev->dv_type == DEVT_DISK) {
+ rc = disk_open((struct disk_devdesc *)dev, vd->vdisk_size,
+ vd->vdisk_sectorsz);
}
if (rc == 0)
vd->vdisk_open++;
Index: stand/efi/libefi/efihttp.c
===================================================================
--- stand/efi/libefi/efihttp.c
+++ stand/efi/libefi/efihttp.c
@@ -58,7 +58,7 @@
static int efihttp_dev_init(void);
static int efihttp_dev_strategy(void *devdata, int rw, daddr_t blk, size_t size,
char *buf, size_t *rsize);
-static int efihttp_dev_open(struct open_file *f, ...);
+static int efihttp_dev_open(struct open_file *f, struct devdesc *dev);
static int efihttp_dev_close(struct open_file *f);
static int efihttp_fs_open(const char *path, struct open_file *f);
@@ -228,7 +228,7 @@
}
static int
-efihttp_dev_open(struct open_file *f, ...)
+efihttp_dev_open(struct open_file *f, struct devdesc *dev)
{
EFI_HTTP_CONFIG_DATA config;
EFI_HTTPv4_ACCESS_POINT config_access;
@@ -238,7 +238,6 @@
IPv4_DEVICE_PATH *ipv4;
MAC_ADDR_DEVICE_PATH *mac;
URI_DEVICE_PATH *uri;
- struct devdesc *dev;
struct open_efihttp *oh;
char *c;
EFI_HANDLE handle;
@@ -292,7 +291,6 @@
if (!oh)
return (ENOMEM);
oh->dev_handle = handle;
- dev = (struct devdesc *)f->f_devdata;
dev->d_opendata = oh;
status = BS->OpenProtocol(handle, &httpsb_guid, (void **)&sb, IH, NULL,
@@ -583,7 +581,7 @@
* See https://bugzilla.tianocore.org/show_bug.cgi?id=1917
*/
efihttp_dev_close(f);
- efihttp_dev_open(f);
+ efihttp_dev_open(f, f->f_devdata);
path_slash = malloc(strlen(path) + 2);
if (path_slash == NULL)
return (ENOMEM);
@@ -734,7 +732,7 @@
* See https://bugzilla.tianocore.org/show_bug.cgi?id=1917
*/
efihttp_dev_close(f);
- efihttp_dev_open(f);
+ efihttp_dev_open(f, f->f_devdata);
err = efihttp_fs_open(path, f);
free(path);
if (err != 0)
Index: stand/efi/libefi/efipart.c
===================================================================
--- stand/efi/libefi/efipart.c
+++ stand/efi/libefi/efipart.c
@@ -53,7 +53,7 @@
static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *);
static int efipart_realstrategy(void *, int, daddr_t, size_t, char *, size_t *);
-static int efipart_open(struct open_file *, ...);
+static int efipart_open(struct open_file *, struct devdesc *);
static int efipart_close(struct open_file *);
static int efipart_ioctl(struct open_file *, u_long, void *);
@@ -880,21 +880,13 @@
}
static int
-efipart_open(struct open_file *f, ...)
+efipart_open(struct open_file *f, struct devdesc *dev)
{
- va_list args;
- struct disk_devdesc *dev;
pdinfo_t *pd;
EFI_BLOCK_IO *blkio;
EFI_STATUS status;
- va_start(args, f);
- dev = va_arg(args, struct disk_devdesc *);
- va_end(args);
- if (dev == NULL)
- return (EINVAL);
-
- pd = efiblk_get_pdinfo((struct devdesc *)dev);
+ pd = efiblk_get_pdinfo(dev);
if (pd == NULL)
return (EIO);
@@ -913,10 +905,10 @@
if (pd->pd_bcache == NULL)
pd->pd_bcache = bcache_allocate();
- if (dev->dd.d_dev->dv_type == DEVT_DISK) {
+ if (dev->d_dev->dv_type == DEVT_DISK) {
int rc;
- rc = disk_open(dev,
+ rc = disk_open((struct disk_devdesc *)dev,
blkio->Media->BlockSize * (blkio->Media->LastBlock + 1),
blkio->Media->BlockSize);
if (rc != 0) {
Index: stand/i386/libfirewire/firewire.c
===================================================================
--- stand/i386/libfirewire/firewire.c
+++ stand/i386/libfirewire/firewire.c
@@ -68,7 +68,7 @@
static int fw_init(void);
static int fw_strategy(void *devdata, int flag, daddr_t dblk,
size_t size, char *buf, size_t *rsize);
-static int fw_open(struct open_file *f, ...);
+static int fw_open(struct open_file *f, struct devdesc *dev);
static int fw_close(struct open_file *f);
static int fw_print(int verbose);
static void fw_cleanup(void);
@@ -176,18 +176,8 @@
}
static int
-fw_open(struct open_file *f, ...)
+fw_open(struct open_file *f __unused, struct devdesc *dev __unused)
{
-#if 0
- va_list ap;
- struct i386_devdesc *dev;
- struct open_disk *od;
- int error;
-
- va_start(ap, f);
- dev = va_arg(ap, struct i386_devdesc *);
- va_end(ap);
-#endif
return (ENXIO);
}
Index: stand/i386/libi386/biosdisk.c
===================================================================
--- stand/i386/libi386/biosdisk.c
+++ stand/i386/libi386/biosdisk.c
@@ -147,7 +147,7 @@
char *buf, size_t *rsize);
static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, size_t size,
char *buf, size_t *rsize);
-static int bd_open(struct open_file *f, ...);
+static int bd_open(struct open_file *f, struct devdesc *dev);
static int bd_close(struct open_file *f);
static int bd_ioctl(struct open_file *f, u_long cmd, void *data);
static int bd_print(int verbose);
@@ -836,20 +836,14 @@
* slice before it?)
*/
static int
-bd_open(struct open_file *f, ...)
+bd_open(struct open_file *f, struct devdesc *dev)
{
bdinfo_t *bd;
- struct disk_devdesc *dev;
- va_list ap;
int rc;
TSENTER();
- va_start(ap, f);
- dev = va_arg(ap, struct disk_devdesc *);
- va_end(ap);
-
- bd = bd_get_bdinfo(&dev->dd);
+ bd = bd_get_bdinfo(dev);
if (bd == NULL)
return (EIO);
@@ -863,13 +857,13 @@
bd->bd_bcache = bcache_allocate();
if (bd->bd_open == 0)
- bd->bd_sectors = bd_disk_get_sectors(dev);
+ bd->bd_sectors = bd_disk_get_sectors((struct disk_devdesc *)dev);
bd->bd_open++;
rc = 0;
- if (dev->dd.d_dev->dv_type == DEVT_DISK) {
- rc = disk_open(dev, bd->bd_sectors * bd->bd_sectorsize,
- bd->bd_sectorsize);
+ if (dev->d_dev->dv_type == DEVT_DISK) {
+ rc = disk_open((struct disk_devdesc *)dev,
+ bd->bd_sectors * bd->bd_sectorsize, bd->bd_sectorsize);
if (rc != 0) {
bd->bd_open--;
if (bd->bd_open == 0) {
Index: stand/kboot/hostdisk.c
===================================================================
--- stand/kboot/hostdisk.c
+++ stand/kboot/hostdisk.c
@@ -34,7 +34,7 @@
static int hostdisk_init(void);
static int hostdisk_strategy(void *devdata, int flag, daddr_t dblk,
size_t size, char *buf, size_t *rsize);
-static int hostdisk_open(struct open_file *f, ...);
+static int hostdisk_open(struct open_file *f, struct devdesc *);
static int hostdisk_close(struct open_file *f);
static int hostdisk_ioctl(struct open_file *f, u_long cmd, void *data);
static int hostdisk_print(int verbose);
@@ -85,14 +85,8 @@
}
static int
-hostdisk_open(struct open_file *f, ...)
+hostdisk_open(struct open_file *f, struct devdesc *desc)
{
- struct devdesc *desc;
- va_list vl;
-
- va_start(vl, f);
- desc = va_arg(vl, struct devdesc *);
- va_end(vl);
desc->d_unit = host_open(desc->d_opendata, O_RDONLY, 0);
Index: stand/libofw/ofw_disk.c
===================================================================
--- stand/libofw/ofw_disk.c
+++ stand/libofw/ofw_disk.c
@@ -45,7 +45,7 @@
static int ofwd_init(void);
static int ofwd_strategy(void *devdata, int flag, daddr_t dblk,
size_t size, char *buf, size_t *rsize);
-static int ofwd_open(struct open_file *f, ...);
+static int ofwd_open(struct open_file *f, struct devdesc *d);
static int ofwd_close(struct open_file *f);
static int ofwd_ioctl(struct open_file *f, u_long cmd, void *data);
static int ofwd_print(int verbose);
@@ -116,15 +116,11 @@
}
static int
-ofwd_open(struct open_file *f, ...)
+ofwd_open(struct open_file *f, struct devdesc *d)
{
struct ofw_devdesc *dp;
- va_list vl;
-
- va_start(vl, f);
- dp = va_arg(vl, struct ofw_devdesc *);
- va_end(vl);
+ dp = (struct ofw_devdesc *)d;
if (dp != kdp) {
if (kdp != NULL) {
OF_close(kdp->d_handle);
Index: stand/libsa/geli/gelidev.c
===================================================================
--- stand/libsa/geli/gelidev.c
+++ stand/libsa/geli/gelidev.c
@@ -37,7 +37,7 @@
static int geli_dev_init(void);
static int geli_dev_strategy(void *, int, daddr_t, size_t, char *, size_t *);
-static int geli_dev_open(struct open_file *f, ...);
+static int geli_dev_open(struct open_file *f, struct devdesc *d);
static int geli_dev_close(struct open_file *f);
static int geli_dev_ioctl(struct open_file *, u_long, void *);
static int geli_dev_print(int);
@@ -200,7 +200,7 @@
}
static int
-geli_dev_open(struct open_file *f, ...)
+geli_dev_open(struct open_file *f __unused, struct devdesc *d __unused)
{
/*
Index: stand/libsa/stand.h
===================================================================
--- stand/libsa/stand.h
+++ stand/libsa/stand.h
@@ -136,6 +136,8 @@
#define SEEK_CUR 1 /* set file offset to current plus offset */
#define SEEK_END 2 /* set file offset to EOF plus offset */
+struct devdesc;
+
/*
* Device switch
*/
@@ -151,7 +153,7 @@
int (*dv_init)(void); /* early probe call */
int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
size_t size, char *buf, size_t *rsize);
- int (*dv_open)(struct open_file *f, ...);
+ int (*dv_open)(struct open_file *f, struct devdesc *desc);
int (*dv_close)(struct open_file *f);
int (*dv_ioctl)(struct open_file *f, u_long cmd, void *data);
int (*dv_print)(int verbose); /* print device information */
Index: stand/libsa/zfs/zfs.c
===================================================================
--- stand/libsa/zfs/zfs.c
+++ stand/libsa/zfs/zfs.c
@@ -1560,18 +1560,14 @@
* Attempt to open the pool described by (dev) for use by (f).
*/
static int
-zfs_dev_open(struct open_file *f, ...)
+zfs_dev_open(struct open_file *f, struct devdesc *d)
{
- va_list args;
struct zfs_devdesc *dev;
struct zfsmount *mount;
spa_t *spa;
int rv;
- va_start(args, f);
- dev = va_arg(args, struct zfs_devdesc *);
- va_end(args);
-
+ dev = (struct zfs_devdesc *)d;
if ((spa = spa_find_by_dev(dev)) == NULL)
return (ENXIO);
Index: stand/uboot/main.c
===================================================================
--- stand/uboot/main.c
+++ stand/uboot/main.c
@@ -378,7 +378,8 @@
for (currdev.dd.d_unit = 0; currdev.dd.d_unit < UB_MAX_DEV;
currdev.dd.d_unit++) {
print_disk_probe_info();
- open_result = devsw[devidx]->dv_open(&f, &currdev);
+ open_result = devsw[devidx]->dv_open(&f,
+ (struct devdesc *)&currdev);
if (open_result == 0) {
printf(" good.\n");
return (0);
@@ -396,7 +397,8 @@
if (currdev.dd.d_unit == -1)
break;
print_disk_probe_info();
- open_result = devsw[devidx]->dv_open(&f, &currdev);
+ open_result = devsw[devidx]->dv_open( &f,
+ (struct devdesc *)&currdev);
if (open_result == 0) {
printf(" good.\n");
return (0);
@@ -408,7 +410,8 @@
if ((currdev.dd.d_unit = uboot_diskgetunit(load_type, load_unit)) != -1) {
print_disk_probe_info();
- open_result = devsw[devidx]->dv_open(&f,&currdev);
+ open_result = devsw[devidx]->dv_open(&f,
+ (struct devdesc *)&currdev);
if (open_result == 0) {
printf(" good.\n");
return (0);
Index: stand/uboot/uboot_disk.c
===================================================================
--- stand/uboot/uboot_disk.c
+++ stand/uboot/uboot_disk.c
@@ -74,7 +74,7 @@
/* devsw I/F */
static int stor_init(void);
static int stor_strategy(void *, int, daddr_t, size_t, char *, size_t *);
-static int stor_open(struct open_file *, ...);
+static int stor_open(struct open_file *, struct devdesc *);
static int stor_close(struct open_file *);
static int stor_ioctl(struct open_file *f, u_long cmd, void *data);
static int stor_print(int);
@@ -173,16 +173,10 @@
}
static int
-stor_open(struct open_file *f, ...)
+stor_open(struct open_file *f __unused, struct devdesc *dev)
{
- va_list ap;
- struct disk_devdesc *dev;
-
- va_start(ap, f);
- dev = va_arg(ap, struct disk_devdesc *);
- va_end(ap);
- return (stor_opendev(dev));
+ return (stor_opendev((struct disk_devdesc *)dev));
}
static int
Index: stand/usb/storage/umass_loader.c
===================================================================
--- stand/usb/storage/umass_loader.c
+++ stand/usb/storage/umass_loader.c
@@ -44,7 +44,7 @@
#include "umass_common.h"
static int umass_disk_init(void);
-static int umass_disk_open(struct open_file *,...);
+static int umass_disk_open(struct open_file *, struct devdesc *);
static int umass_disk_close(struct open_file *);
static void umass_disk_cleanup(void);
static int umass_disk_ioctl(struct open_file *, u_long, void *);
@@ -121,20 +121,14 @@
}
static int
-umass_disk_open(struct open_file *f,...)
+umass_disk_open(struct open_file *f __unused, struct devdesc *dev)
{
- va_list ap;
- struct disk_devdesc *dev;
-
- va_start(ap, f);
- dev = va_arg(ap, struct disk_devdesc *);
- va_end(ap);
if (umass_uaa.device == NULL)
return (ENXIO);
if (dev->d_unit != 0)
return (EIO);
- return (umass_disk_open_sub(dev));
+ return (umass_disk_open_sub((struct disk_devdesc *)dev));
}
static int
Index: stand/userboot/userboot/host.c
===================================================================
--- stand/userboot/userboot/host.c
+++ stand/userboot/userboot/host.c
@@ -133,7 +133,7 @@
* 'Open' the host device.
*/
static int
-host_dev_open(struct open_file *f, ...)
+host_dev_open(struct open_file *f __unused, struct devdesc *dev __unused)
{
return (0);
Index: stand/userboot/userboot/main.c
===================================================================
--- stand/userboot/userboot/main.c
+++ stand/userboot/userboot/main.c
@@ -274,7 +274,7 @@
* If we cannot auto-detect the partition type then
* access the disk as a raw device.
*/
- if (dev.dd.d_dev->dv_open(NULL, &dev)) {
+ if (dev.dd.d_dev->dv_open(NULL, (struct devdesc *)&dev)) {
dev.d_slice = D_SLICENONE;
dev.d_partition = D_PARTNONE;
}
Index: stand/userboot/userboot/userboot_disk.c
===================================================================
--- stand/userboot/userboot/userboot_disk.c
+++ stand/userboot/userboot/userboot_disk.c
@@ -57,7 +57,7 @@
size_t size, char *buf, size_t *rsize);
static int userdisk_realstrategy(void *devdata, int flag, daddr_t dblk,
size_t size, char *buf, size_t *rsize);
-static int userdisk_open(struct open_file *f, ...);
+static int userdisk_open(struct open_file *f, struct devdesc *dev);
static int userdisk_close(struct open_file *f);
static int userdisk_ioctl(struct open_file *f, u_long cmd, void *data);
static int userdisk_print(int verbose);
@@ -155,22 +155,16 @@
* Attempt to open the disk described by (dev) for use by (f).
*/
static int
-userdisk_open(struct open_file *f, ...)
+userdisk_open(struct open_file *f __unused, struct devdesc *dev)
{
- va_list ap;
- struct disk_devdesc *dev;
- va_start(ap, f);
- dev = va_arg(ap, struct disk_devdesc *);
- va_end(ap);
-
- if (dev->dd.d_unit < 0 || dev->dd.d_unit >= userdisk_maxunit)
+ if (dev->d_unit < 0 || dev->d_unit >= userdisk_maxunit)
return (EIO);
- ud_info[dev->dd.d_unit].ud_open++;
- if (ud_info[dev->dd.d_unit].ud_bcache == NULL)
- ud_info[dev->dd.d_unit].ud_bcache = bcache_allocate();
- return (disk_open(dev, ud_info[dev->dd.d_unit].mediasize,
- ud_info[dev->dd.d_unit].sectorsize));
+ ud_info[dev->d_unit].ud_open++;
+ if (ud_info[dev->d_unit].ud_bcache == NULL)
+ ud_info[dev->d_unit].ud_bcache = bcache_allocate();
+ return (disk_open((struct disk_devdesc *)dev,
+ ud_info[dev->d_unit].mediasize, ud_info[dev->d_unit].sectorsize));
}
static int

File Metadata

Mime Type
text/plain
Expires
Fri, Jun 19, 3:21 AM (10 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34065569
Default Alt Text
D34923.id105073.diff (17 KB)

Event Timeline