ntfs.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * ntfs.h - Defines for NTFS Linux kernel driver. Part of the Linux-NTFS
  3. * project.
  4. *
  5. * Copyright (c) 2001-2004 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. #ifndef _LINUX_NTFS_H
  24. #define _LINUX_NTFS_H
  25. #include <linux/stddef.h>
  26. #include <linux/kernel.h>
  27. #include <linux/module.h>
  28. #include <linux/compiler.h>
  29. #include <linux/fs.h>
  30. #include <linux/nls.h>
  31. #include <linux/smp.h>
  32. #include "types.h"
  33. #include "volume.h"
  34. #include "layout.h"
  35. typedef enum {
  36. NTFS_BLOCK_SIZE = 512,
  37. NTFS_BLOCK_SIZE_BITS = 9,
  38. NTFS_SB_MAGIC = 0x5346544e, /* 'NTFS' */
  39. NTFS_MAX_NAME_LEN = 255,
  40. } NTFS_CONSTANTS;
  41. /* Global variables. */
  42. /* Slab caches (from super.c). */
  43. extern kmem_cache_t *ntfs_name_cache;
  44. extern kmem_cache_t *ntfs_inode_cache;
  45. extern kmem_cache_t *ntfs_big_inode_cache;
  46. extern kmem_cache_t *ntfs_attr_ctx_cache;
  47. extern kmem_cache_t *ntfs_index_ctx_cache;
  48. /* The various operations structs defined throughout the driver files. */
  49. extern struct address_space_operations ntfs_aops;
  50. extern struct address_space_operations ntfs_mst_aops;
  51. extern struct file_operations ntfs_file_ops;
  52. extern struct inode_operations ntfs_file_inode_ops;
  53. extern struct file_operations ntfs_dir_ops;
  54. extern struct inode_operations ntfs_dir_inode_ops;
  55. extern struct file_operations ntfs_empty_file_ops;
  56. extern struct inode_operations ntfs_empty_inode_ops;
  57. extern struct export_operations ntfs_export_ops;
  58. /**
  59. * NTFS_SB - return the ntfs volume given a vfs super block
  60. * @sb: VFS super block
  61. *
  62. * NTFS_SB() returns the ntfs volume associated with the VFS super block @sb.
  63. */
  64. static inline ntfs_volume *NTFS_SB(struct super_block *sb)
  65. {
  66. return sb->s_fs_info;
  67. }
  68. /* Declarations of functions and global variables. */
  69. /* From fs/ntfs/compress.c */
  70. extern int ntfs_read_compressed_block(struct page *page);
  71. extern int allocate_compression_buffers(void);
  72. extern void free_compression_buffers(void);
  73. /* From fs/ntfs/super.c */
  74. #define default_upcase_len 0x10000
  75. extern struct semaphore ntfs_lock;
  76. typedef struct {
  77. int val;
  78. char *str;
  79. } option_t;
  80. extern const option_t on_errors_arr[];
  81. /* From fs/ntfs/mst.c */
  82. extern int post_read_mst_fixup(NTFS_RECORD *b, const u32 size);
  83. extern int pre_write_mst_fixup(NTFS_RECORD *b, const u32 size);
  84. extern void post_write_mst_fixup(NTFS_RECORD *b);
  85. /* From fs/ntfs/unistr.c */
  86. extern BOOL ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
  87. const ntfschar *s2, size_t s2_len,
  88. const IGNORE_CASE_BOOL ic,
  89. const ntfschar *upcase, const u32 upcase_size);
  90. extern int ntfs_collate_names(const ntfschar *name1, const u32 name1_len,
  91. const ntfschar *name2, const u32 name2_len,
  92. const int err_val, const IGNORE_CASE_BOOL ic,
  93. const ntfschar *upcase, const u32 upcase_len);
  94. extern int ntfs_ucsncmp(const ntfschar *s1, const ntfschar *s2, size_t n);
  95. extern int ntfs_ucsncasecmp(const ntfschar *s1, const ntfschar *s2, size_t n,
  96. const ntfschar *upcase, const u32 upcase_size);
  97. extern void ntfs_upcase_name(ntfschar *name, u32 name_len,
  98. const ntfschar *upcase, const u32 upcase_len);
  99. extern void ntfs_file_upcase_value(FILE_NAME_ATTR *file_name_attr,
  100. const ntfschar *upcase, const u32 upcase_len);
  101. extern int ntfs_file_compare_values(FILE_NAME_ATTR *file_name_attr1,
  102. FILE_NAME_ATTR *file_name_attr2,
  103. const int err_val, const IGNORE_CASE_BOOL ic,
  104. const ntfschar *upcase, const u32 upcase_len);
  105. extern int ntfs_nlstoucs(const ntfs_volume *vol, const char *ins,
  106. const int ins_len, ntfschar **outs);
  107. extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
  108. const int ins_len, unsigned char **outs, int outs_len);
  109. /* From fs/ntfs/upcase.c */
  110. extern ntfschar *generate_default_upcase(void);
  111. #endif /* _LINUX_NTFS_H */