]> err.no Git - linux-2.6/blob - fs/ntfs/ntfs.h
e85f6e928b1ef91fc251bdd427c1a67e363cdbd4
[linux-2.6] / fs / ntfs / ntfs.h
1 /*
2  * ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS
3  *          project.
4  *
5  * Copyright (c) 2001-2005 Anton Altaparmakov
6  * Copyright (C) 2002 Richard Russon
7  *
8  * This program/include file is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as published
10  * by the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program/include file is distributed in the hope that it will be
14  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
15  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program (in the main directory of the Linux-NTFS
20  * distribution in the file COPYING); if not, write to the Free Software
21  * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 #ifndef _LINUX_NTFS_H
25 #define _LINUX_NTFS_H
26
27 #include <linux/stddef.h>
28 #include <linux/kernel.h>
29 #include <linux/module.h>
30 #include <linux/compiler.h>
31 #include <linux/fs.h>
32 #include <linux/nls.h>
33 #include <linux/smp.h>
34
35 #include "types.h"
36 #include "volume.h"
37 #include "layout.h"
38
39 typedef enum {
40         NTFS_BLOCK_SIZE         = 512,
41         NTFS_BLOCK_SIZE_BITS    = 9,
42         NTFS_SB_MAGIC           = 0x5346544e,   /* 'NTFS' */
43         NTFS_MAX_NAME_LEN       = 255,
44         NTFS_MAX_ATTR_NAME_LEN  = 255,
45 } NTFS_CONSTANTS;
46
47 /* Global variables. */
48
49 /* Slab caches (from super.c). */
50 extern kmem_cache_t *ntfs_name_cache;
51 extern kmem_cache_t *ntfs_inode_cache;
52 extern kmem_cache_t *ntfs_big_inode_cache;
53 extern kmem_cache_t *ntfs_attr_ctx_cache;
54 extern kmem_cache_t *ntfs_index_ctx_cache;
55
56 /* The various operations structs defined throughout the driver files. */
57 extern struct address_space_operations ntfs_aops;
58 extern struct address_space_operations ntfs_mst_aops;
59
60 extern struct  file_operations ntfs_file_ops;
61 extern struct inode_operations ntfs_file_inode_ops;
62
63 extern struct  file_operations ntfs_dir_ops;
64 extern struct inode_operations ntfs_dir_inode_ops;
65
66 extern struct  file_operations ntfs_empty_file_ops;
67 extern struct inode_operations ntfs_empty_inode_ops;
68
69 extern struct export_operations ntfs_export_ops;
70
71 /**
72  * NTFS_SB - return the ntfs volume given a vfs super block
73  * @sb:         VFS super block
74  *
75  * NTFS_SB() returns the ntfs volume associated with the VFS super block @sb.
76  */
77 static inline ntfs_volume *NTFS_SB(struct super_block *sb)
78 {
79         return sb->s_fs_info;
80 }
81
82 /* Declarations of functions and global variables. */
83
84 /* From fs/ntfs/compress.c */
85 extern int ntfs_read_compressed_block(struct page *page);
86 extern int allocate_compression_buffers(void);
87 extern void free_compression_buffers(void);
88
89 /* From fs/ntfs/super.c */
90 #define default_upcase_len 0x10000
91 extern struct semaphore ntfs_lock;
92
93 typedef struct {
94         int val;
95         char *str;
96 } option_t;
97 extern const option_t on_errors_arr[];
98
99 /* From fs/ntfs/mst.c */
100 extern int post_read_mst_fixup(NTFS_RECORD *b, const u32 size);
101 extern int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size);
102 extern void post_write_mst_fixup(NTFS_RECORD *b);
103
104 /* From fs/ntfs/unistr.c */
105 extern BOOL ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
106                 const ntfschar *s2, size_t s2_len,
107                 const IGNORE_CASE_BOOL ic,
108                 const ntfschar *upcase, const u32 upcase_size);
109 extern int ntfs_collate_names(const ntfschar *name1, const u32 name1_len,
110                 const ntfschar *name2, const u32 name2_len,
111                 const int err_val, const IGNORE_CASE_BOOL ic,
112                 const ntfschar *upcase, const u32 upcase_len);
113 extern int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n);
114 extern int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n,
115                 const ntfschar *upcase, const u32 upcase_size);
116 extern void ntfs_upcase_name(ntfschar *name, u32 name_len,
117                 const ntfschar *upcase, const u32 upcase_len);
118 extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
119                 const ntfschar *upcase, const u32 upcase_len);
120 extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
121                 FILE_NAME_ATTR *file_name_attr2,
122                 const int err_val, const IGNORE_CASE_BOOL ic,
123                 const ntfschar *upcase, const u32 upcase_len);
124 extern int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
125                 const int ins_len, ntfschar **outs);
126 extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
127                 const int ins_len, unsigned char **outs, int outs_len);
128
129 /* From fs/ntfs/upcase.c */
130 extern ntfschar *generate_default_upcase(void);
131
132 #endif /* _LINUX_NTFS_H */