Remove local definitions of RANGEOF() and use __rangeof() instead.

Also remove a few bogus casts.
This commit is contained in:
David Schultz 2004-11-20 23:00:59 +00:00
parent 7b90b2998e
commit 6db36923ad
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=137946
6 changed files with 17 additions and 35 deletions

View File

@ -467,22 +467,19 @@ fork1(td, flags, pages, procp)
PROC_LOCK(p2);
PROC_LOCK(p1);
#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start))
bzero(&p2->p_startzero,
(unsigned) RANGEOF(struct proc, p_startzero, p_endzero));
__rangeof(struct proc, p_startzero, p_endzero));
bzero(&td2->td_startzero,
(unsigned) RANGEOF(struct thread, td_startzero, td_endzero));
__rangeof(struct thread, td_startzero, td_endzero));
bzero(&kg2->kg_startzero,
(unsigned) RANGEOF(struct ksegrp, kg_startzero, kg_endzero));
__rangeof(struct ksegrp, kg_startzero, kg_endzero));
bcopy(&p1->p_startcopy, &p2->p_startcopy,
(unsigned) RANGEOF(struct proc, p_startcopy, p_endcopy));
__rangeof(struct proc, p_startcopy, p_endcopy));
bcopy(&td->td_startcopy, &td2->td_startcopy,
(unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy));
__rangeof(struct thread, td_startcopy, td_endcopy));
bcopy(&td->td_ksegrp->kg_startcopy, &kg2->kg_startcopy,
(unsigned) RANGEOF(struct ksegrp, kg_startcopy, kg_endcopy));
#undef RANGEOF
__rangeof(struct ksegrp, kg_startcopy, kg_endcopy));
td2->td_sigstk = td->td_sigstk;

View File

@ -61,8 +61,6 @@ extern int max_threads_hits;
extern struct mtx kse_zombie_lock;
#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start))
TAILQ_HEAD(, kse_upcall) zombie_upcalls =
TAILQ_HEAD_INITIALIZER(zombie_upcalls);
@ -600,10 +598,10 @@ kse_create(struct thread *td, struct kse_create_args *uap)
if (uap->newgroup) {
newkg = ksegrp_alloc();
bzero(&newkg->kg_startzero, RANGEOF(struct ksegrp,
kg_startzero, kg_endzero));
bzero(&newkg->kg_startzero,
__rangeof(struct ksegrp, kg_startzero, kg_endzero));
bcopy(&kg->kg_startcopy, &newkg->kg_startcopy,
RANGEOF(struct ksegrp, kg_startcopy, kg_endcopy));
__rangeof(struct ksegrp, kg_startcopy, kg_endcopy));
sched_init_concurrency(newkg);
PROC_LOCK(p);
if (p->p_numksegrps >= max_groups_per_proc) {
@ -1033,7 +1031,7 @@ thread_alloc_spare(struct thread *td)
spare = thread_alloc();
td->td_standin = spare;
bzero(&spare->td_startzero,
(unsigned) RANGEOF(struct thread, td_startzero, td_endzero));
__rangeof(struct thread, td_startzero, td_endzero));
spare->td_proc = td->td_proc;
spare->td_ucred = crhold(td->td_ucred);
}
@ -1068,7 +1066,7 @@ thread_schedule_upcall(struct thread *td, struct kse_upcall *ku)
* do the crhold here because we are in schedlock already.
*/
bcopy(&td->td_startcopy, &td2->td_startcopy,
(unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy));
__rangeof(struct thread, td_startcopy, td_endcopy));
thread_link(td2, ku->ku_ksegrp);
/* inherit parts of blocked thread's context as a good template */
cpu_set_upcall(td2, td);

View File

@ -827,13 +827,10 @@ void
pstats_fork(struct pstats *src, struct pstats *dst)
{
#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start))
bzero(&dst->pstat_startzero,
(unsigned)RANGEOF(struct pstats, pstat_startzero, pstat_endzero));
__rangeof(struct pstats, pstat_startzero, pstat_endzero));
bcopy(&src->pstat_startcopy, &dst->pstat_startcopy,
(unsigned)RANGEOF(struct pstats, pstat_startcopy, pstat_endcopy));
#undef RANGEOF
__rangeof(struct pstats, pstat_startcopy, pstat_endcopy));
}
void

View File

@ -910,7 +910,6 @@ runq_remove(struct runq *rq, struct kse *ke)
/****** functions that are temporarily here ***********/
#include <vm/uma.h>
#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start))
extern struct mtx kse_zombie_lock;
/*
@ -929,7 +928,6 @@ sched_newproc(struct proc *p, struct ksegrp *kg, struct thread *td)
sched_init_concurrency(kg);
}
#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start))
/*
* thread is being either created or recycled.
* Fix up the per-scheduler resources associated with it.

View File

@ -57,12 +57,6 @@ static int thr_concurrency = 0;
SYSCTL_INT(_kern_threads, OID_AUTO, thr_concurrency, CTLFLAG_RW,
&thr_concurrency, 0, "a concurrency value if not default");
/*
* Back end support functions.
*/
#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start))
/*
* System call interface.
*/
@ -109,15 +103,15 @@ thr_create(struct thread *td, struct thr_create_args *uap)
}
bzero(&newtd->td_startzero,
(unsigned) RANGEOF(struct thread, td_startzero, td_endzero));
__rangeof(struct thread, td_startzero, td_endzero));
bcopy(&td->td_startcopy, &newtd->td_startcopy,
(unsigned) RANGEOF(struct thread, td_startcopy, td_endcopy));
__rangeof(struct thread, td_startcopy, td_endcopy));
if (scope_sys) {
bzero(&newkg->kg_startzero,
(unsigned)RANGEOF(struct ksegrp, kg_startzero, kg_endzero));
__rangeof(struct ksegrp, kg_startzero, kg_endzero));
bcopy(&kg->kg_startcopy, &newkg->kg_startcopy,
(unsigned)RANGEOF(struct ksegrp, kg_startcopy, kg_endcopy));
__rangeof(struct ksegrp, kg_startcopy, kg_endcopy));
}
newtd->td_proc = td->td_proc;

View File

@ -72,8 +72,6 @@ SYSCTL_INT(_kern_threads, OID_AUTO, max_threads_hits, CTLFLAG_RD,
int virtual_cpu;
#define RANGEOF(type, start, end) (offsetof(type, end) - offsetof(type, start))
TAILQ_HEAD(, thread) zombie_threads = TAILQ_HEAD_INITIALIZER(zombie_threads);
TAILQ_HEAD(, ksegrp) zombie_ksegrps = TAILQ_HEAD_INITIALIZER(zombie_ksegrps);
struct mtx kse_zombie_lock;