Changeset View
Standalone View
sys/geom/label/g_label.h
Show All 28 Lines | |||||
*/ | */ | ||||
#ifndef _G_LABEL_H_ | #ifndef _G_LABEL_H_ | ||||
#define _G_LABEL_H_ | #define _G_LABEL_H_ | ||||
#include <sys/endian.h> | #include <sys/endian.h> | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <geom/geom_int.h> | |||||
rlibby: I think it would be preferable not to include geom_int.h in headers. I don't think it's… | |||||
Done Inline ActionsTo avoid the include, I think I have two options:
Of these two, I'd prefer the latter. My reservation with it is that geom.h is kind of the public API of GEOM, and consumed more broadly than just GEOM object classes. Did you have something else in mind? Or a preference among these two? cem: To avoid the include, I think I have two options:
- I would have to move the geom_int.h… | |||||
Done Inline ActionsOne of those two seems fine. I would have a slight preference for the former, for the API reasons. Another alternative might be a new geom_log.h or geom_dbg.h, which you'd then have to go include appropriately. This isn't something I would insist on in any case, it just seemed non-optimal to be including an internals header in other headers like that. rlibby: One of those two seems fine. I would have a slight preference for the former, for the API… | |||||
Done Inline ActionsNew file is probably best, since geom_int.h is documented as "not included from classes," for whatever reason. I'll plan to do that. cem: New file is probably best, since geom_int.h is documented as "not included from classes," for… | |||||
#endif | #endif | ||||
#define G_LABEL_CLASS_NAME "LABEL" | #define G_LABEL_CLASS_NAME "LABEL" | ||||
#define G_LABEL_MAGIC "GEOM::LABEL" | #define G_LABEL_MAGIC "GEOM::LABEL" | ||||
/* | /* | ||||
* Version history: | * Version history: | ||||
* 1 - Initial version number. | * 1 - Initial version number. | ||||
* 2 - Added md_provsize field to metadata. | * 2 - Added md_provsize field to metadata. | ||||
*/ | */ | ||||
#define G_LABEL_VERSION 2 | #define G_LABEL_VERSION 2 | ||||
#define G_LABEL_DIR "label" | #define G_LABEL_DIR "label" | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
extern u_int g_label_debug; | extern u_int g_label_debug; | ||||
#define G_LABEL_DEBUG(lvl, ...) do { \ | #define G_LABEL_DEBUG(lvl, ...) \ | ||||
if (g_label_debug >= (lvl)) { \ | _GEOM_DEBUG("GEOM_LABEL", g_label_debug, (lvl), NULL, __VA_ARGS__) | ||||
printf("GEOM_LABEL"); \ | |||||
if (g_label_debug > 0) \ | |||||
printf("[%u]", lvl); \ | |||||
printf(": "); \ | |||||
printf(__VA_ARGS__); \ | |||||
printf("\n"); \ | |||||
} \ | |||||
} while (0) | |||||
SYSCTL_DECL(_kern_geom_label); | SYSCTL_DECL(_kern_geom_label); | ||||
#define G_LABEL_INIT(kind, label, descr) \ | #define G_LABEL_INIT(kind, label, descr) \ | ||||
SYSCTL_NODE(_kern_geom_label, OID_AUTO, kind, CTLFLAG_RD, \ | SYSCTL_NODE(_kern_geom_label, OID_AUTO, kind, CTLFLAG_RD, \ | ||||
NULL, ""); \ | NULL, ""); \ | ||||
SYSCTL_INT(_kern_geom_label_##kind, OID_AUTO, enable, \ | SYSCTL_INT(_kern_geom_label_##kind, OID_AUTO, enable, \ | ||||
CTLFLAG_RWTUN, &label.ld_enabled, 1, descr) | CTLFLAG_RWTUN, &label.ld_enabled, 1, descr) | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |
I think it would be preferable not to include geom_int.h in headers. I don't think it's necessary just to define macros in terms of _GEOM_DEBUG().