1 /**
2 * @file compat.c
3 * This file is intended to be up-to-date with the last linux version and
4 * provide work-arounds for missing features in previous kernel version
5 *
6 * @remark Copyright 2002 OProfile authors
7 * @remark Read the file COPYING
8 *
9 * @author John Levon
10 * @author Philippe Elie
11 */
12
13 #include "op_dcache.h"
14 #include <linux/ioport.h>
15
16 #ifdef NEED_2_2_DENTRIES
17
18 /* note - assumes you only test for NULL, and not
19 * actually care about the return value */
compat_request_region(unsigned long start,unsigned long n,char const * name)20 void * compat_request_region(unsigned long start, unsigned long n, char const * name)
21 {
22 if (check_region(start, n) != 0)
23 return NULL;
24 request_region(start, n, name);
25 return (void *)1;
26 }
27
wind_dentries_2_2(struct dentry * dentry)28 int wind_dentries_2_2(struct dentry * dentry)
29 {
30 struct dentry * root = current->fs->root;
31
32 if (dentry->d_parent != dentry && list_empty(&dentry->d_hash))
33 return 0;
34
35 for (;;) {
36 struct dentry * parent;
37
38 if (dentry == root)
39 break;
40
41 dentry = dentry->d_covers;
42 parent = dentry->d_parent;
43
44 if (dentry == parent)
45 break;
46
47 push_dname(&dentry->d_name);
48
49 dentry = parent;
50 }
51
52 return 1;
53 }
54
55 /* called with note_lock held */
do_path_hash_2_2(struct dentry * dentry)56 uint do_path_hash_2_2(struct dentry * dentry)
57 {
58 /* BKL is already taken */
59
60 return do_hash(dentry, 0, 0, 0);
61 }
62
63 #endif /* NEED_2_2_DENTRIES */
64