X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Finclude%2Flibcfs%2Flibcfs.h;h=f928fcfd3104b9f774fa5cb54106c8e320e54387;hp=d68a5eb166253108a802a95ea89e18558db76d6e;hb=2f07d63bd98623c8daaafe1d63d7567a03586fea;hpb=a88ba26385307ae2863cdadd7dfb8cbaf2ca1c02 diff --git a/lnet/include/libcfs/libcfs.h b/lnet/include/libcfs/libcfs.h index d68a5eb..f928fcf 100644 --- a/lnet/include/libcfs/libcfs.h +++ b/lnet/include/libcfs/libcfs.h @@ -18,6 +18,10 @@ #include "curproc.h" +#ifndef __KERNEL__ +#include +#endif + #define PORTAL_DEBUG #ifndef offsetof @@ -66,6 +70,7 @@ extern unsigned int portal_printk; #define S_CONFOBD 0x00400000 #define S_LMV 0x00800000 #define S_CMOBD 0x01000000 +#define S_SEC 0x02000000 /* If you change these values, please keep these files up to date... * portals/utils/debug.c * utils/lconf @@ -99,6 +104,7 @@ extern unsigned int portal_printk; #define D_CONFIG 0x01000000 #define D_CONSOLE 0x02000000 #define D_QUOTA 0x04000000 +#define D_SEC 0x08000000 /* If you change these values, please keep these files up to date... * portals/utils/debug.c * utils/lconf @@ -108,6 +114,7 @@ extern unsigned int portal_printk; # define DEBUG_SUBSYSTEM S_UNDEFINED #endif +#ifdef __KERNEL__ #if 1 #define CDEBUG(mask, format, a...) \ do { \ @@ -158,8 +165,8 @@ do { \ } \ } while (0) -#define CWARN(format, a...) CDEBUG_LIMIT(D_WARNING, format, ## a) -#define CERROR(format, a...) CDEBUG_LIMIT(D_ERROR, format, ## a) +#define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a) +#define CERROR(format, a...) CDEBUG(D_ERROR, format, ## a) #define CEMERG(format, a...) CDEBUG(D_EMERG, format, ## a) #define LCONSOLE(mask, format, a...) CDEBUG(D_CONSOLE | (mask), format, ## a) @@ -205,28 +212,53 @@ do { \ CDEBUG(D_TRACE, "Process leaving\n"); \ EXIT_NESTING; \ } while(0) -#else +#else /* !CDEBUG_ENTRY_EXIT */ #define RETURN(rc) return (rc) #define ENTRY #define EXIT -#endif +#endif /* !CDEBUG_ENTRY_EXIT */ -#else +#else /* !1 */ #define CDEBUG(mask, format, a...) do { } while (0) #define CWARN(format, a...) printk(KERN_WARNING format, ## a) #define CERROR(format, a...) printk(KERN_ERR format, ## a) #define CEMERG(format, a...) printk(KERN_EMERG format, ## a) +#define LCONSOLE(mask, format, a...) printk(format, ## a) +#define LCONSOLE_INFO(format, a...) printk(KERN_INFO format, ## a) +#define LCONSOLE_WARN(format, a...) printk(KERN_WARNING format, ## a) +#define LCONSOLE_ERROR(format, a...) printk(KERN_ERROR format, ## a) +#define LCONSOLE_EMERG(format, a...) printk(KERN_EMERG format, ## a) #define GOTO(label, rc) do { (void)(rc); goto label; } while (0) #define RETURN(rc) return (rc) #define ENTRY do { } while (0) #define EXIT do { } while (0) -#endif +#endif /* !1 */ +#else /* !__KERNEL__ */ +#define CDEBUG(mask, format, a...) do { } while (0) +#define LCONSOLE(mask, format, a...) fprintf(stderr, format, ## a) +#define CWARN(format, a...) fprintf(stderr, format, ## a) +#define CERROR(format, a...) fprintf(stderr, format, ## a) +#define CEMERG(format, a...) fprintf(stderr, format, ## a) +#define LCONSOLE_INFO(format, a...) fprintf(stderr, format, ## a) +#define LCONSOLE_WARN(format, a...) fprintf(stderr, format, ## a) +#define LCONSOLE_ERROR(format, a...) fprintf(stderr, format, ## a) +#define LCONSOLE_EMERG(format, a...) fprintf(stderr, format, ## a) +#define GOTO(label, rc) do { (void)(rc); goto label; } while (0) +#define RETURN(rc) return (rc) +#define ENTRY do { } while (0) +#define EXIT do { } while (0) +#endif /* !__KERNEL__ */ #define LUSTRE_SRV_PTL_PID LUSTRE_PTL_PID -#define PORTALS_CFG_VERSION 0x00010001; +/* + * eeb cfg + * ecf6 + * ecfG + */ +#define PORTALS_CFG_VERSION 0xecf60001 struct portals_cfg { __u32 pcfg_version; @@ -236,6 +268,8 @@ struct portals_cfg { __u32 pcfg_flags; __u32 pcfg_gw_nal; + __u32 pcfg_padding1; + __u64 pcfg_nid; __u64 pcfg_nid2; __u64 pcfg_nid3; @@ -247,19 +281,43 @@ struct portals_cfg { __u32 pcfg_wait; __u32 pcfg_plen1; /* buffers in userspace */ - char *pcfg_pbuf1; __u32 pcfg_plen2; /* buffers in userspace */ - char *pcfg_pbuf2; + __u32 pcfg_alloc_size; /* size of this allocated portals_cfg */ + char pcfg_pbuf[0]; }; #define PCFG_INIT(pcfg, cmd) \ do { \ - memset(&pcfg, 0, sizeof(pcfg)); \ - pcfg.pcfg_version = PORTALS_CFG_VERSION; \ - pcfg.pcfg_command = (cmd); \ + memset(&(pcfg), 0, sizeof((pcfg))); \ + (pcfg).pcfg_version = PORTALS_CFG_VERSION; \ + (pcfg).pcfg_command = (cmd); \ \ } while (0) +#define PCFG_INIT_PBUF(pcfg, cmd, plen1, plen2) \ + do { \ + int bufsize = size_round(sizeof(*(pcfg))); \ + bufsize += size_round(plen1) + size_round(plen2); \ + PORTAL_ALLOC((pcfg), bufsize); \ + if ((pcfg)) { \ + memset((pcfg), 0, bufsize); \ + (pcfg)->pcfg_version = PORTALS_CFG_VERSION; \ + (pcfg)->pcfg_command = (cmd); \ + (pcfg)->pcfg_plen1 = (plen1); \ + (pcfg)->pcfg_plen2 = (plen2); \ + (pcfg)->pcfg_alloc_size = bufsize; \ + } \ + } while (0) + +#define PCFG_FREE_PBUF(pcfg) PORTAL_FREE((pcfg), (pcfg)->pcfg_alloc_size) + +#define PCFG_PBUF(pcfg, idx) \ + (0 == (idx) \ + ? ((char *)(pcfg) + size_round(sizeof(*(pcfg)))) \ + : (1 == (idx) \ + ? ((char *)(pcfg) + size_round(sizeof(*(pcfg))) + size_round(pcfg->pcfg_plen1)) \ + : (NULL))) + typedef int (nal_cmd_handler_fn)(struct portals_cfg *, void *); int libcfs_nal_cmd_register(int nal, nal_cmd_handler_fn *handler, void *arg); int libcfs_nal_cmd(struct portals_cfg *pcfg);