diff options
author | anton <anton@cvs.openbsd.org> | 2018-08-27 15:57:40 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2018-08-27 15:57:40 +0000 |
commit | bb7d9dc6ea1c7b7297247257f3cfbcb4d1996c49 (patch) | |
tree | aec73a6c7383cb10e61fe532e6d5759126fa2929 | |
parent | 67367c30476370e261ea5e7885e6cc1edab0382f (diff) |
Rename struct kd -> kcov_dev. The terse name was initially fine since it wasn't
used outside of dev/kcov.c. Nowadays, struct proc includes a kcov pointer and it
therefore deserves a more descriptive name.
Prodded by visa@; ok deraadt@ visa@
-rw-r--r-- | sys/dev/kcov.c | 37 | ||||
-rw-r--r-- | sys/sys/proc.h | 6 |
2 files changed, 21 insertions, 22 deletions
diff --git a/sys/dev/kcov.c b/sys/dev/kcov.c index 5f82b2ae0a7..8e36bc8b8ef 100644 --- a/sys/dev/kcov.c +++ b/sys/dev/kcov.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kcov.c,v 1.3 2018/08/25 15:38:07 anton Exp $ */ +/* $OpenBSD: kcov.c,v 1.4 2018/08/27 15:57:39 anton Exp $ */ /* * Copyright (c) 2018 Anton Lindqvist <anton@openbsd.org> @@ -33,8 +33,7 @@ #define DPRINTF(x...) #endif -/* kcov descriptor */ -struct kd { +struct kcov_dev { enum { KCOV_MODE_DISABLED, KCOV_MODE_INIT, @@ -46,18 +45,18 @@ struct kd { size_t kd_nmemb; size_t kd_size; - TAILQ_ENTRY(kd) kd_entry; + TAILQ_ENTRY(kcov_dev) kd_entry; }; void kcovattach(int); -int kd_alloc(struct kd *, unsigned long); -void kd_free(struct kd *); -struct kd *kd_lookup(int); +int kd_alloc(struct kcov_dev *, unsigned long); +void kd_free(struct kcov_dev *); +struct kcov_dev *kd_lookup(int); static inline int inintr(void); -TAILQ_HEAD(, kd) kd_list = TAILQ_HEAD_INITIALIZER(kd_list); +TAILQ_HEAD(, kcov_dev) kd_list = TAILQ_HEAD_INITIALIZER(kd_list); #ifdef KCOV_DEBUG int kcov_debug = 1; @@ -78,7 +77,7 @@ void __sanitizer_cov_trace_pc(void) { extern int cold; - struct kd *kd; + struct kcov_dev *kd; uint64_t idx; /* Do not trace during boot. */ @@ -108,7 +107,7 @@ kcovattach(int count) int kcovopen(dev_t dev, int flag, int mode, struct proc *p) { - struct kd *kd; + struct kcov_dev *kd; if (kd_lookup(minor(dev)) != NULL) return (EBUSY); @@ -124,7 +123,7 @@ kcovopen(dev_t dev, int flag, int mode, struct proc *p) int kcovclose(dev_t dev, int flag, int mode, struct proc *p) { - struct kd *kd; + struct kcov_dev *kd; kd = kd_lookup(minor(dev)); if (kd == NULL) @@ -143,7 +142,7 @@ kcovclose(dev_t dev, int flag, int mode, struct proc *p) int kcovioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) { - struct kd *kd; + struct kcov_dev *kd; int error = 0; kd = kd_lookup(minor(dev)); @@ -192,7 +191,7 @@ kcovioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p) paddr_t kcovmmap(dev_t dev, off_t offset, int prot) { - struct kd *kd; + struct kcov_dev *kd; paddr_t pa; vaddr_t va; @@ -212,7 +211,7 @@ kcovmmap(dev_t dev, off_t offset, int prot) void kcov_exit(struct proc *p) { - struct kd *kd; + struct kcov_dev *kd; kd = p->p_kd; if (kd == NULL) @@ -227,10 +226,10 @@ kcov_exit(struct proc *p) p->p_kd = NULL; } -struct kd * +struct kcov_dev * kd_lookup(int unit) { - struct kd *kd; + struct kcov_dev *kd; TAILQ_FOREACH(kd, &kd_list, kd_entry) { if (kd->kd_unit == unit) @@ -240,7 +239,7 @@ kd_lookup(int unit) } int -kd_alloc(struct kd *kd, unsigned long nmemb) +kd_alloc(struct kcov_dev *kd, unsigned long nmemb) { size_t size; @@ -258,13 +257,13 @@ kd_alloc(struct kd *kd, unsigned long nmemb) } void -kd_free(struct kd *kd) +kd_free(struct kcov_dev *kd) { DPRINTF("%s: unit=%d mode=%d\n", __func__, kd->kd_unit, kd->kd_mode); TAILQ_REMOVE(&kd_list, kd, kd_entry); free(kd->kd_buf, M_SUBPROC, kd->kd_size); - free(kd, M_SUBPROC, sizeof(struct kd)); + free(kd, M_SUBPROC, sizeof(*kd)); } static inline int diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 924413f7e09..c6858d178f3 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.257 2018/08/25 15:38:07 anton Exp $ */ +/* $OpenBSD: proc.h,v 1.258 2018/08/27 15:57:39 anton Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -288,7 +288,7 @@ struct process { "\024NOBROADCASTKILL" "\025PLEDGE" "\026WXNEEDED" "\027EXECPLEDGE" ) -struct kd; +struct kcov_dev; struct lock_list_entry; struct proc { @@ -376,7 +376,7 @@ struct proc { struct lock_list_entry *p_sleeplocks; - struct kd *p_kd; /* kcov descriptor */ + struct kcov_dev *p_kd; }; /* Status values. */ |