sysrename: fix to take full paths. Currently not quite there
[akaros.git] / kern / include / pagemap.h
index bbbed5e..122f18f 100644 (file)
 
 #include <radix.h>
 #include <atomic.h>
+#include <mm.h>
 
 /* Need to be careful, due to some ghetto circular references */
 struct page;
 struct inode;
 struct block_device;
+struct chan;
 struct page_map_operations;
 
 /* Every object that has pages, like an inode or the swap (or even direct block
@@ -26,13 +28,14 @@ struct page_map {
        union {
                struct inode                            *pm_host;       /* inode of the owner, if any */
                struct block_device                     *pm_bdev;       /* bdev of the owner, if any */
+               struct chan                                     *pm_chan;
        };
        struct radix_tree                       pm_tree;                /* tracks present pages */
-       spinlock_t                                      pm_tree_lock;   /* spinlock => we can't block */
        unsigned long                           pm_num_pages;   /* how many pages are present */
        struct page_map_operations      *pm_op;
-       unsigned int                            pm_flags;
-       /*... and private lists, backing block dev info, other mappings, etc. */
+       spinlock_t                                      pm_lock;
+       struct vmr_tailq                        pm_vmrs;
+       atomic_t                                        pm_removal;
 };
 
 /* Operations performed on a page_map.  These are usually FS specific, which
@@ -40,6 +43,7 @@ struct page_map {
  * Will fill these in as they are created/needed/used. */
 struct page_map_operations {
        int (*readpage) (struct page_map *, struct page *);
+       int (*writepage) (struct page_map *, struct page *);
 /*     readpages: read a list of pages
        writepage: write from a page to its backing store
        writepages: write a list of pages
@@ -56,6 +60,13 @@ struct page_map_operations {
 /* Page cache functions */
 void pm_init(struct page_map *pm, struct page_map_operations *op, void *host);
 int pm_load_page(struct page_map *pm, unsigned long index, struct page **pp);
+int pm_load_page_nowait(struct page_map *pm, unsigned long index,
+                        struct page **pp);
 void pm_put_page(struct page *page);
+void pm_add_vmr(struct page_map *pm, struct vm_region *vmr);
+void pm_remove_vmr(struct page_map *pm, struct vm_region *vmr);
+int pm_remove_contig(struct page_map *pm, unsigned long index,
+                     unsigned long nr_pgs);
+void print_page_map_info(struct page_map *pm);
 
 #endif /* ROS_KERN_PAGEMAP_H */