FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_mac.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/lock.h>
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/alq.h>
#include <sys/malloc.h>
#include <sys/unistd.h>
#include <sys/fcntl.h>
#include <sys/eventhandler.h>
#include <security/mac/mac_framework.h>
Go to the source code of this file.
Data Structures | |
struct | alq |
Macros | |
#define | AQ_WANTED 0x0001 /* Wakeup sleeper when io is done */ |
#define | AQ_ACTIVE 0x0002 /* on the active list */ |
#define | AQ_FLUSHING 0x0004 /* doing IO */ |
#define | AQ_SHUTDOWN 0x0008 /* Queue no longer valid */ |
#define | AQ_ORDERED 0x0010 /* Queue enforces ordered writes */ |
#define | AQ_LEGACY 0x0020 /* Legacy queue (fixed length writes) */ |
#define | ALQ_LOCK(alq) mtx_lock_spin(&(alq)->aq_mtx) |
#define | ALQ_UNLOCK(alq) mtx_unlock_spin(&(alq)->aq_mtx) |
#define | HAS_PENDING_DATA(alq) ((alq)->aq_freebytes != (alq)->aq_buflen) |
#define | ALD_LOCK() mtx_lock(&ald_mtx) |
#define | ALD_UNLOCK() mtx_unlock(&ald_mtx) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static | MALLOC_DEFINE (M_ALD,"ALD","ALD") |
static | LIST_HEAD (alq) |
static int | ald_rem (struct alq *alq) |
static void | ald_activate (struct alq *alq) |
static void | ald_deactivate (struct alq *alq) |
static void | ald_startup (void *unused) |
static void | ald_daemon (void) |
static void | ald_shutdown (void *arg, int howto) |
static void | alq_shutdown (struct alq *alq) |
void | alq_destroy (struct alq *alq) |
static int | alq_doio (struct alq *alq) |
SYSINIT (aldthread, SI_SUB_KTHREAD_IDLE, SI_ORDER_ANY, kproc_start,&ald_kp) | |
SYSINIT (ald, SI_SUB_LOCK, SI_ORDER_ANY, ald_startup, NULL) | |
int | alq_open_flags (struct alq **alqp, const char *file, struct ucred *cred, int cmode, int size, int flags) |
int | alq_open (struct alq **alqp, const char *file, struct ucred *cred, int cmode, int size, int count) |
int | alq_writen (struct alq *alq, void *data, int len, int flags) |
int | alq_write (struct alq *alq, void *data, int flags) |
struct ale * | alq_getn (struct alq *alq, int len, int flags) |
struct ale * | alq_get (struct alq *alq, int flags) |
void | alq_post_flags (struct alq *alq, struct ale *ale, int flags) |
void | alq_flush (struct alq *alq) |
void | alq_close (struct alq *alq) |
static int | alq_load_handler (module_t mod, int what, void *arg) |
DECLARE_MODULE (alq, alq_mod, SI_SUB_SMP, SI_ORDER_ANY) | |
MODULE_VERSION (alq, 1) | |
Variables | |
static struct mtx | ald_mtx |
static struct kproc_desc | ald_kp |
static moduledata_t | alq_mod |
#define ALD_LOCK | ( | ) | mtx_lock(&ald_mtx) |
Referenced by ald_daemon(), ald_rem(), ald_shutdown(), alq_flush(), alq_load_handler(), alq_post_flags(), alq_shutdown(), and alq_writen().
#define ALD_UNLOCK | ( | ) | mtx_unlock(&ald_mtx) |
Referenced by ald_daemon(), ald_rem(), ald_shutdown(), alq_flush(), alq_load_handler(), alq_post_flags(), alq_shutdown(), and alq_writen().
Definition at line 86 of file kern_alq.c.
Referenced by ald_daemon(), alq_doio(), alq_flush(), alq_getn(), alq_shutdown(), and alq_writen().
Definition at line 87 of file kern_alq.c.
Referenced by ald_daemon(), alq_doio(), alq_flush(), alq_getn(), alq_post_flags(), alq_shutdown(), and alq_writen().
#define AQ_ACTIVE 0x0002 /* on the active list */ |
Definition at line 80 of file kern_alq.c.
Referenced by ald_deactivate(), alq_flush(), alq_getn(), alq_post_flags(), alq_shutdown(), and alq_writen().
#define AQ_FLUSHING 0x0004 /* doing IO */ |
Definition at line 81 of file kern_alq.c.
Referenced by alq_doio(), and alq_flush().
#define AQ_LEGACY 0x0020 /* Legacy queue (fixed length writes) */ |
Definition at line 84 of file kern_alq.c.
Referenced by alq_get(), alq_open(), and alq_write().
#define AQ_ORDERED 0x0010 /* Queue enforces ordered writes */ |
Definition at line 83 of file kern_alq.c.
Referenced by alq_getn(), alq_open_flags(), alq_post_flags(), and alq_writen().
#define AQ_SHUTDOWN 0x0008 /* Queue no longer valid */ |
Definition at line 82 of file kern_alq.c.
Referenced by alq_getn(), alq_shutdown(), and alq_writen().
#define AQ_WANTED 0x0001 /* Wakeup sleeper when io is done */ |
Definition at line 79 of file kern_alq.c.
Referenced by alq_doio(), alq_getn(), alq_shutdown(), and alq_writen().
Definition at line 89 of file kern_alq.c.
Referenced by alq_doio(), alq_flush(), alq_getn(), alq_post_flags(), alq_shutdown(), and alq_writen().
__FBSDID | ( | "$BSDSUniX$" | ) |
|
static |
Definition at line 169 of file kern_alq.c.
References wakeup().
Referenced by alq_post_flags(), alq_shutdown(), and alq_writen().
|
static |
Definition at line 191 of file kern_alq.c.
References ald_deactivate(), ALD_LOCK, ald_mtx, ald_shutdown(), ALD_UNLOCK, alq_doio(), ALQ_LOCK, ALQ_UNLOCK, kproc_exit(), and wakeup_one().
|
static |
Definition at line 176 of file kern_alq.c.
References AQ_ACTIVE, and alq::aq_flags.
Referenced by ald_daemon(), and alq_flush().
|
static |
Definition at line 148 of file kern_alq.c.
References ALD_LOCK, and ALD_UNLOCK.
Referenced by alq_close().
|
static |
Definition at line 228 of file kern_alq.c.
References ALD_LOCK, ald_mtx, ALD_UNLOCK, alq_shutdown(), and wakeup().
Referenced by ald_daemon(), and alq_load_handler().
|
static |
Definition at line 183 of file kern_alq.c.
References ald_mtx, and mtx_init().
void alq_close | ( | struct alq * | alq | ) |
Definition at line 922 of file kern_alq.c.
References ald_rem(), and alq_destroy().
void alq_destroy | ( | struct alq * | alq | ) |
Definition at line 294 of file kern_alq.c.
References alq_shutdown(), alq::aq_entbuf, alq::aq_mtx, free(), and mtx_destroy().
Referenced by alq_close(), and alq_open_flags().
|
static |
Definition at line 308 of file kern_alq.c.
References ALQ_LOCK, ALQ_UNLOCK, alq::aq_buflen, alq::aq_cred, alq::aq_entbuf, alq::aq_flags, AQ_FLUSHING, alq::aq_freebytes, alq::aq_vp, AQ_WANTED, alq::aq_wrapearly, alq::aq_writehead, alq::aq_writetail, HAS_PENDING_DATA, vn_finished_write(), and vn_start_write().
Referenced by ald_daemon(), and alq_flush().
void alq_flush | ( | struct alq * | alq | ) |
Definition at line 892 of file kern_alq.c.
References ald_deactivate(), ALD_LOCK, ALD_UNLOCK, alq_doio(), ALQ_LOCK, ALQ_UNLOCK, AQ_ACTIVE, alq::aq_flags, AQ_FLUSHING, HAS_PENDING_DATA, and wakeup_one().
struct ale* alq_get | ( | struct alq * | alq, |
int | flags | ||
) |
Definition at line 825 of file kern_alq.c.
References alq_getn(), alq::aq_entlen, alq::aq_flags, and AQ_LEGACY.
Referenced by ktr_tracepoint().
struct ale* alq_getn | ( | struct alq * | alq, |
int | len, | ||
int | flags | ||
) |
Definition at line 681 of file kern_alq.c.
References ALQ_LOCK, ALQ_UNLOCK, AQ_ACTIVE, alq::aq_buflen, alq::aq_entbuf, alq::aq_flags, alq::aq_freebytes, alq::aq_getpost, alq::aq_mtx, AQ_ORDERED, AQ_SHUTDOWN, alq::aq_waiters, AQ_WANTED, alq::aq_wrapearly, alq::aq_writehead, alq::aq_writetail, HAS_PENDING_DATA, msleep_spin(), wakeup(), and wakeup_one().
Referenced by alq_get().
|
static |
Definition at line 930 of file kern_alq.c.
References ALD_LOCK, ald_mtx, ald_shutdown(), ALD_UNLOCK, and mtx_destroy().
int alq_open | ( | struct alq ** | alqp, |
const char * | file, | ||
struct ucred * | cred, | ||
int | cmode, | ||
int | size, | ||
int | count | ||
) |
Definition at line 489 of file kern_alq.c.
References alq_open_flags(), AQ_LEGACY, and count.
int alq_open_flags | ( | struct alq ** | alqp, |
const char * | file, | ||
struct ucred * | cred, | ||
int | cmode, | ||
int | size, | ||
int | flags | ||
) |
Definition at line 434 of file kern_alq.c.
References alq_destroy(), alq::aq_buflen, alq::aq_cred, alq::aq_entbuf, alq::aq_entlen, alq::aq_entmax, alq::aq_flags, alq::aq_freebytes, alq::aq_mtx, AQ_ORDERED, alq::aq_vp, alq::aq_writehead, alq::aq_writetail, crhold(), malloc(), mtx_init(), NDFREE(), and vn_open_cred().
Referenced by alq_open().
void alq_post_flags | ( | struct alq * | alq, |
struct ale * | ale, | ||
int | flags | ||
) |
Definition at line 834 of file kern_alq.c.
References ald_activate(), ALD_LOCK, ALD_UNLOCK, ALQ_UNLOCK, AQ_ACTIVE, alq::aq_buflen, alq::aq_flags, alq::aq_freebytes, AQ_ORDERED, alq::aq_waiters, alq::aq_writehead, HAS_PENDING_DATA, and wakeup_one().
|
static |
Definition at line 260 of file kern_alq.c.
References ald_activate(), ALD_LOCK, ALD_UNLOCK, ALQ_LOCK, ALQ_UNLOCK, AQ_ACTIVE, alq::aq_cred, alq::aq_flags, alq::aq_mtx, AQ_SHUTDOWN, alq::aq_vp, AQ_WANTED, crfree(), HAS_PENDING_DATA, msleep_spin(), and vn_close().
Referenced by ald_shutdown(), and alq_destroy().
int alq_write | ( | struct alq * | alq, |
void * | data, | ||
int | flags | ||
) |
Definition at line 669 of file kern_alq.c.
References alq_writen(), alq::aq_entlen, alq::aq_flags, and AQ_LEGACY.
int alq_writen | ( | struct alq * | alq, |
void * | data, | ||
int | len, | ||
int | flags | ||
) |
Definition at line 515 of file kern_alq.c.
References ald_activate(), ALD_LOCK, ALD_UNLOCK, ALQ_LOCK, ALQ_UNLOCK, AQ_ACTIVE, alq::aq_buflen, alq::aq_entbuf, alq::aq_flags, alq::aq_freebytes, alq::aq_mtx, AQ_ORDERED, AQ_SHUTDOWN, alq::aq_waiters, AQ_WANTED, alq::aq_writehead, HAS_PENDING_DATA, msleep_spin(), wakeup(), and wakeup_one().
Referenced by alq_write().
|
static |
Definition at line 97 of file kern_alq.c.
Referenced by hashdestroy(), hashinit_flags(), and phashinit().
|
static |
MODULE_VERSION | ( | alq | , |
1 | |||
) |
SYSINIT | ( | aldthread | , |
SI_SUB_KTHREAD_IDLE | , | ||
SI_ORDER_ANY | , | ||
kproc_start | , | ||
& | ald_kp | ||
) |
SYSINIT | ( | ald | , |
SI_SUB_LOCK | , | ||
SI_ORDER_ANY | , | ||
ald_startup | , | ||
NULL | |||
) |
|
static |
Definition at line 417 of file kern_alq.c.
|
static |
Definition at line 96 of file kern_alq.c.
Referenced by ald_daemon(), ald_shutdown(), ald_startup(), and alq_load_handler().
|
static |
Definition at line 971 of file kern_alq.c.