1 |
/* |
2 |
* include/linux/realpath.h |
3 |
* |
4 |
* Get the canonicalized absolute pathnames. The basis for SAKURA and TOMOYO. |
5 |
* |
6 |
* Copyright (C) 2005-2008 NTT DATA CORPORATION |
7 |
* |
8 |
* Version: 1.6.1-rc 2008/04/24 |
9 |
* |
10 |
* This file is applicable to both 2.4.30 and 2.6.11 and later. |
11 |
* See README.ccs for ChangeLog. |
12 |
* |
13 |
*/ |
14 |
|
15 |
#ifndef _LINUX_REALPATH_H |
16 |
#define _LINUX_REALPATH_H |
17 |
|
18 |
struct dentry; |
19 |
struct vfsmount; |
20 |
struct condition_list; |
21 |
struct path_info; |
22 |
|
23 |
/* Returns realpath(3) of the given pathname but ignores chroot'ed root. */ |
24 |
int ccs_realpath_from_dentry2(struct dentry *dentry, struct vfsmount *mnt, |
25 |
char *newname, int newname_len); |
26 |
|
27 |
/* |
28 |
* Returns realpath(3) of the given pathname but ignores chroot'ed root. |
29 |
* These functions use ccs_alloc(), so caller must ccs_free() |
30 |
* if these functions didn't return NULL. |
31 |
*/ |
32 |
char *ccs_realpath(const char *pathname); |
33 |
/* Same with ccs_realpath() except that it doesn't follow the final symlink. */ |
34 |
char *ccs_realpath_nofollow(const char *pathname); |
35 |
/* Same with ccs_realpath() except that the pathname is already solved. */ |
36 |
char *ccs_realpath_from_dentry(struct dentry *dentry, struct vfsmount *mnt); |
37 |
|
38 |
/* |
39 |
* Allocate memory for ACL entry. |
40 |
* The RAM is chunked, so NEVER try to kfree() the returned pointer. |
41 |
*/ |
42 |
void *ccs_alloc_element(const unsigned int size); |
43 |
|
44 |
/* Get used RAM size for ccs_alloc_elements(). */ |
45 |
unsigned int ccs_get_memory_used_for_elements(void); |
46 |
|
47 |
/* |
48 |
* Keep the given name on the RAM. |
49 |
* The RAM is shared, so NEVER try to modify or kfree() the returned name. |
50 |
*/ |
51 |
const struct path_info *ccs_save_name(const char *name); |
52 |
|
53 |
/* Get used RAM size for ccs_save_name(). */ |
54 |
unsigned int ccs_get_memory_used_for_save_name(void); |
55 |
|
56 |
/* Allocate memory for temporary use (e.g. permission checks). */ |
57 |
void *ccs_alloc(const size_t size); |
58 |
|
59 |
/* Get used RAM size for ccs_alloc(). */ |
60 |
unsigned int ccs_get_memory_used_for_dynamic(void); |
61 |
|
62 |
/* Free memory allocated by ccs_alloc(). */ |
63 |
void ccs_free(const void *p); |
64 |
|
65 |
#endif |