]> bbs.cooldavid.org Git - net-next-2.6.git/blame - security/tomoyo/realpath.h
TOMOYO: Remove memory pool for list elements.
[net-next-2.6.git] / security / tomoyo / realpath.h
CommitLineData
c73bd6d4
KT
1/*
2 * security/tomoyo/realpath.h
3 *
4 * Get the canonicalized absolute pathnames. The basis for TOMOYO.
5 *
6 * Copyright (C) 2005-2009 NTT DATA CORPORATION
7 *
39826a1e 8 * Version: 2.2.0 2009/04/01
c73bd6d4
KT
9 *
10 */
11
12#ifndef _SECURITY_TOMOYO_REALPATH_H
13#define _SECURITY_TOMOYO_REALPATH_H
14
15struct path;
16struct tomoyo_path_info;
17struct tomoyo_io_buffer;
18
19/* Convert binary string to ascii string. */
20int tomoyo_encode(char *buffer, int buflen, const char *str);
21
22/* Returns realpath(3) of the given pathname but ignores chroot'ed root. */
23int tomoyo_realpath_from_path2(struct path *path, char *newname,
24 int newname_len);
25
26/*
27 * Returns realpath(3) of the given pathname but ignores chroot'ed root.
28 * These functions use tomoyo_alloc(), so the caller must call tomoyo_free()
29 * if these functions didn't return NULL.
30 */
31char *tomoyo_realpath(const char *pathname);
32/*
33 * Same with tomoyo_realpath() except that it doesn't follow the final symlink.
34 */
35char *tomoyo_realpath_nofollow(const char *pathname);
36/* Same with tomoyo_realpath() except that the pathname is already solved. */
37char *tomoyo_realpath_from_path(struct path *path);
38
cd7bec6a
TH
39/* Check memory quota. */
40bool tomoyo_memory_ok(void *ptr);
c73bd6d4
KT
41
42/*
43 * Keep the given name on the RAM.
44 * The RAM is shared, so NEVER try to modify or kfree() the returned name.
45 */
46const struct tomoyo_path_info *tomoyo_save_name(const char *name);
47
48/* Allocate memory for temporary use (e.g. permission checks). */
49void *tomoyo_alloc(const size_t size);
50
51/* Free memory allocated by tomoyo_alloc(). */
52void tomoyo_free(const void *p);
53
54/* Check for memory usage. */
55int tomoyo_read_memory_counter(struct tomoyo_io_buffer *head);
56
57/* Set memory quota. */
58int tomoyo_write_memory_quota(struct tomoyo_io_buffer *head);
59
1581e7dd
TH
60/* Initialize realpath related code. */
61void __init tomoyo_realpath_init(void);
62
c73bd6d4 63#endif /* !defined(_SECURITY_TOMOYO_REALPATH_H) */