LCOV - code coverage report
Current view: top level - include - vma.h (source / functions) Hit Total Coverage
Test: coverage3.info Lines: 4 4 100.0 %
Date: 2014-04-22 Functions: 0 0 -
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : #ifndef __CR_VMA_H__
       2                 :            : #define __CR_VMA_H__
       3                 :            : 
       4                 :            : #include "list.h"
       5                 :            : #include "protobuf/vma.pb-c.h"
       6                 :            : 
       7                 :            : struct vm_area_list {
       8                 :            :         struct list_head        h;
       9                 :            :         unsigned                nr;
      10                 :            :         unsigned long           priv_size; /* nr of pages in private VMAs */
      11                 :            :         unsigned long           longest; /* nr of pages in longest VMA */
      12                 :            : };
      13                 :            : 
      14                 :            : #define VM_AREA_LIST(name)      struct vm_area_list name = { .h = LIST_HEAD_INIT(name.h), .nr = 0, }
      15                 :            : 
      16                 :            : static inline void vm_area_list_init(struct vm_area_list *vml)
      17                 :            : {
      18                 :       2894 :         INIT_LIST_HEAD(&vml->h);
      19                 :       2894 :         vml->nr = 0;
      20                 :       2894 :         vml->priv_size = 0;
      21                 :       2894 :         vml->longest = 0;
      22                 :            : }
      23                 :            : 
      24                 :            : struct file_desc;
      25                 :            : 
      26                 :            : struct vma_area {
      27                 :            :         struct list_head        list;
      28                 :            :         VmaEntry                *e;
      29                 :            : 
      30                 :            :         union {
      31                 :            :                 int             vm_file_fd;
      32                 :            :                 int             vm_socket_id;
      33                 :            :                 struct file_desc *fd;
      34                 :            :         };
      35                 :            :         unsigned long           *page_bitmap;  /* existent pages */
      36                 :            :         unsigned long           *ppage_bitmap; /* parent's existent pages */
      37                 :            : 
      38                 :            :         unsigned long           premmaped_addr;
      39                 :            : 
      40                 :            :         bool                    file_borrowed;
      41                 :            : 
      42                 :            :         struct stat             *st;
      43                 :            : };
      44                 :            : 
      45                 :            : extern struct vma_area *alloc_vma_area(void);
      46                 :            : extern int collect_mappings(pid_t pid, struct vm_area_list *vma_area_list);
      47                 :            : extern void free_mappings(struct vm_area_list *vma_area_list);
      48                 :            : extern bool privately_dump_vma(struct vma_area *vma);
      49                 :            : 
      50                 :            : #define vma_area_is(vma_area, s)        vma_entry_is((vma_area)->e, s)
      51                 :            : #define vma_area_len(vma_area)          vma_entry_len((vma_area)->e)
      52                 :            : #define vma_entry_is(vma, s)            (((vma)->status & (s)) == (s))
      53                 :            : #define vma_entry_len(vma)              ((vma)->end - (vma)->start)
      54                 :            : 
      55                 :            : /*
      56                 :            :  * vma_premmaped_start() can be used only in restorer.
      57                 :            :  * In other cases vma_area->premmaped_addr must be used.
      58                 :            :  * This hack is required, because vma_area isn't tranfered in restorer and
      59                 :            :  * shmid is used to determing which vma-s are cowed.
      60                 :            :  */
      61                 :            : #define vma_premmaped_start(vma)        ((vma)->shmid)
      62                 :            : 
      63                 :            : static inline int in_vma_area(struct vma_area *vma, unsigned long addr)
      64                 :            : {
      65                 :            :         return addr >= (unsigned long)vma->e->start &&
      66                 :            :                 addr < (unsigned long)vma->e->end;
      67                 :            : }
      68                 :            : 
      69                 :            : #endif /* __CR_VMA_H__ */

Generated by: LCOV version 1.9