2 * dir.h - Exports for directory handling. Originated from the Linux-NTFS project.
4 * Copyright (c) 2002 Anton Altaparmakov
5 * Copyright (c) 2005-2006 Yura Pakhuchiy
6 * Copyright (c) 2004-2005 Richard Russon
7 * Copyright (c) 2005-2008 Szabolcs Szakacsits
9 * This program/include file is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program/include file is distributed in the hope that it will be
15 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program (in the main directory of the NTFS-3G
21 * distribution in the file COPYING); if not, write to the Free Software
22 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33 * We do not have these under DJGPP, so define our version that do not conflict
34 * with other S_IFs defined under DJGPP.
38 #define S_IFLNK 0120000
41 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
44 #define S_IFSOCK 0140000
47 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
52 * The little endian Unicode strings $I30, $SII, $SDH, $O, $Q, $R
53 * as a global constant.
55 extern ntfschar NTFS_INDEX_I30
[5];
56 extern ntfschar NTFS_INDEX_SII
[5];
57 extern ntfschar NTFS_INDEX_SDH
[5];
58 extern ntfschar NTFS_INDEX_O
[3];
59 extern ntfschar NTFS_INDEX_Q
[3];
60 extern ntfschar NTFS_INDEX_R
[3];
62 extern u64
ntfs_inode_lookup_by_name(ntfs_inode
*dir_ni
,
63 const ntfschar
*uname
, const int uname_len
);
64 extern u64
ntfs_inode_lookup_by_mbsname(ntfs_inode
*dir_ni
, const char *name
);
65 extern void ntfs_inode_update_mbsname(ntfs_inode
*dir_ni
, const char *name
,
68 extern ntfs_inode
*ntfs_pathname_to_inode(ntfs_volume
*vol
, ntfs_inode
*parent
,
69 const char *pathname
);
70 extern ntfs_inode
*ntfs_create(ntfs_inode
*dir_ni
, le32 securid
,
71 const ntfschar
*name
, u8 name_len
, mode_t type
);
72 extern ntfs_inode
*ntfs_create_device(ntfs_inode
*dir_ni
, le32 securid
,
73 const ntfschar
*name
, u8 name_len
, mode_t type
, dev_t dev
);
74 extern ntfs_inode
*ntfs_create_symlink(ntfs_inode
*dir_ni
, le32 securid
,
75 const ntfschar
*name
, u8 name_len
, const ntfschar
*target
,
77 extern int ntfs_check_empty_dir(ntfs_inode
*ni
);
78 extern int ntfs_delete(ntfs_volume
*vol
, const char *path
,
79 ntfs_inode
*ni
, ntfs_inode
*dir_ni
, const ntfschar
*name
,
82 extern int ntfs_link(ntfs_inode
*ni
, ntfs_inode
*dir_ni
, const ntfschar
*name
,
86 * File types (adapted from include <linux/fs.h>)
88 #define NTFS_DT_UNKNOWN 0
89 #define NTFS_DT_FIFO 1
94 #define NTFS_DT_LNK 10
95 #define NTFS_DT_SOCK 12
96 #define NTFS_DT_WHT 14
97 #define NTFS_DT_REPARSE 32
100 * This is the "ntfs_filldir" function type, used by ntfs_readdir() to let
101 * the caller specify what kind of dirent layout it wants to have.
102 * This allows the caller to read directories into their application or
103 * to have different dirent layouts depending on the binary type.
105 typedef int (*ntfs_filldir_t
)(void *dirent
, const ntfschar
*name
,
106 const int name_len
, const int name_type
, const s64 pos
,
107 const MFT_REF mref
, const unsigned dt_type
);
109 extern int ntfs_readdir(ntfs_inode
*dir_ni
, s64
*pos
,
110 void *dirent
, ntfs_filldir_t filldir
);
112 ntfs_inode
*ntfs_dir_parent_inode(ntfs_inode
*ni
);
113 u32
ntfs_interix_types(ntfs_inode
*ni
);
115 int ntfs_get_ntfs_dos_name(ntfs_inode
*ni
, ntfs_inode
*dir_ni
,
116 char *value
, size_t size
);
117 int ntfs_set_ntfs_dos_name(ntfs_inode
*ni
, ntfs_inode
*dir_ni
,
118 const char *value
, size_t size
, int flags
);
119 int ntfs_remove_ntfs_dos_name(ntfs_inode
*ni
, ntfs_inode
*dir_ni
);
120 int ntfs_dir_link_cnt(ntfs_inode
*ni
);
124 struct CACHED_GENERIC
;
126 extern int ntfs_dir_inode_hash(const struct CACHED_GENERIC
*cached
);
127 extern int ntfs_dir_lookup_hash(const struct CACHED_GENERIC
*cached
);
131 #endif /* defined _NTFS_DIR_H */