vfs: check userland buffers before reading them.
[haiku.git] / headers / build / os / kernel / fs_attr.h
blob454914f359abd9d8f5e17670b72e963a2fba2dab
1 /*
2 * Copyright 2002-2009, Haiku Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _FS_ATTR_H
6 #define _FS_ATTR_H
9 #include <OS.h>
10 #include <dirent.h>
13 typedef struct attr_info {
14 uint32 type;
15 off_t size;
16 } attr_info;
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
24 /* Since libroot_build is also used on Haiku and linked against the real
25 * libroot which also has the fs*attr functions, these must be shadowed. */
26 #ifndef BUILDING_FS_ATTR_HAIKU
27 #define fs_read_attr build_fs_read_attr
28 #define fs_write_attr build_fs_write_attr
29 #define fs_remove_attr build_fs_remove_attr
30 #define fs_stat_attr build_fs_stat_attr
31 #define fs_open_attr build_fs_open_attr
32 #define fs_fopen_attr build_fs_fopen_attr
33 #define fs_close_attr build_fs_close_attr
34 #define fs_open_attr_dir build_fs_open_attr_dir
35 #define fs_fopen_attr_dir build_fs_fopen_attr_dir
36 #define fs_close_attr_dir build_fs_close_attr_dir
37 #define fs_read_attr_dir build_fs_read_attr_dir
38 #define fs_rewind_attr_dir build_fs_rewind_attr_dir
39 #endif
42 extern ssize_t fs_read_attr(int fd, const char *attribute, uint32 type,
43 off_t pos, void *buffer, size_t readBytes);
44 extern ssize_t fs_write_attr(int fd, const char *attribute, uint32 type,
45 off_t pos, const void *buffer, size_t readBytes);
46 extern int fs_remove_attr(int fd, const char *attribute);
47 extern int fs_stat_attr(int fd, const char *attribute,
48 struct attr_info *attrInfo);
50 extern int fs_open_attr(const char *path, const char *attribute,
51 uint32 type, int openMode);
52 extern int fs_fopen_attr(int fd, const char *attribute, uint32 type,
53 int openMode);
54 extern int fs_close_attr(int fd);
56 extern DIR *fs_open_attr_dir(const char *path);
57 extern DIR *fs_fopen_attr_dir(int fd);
58 extern int fs_close_attr_dir(DIR *dir);
59 extern struct dirent *fs_read_attr_dir(DIR *dir);
60 extern void fs_rewind_attr_dir(DIR *dir);
62 #ifdef __cplusplus
64 #endif
66 #endif /* _FS_ATTR_H */