Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/cache/g_cache.h
Show All 26 Lines | |||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _G_CACHE_H_ | #ifndef _G_CACHE_H_ | ||||
#define _G_CACHE_H_ | #define _G_CACHE_H_ | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#ifdef _KERNEL | |||||
#include <geom/geom_int.h> | |||||
#endif | |||||
#define G_CACHE_CLASS_NAME "CACHE" | #define G_CACHE_CLASS_NAME "CACHE" | ||||
#define G_CACHE_MAGIC "GEOM::CACHE" | #define G_CACHE_MAGIC "GEOM::CACHE" | ||||
#define G_CACHE_VERSION 1 | #define G_CACHE_VERSION 1 | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#define G_CACHE_TYPE_MANUAL 0 | #define G_CACHE_TYPE_MANUAL 0 | ||||
#define G_CACHE_TYPE_AUTOMATIC 1 | #define G_CACHE_TYPE_AUTOMATIC 1 | ||||
#define G_CACHE_DEBUG(lvl, ...) do { \ | #define G_CACHE_DEBUG(lvl, ...) \ | ||||
if (g_cache_debug >= (lvl)) { \ | _GEOM_DEBUG("GEOM_CACHE", g_cache_debug, (lvl), NULL, __VA_ARGS__) | ||||
printf("GEOM_CACHE"); \ | #define G_CACHE_LOGREQ(bp, ...) \ | ||||
if (g_cache_debug > 0) \ | _GEOM_DEBUG("GEOM_CACHE", g_cache_debug, 2, (bp), __VA_ARGS__) | ||||
printf("[%u]", lvl); \ | |||||
printf(": "); \ | |||||
printf(__VA_ARGS__); \ | |||||
printf("\n"); \ | |||||
} \ | |||||
} while (0) | |||||
#define G_CACHE_LOGREQ(bp, ...) do { \ | |||||
if (g_cache_debug >= 2) { \ | |||||
printf("GEOM_CACHE[2]: "); \ | |||||
printf(__VA_ARGS__); \ | |||||
printf(" "); \ | |||||
g_print_bio(bp); \ | |||||
printf("\n"); \ | |||||
} \ | |||||
} while (0) | |||||
#define G_CACHE_BUCKETS (1 << 3) | #define G_CACHE_BUCKETS (1 << 3) | ||||
#define G_CACHE_BUCKET(bno) ((bno) & (G_CACHE_BUCKETS - 1)) | #define G_CACHE_BUCKET(bno) ((bno) & (G_CACHE_BUCKETS - 1)) | ||||
struct g_cache_softc { | struct g_cache_softc { | ||||
struct g_geom *sc_geom; | struct g_geom *sc_geom; | ||||
int sc_type; | int sc_type; | ||||
u_int sc_bshift; | u_int sc_bshift; | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |