1 /*
2 * Copyright (c) International Business Machines Corp., 2001
3 * Copyright (c) 2013 Cyril Hrubis <chrubis@suse.cz>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 * the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20 #ifndef GETDENTS_H
21 #define GETDENTS_H
22
23 #include <stdint.h>
24 #include "test.h"
25 #include "lapi/syscalls.h"
26
27 /*
28 * See fs/compat.c struct compat_linux_dirent
29 */
30 struct linux_dirent {
31 unsigned long d_ino;
32 unsigned long d_off;
33 unsigned short d_reclen;
34 char d_name[];
35 };
36
37 static inline int
getdents(unsigned int fd,struct linux_dirent * dirp,unsigned int size)38 getdents(unsigned int fd, struct linux_dirent *dirp, unsigned int size)
39 {
40 return ltp_syscall(__NR_getdents, fd, dirp, size);
41 }
42
43 struct linux_dirent64 {
44 uint64_t d_ino;
45 int64_t d_off;
46 unsigned short d_reclen;
47 unsigned char d_type;
48 char d_name[];
49 };
50
51 static inline int
getdents64(unsigned int fd,struct linux_dirent64 * dirp64,unsigned int size)52 getdents64(unsigned int fd, struct linux_dirent64 *dirp64, unsigned int size)
53 {
54 return ltp_syscall(__NR_getdents64, fd, dirp64, size);
55 }
56
57 #endif /* GETDENTS_H */
58