Line data Source code
1 : #ifndef __RGRP_DOT_H__ 2 : #define __RGRP_DOT_H__ 3 : 4 : #include "libgfs2.h" 5 : 6 : struct rg_spec { 7 : uint32_t len; /* Rgrp length */ 8 : uint32_t num; /* Number of contiguous rgrps of this length */ 9 : }; 10 : 11 : /* Heads a buffer of rg_specs */ 12 : struct rgs_plan { 13 : unsigned length; /* # entries */ 14 : unsigned capacity; /* # entries for which memory has been allocated */ 15 : struct rg_spec rg_specs[]; 16 : }; 17 : 18 : /** 19 : * This structure is defined in libgfs2.h as an opaque type. It stores the 20 : * constants and context required for creating resource groups from any point 21 : * in an application. 22 : */ 23 : struct _lgfs2_rgrps { 24 : struct osi_root rgs_root; 25 : struct rgs_plan *rgs_plan; 26 : struct lgfs2_sbd *rgs_sdp; 27 : unsigned long rgs_align; 28 : unsigned long rgs_align_off; 29 : }; 30 : 31 : struct lgfs2_rbm { 32 : lgfs2_rgrp_t rgd; 33 : uint32_t offset; /* The offset is bitmap relative */ 34 : unsigned bii; /* Bitmap index */ 35 : }; 36 : 37 5024594 : static inline struct lgfs2_bitmap *rbm_bi(const struct lgfs2_rbm *rbm) 38 : { 39 5024594 : return rbm->rgd->rt_bits + rbm->bii; 40 : } 41 : 42 86662 : static inline uint64_t lgfs2_rbm_to_block(const struct lgfs2_rbm *rbm) 43 : { 44 86662 : return rbm->rgd->rt_data0 + (rbm_bi(rbm)->bi_start * GFS2_NBBY) + 45 86662 : rbm->offset; 46 : } 47 : 48 : static inline int lgfs2_rbm_eq(const struct lgfs2_rbm *rbm1, const struct lgfs2_rbm *rbm2) 49 : { 50 : return (rbm1->rgd == rbm2->rgd) && (rbm1->bii == rbm2->bii) && 51 : (rbm1->offset == rbm2->offset); 52 : } 53 : 54 : extern int lgfs2_rbm_from_block(struct lgfs2_rbm *rbm, uint64_t block); 55 : extern int lgfs2_rbm_find(struct lgfs2_rbm *rbm, uint8_t state, uint32_t *minext); 56 : extern unsigned lgfs2_alloc_extent(const struct lgfs2_rbm *rbm, int state, const unsigned elen); 57 : 58 : #endif /* __RGRP_DOT_H__ */