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 ("$FreeBSD$") | |
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_LAST, 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) |
#define ALD_UNLOCK | ( | ) | mtx_unlock(&ald_mtx) |
Definition at line 88 of file kern_alq.c.
Definition at line 89 of file kern_alq.c.
#define AQ_ACTIVE 0x0002 /* on the active list */ |
Definition at line 82 of file kern_alq.c.
#define AQ_FLUSHING 0x0004 /* doing IO */ |
Definition at line 83 of file kern_alq.c.
#define AQ_LEGACY 0x0020 /* Legacy queue (fixed length writes) */ |
Definition at line 86 of file kern_alq.c.
#define AQ_ORDERED 0x0010 /* Queue enforces ordered writes */ |
Definition at line 85 of file kern_alq.c.
#define AQ_SHUTDOWN 0x0008 /* Queue no longer valid */ |
Definition at line 84 of file kern_alq.c.
#define AQ_WANTED 0x0001 /* Wakeup sleeper when io is done */ |
Definition at line 81 of file kern_alq.c.
Definition at line 91 of file kern_alq.c.
__FBSDID | ( | "$FreeBSD$" | ) |
|
static |
Definition at line 170 of file kern_alq.c.
References wakeup().
Referenced by alq_post_flags(), alq_shutdown(), and alq_writen().
|
static |
Definition at line 192 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 177 of file kern_alq.c.
References alq::aq_flags.
Referenced by ald_daemon(), and alq_flush().
|
static |
Definition at line 149 of file kern_alq.c.
References ALD_LOCK, and ALD_UNLOCK.
Referenced by alq_close().
|
static |
Definition at line 229 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 184 of file kern_alq.c.
References ald_mtx.
void alq_close | ( | struct alq * | alq | ) |
Definition at line 913 of file kern_alq.c.
References ald_rem(), and alq_destroy().
void alq_destroy | ( | struct alq * | alq | ) |
Definition at line 295 of file kern_alq.c.
References alq_shutdown(), alq::aq_entbuf, alq::aq_mtx, and free().
Referenced by alq_close(), and alq_open_flags().
|
static |
Definition at line 309 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 883 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 816 of file kern_alq.c.
References alq_getn(), alq::aq_entlen, alq::aq_flags, AQ_LEGACY, and flags.
Referenced by ktr_tracepoint().
struct ale * alq_getn | ( | struct alq * | alq, |
int | len, | ||
int | flags | ||
) |
Definition at line 672 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, flags, HAS_PENDING_DATA, wakeup(), and wakeup_one().
Referenced by alq_get().
|
static |
Definition at line 921 of file kern_alq.c.
References ALD_LOCK, ald_mtx, ald_shutdown(), and ALD_UNLOCK.
int alq_open | ( | struct alq ** | alqp, |
const char * | file, | ||
struct ucred * | cred, | ||
int | cmode, | ||
int | size, | ||
int | count | ||
) |
Definition at line 481 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 431 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(), flags, malloc(), NDFREE(), and vn_open_cred().
Referenced by alq_open().
void alq_post_flags | ( | struct alq * | alq, |
struct ale * | ale, | ||
int | flags | ||
) |
Definition at line 825 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, flags, HAS_PENDING_DATA, and wakeup_one().
|
static |
Definition at line 261 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, and vn_close().
Referenced by ald_shutdown(), and alq_destroy().
int alq_write | ( | struct alq * | alq, |
void * | data, | ||
int | flags | ||
) |
Definition at line 660 of file kern_alq.c.
References alq_writen(), alq::aq_entlen, alq::aq_flags, AQ_LEGACY, data, and flags.
int alq_writen | ( | struct alq * | alq, |
void * | data, | ||
int | len, | ||
int | flags | ||
) |
Definition at line 506 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, data, flags, HAS_PENDING_DATA, wakeup(), and wakeup_one().
Referenced by alq_write().
|
static |
Definition at line 99 of file kern_alq.c.
Referenced by hashdestroy(), hashinit_flags(), and phashinit_flags().
|
static |
MODULE_VERSION | ( | alq | , |
1 | |||
) |
SYSINIT | ( | ald | , |
SI_SUB_LOCK | , | ||
SI_ORDER_ANY | , | ||
ald_startup | , | ||
NULL | |||
) |
SYSINIT | ( | aldthread | , |
SI_SUB_KTHREAD_IDLE | , | ||
SI_ORDER_ANY | , | ||
kproc_start | , | ||
& | ald_kp | ||
) |
|
static |
Definition at line 415 of file kern_alq.c.
|
static |
Definition at line 98 of file kern_alq.c.
Referenced by ald_daemon(), ald_shutdown(), ald_startup(), and alq_load_handler().
|
static |
Definition at line 962 of file kern_alq.c.