libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / system / libroot / os / fs_index.c
blob89469e2aa1eff7a01cd0d142d78c71863bbcf618
1 /*
2 * Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
4 */
7 #include <fs_index.h>
9 #include <dirent.h>
10 #include <errno.h>
11 #include <fcntl.h>
12 #include <stdlib.h>
14 #include <dirent_private.h>
15 #include <errno_private.h>
16 #include <syscalls.h>
17 #include <syscall_utils.h>
20 int
21 fs_create_index(dev_t device, const char *name, uint32 type, uint32 flags)
23 status_t status = _kern_create_index(device, name, type, flags);
25 RETURN_AND_SET_ERRNO(status);
29 int
30 fs_remove_index(dev_t device, const char *name)
32 status_t status = _kern_remove_index(device, name);
34 RETURN_AND_SET_ERRNO(status);
38 int
39 fs_stat_index(dev_t device, const char *name, struct index_info *indexInfo)
41 struct stat stat;
43 status_t status = _kern_read_index_stat(device, name, &stat);
44 if (status == B_OK) {
45 indexInfo->type = stat.st_type;
46 indexInfo->size = stat.st_size;
47 indexInfo->modification_time = stat.st_mtime;
48 indexInfo->creation_time = stat.st_crtime;
49 indexInfo->uid = stat.st_uid;
50 indexInfo->gid = stat.st_gid;
53 RETURN_AND_SET_ERRNO(status);
57 DIR *
58 fs_open_index_dir(dev_t device)
60 DIR *dir;
62 int fd = _kern_open_index_dir(device);
63 if (fd < 0) {
64 __set_errno(fd);
65 return NULL;
68 // allocate the DIR structure
69 if ((dir = __create_dir_struct(fd)) == NULL) {
70 _kern_close(fd);
71 return NULL;
74 return dir;
78 int
79 fs_close_index_dir(DIR *dir)
81 return closedir(dir);
85 struct dirent *
86 fs_read_index_dir(DIR *dir)
88 return readdir(dir);
92 void
93 fs_rewind_index_dir(DIR *dir)
95 rewinddir(dir);