patch-1.3.42 linux/include/linux/mm.h
Next file: linux/include/linux/netdevice.h
Previous file: linux/include/linux/major.h
Back to the patch index
Back to the overall index
- Lines: 50
- Date:
Tue Nov 14 16:45:06 1995
- Orig file:
v1.3.41/linux/include/linux/mm.h
- Orig date:
Thu Nov 9 11:23:52 1995
diff -u --recursive --new-file v1.3.41/linux/include/linux/mm.h linux/include/linux/mm.h
@@ -215,8 +215,6 @@
/* mmap.c */
extern unsigned long do_mmap(struct file * file, unsigned long addr, unsigned long len,
unsigned long prot, unsigned long flags, unsigned long off);
-extern struct vm_area_struct * find_vma (struct task_struct *, unsigned long);
-extern struct vm_area_struct * find_vma_intersection (struct task_struct *, unsigned long, unsigned long);
extern void merge_segments(struct task_struct *, unsigned long, unsigned long);
extern void insert_vm_struct(struct task_struct *, struct vm_area_struct *);
extern void remove_shared_vm_struct(struct vm_area_struct *);
@@ -244,6 +242,40 @@
#define GFP_LEVEL_MASK 0xf
+#define avl_empty (struct vm_area_struct *) NULL
+
+/* Look up the first VMA which satisfies addr < vm_end, NULL if none. */
+static inline struct vm_area_struct * find_vma (struct task_struct * task, unsigned long addr)
+{
+ struct vm_area_struct * result = NULL;
+ struct vm_area_struct * tree;
+
+ if (!task->mm)
+ return NULL;
+ for (tree = task->mm->mmap_avl ; ; ) {
+ if (tree == avl_empty)
+ return result;
+ if (tree->vm_end > addr) {
+ if (tree->vm_start <= addr)
+ return tree;
+ result = tree;
+ tree = tree->vm_avl_left;
+ } else
+ tree = tree->vm_avl_right;
+ }
+}
+
+/* Look up the first VMA which intersects the interval start_addr..end_addr-1,
+ NULL if none. Assume start_addr < end_addr. */
+static inline struct vm_area_struct * find_vma_intersection (struct task_struct * task, unsigned long start_addr, unsigned long end_addr)
+{
+ struct vm_area_struct * vma;
+
+ vma = find_vma(task,start_addr);
+ if (!vma || end_addr <= vma->vm_start)
+ return NULL;
+ return vma;
+}
/*
* vm_ops not present page codes for shared memory.
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov
with Sam's (original) version of this