2019-05-22 10:51:42 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2005-04-17 02:20:36 +04:00
|
|
|
/*
|
2014-10-16 15:28:03 +04:00
|
|
|
* ntfs.h - Defines for NTFS Linux kernel driver.
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
2014-10-16 15:28:03 +04:00
|
|
|
* Copyright (c) 2001-2014 Anton Altaparmakov and Tuxera Inc.
|
2005-04-17 02:20:36 +04:00
|
|
|
* Copyright (C) 2002 Richard Russon
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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>
|
2005-04-06 19:09:21 +04:00
|
|
|
#include <linux/pagemap.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
#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,
|
2005-04-06 16:34:31 +04:00
|
|
|
NTFS_MAX_ATTR_NAME_LEN = 255,
|
2005-04-06 19:09:21 +04:00
|
|
|
NTFS_MAX_CLUSTER_SIZE = 64 * 1024, /* 64kiB */
|
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
ago with promise that one day it will be possible to implement page
cache with bigger chunks than PAGE_SIZE.
This promise never materialized. And unlikely will.
We have many places where PAGE_CACHE_SIZE assumed to be equal to
PAGE_SIZE. And it's constant source of confusion on whether
PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
especially on the border between fs and mm.
Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
breakage to be doable.
Let's stop pretending that pages in page cache are special. They are
not.
The changes are pretty straight-forward:
- <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
- page_cache_get() -> get_page();
- page_cache_release() -> put_page();
This patch contains automated changes generated with coccinelle using
script below. For some reason, coccinelle doesn't patch header files.
I've called spatch for them manually.
The only adjustment after coccinelle is revert of changes to
PAGE_CAHCE_ALIGN definition: we are going to drop it later.
There are few places in the code where coccinelle didn't reach. I'll
fix them manually in a separate patch. Comments and documentation also
will be addressed with the separate patch.
virtual patch
@@
expression E;
@@
- E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
expression E;
@@
- E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
@@
- PAGE_CACHE_SHIFT
+ PAGE_SHIFT
@@
@@
- PAGE_CACHE_SIZE
+ PAGE_SIZE
@@
@@
- PAGE_CACHE_MASK
+ PAGE_MASK
@@
expression E;
@@
- PAGE_CACHE_ALIGN(E)
+ PAGE_ALIGN(E)
@@
expression E;
@@
- page_cache_get(E)
+ get_page(E)
@@
expression E;
@@
- page_cache_release(E)
+ put_page(E)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-04-01 15:29:47 +03:00
|
|
|
NTFS_MAX_PAGES_PER_CLUSTER = NTFS_MAX_CLUSTER_SIZE / PAGE_SIZE,
|
2005-04-17 02:20:36 +04:00
|
|
|
} NTFS_CONSTANTS;
|
|
|
|
|
|
|
|
/* Global variables. */
|
|
|
|
|
|
|
|
/* Slab caches (from super.c). */
|
2006-02-06 00:43:57 +03:00
|
|
|
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;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* The various operations structs defined throughout the driver files. */
|
2014-10-16 15:28:03 +04:00
|
|
|
extern const struct address_space_operations ntfs_normal_aops;
|
|
|
|
extern const struct address_space_operations ntfs_compressed_aops;
|
2006-06-28 15:26:44 +04:00
|
|
|
extern const struct address_space_operations ntfs_mst_aops;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-03-28 13:56:42 +04:00
|
|
|
extern const struct file_operations ntfs_file_ops;
|
2007-02-12 11:55:39 +03:00
|
|
|
extern const struct inode_operations ntfs_file_inode_ops;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-03-28 13:56:42 +04:00
|
|
|
extern const struct file_operations ntfs_dir_ops;
|
2007-02-12 11:55:39 +03:00
|
|
|
extern const struct inode_operations ntfs_dir_inode_ops;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2006-03-28 13:56:42 +04:00
|
|
|
extern const struct file_operations ntfs_empty_file_ops;
|
2007-02-12 11:55:39 +03:00
|
|
|
extern const struct inode_operations ntfs_empty_inode_ops;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-10-22 03:42:17 +04:00
|
|
|
extern const struct export_operations ntfs_export_ops;
|
2005-03-03 16:44:15 +03:00
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/**
|
|
|
|
* 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
|
2006-03-23 19:57:48 +03:00
|
|
|
extern struct mutex ntfs_lock;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
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 */
|
2006-10-01 10:27:12 +04:00
|
|
|
extern bool ntfs_are_names_equal(const ntfschar *s1, size_t s1_len,
|
2005-04-17 02:20:36 +04:00
|
|
|
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);
|
|
|
|
|
2006-03-26 13:39:53 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
#endif /* _LINUX_NTFS_H */
|