#ifndef _TTM_BACKUP_H_
#define _TTM_BACKUP_H_
#include <linux/mm_types.h>
#include <linux/shmem_fs.h>
static inline struct page *
ttm_backup_handle_to_page_ptr(unsigned long handle)
{
return (struct page *)(handle << 1 | 1);
}
static inline bool ttm_backup_page_ptr_is_handle(const struct page *page)
{
return (unsigned long)page & 1;
}
static inline unsigned long
ttm_backup_page_ptr_to_handle(const struct page *page)
{
WARN_ON(!ttm_backup_page_ptr_is_handle(page));
return (unsigned long)page >> 1;
}
void ttm_backup_drop(struct file *backup, pgoff_t handle);
int ttm_backup_copy_page(struct file *backup, struct page *dst,
pgoff_t handle, bool intr, gfp_t additional_gfp);
s64
ttm_backup_backup_folio(struct file *backup, struct folio *folio,
unsigned int order, bool writeback, pgoff_t idx,
gfp_t folio_gfp, gfp_t alloc_gfp,
pgoff_t *nr_pages_backed);
void ttm_backup_fini(struct file *backup);
u64 ttm_backup_bytes_avail(void);
struct file *ttm_backup_shmem_create(loff_t size);
#endif