Eliminate some thread pointers which do not make sense anymore.
Split private parts of geom.h into geom_int.h. The latter should never be included in class implemtations.
This commit is contained in:
parent
a9ce7dc604
commit
b1876192f0
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93250
@ -57,27 +57,18 @@ struct thread;
|
||||
struct bio;
|
||||
struct sbuf;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
#define G_CLASS_INITSTUFF { 0, 0 }, { 0 }, 0
|
||||
|
||||
typedef struct g_geom * g_create_geom_t (struct g_class *mp,
|
||||
struct g_provider *pp, char *name);
|
||||
typedef struct g_geom * g_taste_t (struct g_class *, struct g_provider *,
|
||||
struct thread *tp, int flags);
|
||||
int flags);
|
||||
#define G_TF_NORMAL 0
|
||||
#define G_TF_INSIST 1
|
||||
#define G_TF_TRANSPARENT 2
|
||||
typedef int g_access_t (struct g_provider *, int, int, int);
|
||||
/* XXX: not sure about the thread arg */
|
||||
typedef void g_orphan_t (struct g_consumer *, struct thread *);
|
||||
typedef void g_orphan_t (struct g_consumer *);
|
||||
|
||||
typedef void g_start_t (struct bio *);
|
||||
typedef void g_spoiled_t (struct g_consumer *);
|
||||
@ -168,30 +159,7 @@ struct g_provider {
|
||||
int index;
|
||||
};
|
||||
|
||||
/*
|
||||
* Various internal actions are tracked by tagging g_event[s] onto
|
||||
* an internal eventqueue.
|
||||
*/
|
||||
enum g_events {
|
||||
EV_NEW_CLASS, /* class */
|
||||
EV_NEW_PROVIDER, /* provider */
|
||||
EV_SPOILED, /* provider, consumer */
|
||||
EV_LAST
|
||||
};
|
||||
|
||||
struct g_event {
|
||||
enum g_events event;
|
||||
TAILQ_ENTRY(g_event) events;
|
||||
struct g_class *class;
|
||||
struct g_geom *geom;
|
||||
struct g_provider *provider;
|
||||
struct g_consumer *consumer;
|
||||
};
|
||||
|
||||
/* geom_dump.c */
|
||||
struct sbuf * g_conf(void);
|
||||
struct sbuf * g_conf_specific(struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp);
|
||||
struct sbuf * g_confdot(void);
|
||||
void g_hexdump(void *ptr, int length);
|
||||
void g_trace(int level, char *, ...);
|
||||
# define G_T_TOPOLOGY 1
|
||||
@ -206,11 +174,8 @@ uint32_t g_dec_le4(u_char *p);
|
||||
void g_enc_le4(u_char *p, uint32_t u);
|
||||
|
||||
/* geom_event.c */
|
||||
void g_event_init(void);
|
||||
void g_orphan_provider(struct g_provider *pp, int error);
|
||||
void g_post_event(enum g_events ev, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp);
|
||||
void g_rattle(void);
|
||||
void g_run_events(struct thread *tp);
|
||||
void g_silence(void);
|
||||
|
||||
/* geom_subr.c */
|
||||
@ -228,7 +193,6 @@ int g_haveattr(struct bio *bp, char *attribute, void *val, int len);
|
||||
int g_haveattr_int(struct bio *bp, char *attribute, int val);
|
||||
int g_haveattr_off_t(struct bio *bp, char *attribute, off_t val);
|
||||
struct g_geom * g_insert_geom(char *class, struct g_consumer *cp);
|
||||
extern struct class_list_head g_classs;
|
||||
struct g_consumer * g_new_consumer(struct g_geom *gp);
|
||||
struct g_geom * g_new_geomf(struct g_class *mp, char *fmt, ...);
|
||||
struct g_provider * g_new_providerf(struct g_geom *gp, char *fmt, ...);
|
||||
@ -236,23 +200,18 @@ void g_spoil(struct g_provider *pp, struct g_consumer *cp);
|
||||
int g_std_access(struct g_provider *pp, int dr, int dw, int de);
|
||||
void g_std_done(struct bio *bp);
|
||||
void g_std_spoiled(struct g_consumer *cp);
|
||||
extern char *g_wait_event, *g_wait_sim, *g_wait_up, *g_wait_down;
|
||||
|
||||
/* geom_io.c */
|
||||
struct bio * g_clone_bio(struct bio *);
|
||||
void g_destroy_bio(struct bio *);
|
||||
void g_io_deliver(struct bio *bp);
|
||||
int g_io_getattr(char *attr, struct g_consumer *cp, int *len, void *ptr, struct thread *tp);
|
||||
void g_io_init(void);
|
||||
int g_io_getattr(char *attr, struct g_consumer *cp, int *len, void *ptr);
|
||||
void g_io_request(struct bio *bp, struct g_consumer *cp);
|
||||
void g_io_schedule_down(struct thread *tp);
|
||||
void g_io_schedule_up(struct thread *tp);
|
||||
int g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr, struct thread *tp);
|
||||
int g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr);
|
||||
struct bio *g_new_bio(void);
|
||||
void * g_read_data(struct g_consumer *cp, off_t offset, off_t length, int *error);
|
||||
|
||||
/* geom_kern.c / geom_kernsim.c */
|
||||
void g_init(void);
|
||||
|
||||
struct g_ioctl {
|
||||
u_long cmd;
|
||||
|
@ -319,7 +319,7 @@ g_bsd_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_consum
|
||||
}
|
||||
|
||||
static struct g_geom *
|
||||
g_bsd_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int flags)
|
||||
g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_consumer *cp;
|
||||
@ -345,18 +345,18 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int fl
|
||||
npart = 0;
|
||||
while (1) { /* a trick to allow us to use break */
|
||||
j = sizeof i;
|
||||
error = g_io_getattr("MBR::type", cp, &j, &i, tp);
|
||||
error = g_io_getattr("MBR::type", cp, &j, &i);
|
||||
if (!error && i != 165 && flags == G_TF_NORMAL)
|
||||
break;
|
||||
j = sizeof secsize;
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &secsize, tp);
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &secsize);
|
||||
if (error) {
|
||||
secsize = 512;
|
||||
printf("g_bsd_taste: error %d Sectors are %d bytes\n",
|
||||
error, secsize);
|
||||
}
|
||||
j = sizeof mediasize;
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &j, &mediasize, tp);
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &j, &mediasize);
|
||||
if (error) {
|
||||
mediasize = 0;
|
||||
printf("g_error %d Mediasize is %lld bytes\n",
|
||||
@ -404,12 +404,12 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int fl
|
||||
dl->d_secsize = secsize;
|
||||
dl->d_rpm = 3600;
|
||||
j = sizeof fwsectors;
|
||||
error = g_io_getattr("GEOM::fwsectors", cp, &j, &fwsectors, tp);
|
||||
error = g_io_getattr("GEOM::fwsectors", cp, &j, &fwsectors);
|
||||
if (error)
|
||||
dl->d_nsectors = 32;
|
||||
else
|
||||
dl->d_nsectors = fwsectors;
|
||||
error = g_io_getattr("GEOM::fwheads", cp, &j, &fwheads, tp);
|
||||
error = g_io_getattr("GEOM::fwheads", cp, &j, &fwheads);
|
||||
if (error)
|
||||
dl->d_ntracks = 64;
|
||||
else
|
||||
|
@ -124,7 +124,7 @@ g_dev_register_cloner(void *foo __unused)
|
||||
SYSINIT(geomdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,g_dev_register_cloner,NULL);
|
||||
|
||||
static struct g_geom *
|
||||
g_dev_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp __unused, int insist __unused)
|
||||
g_dev_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_consumer *cp;
|
||||
@ -146,14 +146,14 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp __unuse
|
||||
g_topology_unlock();
|
||||
if (!error) {
|
||||
j = sizeof secsize;
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &secsize, tp);
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &secsize);
|
||||
if (error) {
|
||||
secsize = 512;
|
||||
printf("g_bsd_taste: error %d Sectors are %d bytes\n",
|
||||
error, secsize);
|
||||
}
|
||||
j = sizeof mediasize;
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &j, &mediasize, tp);
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &j, &mediasize);
|
||||
if (error) {
|
||||
mediasize = 0;
|
||||
printf("g_error %d Mediasize is %lld bytes\n",
|
||||
@ -251,19 +251,19 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
|
||||
i = IOCPARM_LEN(cmd);
|
||||
switch (cmd) {
|
||||
case DIOCGSECTORSIZE:
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &i, data, td);
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &i, data);
|
||||
break;
|
||||
case DIOCGMEDIASIZE:
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &i, data, td);
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &i, data);
|
||||
break;
|
||||
case DIOCGFWSECTORS:
|
||||
error = g_io_getattr("GEOM::fwsectors", cp, &i, data, td);
|
||||
error = g_io_getattr("GEOM::fwsectors", cp, &i, data);
|
||||
break;
|
||||
case DIOCGFWHEADS:
|
||||
error = g_io_getattr("GEOM::fwheads", cp, &i, data, td);
|
||||
error = g_io_getattr("GEOM::fwheads", cp, &i, data);
|
||||
break;
|
||||
case DIOCGFWCYLINDERS:
|
||||
error = g_io_getattr("GEOM::fwcylinders", cp, &i, data, td);
|
||||
error = g_io_getattr("GEOM::fwcylinders", cp, &i, data);
|
||||
break;
|
||||
default:
|
||||
gio = g_malloc(sizeof *gio, M_WAITOK);
|
||||
@ -273,9 +273,9 @@ g_dev_ioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
|
||||
gio->td = td;
|
||||
i = sizeof *gio;
|
||||
if (cmd & IOC_IN)
|
||||
error = g_io_setattr("GEOM::ioctl", cp, i, gio, td);
|
||||
error = g_io_setattr("GEOM::ioctl", cp, i, gio);
|
||||
else
|
||||
error = g_io_getattr("GEOM::ioctl", cp, &i, gio, td);
|
||||
error = g_io_getattr("GEOM::ioctl", cp, &i, gio);
|
||||
g_free(gio);
|
||||
break;
|
||||
}
|
||||
@ -315,7 +315,7 @@ g_dev_psize(dev_t dev)
|
||||
cp = dev->si_drv2;
|
||||
|
||||
i = sizeof mediasize;
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &i, &mediasize, NULL);
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &i, &mediasize);
|
||||
if (error)
|
||||
return (-1);
|
||||
return (mediasize >> DEV_BSHIFT);
|
||||
@ -367,7 +367,7 @@ g_dev_strategy(struct bio *bp)
|
||||
|
||||
|
||||
static void
|
||||
g_dev_orphan(struct g_consumer *cp, struct thread *tp)
|
||||
g_dev_orphan(struct g_consumer *cp)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
dev_t dev;
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
|
||||
static void
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include <sys/malloc.h>
|
||||
#endif
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
uint32_t
|
||||
g_dec_be2(u_char *p)
|
||||
|
@ -58,10 +58,11 @@
|
||||
#include <sys/errno.h>
|
||||
#include <sys/time.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
static struct event_tailq_head g_events = TAILQ_HEAD_INITIALIZER(g_events);
|
||||
static u_int g_pending_events, g_silence_events;
|
||||
static void g_do_event(struct g_event *ep, struct thread *tp);
|
||||
static void g_do_event(struct g_event *ep);
|
||||
static TAILQ_HEAD(,g_provider) g_doorstep = TAILQ_HEAD_INITIALIZER(g_doorstep);
|
||||
static struct mtx g_doorlock;
|
||||
|
||||
@ -108,7 +109,7 @@ g_orphan_provider(struct g_provider *pp, int error)
|
||||
*/
|
||||
|
||||
static void
|
||||
g_orphan_register(struct g_provider *pp, struct thread *tp)
|
||||
g_orphan_register(struct g_provider *pp)
|
||||
{
|
||||
struct g_consumer *cp, *cp2;
|
||||
|
||||
@ -125,7 +126,7 @@ g_orphan_register(struct g_provider *pp, struct thread *tp)
|
||||
KASSERT(cp->geom->class->orphan != NULL,
|
||||
("class %s has no orphan, geom %s",
|
||||
cp->geom->class->name, cp->geom->name));
|
||||
cp->geom->class->orphan(cp, tp);
|
||||
cp->geom->class->orphan(cp);
|
||||
cp = cp2;
|
||||
}
|
||||
}
|
||||
@ -138,7 +139,7 @@ g_destroy_event(struct g_event *ep)
|
||||
}
|
||||
|
||||
static void
|
||||
g_do_event(struct g_event *ep, struct thread *tp)
|
||||
g_do_event(struct g_event *ep)
|
||||
{
|
||||
struct g_class *mp, *mp2;
|
||||
struct g_geom *gp;
|
||||
@ -159,7 +160,7 @@ g_do_event(struct g_event *ep, struct thread *tp)
|
||||
continue;
|
||||
LIST_FOREACH(gp, &mp->geom, geom) {
|
||||
LIST_FOREACH(pp, &gp->provider, provider) {
|
||||
mp2->taste(ep->class, pp, tp, 0);
|
||||
mp2->taste(ep->class, pp, 0);
|
||||
g_topology_assert();
|
||||
}
|
||||
}
|
||||
@ -176,7 +177,7 @@ g_do_event(struct g_event *ep, struct thread *tp)
|
||||
if(cp->geom->class == mp)
|
||||
i = 0;
|
||||
if (i) {
|
||||
mp->taste(mp, ep->provider, tp, 0);
|
||||
mp->taste(mp, ep->provider, 0);
|
||||
g_topology_assert();
|
||||
}
|
||||
}
|
||||
@ -204,7 +205,7 @@ g_do_event(struct g_event *ep, struct thread *tp)
|
||||
}
|
||||
|
||||
static int
|
||||
one_event(struct thread *tp)
|
||||
one_event(void)
|
||||
{
|
||||
struct g_event *ep;
|
||||
struct g_provider *pp;
|
||||
@ -218,7 +219,7 @@ one_event(struct thread *tp)
|
||||
mtx_unlock(&g_doorlock);
|
||||
if (pp == NULL)
|
||||
break;
|
||||
g_orphan_register(pp, tp);
|
||||
g_orphan_register(pp);
|
||||
}
|
||||
ep = TAILQ_FIRST(&g_events);
|
||||
if (ep == NULL) {
|
||||
@ -234,7 +235,7 @@ one_event(struct thread *tp)
|
||||
ep->provider->event = NULL;
|
||||
if (ep->consumer != NULL)
|
||||
ep->consumer->event = NULL;
|
||||
g_do_event(ep, tp);
|
||||
g_do_event(ep);
|
||||
g_pending_events--;
|
||||
if (g_pending_events == 0) {
|
||||
mtx_lock(&Giant);
|
||||
@ -247,10 +248,10 @@ one_event(struct thread *tp)
|
||||
}
|
||||
|
||||
void
|
||||
g_run_events(struct thread *tp)
|
||||
g_run_events()
|
||||
{
|
||||
|
||||
while (one_event(tp))
|
||||
while (one_event())
|
||||
;
|
||||
}
|
||||
|
||||
|
87
sys/geom/geom_int.h
Normal file
87
sys/geom/geom_int.h
Normal file
@ -0,0 +1,87 @@
|
||||
/*-
|
||||
* Copyright (c) 2002 Poul-Henning Kamp
|
||||
* Copyright (c) 2002 Networks Associates Technology, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software was developed for the FreeBSD Project by Poul-Henning Kamp
|
||||
* and NAI Labs, the Security Research Division of Network Associates, Inc.
|
||||
* under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
|
||||
* DARPA CHATS research program.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The names of the authors may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/*
|
||||
* Various internal actions are tracked by tagging g_event[s] onto
|
||||
* an internal eventqueue.
|
||||
*/
|
||||
enum g_events {
|
||||
EV_NEW_CLASS, /* class */
|
||||
EV_NEW_PROVIDER, /* provider */
|
||||
EV_SPOILED, /* provider, consumer */
|
||||
EV_LAST
|
||||
};
|
||||
|
||||
struct g_event {
|
||||
enum g_events event;
|
||||
TAILQ_ENTRY(g_event) events;
|
||||
struct g_class *class;
|
||||
struct g_geom *geom;
|
||||
struct g_provider *provider;
|
||||
struct g_consumer *consumer;
|
||||
};
|
||||
|
||||
/* geom_dump.c */
|
||||
struct sbuf * g_conf(void);
|
||||
struct sbuf * g_conf_specific(struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp);
|
||||
struct sbuf * g_confdot(void);
|
||||
|
||||
|
||||
/* geom_event.c */
|
||||
void g_event_init(void);
|
||||
void g_post_event(enum g_events ev, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp);
|
||||
void g_run_events(void);
|
||||
|
||||
/* geom_subr.c */
|
||||
extern struct class_list_head g_classs;
|
||||
extern char *g_wait_event, *g_wait_sim, *g_wait_up, *g_wait_down;
|
||||
|
||||
/* geom_io.c */
|
||||
void g_io_init(void);
|
||||
void g_io_schedule_down(struct thread *tp);
|
||||
void g_io_schedule_up(struct thread *tp);
|
||||
|
||||
/* geom_kern.c / geom_kernsim.c */
|
||||
void g_init(void);
|
@ -53,6 +53,7 @@
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
static struct g_bioq g_bio_run_down;
|
||||
static struct g_bioq g_bio_run_up;
|
||||
@ -163,7 +164,7 @@ g_io_init()
|
||||
}
|
||||
|
||||
int
|
||||
g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr, struct thread *tp __unused)
|
||||
g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr)
|
||||
{
|
||||
struct bio *bp;
|
||||
int error;
|
||||
@ -192,7 +193,7 @@ g_io_setattr(char *attr, struct g_consumer *cp, int len, void *ptr, struct threa
|
||||
|
||||
|
||||
int
|
||||
g_io_getattr(char *attr, struct g_consumer *cp, int *len, void *ptr, struct thread *tp __unused)
|
||||
g_io_getattr(char *attr, struct g_consumer *cp, int *len, void *ptr)
|
||||
{
|
||||
struct bio *bp;
|
||||
int error;
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include <sys/sbuf.h>
|
||||
#include <sys/errno.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
|
||||
MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures");
|
||||
|
||||
@ -107,12 +108,10 @@ static struct proc *g_event_proc;
|
||||
static void
|
||||
g_event_procbody(void)
|
||||
{
|
||||
struct proc *p = g_event_proc;
|
||||
struct thread *tp = &p->p_xxthread;
|
||||
|
||||
curthread->td_base_pri = PRIBIO;
|
||||
for(;;) {
|
||||
g_run_events(tp);
|
||||
g_run_events();
|
||||
mtx_lock(&Giant);
|
||||
tsleep(&g_wait_event, PRIBIO, "g_events", hz/10);
|
||||
mtx_unlock(&Giant);
|
||||
|
@ -164,7 +164,7 @@ g_mbr_print(int i __unused, struct dos_partition *dp __unused)
|
||||
}
|
||||
|
||||
static struct g_geom *
|
||||
g_mbr_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int insist)
|
||||
g_mbr_taste(struct g_class *mp, struct g_provider *pp, int insist)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_consumer *cp;
|
||||
@ -192,7 +192,7 @@ g_mbr_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int in
|
||||
break;
|
||||
j = sizeof i;
|
||||
/* For now we only support 512 bytes sectors */
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &i, tp);
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &i);
|
||||
if (!error && i != 512)
|
||||
break;
|
||||
buf = g_read_data(cp, 0, 512, &error);
|
||||
@ -304,7 +304,7 @@ g_mbrext_print(int i, struct dos_partition *dp)
|
||||
}
|
||||
|
||||
static struct g_geom *
|
||||
g_mbrext_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp __unused, int insist __unused)
|
||||
g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_consumer *cp;
|
||||
@ -328,7 +328,7 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp __un
|
||||
slice = 0;
|
||||
while (1) { /* a trick to allow us to use break */
|
||||
j = sizeof i;
|
||||
error = g_io_getattr("MBR::type", cp, &j, &i, tp);
|
||||
error = g_io_getattr("MBR::type", cp, &j, &i);
|
||||
if (error || i != DOSPTYP_EXT)
|
||||
break;
|
||||
for (;;) {
|
||||
|
@ -247,7 +247,7 @@ g_slice_new(struct g_class *mp, int slices, struct g_provider *pp, struct g_cons
|
||||
}
|
||||
|
||||
void
|
||||
g_slice_orphan(struct g_consumer *cp, struct thread *tp __unused)
|
||||
g_slice_orphan(struct g_consumer *cp)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_provider *pp;
|
||||
|
@ -50,7 +50,7 @@ struct g_slicer {
|
||||
g_slice_start_t *start;
|
||||
};
|
||||
|
||||
void g_slice_orphan(struct g_consumer *cp, struct thread *tp);
|
||||
g_orphan_t g_slice_orphan;
|
||||
struct g_slicer * g_slice_init(unsigned nslice, unsigned scsize);
|
||||
int g_slice_access(struct g_provider *pp, int dr, int dw, int de);
|
||||
void g_slice_start(struct bio *bp);
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include <sys/errno.h>
|
||||
#include <sys/sbuf.h>
|
||||
#include <geom/geom.h>
|
||||
#include <geom/geom_int.h>
|
||||
#include <machine/stdarg.h>
|
||||
|
||||
struct class_list_head g_classs = LIST_HEAD_INITIALIZER(g_classs);
|
||||
@ -590,7 +591,7 @@ g_create_geomf(char *class, struct g_provider *pp, char *fmt, ...)
|
||||
s = NULL;
|
||||
}
|
||||
if (pp != NULL)
|
||||
gp = mp->taste(mp, pp, NULL, G_TF_INSIST);
|
||||
gp = mp->taste(mp, pp, G_TF_INSIST);
|
||||
if (gp == NULL && mp->create_geom == NULL)
|
||||
return (NULL);
|
||||
if (gp == NULL)
|
||||
@ -618,7 +619,7 @@ g_insert_geom(char *class, struct g_consumer *cp)
|
||||
if (mp->create_geom == NULL)
|
||||
return (NULL);
|
||||
pp = cp->provider;
|
||||
gp = mp->taste(mp, pp, NULL, G_TF_TRANSPARENT);
|
||||
gp = mp->taste(mp, pp, G_TF_TRANSPARENT);
|
||||
if (gp == NULL)
|
||||
return (NULL);
|
||||
pp2 = LIST_FIRST(&gp->provider);
|
||||
|
@ -84,7 +84,7 @@ g_sunlabel_dumpconf(struct sbuf *sb, char *indent, struct g_geom *gp, struct g_c
|
||||
}
|
||||
|
||||
static struct g_geom *
|
||||
g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, int flags)
|
||||
g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, int flags)
|
||||
{
|
||||
struct g_geom *gp;
|
||||
struct g_consumer *cp;
|
||||
@ -110,14 +110,14 @@ g_sunlabel_taste(struct g_class *mp, struct g_provider *pp, struct thread *tp, i
|
||||
if (gp->rank != 2 && flags == G_TF_NORMAL)
|
||||
break;
|
||||
j = sizeof secsize;
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &secsize, tp);
|
||||
error = g_io_getattr("GEOM::sectorsize", cp, &j, &secsize);
|
||||
if (error) {
|
||||
secsize = 512;
|
||||
printf("g_sunlabel_taste: error %d Sectors are %d bytes\n",
|
||||
error, secsize);
|
||||
}
|
||||
j = sizeof mediasize;
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &j, &mediasize, tp);
|
||||
error = g_io_getattr("GEOM::mediasize", cp, &j, &mediasize);
|
||||
if (error) {
|
||||
mediasize = 0;
|
||||
printf("g_error %d Mediasize is %lld bytes\n",
|
||||
|
Loading…
Reference in New Issue
Block a user