LCOV - code coverage report
Current view: top level - discof/restore/utils - fd_vinyl_admin.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 19 0.0 %
Date: 2026-03-19 18:19:27 Functions: 0 12 0.0 %

          Line data    Source code
       1             : #ifndef HEADER_fd_src_discof_restore_utils_fd_vinyl_admin_h
       2             : #define HEADER_fd_src_discof_restore_utils_fd_vinyl_admin_h
       3             : 
       4             : #include "../../../flamenco/fd_rwlock.h"
       5             : 
       6           0 : #define FD_VINYL_ADMIN_MAGIC (0XF17EDA2C7E412AD8) /* FIREDANCER VINYL ADMIN */
       7             : 
       8             : /* Vinyl admin synchronization object. */
       9           0 : #define FD_VINYL_ADMIN_WR_SEQ_CNT_MAX       (8UL)
      10             : 
      11           0 : #define FD_VINYL_ADMIN_STATUS_INIT_PENDING  (0UL)
      12           0 : #define FD_VINYL_ADMIN_STATUS_INIT_DONE     (1UL)
      13           0 : #define FD_VINYL_ADMIN_STATUS_UPDATING      (2UL)
      14           0 : #define FD_VINYL_ADMIN_STATUS_SNAPSHOT_FULL (3UL)
      15           0 : #define FD_VINYL_ADMIN_STATUS_SNAPSHOT_INCR (4UL)
      16           0 : #define FD_VINYL_ADMIN_STATUS_ERROR         (ULONG_MAX)
      17             : 
      18             : struct fd_vinyl_admin {
      19             :   ulong       magic; /* ==FD_VINYL_ADMIN_MAGIC */
      20             : 
      21             :   ulong       status;
      22             : 
      23             :   struct {
      24             :     ulong     past;
      25             :     ulong     present;
      26             :   } bstream_seq;
      27             : 
      28             :   ulong       wr_seq[FD_VINYL_ADMIN_WR_SEQ_CNT_MAX];
      29             :   ulong       wr_cnt;
      30             : 
      31             :   fd_rwlock_t lock;
      32             : };
      33             : typedef struct fd_vinyl_admin fd_vinyl_admin_t;
      34             : 
      35             : static inline const char *
      36           0 : fd_vinyl_admin_status_str( ulong status ) {
      37           0 :   switch( status ) {
      38           0 :     case FD_VINYL_ADMIN_STATUS_INIT_PENDING:  return "init_pending";
      39           0 :     case FD_VINYL_ADMIN_STATUS_INIT_DONE:     return "init_done";
      40           0 :     case FD_VINYL_ADMIN_STATUS_UPDATING:      return "updating";
      41           0 :     case FD_VINYL_ADMIN_STATUS_SNAPSHOT_FULL: return "snapshot_full";
      42           0 :     case FD_VINYL_ADMIN_STATUS_SNAPSHOT_INCR: return "snapshot_incr";
      43           0 :     case FD_VINYL_ADMIN_STATUS_ERROR:         return "error";
      44           0 :     default:                                  return "unknown";
      45           0 :   }
      46           0 : }
      47             : 
      48             : FD_PROTOTYPES_BEGIN
      49             : 
      50             : /* fd_vinyl_admin_{align, footprint} return align and footprint */
      51             : 
      52             : ulong
      53             : fd_vinyl_admin_align( void );
      54             : 
      55             : ulong
      56             : fd_vinyl_admin_footprint( void );
      57             : 
      58             : /* fd_vinyl_admin_new initializes a new vinyl admin object.  It returns
      59             :    a void pointer to the base of the fd_vinyl_admin_t in memory.  On
      60             :    return, it does not retain ownership of the memory. */
      61             : 
      62             : void *
      63             : fd_vinyl_admin_new( void * mem );
      64             : 
      65             : /* fd_vinyl_admin_join return a fd_vinyl_admin_t pointer on success,
      66             :    NULL otherwise.  A condition for failure is e.g. an incorrect
      67             :    magic value (meaning the memory region does not correspond to a
      68             :    properly initialized vinyl admin object).  On return, it does not
      69             :    retain ownership of the memory.*/
      70             : 
      71             : fd_vinyl_admin_t *
      72             : fd_vinyl_admin_join( void * _admin );
      73             : 
      74             : /* fd_vinyl_admin_leave leaves the vinyl admin object, returning a void
      75             :    pointer to the memory region. */
      76             : 
      77             : void *
      78             : fd_vinyl_admin_leave( fd_vinyl_admin_t * _admin );
      79             : 
      80             : /* fd_vinyl_admin_delete leaves the memory region, returning a void
      81             :    pointer to the memory region. */
      82             : 
      83             : void *
      84             : fd_vinyl_admin_delete( void * _admin );
      85             : 
      86             : /* fd_vinyl_admin_query does a volatile read of the vinyl admin object
      87             :    field.  It does not handle the rwlock. */
      88             : 
      89             : ulong
      90             : fd_vinyl_admin_ulong_query( ulong const * _field );
      91             : 
      92             : /* fd_vinyl_admin_update modifies the given field of a vinyl admin
      93             :    object.  It does not handle the rwlock. */
      94             : 
      95             : void
      96             : fd_vinyl_admin_ulong_update( ulong * _field,
      97             :                              ulong   value );
      98             : 
      99             : FD_PROTOTYPES_END
     100             : 
     101             : #endif /* HEADER_fd_src_discof_restore_utils_fd_vinyl_admin_h */

Generated by: LCOV version 1.14