summaryrefslogtreecommitdiff
path: root/sys/arch/macppc
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2003-10-16 04:30:10 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2003-10-16 04:30:10 +0000
commiteb6b972eb5f7f4aea38051946f3892ad74d5bfaa (patch)
tree1affd8cdd64c44b286c627bfe90d7c0836a0a5b8 /sys/arch/macppc
parentcc4c74a8bd4068140ebd064c8104c06f467cb66a (diff)
There is no end to the ANSI/KNF journey.
Diffstat (limited to 'sys/arch/macppc')
-rw-r--r--sys/arch/macppc/stand/Locore.c103
-rw-r--r--sys/arch/macppc/stand/alloc.c13
-rw-r--r--sys/arch/macppc/stand/boot.c21
-rw-r--r--sys/arch/macppc/stand/cache.c7
-rw-r--r--sys/arch/macppc/stand/hfs.c28
-rw-r--r--sys/arch/macppc/stand/net.c22
-rw-r--r--sys/arch/macppc/stand/netif_of.c30
-rw-r--r--sys/arch/macppc/stand/ofdev.c82
8 files changed, 105 insertions, 201 deletions
diff --git a/sys/arch/macppc/stand/Locore.c b/sys/arch/macppc/stand/Locore.c
index c2e57cc5241..40ddebf2d4a 100644
--- a/sys/arch/macppc/stand/Locore.c
+++ b/sys/arch/macppc/stand/Locore.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: Locore.c,v 1.7 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: Locore.c,v 1.8 2003/10/16 04:30:09 drahn Exp $ */
/* $NetBSD: Locore.c,v 1.1 1997/04/16 20:29:11 thorpej Exp $ */
/*
@@ -79,12 +79,7 @@ bat_init:
");
__dead void
-_start(vpd, res, openfirm, arg, argl)
- void *vpd;
- int res;
- int (*openfirm)(void *);
- char *arg;
- int argl;
+_start(void *vpd, int res, int (*openfirm)(void *), char *arg, int argl)
{
extern char etext[];
@@ -120,14 +115,13 @@ patch_dec_intr()
*/
time = 0x40000000;
asm("mtdec %0" :: "r"(time));
+
/* we assume that handle_decr_intr is in the first 128 Meg */
br_instr = (18 << 23) | (unsigned int)handle_decr_intr;
*decr_intr = br_instr;
-
-
-
}
#endif
+
__dead void
_rtt()
{
@@ -146,8 +140,7 @@ _rtt()
}
int
-OF_finddevice(name)
- char *name;
+OF_finddevice(char *name)
{
static struct {
char *name;
@@ -159,8 +152,8 @@ OF_finddevice(name)
"finddevice",
1,
1,
- };
-
+ };
+
args.device = name;
if (openfirmware(&args) == -1)
return -1;
@@ -168,8 +161,7 @@ OF_finddevice(name)
}
int
-OF_instance_to_package(ihandle)
- int ihandle;
+OF_instance_to_package(int ihandle)
{
static struct {
char *name;
@@ -182,7 +174,7 @@ OF_instance_to_package(ihandle)
1,
1,
};
-
+
args.ihandle = ihandle;
if (openfirmware(&args) == -1)
return -1;
@@ -190,11 +182,7 @@ OF_instance_to_package(ihandle)
}
int
-OF_getprop(handle, prop, buf, buflen)
- int handle;
- char *prop;
- void *buf;
- int buflen;
+OF_getprop(int handle, char *prop, void *buf, int buflen)
{
static struct {
char *name;
@@ -210,7 +198,7 @@ OF_getprop(handle, prop, buf, buflen)
4,
1,
};
-
+
args.phandle = handle;
args.prop = prop;
args.buf = buf;
@@ -222,11 +210,7 @@ OF_getprop(handle, prop, buf, buflen)
#ifdef __notyet__ /* Has a bug on FirePower */
int
-OF_setprop(handle, prop, buf, len)
- int handle;
- char *prop;
- void *buf;
- int len;
+OF_setprop(int handle, char *prop, void *buf, int len)
{
static struct {
char *name;
@@ -242,7 +226,7 @@ OF_setprop(handle, prop, buf, len)
4,
1,
};
-
+
args.phandle = handle;
args.prop = prop;
args.buf = buf;
@@ -254,8 +238,7 @@ OF_setprop(handle, prop, buf, len)
#endif
int
-OF_open(dname)
- char *dname;
+OF_open(char *dname)
{
static struct {
char *name;
@@ -268,7 +251,7 @@ OF_open(dname)
1,
1,
};
-
+
args.dname = dname;
if (openfirmware(&args) == -1)
return -1;
@@ -276,8 +259,7 @@ OF_open(dname)
}
void
-OF_close(handle)
- int handle;
+OF_close(int handle)
{
static struct {
char *name;
@@ -289,16 +271,13 @@ OF_close(handle)
1,
0,
};
-
+
args.handle = handle;
openfirmware(&args);
}
int
-OF_write(handle, addr, len)
- int handle;
- void *addr;
- int len;
+OF_write(int handle, void *addr, int len)
{
static struct {
char *name;
@@ -323,10 +302,7 @@ OF_write(handle, addr, len)
}
int
-OF_read(handle, addr, len)
- int handle;
- void *addr;
- int len;
+OF_read(int handle, void *addr, int len)
{
static struct {
char *name;
@@ -351,9 +327,7 @@ OF_read(handle, addr, len)
}
int
-OF_seek(handle, pos)
- int handle;
- u_quad_t pos;
+OF_seek(int handle, u_quad_t pos)
{
static struct {
char *name;
@@ -368,7 +342,7 @@ OF_seek(handle, pos)
3,
1,
};
-
+
args.handle = handle;
args.poshi = (int)(pos >> 32);
args.poslo = (int)pos;
@@ -378,10 +352,7 @@ OF_seek(handle, pos)
}
void *
-OF_claim(virt, size, align)
- void *virt;
- u_int size;
- u_int align;
+OF_claim(void *virt, u_int size, u_int align)
{
static struct {
char *name;
@@ -412,16 +383,13 @@ OF_claim(virt, size, align)
args.align = align;
if (openfirmware(&args) == -1)
return (void *)-1;
- if (virt != 0) {
+ if (virt != 0)
return virt;
- }
return args.baseaddr;
}
void
-OF_release(virt, size)
- void *virt;
- u_int size;
+OF_release(void *virt, u_int size)
{
static struct {
char *name;
@@ -434,7 +402,7 @@ OF_release(virt, size)
2,
0,
};
-
+
args.virt = virt;
args.size = size;
openfirmware(&args);
@@ -453,19 +421,14 @@ OF_milliseconds()
0,
1,
};
-
+
openfirmware(&args);
return args.ms;
}
#ifdef __notyet__
void
-OF_chain(virt, size, entry, arg, len)
- void *virt;
- u_int size;
- void (*entry)();
- void *arg;
- u_int len;
+OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len)
{
static struct {
char *name;
@@ -491,12 +454,7 @@ OF_chain(virt, size, entry, arg, len)
}
#else
void
-OF_chain(virt, size, entry, arg, len)
- void *virt;
- u_int size;
- void (*entry)();
- void *arg;
- u_int len;
+OF_chain(void *virt, u_int size, void (*entry)(), void *arg, u_int len)
{
/*
* This is a REALLY dirty hack till the firmware gets this going
@@ -555,7 +513,7 @@ static void
setup()
{
int chosen;
-
+
if ((chosen = OF_finddevice("/chosen")) == -1)
_rtt();
if (OF_getprop(chosen, "stdin", &stdin, sizeof(stdin)) != sizeof(stdin)
@@ -569,8 +527,7 @@ setup()
}
void
-putchar(c)
- int c;
+putchar(int c)
{
char ch = c;
diff --git a/sys/arch/macppc/stand/alloc.c b/sys/arch/macppc/stand/alloc.c
index 2c49b93adb6..aa747189fa6 100644
--- a/sys/arch/macppc/stand/alloc.c
+++ b/sys/arch/macppc/stand/alloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: alloc.c,v 1.2 2002/03/14 03:15:56 millert Exp $ */
+/* $OpenBSD: alloc.c,v 1.3 2003/10/16 04:30:09 drahn Exp $ */
/* $NetBSD: alloc.c,v 1.1 1997/04/16 20:29:16 thorpej Exp $ */
/*
@@ -95,8 +95,7 @@ LIST_HEAD(, ml) allocatedlist = LIST_HEAD_INITIALIZER(allocatedlist);
#define OVERHEAD ALIGN(sizeof (struct ml)) /* shorthand */
void *
-alloc(size)
- unsigned size;
+alloc(unsigned size)
{
struct ml *f, *bestf;
unsigned bestsize = 0xffffffff; /* greater than any real size */
@@ -163,23 +162,21 @@ alloc(size)
/* we take the best fit */
f = bestf;
- found:
+found:
/* remove from freelist */
LIST_REMOVE(f, list);
help = (char *)f;
#ifdef ALLOC_TRACE
printf("=%lx (origsize %u)\n", (u_long)(help + OVERHEAD), f->size);
#endif
- out:
+out:
/* place on allocated list */
LIST_INSERT_HEAD(&allocatedlist, f, list);
return (help + OVERHEAD);
}
void
-free(ptr, size)
- void *ptr;
- unsigned size; /* only for consistenct check */
+free(void *ptr, unsigned size)
{
register struct ml *a = (struct ml *)((char *)ptr - OVERHEAD);
diff --git a/sys/arch/macppc/stand/boot.c b/sys/arch/macppc/stand/boot.c
index c1af395f2cc..d63e2a1565f 100644
--- a/sys/arch/macppc/stand/boot.c
+++ b/sys/arch/macppc/stand/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.9 2003/06/01 17:00:36 deraadt Exp $ */
+/* $OpenBSD: boot.c,v 1.10 2003/10/16 04:30:09 drahn Exp $ */
/* $NetBSD: boot.c,v 1.1 1997/04/16 20:29:17 thorpej Exp $ */
/*
@@ -67,11 +67,10 @@ int boothowto;
int debug;
static void
-prom2boot(dev)
- char *dev;
+prom2boot(char *dev)
{
char *cp, *lp = 0;
-
+
for (cp = dev; *cp; cp++)
if (*cp == ':')
lp = cp;
@@ -81,9 +80,7 @@ prom2boot(dev)
}
static void
-parseargs(str, howtop)
- char *str;
- int *howtop;
+parseargs(char *str, int *howtop)
{
char *cp;
@@ -109,7 +106,7 @@ parseargs(str, howtop)
}
if (!*cp)
return;
-
+
*cp++ = 0;
while (*cp) {
switch (*cp++) {
@@ -131,11 +128,7 @@ parseargs(str, howtop)
}
static void
-chain(entry, args, ssym, esym)
- void (*entry)();
- char *args;
- void *ssym;
- void *esym;
+chain(void (*entry)(), char *args, void *ssym, void *esym)
{
extern char end[];
int l, machine_tag;
@@ -175,7 +168,7 @@ main()
u_int32_t entry;
void *ssym, *esym;
int fd;
-
+
printf("\n>> OpenBSD/macppc Boot\n");
/*
diff --git a/sys/arch/macppc/stand/cache.c b/sys/arch/macppc/stand/cache.c
index 65fa15728b3..99b15796c90 100644
--- a/sys/arch/macppc/stand/cache.c
+++ b/sys/arch/macppc/stand/cache.c
@@ -1,10 +1,8 @@
-/* $OpenBSD: cache.c,v 1.1 2001/09/01 15:39:02 drahn Exp $ */
+/* $OpenBSD: cache.c,v 1.2 2003/10/16 04:30:09 drahn Exp $ */
#define CACHELINESIZE 32 /* For now XXX */
void
-syncicache(from, len)
- void *from;
- int len;
+syncicache(void *from, int len)
{
int l = len;
void *p = from;
@@ -20,4 +18,3 @@ syncicache(from, len)
} while ((len -= CACHELINESIZE) > 0);
asm volatile ("isync");
}
-
diff --git a/sys/arch/macppc/stand/hfs.c b/sys/arch/macppc/stand/hfs.c
index da3116e3297..7e591403b09 100644
--- a/sys/arch/macppc/stand/hfs.c
+++ b/sys/arch/macppc/stand/hfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hfs.c,v 1.2 2003/06/01 17:00:36 deraadt Exp $ */
+/* $OpenBSD: hfs.c,v 1.3 2003/10/16 04:30:09 drahn Exp $ */
/* $NetBSD: hfs.c,v 1.1 2000/11/14 11:25:35 tsubai Exp $ */
/*-
@@ -37,9 +37,7 @@
static int OF_fd; /* XXX */
int
-hfs_open(path, f)
- char *path;
- struct open_file *f;
+hfs_open(char *path, struct open_file *f)
{
int chosen;
char bootpath[128], *cp;
@@ -72,18 +70,14 @@ hfs_open(path, f)
}
int
-hfs_close(f)
- struct open_file *f;
+hfs_close(struct open_file *f)
{
OF_close(OF_fd);
return 0;
}
int
-hfs_read(f, start, size, resid)
- struct open_file *f;
- void *start;
- size_t size, *resid;
+hfs_read(struct open_file *f, void *start, size_t size, size_t *resid)
{
int len;
@@ -95,20 +89,14 @@ hfs_read(f, start, size, resid)
}
int
-hfs_write(f, start, size, resid)
- struct open_file *f;
- void *start;
- size_t size, *resid;
+hfs_write(struct open_file *f, void *start, size_t size, size_t *resid)
{
printf("hfs_write\n");
return ENXIO;
}
off_t
-hfs_seek(f, offset, where)
- struct open_file *f;
- off_t offset;
- int where;
+hfs_seek(struct open_file *f, off_t offset, int where)
{
switch (where) {
case SEEK_SET:
@@ -121,9 +109,7 @@ hfs_seek(f, offset, where)
}
int
-hfs_stat(f, sb)
- struct open_file *f;
- struct stat *sb;
+hfs_stat(struct open_file *f, struct stat *sb)
{
return 0;
}
diff --git a/sys/arch/macppc/stand/net.c b/sys/arch/macppc/stand/net.c
index 50acb67b7b6..4a876de51c6 100644
--- a/sys/arch/macppc/stand/net.c
+++ b/sys/arch/macppc/stand/net.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: net.c,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: net.c,v 1.4 2003/10/16 04:30:09 drahn Exp $ */
/* $NetBSD: net.c,v 1.1 1997/04/16 20:29:18 thorpej Exp $ */
/*
@@ -72,11 +72,10 @@ static int open_count;
* This opens the low-level device and sets f->f_devdata.
*/
int
-net_open(op)
- struct of_dev *op;
+net_open(struct of_dev *op)
{
int error = 0;
-
+
/*
* On first open, do netif open, mount, etc.
*/
@@ -99,8 +98,7 @@ bad:
}
int
-net_close(op)
- struct of_dev *op;
+net_close(struct of_dev *op)
{
/*
* On last close, do netif close, etc.
@@ -119,21 +117,21 @@ net_mountroot()
#ifdef DEBUG
printf("net_mountroot\n");
#endif
-
+
/*
* Get info for NFS boot: our IP address, out hostname,
* server IP address, and our root path on the server.
* We use BOOTP (RFC951, RFC1532) exclusively as mandated
* by PowerPC Reference Platform Specification I.4.2
*/
-
+
bootp(netdev_sock);
-
+
if (myip.s_addr == 0)
return ETIMEDOUT;
-
+
printf("Using IP address: %s\n", inet_ntoa(myip));
-
+
#ifdef DEBUG
printf("myip: %s (%s)", hostname, inet_ntoa(myip));
if (gateip.s_addr)
@@ -143,7 +141,7 @@ net_mountroot()
printf("\n");
#endif
printf("root addr=%s path=%s\n", inet_ntoa(rootip), rootpath);
-
+
/*
* Get the NFS file handle (mount).
*/
diff --git a/sys/arch/macppc/stand/netif_of.c b/sys/arch/macppc/stand/netif_of.c
index 286f5f9594a..cde570269e0 100644
--- a/sys/arch/macppc/stand/netif_of.c
+++ b/sys/arch/macppc/stand/netif_of.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: netif_of.c,v 1.3 2002/09/15 09:01:59 deraadt Exp $ */
+/* $OpenBSD: netif_of.c,v 1.4 2003/10/16 04:30:09 drahn Exp $ */
/* $NetBSD: netif_of.c,v 1.1 1997/04/16 20:29:19 thorpej Exp $ */
/*
@@ -66,8 +66,7 @@ static struct netif netif_of;
struct iodesc sockets[SOPEN_MAX];
struct iodesc *
-socktodesc(sock)
- int sock;
+socktodesc(int sock)
{
if (sock != 0)
return NULL;
@@ -75,14 +74,13 @@ socktodesc(sock)
}
int
-netif_open(machdep_hint)
- void *machdep_hint;
+netif_open(void *machdep_hint)
{
struct of_dev *op = machdep_hint;
struct iodesc *io;
int fd, error;
char addr[32];
-
+
#ifdef NETIF_DEBUG
printf("netif_open...");
#endif
@@ -99,7 +97,7 @@ netif_open(machdep_hint)
netif_of.nif_devdata = op;
io->io_netif = &netif_of;
-
+
/* Put our ethernet address in io->myea */
OF_getprop(OF_instance_to_package(op->handle),
"local-mac-address", io->myea, sizeof io->myea) == -1 &&
@@ -113,8 +111,7 @@ netif_open(machdep_hint)
}
int
-netif_close(fd)
- int fd;
+netif_close(int fd)
{
struct iodesc *io;
struct netif *ni;
@@ -147,10 +144,7 @@ netif_close(fd)
* Return the length sent (or -1 on error).
*/
ssize_t
-netif_put(desc, pkt, len)
- struct iodesc *desc;
- void *pkt;
- size_t len;
+netif_put(struct iodesc *desc, void *pkt, size_t len)
{
struct of_dev *op;
ssize_t rv;
@@ -197,11 +191,7 @@ netif_put(desc, pkt, len)
* Return the total length received (or -1 on error).
*/
ssize_t
-netif_get(desc, pkt, maxlen, timo)
- struct iodesc *desc;
- void *pkt;
- size_t maxlen;
- time_t timo;
+netif_get(struct iodesc *desc, void *pkt, size_t maxlen, time_t timo)
{
struct of_dev *op;
int tick0, tmo_ms;
@@ -211,7 +201,7 @@ netif_get(desc, pkt, maxlen, timo)
#ifdef NETIF_DEBUG
printf("netif_get: pkt=0x%x, maxlen=%d, tmo=%d\n",
- pkt, maxlen, timo);
+ pkt, maxlen, timo);
#endif
tmo_ms = timo * 1000;
@@ -220,7 +210,7 @@ netif_get(desc, pkt, maxlen, timo)
do {
len = OF_read(op->handle, pkt, maxlen);
} while ((len == -2 || len == 0) &&
- ((OF_milliseconds() - tick0) < tmo_ms));
+ ((OF_milliseconds() - tick0) < tmo_ms));
#ifdef NETIF_DEBUG
printf("netif_get: received len=%d\n", len);
diff --git a/sys/arch/macppc/stand/ofdev.c b/sys/arch/macppc/stand/ofdev.c
index 324654102ec..d989ca58b51 100644
--- a/sys/arch/macppc/stand/ofdev.c
+++ b/sys/arch/macppc/stand/ofdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofdev.c,v 1.7 2003/04/06 18:54:19 ho Exp $ */
+/* $OpenBSD: ofdev.c,v 1.8 2003/10/16 04:30:09 drahn Exp $ */
/* $NetBSD: ofdev.c,v 1.1 1997/04/16 20:29:20 thorpej Exp $ */
/*
@@ -49,9 +49,7 @@
extern char bootdev[];
static char *
-filename(str, ppart)
- char *str;
- char *ppart;
+filename(char *str, char *ppart)
{
char *cp, *lp;
char savec;
@@ -100,13 +98,8 @@ filename(str, ppart)
}
static int
-strategy(devdata, rw, blk, size, buf, rsize)
- void *devdata;
- int rw;
- daddr_t blk;
- size_t size;
- void *buf;
- size_t *rsize;
+strategy(void *devdata, int rw, daddr_t blk, size_t size, void *buf,
+ size_t *rsize)
{
struct of_dev *dev = devdata;
u_quad_t pos;
@@ -134,17 +127,16 @@ strategy(devdata, rw, blk, size, buf, rsize)
}
static int
-devclose(of)
- struct open_file *of;
+devclose(struct open_file *of)
{
struct of_dev *op = of->f_devdata;
if (op->type == OFDEV_NET)
net_close(op);
- if (op->dmabuf) {
+ if (op->dmabuf)
OF_call_method("dma-free", op->handle, 2, 0,
- op->dmabuf, MAXPHYS);
- }
+ op->dmabuf, MAXPHYS);
+
OF_close(op->handle);
op->handle = -1;
}
@@ -191,10 +183,7 @@ get_long(p)
}
int
-read_mac_label(devp, buf, lp)
- struct of_dev *devp;
- char *buf;
- struct disklabel *lp;
+read_mac_label(struct of_dev *devp, char *buf, struct disklabel *lp)
{
struct part_map_entry *part;
struct buf *bp;
@@ -204,17 +193,16 @@ read_mac_label(devp, buf, lp)
int i;
char *s;
- if ((strategy(devp, F_READ, 1, DEV_BSIZE, buf, &read) != 0)
- || (read != DEV_BSIZE))
- {
+ if ((strategy(devp, F_READ, 1, DEV_BSIZE, buf, &read) != 0) ||
+ (read != DEV_BSIZE))
return ERDLAB;
- }
+
part = (struct part_map_entry *)buf;
/* if first partition is not valid, assume not HFS/DPME partitioned */
- if (part->pmSig != PART_ENTRY_MAGIC) {
+ if (part->pmSig != PART_ENTRY_MAGIC)
return ERDLAB;
- }
+
part_cnt = part->pmMapBlkCnt;
/* first search for "OpenBSD" partition type
@@ -227,14 +215,14 @@ read_mac_label(devp, buf, lp)
/* read the appropriate block */
if ((strategy(devp, F_READ, 1+i, DEV_BSIZE, buf, &read) != 0)
|| (read != DEV_BSIZE))
- {
return ERDLAB;
- }
+
part = (struct part_map_entry *)buf;
/* toupper the string, in case caps are different... */
for (s = part->pmPartType; *s; s++)
if ((*s >= 'a') && (*s <= 'z'))
*s = (*s - 'a' + 'A');
+
if (0 == strcmp(part->pmPartType, PART_TYPE_OPENBSD)) {
/* FOUND OUR PARTITION!!! */
printf("found OpenBSD DPME partition\n");
@@ -242,9 +230,9 @@ read_mac_label(devp, buf, lp)
DEV_BSIZE, buf, &read) == 0
&& read == DEV_BSIZE)
{
- if (!getdisklabel(buf, lp)) {
+ if (!getdisklabel(buf, lp))
return 0;
- }
+
/* If we have an OpenBSD region
* but no valid parition table,
* we cannot load a kernel from
@@ -253,14 +241,12 @@ read_mac_label(devp, buf, lp)
* OpenBSD of DPME type.
*/
return ERDLAB;
-
}
-
}
}
return ERDLAB;
-
}
+
/*
* Find a valid disklabel.
*/
@@ -278,8 +264,8 @@ search_label(devp, off, buf, lp, off0)
u_long poff;
static int recursion;
- if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read)
- || read != DEV_BSIZE)
+ if (strategy(devp, F_READ, off, DEV_BSIZE, buf, &read) ||
+ read != DEV_BSIZE)
return ERDLAB;
if (buf[510] != 0x55 || buf[511] != 0xaa)
@@ -288,12 +274,12 @@ search_label(devp, off, buf, lp, off0)
if (recursion++ <= 1)
off0 += off;
for (p = (struct dos_partition *)(buf + DOSPARTOFF), i = 4;
- --i >= 0; p++) {
+ --i >= 0; p++) {
if (p->dp_typ == DOSPTYP_OPENBSD ||
p->dp_typ == DOSPTYP_NETBSD) {
poff = get_long(&p->dp_start) + off0;
if (strategy(devp, F_READ, poff + LABELSECTOR,
- DEV_BSIZE, buf, &read) == 0
+ DEV_BSIZE, buf, &read) == 0
&& read == DEV_BSIZE) {
if (!getdisklabel(buf, lp)) {
recursion--;
@@ -323,10 +309,7 @@ search_label(devp, off, buf, lp, off0)
}
int
-devopen(of, name, file)
- struct open_file *of;
- const char *name;
- char **file;
+devopen(struct open_file *of, const char *name, char **file)
{
char *cp;
char partition;
@@ -385,23 +368,26 @@ devopen(of, name, file)
ofdev.bsize = DEV_BSIZE;
/* First try to find a disklabel without MBR partitions */
if (strategy(&ofdev, F_READ,
- LABELSECTOR, DEV_BSIZE, buf, &read) != 0
- || read != DEV_BSIZE
- || getdisklabel(buf, &label)) {
+ LABELSECTOR, DEV_BSIZE, buf, &read) != 0 ||
+ read != DEV_BSIZE ||
+ getdisklabel(buf, &label)) {
/* Else try MBR partitions */
error = read_mac_label(&ofdev, buf, &label);
- if (error == ERDLAB) {
+ if (error == ERDLAB)
error = search_label(&ofdev, 0, buf, &label, 0);
- }
+
if (error && error != ERDLAB)
goto bad;
}
if (error == ERDLAB) {
if (partition)
- /* User specified a partition, but there is none */
+ /*
+ * User specified a partition,
+ * but there is none
+ */
goto bad;
- /* No, label, just use complete disk */
+ /* No label, just use complete disk */
ofdev.partoff = 0;
} else {
part = partition ? partition - 'a' : 0;