mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-12 09:58:36 +00:00
Style, whitespace and lint fixes.
Sponsored by: DARPA & NAI Labs.
This commit is contained in:
parent
eadf0ffdce
commit
4ae677009e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=104087
@ -56,9 +56,9 @@
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/libkern.h>
|
||||
#include <sys/md5.h>
|
||||
#include <sys/endian.h>
|
||||
#endif
|
||||
#include <sys/endian.h>
|
||||
#include <sys/md5.h>
|
||||
#include <sys/errno.h>
|
||||
#include <geom/geom.h>
|
||||
|
||||
@ -354,7 +354,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
|
||||
u_char *p;
|
||||
|
||||
p = sc->master_key;
|
||||
for (i = 0; i < sizeof sc->master_key; i ++)
|
||||
for (i = 0; i < (int)sizeof sc->master_key; i ++)
|
||||
*p++ = i;
|
||||
}
|
||||
if (sc->keying == KEY_RANDOM) {
|
||||
@ -363,7 +363,7 @@ g_aes_taste(struct g_class *mp, struct g_provider *pp, int flags __unused)
|
||||
u_char *p;
|
||||
|
||||
p = sc->master_key;
|
||||
for (i = 0; i < sizeof sc->master_key; i += sizeof u) {
|
||||
for (i = 0; i < (int)sizeof sc->master_key; i += sizeof u) {
|
||||
u = arc4random();
|
||||
*p++ = u;
|
||||
*p++ = u >> 8;
|
||||
|
@ -60,19 +60,20 @@ static d_ioctl_t g_dev_ioctl;
|
||||
static d_psize_t g_dev_psize;
|
||||
|
||||
static struct cdevsw g_dev_cdevsw = {
|
||||
/* open */ g_dev_open,
|
||||
/* close */ g_dev_close,
|
||||
/* read */ physread,
|
||||
/* write */ physwrite,
|
||||
/* ioctl */ g_dev_ioctl,
|
||||
/* poll */ nopoll,
|
||||
/* mmap */ nommap,
|
||||
/* strategy */ g_dev_strategy,
|
||||
/* name */ "g_dev",
|
||||
/* maj */ CDEV_MAJOR,
|
||||
/* dump */ nodump,
|
||||
/* psize */ g_dev_psize,
|
||||
/* flags */ D_DISK | D_CANFREE | D_TRACKCLOSE,
|
||||
/* open */ g_dev_open,
|
||||
/* close */ g_dev_close,
|
||||
/* read */ physread,
|
||||
/* write */ physwrite,
|
||||
/* ioctl */ g_dev_ioctl,
|
||||
/* poll */ nopoll,
|
||||
/* mmap */ nommap,
|
||||
/* strategy */ g_dev_strategy,
|
||||
/* name */ "g_dev",
|
||||
/* maj */ CDEV_MAJOR,
|
||||
/* dump */ nodump,
|
||||
/* psize */ g_dev_psize,
|
||||
/* flags */ D_DISK | D_CANFREE | D_TRACKCLOSE,
|
||||
/* kqfilter */ nokqfilter
|
||||
};
|
||||
|
||||
static g_taste_t g_dev_taste;
|
||||
@ -86,7 +87,7 @@ static struct g_class g_dev_class = {
|
||||
};
|
||||
|
||||
static void
|
||||
g_dev_clone(void *arg, char *name, int namelen __unused, dev_t *dev)
|
||||
g_dev_clone(void *arg __unused, char *name, int namelen __unused, dev_t *dev)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
|
||||
|
@ -35,8 +35,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "opt_geom.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -50,7 +48,6 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/stdint.h>
|
||||
#include <machine/md_var.h>
|
||||
#include <sys/ctype.h>
|
||||
|
||||
|
||||
#include <sys/lock.h>
|
||||
|
@ -60,7 +60,6 @@
|
||||
#include <sys/systm.h>
|
||||
#endif
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
uint16_t
|
||||
g_dec_be2(u_char *p)
|
||||
|
@ -49,7 +49,6 @@
|
||||
#endif
|
||||
|
||||
#include <sys/endian.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/uuid.h>
|
||||
#include <sys/gpt.h>
|
||||
@ -161,22 +160,24 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist)
|
||||
g_topology_unlock();
|
||||
gp->dumpconf = g_gpt_dumpconf;
|
||||
|
||||
npart = 0;
|
||||
mbr = NULL;
|
||||
do {
|
||||
|
||||
if (gp->rank != 2 && insist == 0)
|
||||
goto out;
|
||||
npart = 0;
|
||||
mbr = NULL;
|
||||
|
||||
error = g_getattr("GEOM::sectorsize", cp, &secsz);
|
||||
if (error)
|
||||
goto out;
|
||||
if (gp->rank != 2 && insist == 0)
|
||||
break;
|
||||
|
||||
/* XXX: we need to get the media size as well. */
|
||||
error = g_getattr("GEOM::sectorsize", cp, &secsz);
|
||||
if (error)
|
||||
break;
|
||||
|
||||
/* Read both the MBR sector and the GPT sector. */
|
||||
mbr = g_read_data(cp, 0, 2 * secsz, &error);
|
||||
if (mbr == NULL || error != 0)
|
||||
goto out;
|
||||
/* XXX: we need to get the media size as well. */
|
||||
|
||||
/* Read both the MBR sector and the GPT sector. */
|
||||
mbr = g_read_data(cp, 0, 2 * secsz, &error);
|
||||
if (mbr == NULL || error != 0)
|
||||
break;
|
||||
#if 0
|
||||
/*
|
||||
* XXX: we should ignore the GPT if there's a MBR and the MBR is
|
||||
@ -191,46 +192,49 @@ g_gpt_taste(struct g_class *mp, struct g_provider *pp, int insist)
|
||||
goto out;
|
||||
#endif
|
||||
|
||||
hdr = (void*)(mbr + secsz);
|
||||
hdr = (void*)(mbr + secsz);
|
||||
|
||||
/*
|
||||
* XXX: if we don't have a GPT header at LBA 1, we should check if
|
||||
* there's a backup GPT at the end of the medium. If we have a valid
|
||||
* backup GPT, we should restore the primary GPT and claim this lunch.
|
||||
*/
|
||||
if (!is_gpt_hdr(hdr))
|
||||
goto out;
|
||||
|
||||
tblsz = (hdr->hdr_entries * hdr->hdr_entsz + secsz - 1) & ~(secsz - 1);
|
||||
buf = g_read_data(cp, hdr->hdr_lba_table * secsz, tblsz, &error);
|
||||
|
||||
gsp->frontstuff = hdr->hdr_lba_start * secsz;
|
||||
|
||||
for (i = 0; i < hdr->hdr_entries; i++) {
|
||||
struct uuid unused = GPT_ENT_TYPE_UNUSED;
|
||||
struct uuid freebsd = GPT_ENT_TYPE_FREEBSD;
|
||||
if (i >= GPT_MAX_SLICES)
|
||||
if (!is_gpt_hdr(hdr))
|
||||
break;
|
||||
ent = (void*)(buf + i * hdr->hdr_entsz);
|
||||
if (!memcmp(&ent->ent_type, &unused, sizeof(unused)))
|
||||
continue;
|
||||
gs->part[i] = g_malloc(hdr->hdr_entsz, M_WAITOK);
|
||||
if (gs->part[i] == NULL)
|
||||
break;
|
||||
bcopy(ent, gs->part[i], hdr->hdr_entsz);
|
||||
ps = (!memcmp(&ent->ent_type, &freebsd, sizeof(freebsd)))
|
||||
? 's' : 'p';
|
||||
g_topology_lock();
|
||||
(void)g_slice_addslice(gp, i, ent->ent_lba_start * secsz,
|
||||
(ent->ent_lba_end - ent->ent_lba_start + 1ULL) * secsz,
|
||||
"%s%c%d", gp->name, ps, i + 1);
|
||||
g_topology_unlock();
|
||||
npart++;
|
||||
}
|
||||
|
||||
g_free(buf);
|
||||
tblsz = (hdr->hdr_entries * hdr->hdr_entsz + secsz - 1) &
|
||||
~(secsz - 1);
|
||||
buf = g_read_data(cp, hdr->hdr_lba_table * secsz, tblsz, &error);
|
||||
|
||||
gsp->frontstuff = hdr->hdr_lba_start * secsz;
|
||||
|
||||
for (i = 0; i < hdr->hdr_entries; i++) {
|
||||
struct uuid unused = GPT_ENT_TYPE_UNUSED;
|
||||
struct uuid freebsd = GPT_ENT_TYPE_FREEBSD;
|
||||
if (i >= GPT_MAX_SLICES)
|
||||
break;
|
||||
ent = (void*)(buf + i * hdr->hdr_entsz);
|
||||
if (!memcmp(&ent->ent_type, &unused, sizeof(unused)))
|
||||
continue;
|
||||
gs->part[i] = g_malloc(hdr->hdr_entsz, M_WAITOK);
|
||||
if (gs->part[i] == NULL)
|
||||
break;
|
||||
bcopy(ent, gs->part[i], hdr->hdr_entsz);
|
||||
ps = (!memcmp(&ent->ent_type, &freebsd, sizeof(freebsd)))
|
||||
? 's' : 'p';
|
||||
g_topology_lock();
|
||||
(void)g_slice_addslice(gp, i,
|
||||
ent->ent_lba_start * secsz,
|
||||
(1 + ent->ent_lba_end - ent->ent_lba_start) * secsz,
|
||||
"%s%c%d", gp->name, ps, i + 1);
|
||||
g_topology_unlock();
|
||||
npart++;
|
||||
}
|
||||
g_free(buf);
|
||||
|
||||
} while (0);
|
||||
|
||||
|
||||
out:
|
||||
if (mbr != NULL)
|
||||
g_free(mbr);
|
||||
|
||||
|
@ -39,7 +39,6 @@ LIST_HEAD(class_list_head, g_class);
|
||||
TAILQ_HEAD(g_tailq_head, g_geom);
|
||||
TAILQ_HEAD(event_tailq_head, g_event);
|
||||
|
||||
extern struct g_tailq_head geoms;
|
||||
extern struct event_tailq_head events;
|
||||
extern int g_debugflags;
|
||||
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/sx.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/errno.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
@ -86,7 +85,7 @@ g_up_procbody(void)
|
||||
|
||||
mtx_init(&mymutex, "g_up", MTX_DEF, 0);
|
||||
mtx_lock(&mymutex);
|
||||
curthread->td_base_pri = PRIBIO;
|
||||
tp->td_base_pri = PRIBIO;
|
||||
for(;;) {
|
||||
g_io_schedule_up(tp);
|
||||
msleep(&g_wait_up, &mymutex, PRIBIO, "g_up", hz/10);
|
||||
@ -110,7 +109,7 @@ g_down_procbody(void)
|
||||
|
||||
mtx_init(&mymutex, "g_down", MTX_DEF, 0);
|
||||
mtx_lock(&mymutex);
|
||||
curthread->td_base_pri = PRIBIO;
|
||||
tp->td_base_pri = PRIBIO;
|
||||
for(;;) {
|
||||
g_io_schedule_down(tp);
|
||||
msleep(&g_wait_down, &mymutex, PRIBIO, "g_down", hz/10);
|
||||
@ -128,8 +127,10 @@ static struct proc *g_event_proc;
|
||||
static void
|
||||
g_event_procbody(void)
|
||||
{
|
||||
struct proc *p = g_down_proc;
|
||||
struct thread *tp = FIRST_THREAD_IN_PROC(p);
|
||||
|
||||
curthread->td_base_pri = PRIBIO;
|
||||
tp->td_base_pri = PRIBIO;
|
||||
for(;;) {
|
||||
g_run_events();
|
||||
tsleep(&g_wait_event, PRIBIO, "g_events", hz/10);
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include <sys/mutex.h>
|
||||
#endif
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <geom/geom.h>
|
||||
@ -196,7 +195,7 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist)
|
||||
error = g_getattr("GEOM::sectorsize", cp, §orsize);
|
||||
if (error)
|
||||
break;
|
||||
if (!error && sectorsize != 512)
|
||||
if (sectorsize != 512)
|
||||
break;
|
||||
gsp->frontstuff = sectorsize * fwsectors;
|
||||
#ifdef GEOM_GPT
|
||||
@ -358,7 +357,7 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
|
||||
error = g_getattr("GEOM::sectorsize", cp, §orsize);
|
||||
if (error)
|
||||
break;
|
||||
if (!error && sectorsize != 512)
|
||||
if (sectorsize != 512)
|
||||
break;
|
||||
gsp->frontstuff = sectorsize * fwsectors;
|
||||
for (;;) {
|
||||
|
@ -53,7 +53,6 @@
|
||||
#include <sys/mutex.h>
|
||||
#endif
|
||||
#include <sys/stdint.h>
|
||||
#include <sys/errno.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_slice.h>
|
||||
#include <machine/endian.h>
|
||||
|
@ -206,7 +206,7 @@ g_slice_start(struct bio *bp)
|
||||
}
|
||||
|
||||
void
|
||||
g_slice_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_consumer *cp __unused, struct g_provider *pp)
|
||||
g_slice_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp)
|
||||
{
|
||||
struct g_mbr_softc *mp;
|
||||
struct g_slicer *gsp;
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#endif
|
||||
#include <sys/errno.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_slice.h>
|
||||
#include <machine/endian.h>
|
||||
|
Loading…
Reference in New Issue
Block a user