http://linux-ntfs.sourceforge.net/snapshots/ntfsprogs-200307311516.tar.bz2
[ntfsprogs.git] / include / dir.h
1 /*
2  * dir.h - Exports for directory handling. Part of the Linux-NTFS project.
3  *
4  * Copyright (c) 2002 Anton Altaparmakov
5  *
6  * This program/include file is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as published
8  * by the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program/include file is distributed in the hope that it will be
12  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program (in the main directory of the Linux-NTFS
18  * distribution in the file COPYING); if not, write to the Free Software
19  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21
22 #ifndef _NTFS_DIR_H
23 #define _NTFS_DIR_H
24
25 #include "types.h"
26
27 /* The little endian Unicode string $I30 as a global constant. */
28 extern uchar_t I30[5];
29
30 extern u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
31                 const uchar_t *uname, const int uname_len);
32
33 /*
34  * File types (adapted from include <linux/fs.h>)
35  */
36 #define NTFS_DT_UNKNOWN         0
37 #define NTFS_DT_FIFO            1
38 #define NTFS_DT_CHR             2
39 #define NTFS_DT_DIR             4
40 #define NTFS_DT_BLK             6
41 #define NTFS_DT_REG             8
42 #define NTFS_DT_LNK             10
43 #define NTFS_DT_SOCK            12
44 #define NTFS_DT_WHT             14
45
46 /*
47  * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let
48  * the caller specify what kind of dirent layout it wants to have.
49  * This allows the caller to read directories into their application or
50  * to have different dirent layouts depending on the binary type.
51  */
52 typedef int (*ntfs_filldir_t)(void *dirent, const uchar_t *name,
53                 const int name_len, const int name_type, const s64 pos,
54                 const MFT_REF mref, const unsigned dt_type);
55
56 extern int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
57                 void *dirent, ntfs_filldir_t filldir);
58
59 #endif /* defined _NTFS_DIR_H */
60