1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * ntfs.h - Defines for NTFS Linux kernel driver.
5 * Copyright (c) 2001-2014 Anton Altaparmakov and Tuxera Inc.
6 * Copyright (C) 2002 Richard Russon
12 #include <linux/stddef.h>
13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/compiler.h>
17 #include <linux/nls.h>
18 #include <linux/smp.h>
19 #include <linux/pagemap.h>
26 NTFS_BLOCK_SIZE
= 512,
27 NTFS_BLOCK_SIZE_BITS
= 9,
28 NTFS_SB_MAGIC
= 0x5346544e, /* 'NTFS' */
29 NTFS_MAX_NAME_LEN
= 255,
30 NTFS_MAX_ATTR_NAME_LEN
= 255,
31 NTFS_MAX_CLUSTER_SIZE
= 64 * 1024, /* 64kiB */
32 NTFS_MAX_PAGES_PER_CLUSTER
= NTFS_MAX_CLUSTER_SIZE
/ PAGE_SIZE
,
35 /* Global variables. */
37 /* Slab caches (from super.c). */
38 extern struct kmem_cache
*ntfs_name_cache
;
39 extern struct kmem_cache
*ntfs_inode_cache
;
40 extern struct kmem_cache
*ntfs_big_inode_cache
;
41 extern struct kmem_cache
*ntfs_attr_ctx_cache
;
42 extern struct kmem_cache
*ntfs_index_ctx_cache
;
44 /* The various operations structs defined throughout the driver files. */
45 extern const struct address_space_operations ntfs_normal_aops
;
46 extern const struct address_space_operations ntfs_compressed_aops
;
47 extern const struct address_space_operations ntfs_mst_aops
;
49 extern const struct file_operations ntfs_file_ops
;
50 extern const struct inode_operations ntfs_file_inode_ops
;
52 extern const struct file_operations ntfs_dir_ops
;
53 extern const struct inode_operations ntfs_dir_inode_ops
;
55 extern const struct file_operations ntfs_empty_file_ops
;
56 extern const struct inode_operations ntfs_empty_inode_ops
;
58 extern const struct export_operations ntfs_export_ops
;
61 * NTFS_SB - return the ntfs volume given a vfs super block
62 * @sb: VFS super block
64 * NTFS_SB() returns the ntfs volume associated with the VFS super block @sb.
66 static inline ntfs_volume
*NTFS_SB(struct super_block
*sb
)
71 /* Declarations of functions and global variables. */
73 /* From fs/ntfs/compress.c */
74 extern int ntfs_read_compressed_block(struct page
*page
);
75 extern int allocate_compression_buffers(void);
76 extern void free_compression_buffers(void);
78 /* From fs/ntfs/super.c */
79 #define default_upcase_len 0x10000
80 extern struct mutex ntfs_lock
;
86 extern const option_t on_errors_arr
[];
88 /* From fs/ntfs/mst.c */
89 extern int post_read_mst_fixup(NTFS_RECORD
*b
, const u32 size
);
90 extern int pre_write_mst_fixup(NTFS_RECORD
*b
, const u32 size
);
91 extern void post_write_mst_fixup(NTFS_RECORD
*b
);
93 /* From fs/ntfs/unistr.c */
94 extern bool ntfs_are_names_equal(const ntfschar
*s1
, size_t s1_len
,
95 const ntfschar
*s2
, size_t s2_len
,
96 const IGNORE_CASE_BOOL ic
,
97 const ntfschar
*upcase
, const u32 upcase_size
);
98 extern int ntfs_collate_names(const ntfschar
*name1
, const u32 name1_len
,
99 const ntfschar
*name2
, const u32 name2_len
,
100 const int err_val
, const IGNORE_CASE_BOOL ic
,
101 const ntfschar
*upcase
, const u32 upcase_len
);
102 extern int ntfs_ucsncmp(const ntfschar
*s1
, const ntfschar
*s2
, size_t n
);
103 extern int ntfs_ucsncasecmp(const ntfschar
*s1
, const ntfschar
*s2
, size_t n
,
104 const ntfschar
*upcase
, const u32 upcase_size
);
105 extern void ntfs_upcase_name(ntfschar
*name
, u32 name_len
,
106 const ntfschar
*upcase
, const u32 upcase_len
);
107 extern void ntfs_file_upcase_value(FILE_NAME_ATTR
*file_name_attr
,
108 const ntfschar
*upcase
, const u32 upcase_len
);
109 extern int ntfs_file_compare_values(FILE_NAME_ATTR
*file_name_attr1
,
110 FILE_NAME_ATTR
*file_name_attr2
,
111 const int err_val
, const IGNORE_CASE_BOOL ic
,
112 const ntfschar
*upcase
, const u32 upcase_len
);
113 extern int ntfs_nlstoucs(const ntfs_volume
*vol
, const char *ins
,
114 const int ins_len
, ntfschar
**outs
);
115 extern int ntfs_ucstonls(const ntfs_volume
*vol
, const ntfschar
*ins
,
116 const int ins_len
, unsigned char **outs
, int outs_len
);
118 /* From fs/ntfs/upcase.c */
119 extern ntfschar
*generate_default_upcase(void);
121 static inline int ntfs_ffs(int x
)
150 #endif /* _LINUX_NTFS_H */