LCOV - code coverage report
Current view: top level - tango/mcache - fd_mcache_private.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 10 13 76.9 %
Date: 2024-11-13 11:58:15 Functions: 4 8 50.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_tango_fd_mcache_private_h
       2             : #define HEADER_fd_src_tango_fd_mcache_private_h
       3             : 
       4             : #include "fd_mcache.h"
       5             : 
       6             : /* FD_MCACHE_MAGIC is used to signal the layout of shared memory region
       7             :    of a mcache. */
       8             : 
       9          15 : #define FD_MCACHE_MAGIC (0xF17EDA2C373CA540UL) /* F17E=FIRE,DA2C/37=DANCER,3C/A54=MCASH,0=V0 / FIRE DANCER MCASH V0 */
      10             : 
      11             : /* fd_mcache_private_hdr specifies the detailed layout of the shared
      12             :    memory region.  */
      13             : 
      14             : struct __attribute__((aligned(FD_MCACHE_ALIGN))) fd_mcache_private_hdr {
      15             : 
      16             :   /* This point is FD_MCACHE_ALIGN aligned  */
      17             : 
      18             :   ulong magic;   /* == FD_MCACHE_MAGIC */
      19             :   ulong depth;   /* == 2^lg_depth >= FD_MCACHE_LG_BLOCK */
      20             :   ulong app_sz;  /* Size of the application region in bytes */
      21             :   ulong seq0;    /* Initial sequence number passed on creation */
      22             :   ulong app_off; /* Location of the application region relative to the first byte of the header */
      23             : 
      24             :   /* Padding to FD_MCACHE_ALIGN here (lots of room for additional static data here) */
      25             : 
      26             :   ulong __attribute__((aligned(FD_MCACHE_ALIGN))) seq[ FD_MCACHE_SEQ_CNT ];
      27             : 
      28             :   /* Padding to FD_MCACHE_ALIGN here (probably zero), this is implicitly FD_FRAG_META_ALIGNED */
      29             : 
      30             :   /* depth fd_frag_meta_t here */
      31             : 
      32             :   /* Padding to FD_MCACHE_ALIGN (probably zero) */
      33             : 
      34             :   /* app_off points here */
      35             :   /* app_sz byte reserved here */
      36             : 
      37             :   /* Padding to FD_MCACHE_ALIGN here */
      38             : };
      39             : 
      40             : typedef struct fd_mcache_private_hdr fd_mcache_private_hdr_t;
      41             : 
      42             : FD_PROTOTYPES_BEGIN
      43             : 
      44             : FD_FN_CONST static inline fd_frag_meta_t const *
      45           0 : fd_mcache_private_cache_const( fd_mcache_private_hdr_t const * mcache ) {
      46           0 :   return (fd_frag_meta_t const *)(mcache+1UL);
      47           0 : }
      48             : 
      49             : FD_FN_CONST static inline fd_frag_meta_t *
      50         132 : fd_mcache_private_mcache( fd_mcache_private_hdr_t * mcache ) {
      51         132 :   return (fd_frag_meta_t *)(mcache+1UL);
      52         132 : }
      53             : 
      54             : FD_FN_CONST static inline fd_mcache_private_hdr_t const *
      55     1207159 : fd_mcache_private_hdr_const( fd_frag_meta_t const * mcache ) {
      56     1207159 :   return (fd_mcache_private_hdr_t const *)(((ulong)mcache) - sizeof(fd_mcache_private_hdr_t));
      57     1207159 : }
      58             : 
      59             : FD_FN_CONST static inline fd_mcache_private_hdr_t *
      60          15 : fd_mcache_private_hdr( fd_frag_meta_t * mcache ) {
      61          15 :   return (fd_mcache_private_hdr_t *)(((ulong)mcache) - sizeof(fd_mcache_private_hdr_t));
      62          15 : }
      63             : 
      64             : FD_PROTOTYPES_END
      65             : 
      66             : #endif /* HEADER_fd_src_tango_fd_mcache_private_h */

Generated by: LCOV version 1.14