blob: da4f06ff6f8da8f8171b8bed855d71de75214fe0 [file] [log] [blame]
Kentaro Takedac73bd6d2009-02-05 17:18:12 +09001/*
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 *
Tetsuo Handa39826a12009-04-08 22:31:28 +09008 * Version: 2.2.0 2009/04/01
Kentaro Takedac73bd6d2009-02-05 17:18:12 +09009 *
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.
Tetsuo Handa8e2d39a2010-01-26 20:45:27 +090028 * These functions use kzalloc(), so the caller must call kfree()
Kentaro Takedac73bd6d2009-02-05 17:18:12 +090029 * 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
Tetsuo Handacd7bec62010-01-05 06:39:37 +090039/* Check memory quota. */
40bool tomoyo_memory_ok(void *ptr);
Kentaro Takedac73bd6d2009-02-05 17:18:12 +090041
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
Kentaro Takedac73bd6d2009-02-05 17:18:12 +090048/* Check for memory usage. */
49int tomoyo_read_memory_counter(struct tomoyo_io_buffer *head);
50
51/* Set memory quota. */
52int tomoyo_write_memory_quota(struct tomoyo_io_buffer *head);
53
Tetsuo Handa1581e7d2009-02-21 20:40:50 +090054/* Initialize realpath related code. */
55void __init tomoyo_realpath_init(void);
56
Kentaro Takedac73bd6d2009-02-05 17:18:12 +090057#endif /* !defined(_SECURITY_TOMOYO_REALPATH_H) */