A swap entry has two parts, one called the type (stored in an unsigned long), and one called the offset (stored in a data structure called a pgoff_t). The type is the swap area (partition or file) to use (there can be up to 32), the offset is the number of page sized (4kb) chunks to count from the beginning of the type. They’re both stored in a swap_entry_ t, which is an unsigned long stored inside a struct for protection. A swap_entry_t is created and manipulated through functions that live in include/linux/swapops.h. There is, for instance, *swp_entry() which takes a type and offset and returns a newly created swap_entry_t *swp_type() and swp_offset() which take a swp_entry_t and return the extracted type (unsigned long) and a pgoff_t, respectively *swp_entry_to_pte(), which takes a swap_entry_t and converts it into its corresponding and analogous page table entry, i.e. pte_t