Blame view

fs/ntfs/ntfs.h 4.24 KB
a1d312de7   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-or-later */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
  /*
ce1bafa09   Anton Altaparmakov   NTFS: Split ntfs_...
3
   * ntfs.h - Defines for NTFS Linux kernel driver.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
   *
ce1bafa09   Anton Altaparmakov   NTFS: Split ntfs_...
5
   * Copyright (c) 2001-2014 Anton Altaparmakov and Tuxera Inc.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
   * Copyright (C) 2002 Richard Russon
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
8
9
10
11
12
13
14
15
16
17
18
   */
  
  #ifndef _LINUX_NTFS_H
  #define _LINUX_NTFS_H
  
  #include <linux/stddef.h>
  #include <linux/kernel.h>
  #include <linux/module.h>
  #include <linux/compiler.h>
  #include <linux/fs.h>
  #include <linux/nls.h>
  #include <linux/smp.h>
7fafb8b63   Anton Altaparmakov   NTFS: Minor clean...
19
  #include <linux/pagemap.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
22
23
24
25
26
27
28
29
  
  #include "types.h"
  #include "volume.h"
  #include "layout.h"
  
  typedef enum {
  	NTFS_BLOCK_SIZE		= 512,
  	NTFS_BLOCK_SIZE_BITS	= 9,
  	NTFS_SB_MAGIC		= 0x5346544e,	/* 'NTFS' */
  	NTFS_MAX_NAME_LEN	= 255,
bb3cf3350   Anton Altaparmakov   NTFS: Update attr...
30
  	NTFS_MAX_ATTR_NAME_LEN	= 255,
7fafb8b63   Anton Altaparmakov   NTFS: Minor clean...
31
  	NTFS_MAX_CLUSTER_SIZE	= 64 * 1024,	/* 64kiB */
09cbfeaf1   Kirill A. Shutemov   mm, fs: get rid o...
32
  	NTFS_MAX_PAGES_PER_CLUSTER = NTFS_MAX_CLUSTER_SIZE / PAGE_SIZE,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
34
35
36
37
  } NTFS_CONSTANTS;
  
  /* Global variables. */
  
  /* Slab caches (from super.c). */
64419d93a   Pekka Enberg   NTFS: We have str...
38
39
40
41
42
  extern struct kmem_cache *ntfs_name_cache;
  extern struct kmem_cache *ntfs_inode_cache;
  extern struct kmem_cache *ntfs_big_inode_cache;
  extern struct kmem_cache *ntfs_attr_ctx_cache;
  extern struct kmem_cache *ntfs_index_ctx_cache;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
43
44
  
  /* The various operations structs defined throughout the driver files. */
ce1bafa09   Anton Altaparmakov   NTFS: Split ntfs_...
45
46
  extern const struct address_space_operations ntfs_normal_aops;
  extern const struct address_space_operations ntfs_compressed_aops;
f5e54d6e5   Christoph Hellwig   [PATCH] mark addr...
47
  extern const struct address_space_operations ntfs_mst_aops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
48

4b6f5d20b   Arjan van de Ven   [PATCH] Make most...
49
  extern const struct  file_operations ntfs_file_ops;
92e1d5be9   Arjan van de Ven   [PATCH] mark stru...
50
  extern const struct inode_operations ntfs_file_inode_ops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
51

4b6f5d20b   Arjan van de Ven   [PATCH] Make most...
52
  extern const struct  file_operations ntfs_dir_ops;
92e1d5be9   Arjan van de Ven   [PATCH] mark stru...
53
  extern const struct inode_operations ntfs_dir_inode_ops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
54

4b6f5d20b   Arjan van de Ven   [PATCH] Make most...
55
  extern const struct  file_operations ntfs_empty_file_ops;
92e1d5be9   Arjan van de Ven   [PATCH] mark stru...
56
  extern const struct inode_operations ntfs_empty_inode_ops;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57

396551644   Christoph Hellwig   exportfs: make st...
58
  extern const struct export_operations ntfs_export_ops;
413826868   Anton Altaparmakov   NTFS: Make fs/ntf...
59

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
  /**
   * NTFS_SB - return the ntfs volume given a vfs super block
   * @sb:		VFS super block
   *
   * NTFS_SB() returns the ntfs volume associated with the VFS super block @sb.
   */
  static inline ntfs_volume *NTFS_SB(struct super_block *sb)
  {
  	return sb->s_fs_info;
  }
  
  /* Declarations of functions and global variables. */
  
  /* From fs/ntfs/compress.c */
  extern int ntfs_read_compressed_block(struct page *page);
  extern int allocate_compression_buffers(void);
  extern void free_compression_buffers(void);
  
  /* From fs/ntfs/super.c */
  #define default_upcase_len 0x10000
4e5e529ad   Ingo Molnar   NTFS: Semaphore t...
80
  extern struct mutex ntfs_lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
81
82
83
84
85
86
87
88
89
90
91
92
93
  
  typedef struct {
  	int val;
  	char *str;
  } option_t;
  extern const option_t on_errors_arr[];
  
  /* From fs/ntfs/mst.c */
  extern int post_read_mst_fixup(NTFS_RECORD *b, const u32 size);
  extern int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size);
  extern void post_write_mst_fixup(NTFS_RECORD *b);
  
  /* From fs/ntfs/unistr.c */
c49c31115   Richard Knutsson   [PATCH] fs/ntfs: ...
94
  extern bool ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
  		const ntfschar *s2, size_t s2_len,
  		const IGNORE_CASE_BOOL ic,
  		const ntfschar *upcase, const u32 upcase_size);
  extern int ntfs_collate_names(const ntfschar *name1, const u32 name1_len,
  		const ntfschar *name2, const u32 name2_len,
  		const int err_val, const IGNORE_CASE_BOOL ic,
  		const ntfschar *upcase, const u32 upcase_len);
  extern int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n);
  extern int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n,
  		const ntfschar *upcase, const u32 upcase_size);
  extern void ntfs_upcase_name(ntfschar *name, u32 name_len,
  		const ntfschar *upcase, const u32 upcase_len);
  extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
  		const ntfschar *upcase, const u32 upcase_len);
  extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
  		FILE_NAME_ATTR *file_name_attr2,
  		const int err_val, const IGNORE_CASE_BOOL ic,
  		const ntfschar *upcase, const u32 upcase_len);
  extern int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
  		const int ins_len, ntfschar **outs);
  extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
  		const int ins_len, unsigned char **outs, int outs_len);
  
  /* From fs/ntfs/upcase.c */
  extern ntfschar *generate_default_upcase(void);
b9a2838cc   Akinobu Mita   [PATCH] bitops: n...
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
  static inline int ntfs_ffs(int x)
  {
  	int r = 1;
  
  	if (!x)
  		return 0;
  	if (!(x & 0xffff)) {
  		x >>= 16;
  		r += 16;
  	}
  	if (!(x & 0xff)) {
  		x >>= 8;
  		r += 8;
  	}
  	if (!(x & 0xf)) {
  		x >>= 4;
  		r += 4;
  	}
  	if (!(x & 3)) {
  		x >>= 2;
  		r += 2;
  	}
  	if (!(x & 1)) {
  		x >>= 1;
  		r += 1;
  	}
  	return r;
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
148
  #endif /* _LINUX_NTFS_H */