Advertisement
kelleynnn

extracting swap type from page table entry (corrected)

Dec 16th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* checks whether a pte_t is a swap pte, and extracts the swap
  2.  * entry from the pte, and the type from the entry
  3.  */
  4.  
  5. #include <linux/swapops.h>
  6.  
  7. unsigned pte_to_type(pte_t mypte){
  8.     swp_entry_t myentry;
  9.     unsigned mytype;
  10.  
  11.     if is_swap_pte(mypte)
  12.     {
  13.         myentry = pte_to_swp_entry(mypte);
  14.         mytype = swp_type(myentry);
  15.         return mytype;
  16.     }
  17.     return -1;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement