Commit 6c8b8509 authored by Anton Altaparmakov's avatar Anton Altaparmakov

Remove all traces of the old ntfs driver.

parent c39e9205
This diff is collapsed.
......@@ -576,35 +576,6 @@ CONFIG_HPFS_FS
say M here and read <file:Documentation/modules.txt>. If unsure,
say N.
CONFIG_NTFS_FS
NTFS is the file system of Microsoft Windows NT. Say Y if you want
to get read access to files on NTFS partitions of your hard drive.
The Linux NTFS driver supports most of the mount options of the VFAT
driver, see <file:Documentation/filesystems/ntfs.txt>. Saying Y here
will give you read-only access to NTFS partitions.
This code is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module will be called ntfs.o. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
CONFIG_NTFS_RW
If you say Y here, you will (maybe) be able to write to NTFS file
systems as well as read from them. The read-write support in NTFS
is far from being complete and is not well tested. If you say Y
here, back up your NTFS volume first, since it will probably get
damaged. Also, download the Linux-NTFS project distribution from
Sourceforge at <http://linux-ntfs.sf.net/> and always run the
included ntfsfix utility after writing to an NTFS partition from
Linux to fix some of the damage done by the driver. You should run
ntfsfix _after_ unmounting the partition in Linux but _before_
rebooting into Windows. When Windows next boots, chkdsk will be
run automatically to fix the remaining damage.
Please note that write support is limited to Windows NT4 and
earlier versions.
If unsure, say N.
CONFIG_SYSV_FS
SCO, Xenix and Coherent are commercial Unix systems for Intel
machines, and Version 7 was used on the DEC PDP-11. Saying Y
......
......@@ -61,8 +61,6 @@ dep_mbool ' JFS statistics' CONFIG_JFS_STATISTICS $CONFIG_JFS_FS
tristate 'Minix fs support' CONFIG_MINIX_FS
tristate 'FreeVxFS file system support (VERITAS VxFS(TM) compatible)' CONFIG_VXFS_FS
tristate 'NTFS file system support (read only)' CONFIG_NTFS_FS
dep_mbool ' NTFS write support (DANGEROUS)' CONFIG_NTFS_RW $CONFIG_NTFS_FS $CONFIG_EXPERIMENTAL
tristate 'OS/2 HPFS file system support' CONFIG_HPFS_FS
......
......@@ -52,7 +52,6 @@ subdir-$(CONFIG_SYSV_FS) += sysv
subdir-$(CONFIG_SMB_FS) += smbfs
subdir-$(CONFIG_NCP_FS) += ncpfs
subdir-$(CONFIG_HPFS_FS) += hpfs
subdir-$(CONFIG_NTFS_FS) += ntfs
subdir-$(CONFIG_UFS_FS) += ufs
subdir-$(CONFIG_EFS_FS) += efs
subdir-$(CONFIG_JFFS_FS) += jffs
......
# Rules for making the NTFS driver
O_TARGET := ntfs.o
obj-y := fs.o sysctl.o support.o util.o inode.o dir.o super.o attr.o unistr.o
obj-m := $(O_TARGET)
# New version format started 3 February 2001.
EXTRA_CFLAGS = -DNTFS_VERSION=\"1.1.21\" #-DDEBUG
include $(TOPDIR)/Rules.make
This diff is collapsed.
/*
* attr.h - Header file for attr.c
*
* Copyright (C) 1997 Rgis Duchesne
* Copyright (c) 2001 Anton Altaparmakov (AIA)
*/
#include <linux/nls.h>
ntfs_u8* ntfs_find_attr_in_mft_rec(ntfs_volume *vol, ntfs_u8 *m, __u32 type,
wchar_t *name, __u32 name_len, int ic, __u16 instance);
int ntfs_extend_attr(ntfs_inode *ino, ntfs_attribute *attr, const __s64 len);
int ntfs_resize_attr(ntfs_inode *ino, ntfs_attribute *attr, __s64 newsize);
int ntfs_insert_attribute(ntfs_inode *ino, unsigned char* attrdata);
int ntfs_read_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
ntfs_io *dest);
int ntfs_write_compressed(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
ntfs_io *dest);
int ntfs_create_attr(ntfs_inode *ino, int anum, char *aname, void *data,
int dsize, ntfs_attribute **rattr);
int ntfs_read_zero(ntfs_io *dest, int size);
int ntfs_make_attr_nonresident(ntfs_inode *ino, ntfs_attribute *attr);
int ntfs_attr_allnonresident(ntfs_inode *ino);
int ntfs_new_attr(ntfs_inode *ino, int type, void *name, int namelen,
void *value, int value_len, int *pos, int *found);
int ntfs_insert_run(ntfs_attribute *attr, int cnum, ntfs_cluster_t cluster,
int len);
This diff is collapsed.
/*
* dir.h - Header file for dir.c
*
* Copyright (C) 1997 Rgis Duchesne
*/
#define ITERATE_SPLIT_DONE 1
enum ntfs_iterate_e {
BY_POSITION,
BY_NAME,
DIR_INSERT
};
/* not all fields are used for all operations */
typedef struct ntfs_iterate_s {
enum ntfs_iterate_e type;
ntfs_inode *dir;
union{
ntfs_u64 pos;
int flags;
}u;
char *result; /* pointer to entry if found */
ntfs_u16* name;
int namelen;
int block; /* current index record */
int newblock; /* index record created in a split */
char *new_entry;
int new_entry_size;
/*ntfs_inode* new;*/
} ntfs_iterate_s;
int ntfs_getdir_unsorted(ntfs_inode *ino, ntfs_u32 *p_high, ntfs_u32* p_low,
int (*cb)(ntfs_u8*, void*), void *param);
int ntfs_getdir_byname(ntfs_iterate_s *walk);
int ntfs_dir_add(ntfs_inode *dir, ntfs_inode *new, ntfs_attribute *name);
int ntfs_check_index_record(ntfs_inode *ino, char *record);
int ntfs_getdir_byposition(ntfs_iterate_s *walk);
int ntfs_mkdir(ntfs_inode* dir,const char* name,int namelen, ntfs_inode *ino);
int ntfs_split_indexroot(ntfs_inode *ino);
int ntfs_add_index_root(ntfs_inode *ino, int type);
This diff is collapsed.
This diff is collapsed.
/*
* inode.h - Header file for inode.c
*
* Copyright (C) 1997 Rgis Duchesne
* Copyright (C) 1998 Martin von Lwis
* Copyright (c) 2001 Anton Altparmakov (AIA)
*/
ntfs_attribute *ntfs_find_attr(ntfs_inode *ino, int type, char *name);
int ntfs_read_attr(ntfs_inode *ino, int type, char *name, __s64 offset,
ntfs_io *buf);
int ntfs_write_attr(ntfs_inode *ino, int type, char *name, __s64 offset,
ntfs_io *buf);
int ntfs_init_inode(ntfs_inode *ino, ntfs_volume *vol, int inum);
void ntfs_clear_inode(ntfs_inode *ino);
int ntfs_check_mft_record(ntfs_volume *vol, char *record);
int ntfs_alloc_inode(ntfs_inode *dir, ntfs_inode *result, const char *filename,
int namelen, ntfs_u32);
int ntfs_alloc_file(ntfs_inode *dir, ntfs_inode *result, char *filename,
int namelen);
int ntfs_update_inode(ntfs_inode *ino);
int ntfs_vcn_to_lcn(ntfs_inode *ino, int vcn);
int ntfs_readwrite_attr(ntfs_inode *ino, ntfs_attribute *attr, __s64 offset,
ntfs_io *dest);
int ntfs_allocate_attr_number(ntfs_inode *ino, int *result);
int ntfs_decompress_run(unsigned char **data, int *length,
ntfs_cluster_t *cluster, int *ctype);
void ntfs_decompress(unsigned char *dest, unsigned char *src, ntfs_size_t l);
int splice_runlists(ntfs_runlist **rl1, int *r1len, const ntfs_runlist *rl2,
int r2len);
/*
* NOTE: Neither of the ntfs_*_bit functions are atomic! But we don't need
* them atomic at present as we never operate on shared/cached bitmaps.
*/
static __inline__ int ntfs_test_and_set_bit(unsigned char *byte, const int bit)
{
unsigned char *ptr = byte + (bit >> 3);
int b = 1 << (bit & 7);
int oldbit = *ptr & b ? 1 : 0;
*ptr |= b;
return oldbit;
}
/*
* macros.h
*
* Copyright (C) 1995 Martin von Lwis
* Copyright (C) 1996 Rgis Duchesne
* Copyright (c) 2001 Anton Altaparmakov
*/
#include <linux/ntfs_fs_i.h>
#include <linux/fs.h>
#include <asm/page.h>
#define NTFS_FD(vol) ((vol)->u.fd)
#define NTFS_SB(vol) ((struct super_block*)(vol)->sb)
#define NTFS_SB2VOL(sb) (&(sb)->u.ntfs_sb)
#define NTFS_INO2VOL(ino) (&((ino)->i_sb->u.ntfs_sb))
static inline struct ntfs_i *ntfs_i(struct inode *inode)
{
return list_entry(inode, struct ntfs_i, vfs_inode);
}
#define NTFS_I(ino) (&ntfs_i(ino)->n)
static inline struct inode *VFS_I(struct ntfs_inode_info *ntfs_ino)
{
return &list_entry(ntfs_ino, struct ntfs_i, n)->vfs_inode;
}
#define IS_MAGIC(a,b) (*(int*)(a) == *(int*)(b))
#define IS_MFT_RECORD(a) IS_MAGIC((a),"FILE")
#define IS_INDEX_RECORD(a) IS_MAGIC((a),"INDX")
/* 'NTFS' in little endian */
#define NTFS_SUPER_MAGIC 0x5346544E
#define NTFS_AFLAG_RO 1
#define NTFS_AFLAG_HIDDEN 2
#define NTFS_AFLAG_SYSTEM 4
#define NTFS_AFLAG_ARCHIVE 20
#define NTFS_AFLAG_COMPRESSED 0x800
#define NTFS_AFLAG_DIR 0x10000000
/*
* ntfsendian.h
*
* Copyright (C) 1998, 1999 Martin von Lwis
* Copyright (C) 1998 Joseph Malicki
* Copyright (C) 1999 Werner Seiler
* Copyright (C) 2001 Anton Altaparmakov (AIA)
*/
#include <asm/byteorder.h>
#define CPU_TO_LE16(a) __cpu_to_le16(a)
#define CPU_TO_LE32(a) __cpu_to_le32(a)
#define CPU_TO_LE64(a) __cpu_to_le64(a)
#define LE16_TO_CPU(a) __cpu_to_le16(a)
#define LE32_TO_CPU(a) __cpu_to_le32(a)
#define LE64_TO_CPU(a) __cpu_to_le64(a)
#define NTFS_GETU8(p) (*(ntfs_u8*)(p))
#define NTFS_GETU16(p) ((ntfs_u16)LE16_TO_CPU(*(ntfs_u16*)(p)))
#define NTFS_GETU24(p) ((ntfs_u32)NTFS_GETU16(p) | \
((ntfs_u32)NTFS_GETU8(((char*)(p)) + 2) << 16))
#define NTFS_GETU32(p) ((ntfs_u32)LE32_TO_CPU(*(ntfs_u32*)(p)))
#define NTFS_GETU40(p) ((ntfs_u64)NTFS_GETU32(p) | \
(((ntfs_u64)NTFS_GETU8(((char*)(p)) + 4)) << 32))
#define NTFS_GETU48(p) ((ntfs_u64)NTFS_GETU32(p) | \
(((ntfs_u64)NTFS_GETU16(((char*)(p)) + 4)) << 32))
#define NTFS_GETU56(p) ((ntfs_u64)NTFS_GETU32(p) | \
(((ntfs_u64)NTFS_GETU24(((char*)(p)) + 4)) << 32))
#define NTFS_GETU64(p) ((ntfs_u64)LE64_TO_CPU(*(ntfs_u64*)(p)))
/* Macros writing unsigned integers */
#define NTFS_PUTU8(p,v) ((*(ntfs_u8*)(p)) = (v))
#define NTFS_PUTU16(p,v) ((*(ntfs_u16*)(p)) = CPU_TO_LE16(v))
#define NTFS_PUTU24(p,v) NTFS_PUTU16(p, (v) & 0xFFFF);\
NTFS_PUTU8(((char*)(p)) + 2, (v) >> 16)
#define NTFS_PUTU32(p,v) ((*(ntfs_u32*)(p)) = CPU_TO_LE32(v))
#define NTFS_PUTU64(p,v) ((*(ntfs_u64*)(p)) = CPU_TO_LE64(v))
/* Macros reading signed integers */
#define NTFS_GETS8(p) ((*(ntfs_s8*)(p)))
#define NTFS_GETS16(p) ((ntfs_s16)LE16_TO_CPU(*(short*)(p)))
#define NTFS_GETS24(p) (NTFS_GETU24(p) < 0x800000 ? \
(int)NTFS_GETU24(p) : \
(int)(NTFS_GETU24(p) - 0x1000000))
#define NTFS_GETS32(p) ((ntfs_s32)LE32_TO_CPU(*(int*)(p)))
#define NTFS_GETS40(p) (((ntfs_s64)NTFS_GETU32(p)) | \
(((ntfs_s64)NTFS_GETS8(((char*)(p)) + 4)) << 32))
#define NTFS_GETS48(p) (((ntfs_s64)NTFS_GETU32(p)) | \
(((ntfs_s64)NTFS_GETS16(((char*)(p)) + 4)) << 32))
#define NTFS_GETS56(p) (((ntfs_s64)NTFS_GETU32(p)) | \
(((ntfs_s64)NTFS_GETS24(((char*)(p)) + 4)) << 32))
#define NTFS_GETS64(p) ((ntfs_s64)NTFS_GETU64(p))
#define NTFS_PUTS8(p,v) NTFS_PUTU8(p,v)
#define NTFS_PUTS16(p,v) NTFS_PUTU16(p,v)
#define NTFS_PUTS24(p,v) NTFS_PUTU24(p,v)
#define NTFS_PUTS32(p,v) NTFS_PUTU32(p,v)
#define NTFS_PUTS64(p,v) NTFS_PUTU64(p,v)
/*
* ntfstypes.h - This file defines four things:
* - Generic platform independent fixed-size types (e.g. ntfs_u32).
* - Specific fixed-size types (e.g. ntfs_offset_t).
* - Macros that read and write those types from and to byte arrays.
* - Types derived from OS specific ones.
*
* Copyright (C) 1996, 1998, 1999 Martin von Lwis
* Copyright (C) 2001 Anton Altaparmakov (AIA)
*/
#include <linux/fs.h>
#include "ntfsendian.h"
#include <asm/types.h>
/* Integral types */
#ifndef NTFS_INTEGRAL_TYPES
#define NTFS_INTEGRAL_TYPES
typedef u8 ntfs_u8;
typedef u16 ntfs_u16;
typedef u32 ntfs_u32;
typedef u64 ntfs_u64;
typedef s8 ntfs_s8;
typedef s16 ntfs_s16;
typedef s32 ntfs_s32;
typedef s64 ntfs_s64;
#endif
/* Unicode character type */
#ifndef NTFS_WCHAR_T
#define NTFS_WCHAR_T
typedef u16 ntfs_wchar_t;
#endif
/* File offset */
#ifndef NTFS_OFFSET_T
#define NTFS_OFFSET_T
typedef s64 ntfs_offset_t;
#endif
/* UTC */
#ifndef NTFS_TIME64_T
#define NTFS_TIME64_T
typedef u64 ntfs_time64_t;
#endif
/*
* This is really signed long long. So we support only volumes up to 2Tb. This
* is ok as Win2k also only uses 32-bits to store clusters.
* Whatever you do keep this a SIGNED value or a lot of NTFS users with
* corrupted filesystems will lynch you! It causes massive fs corruption when
* unsigned due to the nature of many checks relying on being performed on
* signed quantities. (AIA)
*/
#ifndef NTFS_CLUSTER_T
#define NTFS_CLUSTER_T
typedef s32 ntfs_cluster_t;
#endif
/* Architecture independent macros. */
/* PUTU32 would not clear all bytes. */
#define NTFS_PUTINUM(p,i) NTFS_PUTU64(p, i->i_number); \
NTFS_PUTU16(((char*)p) + 6, i->sequence_number)
/* System dependent types. */
#include <asm/posix_types.h>
#ifndef NTMODE_T
#define NTMODE_T
typedef __kernel_mode_t ntmode_t;
#endif
#ifndef NTFS_UID_T
#define NTFS_UID_T
typedef uid_t ntfs_uid_t;
#endif
#ifndef NTFS_GID_T
#define NTFS_GID_T
typedef gid_t ntfs_gid_t;
#endif
#ifndef NTFS_SIZE_T
#define NTFS_SIZE_T
typedef __kernel_size_t ntfs_size_t;
#endif
#ifndef NTFS_TIME_T
#define NTFS_TIME_T
typedef __kernel_time_t ntfs_time_t;
#endif
/*
* struct.h - Structure definitions
*
* Copyright (C) 1997 Rgis Duchesne
* Copyright (C) 2000-2001 Anton Altaparmakov (AIA)
*/
#include <linux/ntfs_fs.h>
/* Necessary forward definition. */
struct ntfs_inode;
/* Which files should be returned from a director listing. */
#define ngt_dos 1 /* only short names, no system files */
#define ngt_nt 2 /* only long names, all-uppercase becomes
* all-lowercase, no system files */
#define ngt_posix 3 /* all names except system files */
#define ngt_full 4 /* all entries */
typedef struct ntfs_sb_info ntfs_volume;
typedef struct {
ntfs_cluster_t lcn;
ntfs_cluster_t len;
} ntfs_runlist;
typedef struct ntfs_attribute {
int type;
ntfs_u16 *name;
int namelen;
int attrno;
__s64 size, allocated, initialized, compsize;
ATTR_FLAGS flags;
__u8 resident, indexed;
int cengine;
union {
void *data; /* if resident */
struct {
ntfs_runlist *runlist;
unsigned long len;
} r;
} d;
} ntfs_attribute;
typedef struct ntfs_inode_info ntfs_inode;
/* Structure to define IO to user buffer. do_read means that the destination
* has to be written using fn_put, do_write means that the destination has to
* read using fn_get. So, do_read is from a user's point of view, while put and
* get are from the driver's point of view. The first argument is always the
* destination of the IO. */
typedef struct ntfs_io{
int do_read;
void (*fn_put)(struct ntfs_io *dest, void *buf, ntfs_size_t);
void (*fn_get)(void *buf, struct ntfs_io *src, ntfs_size_t len);
void *param;
unsigned long size;
} ntfs_io;
#if 0
typedef struct {
ntfs_volume *vol;
ntfs_inode *ino;
int type;
char *name;
int mftno;
int start_vcn;
} ntfs_attrlist_item;
#endif
This diff is collapsed.
/*
* super.h - Header file for super.c
*
* Copyright (C) 1995-1997 Martin von Lwis
* Copyright (C) 1996-1997 Rgis Duchesne
* Copyright (c) 2001 Anton Altaparmakov
*/
int ntfs_get_free_cluster_count(ntfs_inode *bitmap);
int ntfs_get_volumesize(ntfs_volume *vol, __s64 *vol_size);
int ntfs_init_volume(ntfs_volume *vol, char *boot);
int ntfs_load_special_files(ntfs_volume *vol);
int ntfs_release_volume(ntfs_volume *vol);
int ntfs_insert_fixups(unsigned char *rec, int rec_size);
int ntfs_fixup_record(char *record, char *magic, int size);
int ntfs_allocate_clusters(ntfs_volume *vol, ntfs_cluster_t *location,
ntfs_cluster_t *count, ntfs_runlist **rl, int *rl_len,
const NTFS_CLUSTER_ALLOCATION_ZONES zone);
int ntfs_deallocate_cluster_run(const ntfs_volume *vol,
const ntfs_cluster_t lcn, const ntfs_cluster_t len);
int ntfs_deallocate_clusters(const ntfs_volume *vol, const ntfs_runlist *rl,
const int rl_len);
/*
* support.c - Specific support functions
*
* Copyright (C) 1997 Martin von Lwis
* Copyright (C) 1997 Rgis Duchesne
* Copyright (C) 2001 Anton Altaparmakov (AIA)
*/
#include "ntfstypes.h"
#include "struct.h"
#include "support.h"
#include <stdarg.h>
#include <linux/slab.h>
#include <linux/locks.h>
#include <linux/fs.h>
#include "util.h"
#include "inode.h"
#include "macros.h"
#include <linux/nls.h>
static char print_buf[1024];
#ifdef DEBUG
#include "sysctl.h"
#include <linux/kernel.h>
/* Debugging output */
void ntfs_debug(int mask, const char *fmt, ...)
{
va_list ap;
/* Filter it with the debugging level required */
if (ntdebug & mask) {
va_start(ap,fmt);
strcpy(print_buf, KERN_DEBUG "NTFS: ");
vsprintf(print_buf + 9, fmt, ap);
printk(print_buf);
va_end(ap);
}
}
#ifndef ntfs_malloc
/* Verbose kmalloc */
void *ntfs_malloc(int size)
{
void *ret;
ret = kmalloc(size, GFP_KERNEL);
ntfs_debug(DEBUG_MALLOC, "Allocating %x at %p\n", size, ret);
return ret;
}
#endif
#ifndef ntfs_free
/* Verbose kfree() */
void ntfs_free(void *block)
{
ntfs_debug(DEBUG_MALLOC, "Freeing memory at %p\n", block);
kfree(block);
}
#endif
#else /* End of DEBUG functions. Normal ones below... */
#ifndef ntfs_malloc
void *ntfs_malloc(int size)
{
return kmalloc(size, GFP_KERNEL);
}
#endif
#ifndef ntfs_free
void ntfs_free(void *block)
{
kfree(block);
}
#endif
#endif /* DEBUG */
void ntfs_bzero(void *s, int n)
{
memset(s, 0, n);
}
/* These functions deliberately return no value. It is dest, anyway,
and not used anywhere in the NTFS code. */
void ntfs_memcpy(void *dest, const void *src, ntfs_size_t n)
{
memcpy(dest, src, n);
}
void ntfs_memmove(void *dest, const void *src, ntfs_size_t n)
{
memmove(dest, src, n);
}
/* Warn that an error occurred. */
void ntfs_error(const char *fmt,...)
{
va_list ap;
va_start(ap, fmt);
strcpy(print_buf, KERN_ERR "NTFS: ");
vsprintf(print_buf + 9, fmt, ap);
printk(print_buf);
va_end(ap);
}
int ntfs_read_mft_record(ntfs_volume *vol, int mftno, char *buf)
{
int error;
ntfs_io io;
ntfs_debug(DEBUG_OTHER, "read_mft_record 0x%x\n", mftno);
if (mftno == FILE_Mft)
{
ntfs_memcpy(buf, vol->mft, vol->mft_record_size);
return 0;
}
if (!vol->mft_ino)
{
printk(KERN_ERR "NTFS: mft_ino is NULL. Something is terribly "
"wrong here!\n");
return -ENODATA;
}
io.fn_put = ntfs_put;
io.fn_get = 0;
io.param = buf;
io.size = vol->mft_record_size;
ntfs_debug(DEBUG_OTHER, "read_mft_record: calling ntfs_read_attr with: "
"mftno = 0x%x, vol->mft_record_size_bits = 0x%x, "
"mftno << vol->mft_record_size_bits = 0x%Lx\n", mftno,
vol->mft_record_size_bits,
(__s64)mftno << vol->mft_record_size_bits);
error = ntfs_read_attr(vol->mft_ino, vol->at_data, NULL,
(__s64)mftno << vol->mft_record_size_bits, &io);
if (error || (io.size != vol->mft_record_size)) {
ntfs_debug(DEBUG_OTHER, "read_mft_record: read 0x%x failed "
"(%d,%d,%d)\n", mftno, error, io.size,
vol->mft_record_size);
return error ? error : -ENODATA;
}
ntfs_debug(DEBUG_OTHER, "read_mft_record: finished read 0x%x\n", mftno);
if (!ntfs_check_mft_record(vol, buf)) {
/* FIXME: This is incomplete behaviour. We might be able to
* recover at this stage. ntfs_check_mft_record() is too
* conservative at aborting it's operations. It is OK for
* now as we just can't handle some on disk structures
* this way. (AIA) */
printk(KERN_WARNING "NTFS: Invalid MFT record for 0x%x\n", mftno);
return -EIO;
}
ntfs_debug(DEBUG_OTHER, "read_mft_record: Done 0x%x\n", mftno);
return 0;
}
int ntfs_getput_clusters(ntfs_volume *vol, int cluster, ntfs_size_t start_offs,
ntfs_io *buf)
{
struct super_block *sb = NTFS_SB(vol);
struct buffer_head *bh;
int length = buf->size;
int error = 0;
ntfs_size_t to_copy;
ntfs_debug(DEBUG_OTHER, "%s_clusters %d %d %d\n",
buf->do_read ? "get" : "put", cluster, start_offs, length);
to_copy = vol->cluster_size - start_offs;
while (length) {
if (!(bh = sb_bread(sb, cluster))) {
ntfs_debug(DEBUG_OTHER, "%s failed\n",
buf->do_read ? "Reading" : "Writing");
error = -EIO;
goto error_ret;
}
if (to_copy > length)
to_copy = length;
lock_buffer(bh);
if (buf->do_read) {
buf->fn_put(buf, bh->b_data + start_offs, to_copy);
unlock_buffer(bh);
} else {
buf->fn_get(bh->b_data + start_offs, buf, to_copy);
mark_buffer_dirty(bh);
unlock_buffer(bh);
/*
* Note: We treat synchronous IO on a per volume basis
* disregarding flags of individual inodes. This can
* lead to some strange write ordering effects upon a
* remount with a change in the sync flag but it should
* not break anything. [Except if the system crashes
* at that point in time but there would be more thigs
* to worry about than that in that case...]. (AIA)
*/
if (sb->s_flags & MS_SYNCHRONOUS) {
ll_rw_block(WRITE, 1, &bh);
wait_on_buffer(bh);
if (buffer_req(bh) && !buffer_uptodate(bh)) {
printk(KERN_ERR "IO error syncing NTFS "
"cluster [%s:%i]\n",
sb->s_id, cluster);
brelse(bh);
error = -EIO;
goto error_ret;
}
}
}
brelse(bh);
length -= to_copy;
start_offs = 0;
to_copy = vol->cluster_size;
cluster++;
}
error_ret:
return error;
}
ntfs_time64_t ntfs_now(void)
{
return ntfs_unixutc2ntutc(CURRENT_TIME);
}
int ntfs_dupuni2map(ntfs_volume *vol, ntfs_u16 *in, int in_len, char **out,
int *out_len)
{
int i, o, chl, chi;
char *result, *buf, charbuf[NLS_MAX_CHARSET_SIZE];
struct nls_table *nls = vol->nls_map;
result = ntfs_malloc(in_len + 1);
if (!result)
return -ENOMEM;
*out_len = in_len;
for (i = o = 0; i < in_len; i++) {
/* FIXME: Byte order? */
wchar_t uni = in[i];
if ((chl = nls->uni2char(uni, charbuf,
NLS_MAX_CHARSET_SIZE)) > 0) {
/* Adjust result buffer. */
if (chl > 1) {
buf = ntfs_malloc(*out_len + chl - 1);
if (!buf) {
i = -ENOMEM;
goto err_ret;
}
memcpy(buf, result, o);
ntfs_free(result);
result = buf;
*out_len += (chl - 1);
}
for (chi = 0; chi < chl; chi++)
result[o++] = charbuf[chi];
} else {
/* Invalid character. */
printk(KERN_ERR "NTFS: Unicode name contains a "
"character that cannot be converted "
"to chosen character set. Remount "
"with utf8 encoding and this should "
"work.\n");
i = -EILSEQ;
goto err_ret;
}
}
result[*out_len] = '\0';
*out = result;
return 0;
err_ret:
ntfs_free(result);
*out_len = 0;
*out = NULL;
return i;
}
int ntfs_dupmap2uni(ntfs_volume *vol, char* in, int in_len, ntfs_u16 **out,
int *out_len)
{
int i, o;
ntfs_u16 *result;
struct nls_table *nls = vol->nls_map;
*out = result = ntfs_malloc(2 * in_len);
if (!result) {
*out_len = 0;
return -ENOMEM;
}
*out_len = in_len;
for (i = o = 0; i < in_len; i++, o++) {
wchar_t uni;
int charlen;
charlen = nls->char2uni(&in[i], in_len - i, &uni);
if (charlen < 0) {
i = charlen;
goto err_ret;
}
*out_len -= charlen - 1;
i += charlen - 1;
/* FIXME: Byte order? */
result[o] = uni;
if (!result[o]) {
i = -EILSEQ;
goto err_ret;
}
}
return 0;
err_ret:
printk(KERN_ERR "NTFS: Name contains a character that cannot be "
"converted to Unicode.\n");
ntfs_free(result);
*out_len = 0;
*out = NULL;
return i;
}
/*
* support.h - Header file for specific support.c
*
* Copyright (C) 1997 Rgis Duchesne
* Copyright (c) 2001 Anton Altaparmakov (AIA)
*/
/* Debug levels */
#define DEBUG_OTHER 1
#define DEBUG_MALLOC 2
#define DEBUG_BSD 4
#define DEBUG_LINUX 8
#define DEBUG_DIR1 16
#define DEBUG_DIR2 32
#define DEBUG_DIR3 64
#define DEBUG_FILE1 128
#define DEBUG_FILE2 256
#define DEBUG_FILE3 512
#define DEBUG_NAME1 1024
#define DEBUG_NAME2 2048
#ifdef DEBUG
void ntfs_debug(int mask, const char *fmt, ...);
#else
#define ntfs_debug(mask, fmt...) do {} while (0)
#endif
#include <linux/slab.h>
#include <linux/vmalloc.h>
#define ntfs_malloc(size) kmalloc(size, GFP_KERNEL)
#define ntfs_free(ptr) kfree(ptr)
#define ntfs_vmalloc(size) vmalloc_32(size)
#define ntfs_vfree(ptr) vfree(ptr)
void ntfs_bzero(void *s, int n);
void ntfs_memcpy(void *dest, const void *src, ntfs_size_t n);
void ntfs_memmove(void *dest, const void *src, ntfs_size_t n);
void ntfs_error(const char *fmt,...);
int ntfs_read_mft_record(ntfs_volume *vol, int mftno, char *buf);
int ntfs_getput_clusters(ntfs_volume *pvol, int cluster, ntfs_size_t offs,
ntfs_io *buf);
ntfs_time64_t ntfs_now(void);
int ntfs_dupuni2map(ntfs_volume *vol, ntfs_u16 *in, int in_len, char **out,
int *out_len);
int ntfs_dupmap2uni(ntfs_volume *vol, char* in, int in_len, ntfs_u16 **out,
int *out_len);
/*
* sysctl.c - System control stuff
*
* Copyright (C) 1997 Martin von Lwis
* Copyright (C) 1997 Rgis Duchesne
*/
#include "sysctl.h"
#ifdef DEBUG
#include <linux/locks.h>
#include <linux/sysctl.h>
int ntdebug = 0;
/* Add or remove the debug sysctl
* Is this really the only file system with sysctls ?
*/
void ntfs_sysctl(int add)
{
#define FS_NTFS 1
/* Definition of the sysctl */
static ctl_table ntfs_sysctls[]={
{FS_NTFS, /* ID */
"ntfs-debug", /* name in /proc */
&ntdebug,sizeof(ntdebug), /* data ptr, data size */
0644, /* mode */
0, /* child */
proc_dointvec, /* proc handler */
0, /* strategy */
0, /* proc control block */
0,0}, /* extra */
{0}
};
/* Define the parent file : /proc/sys/fs */
static ctl_table sysctls_root[]={
{CTL_FS,
"fs",
NULL,0,
0555,
ntfs_sysctls},
{0}
};
static struct ctl_table_header *sysctls_root_header = NULL;
if(add){
if(!sysctls_root_header)
sysctls_root_header = register_sysctl_table(sysctls_root, 0);
} else if(sysctls_root_header) {
unregister_sysctl_table(sysctls_root_header);
sysctls_root_header = NULL;
}
}
#endif /* DEBUG */
/*
* sysctl.h - Header file for sysctl.c
*
* Copyright (C) 1997 Martin von Lwis
* Copyright (C) 1997 Rgis Duchesne
*/
#ifdef DEBUG
extern int ntdebug;
void ntfs_sysctl(int add);
#define SYSCTL(x) ntfs_sysctl(x)
#else
#define SYSCTL(x)
#endif /* DEBUG */
/*
* unistr.c - Unicode string handling. Part of the Linux-NTFS project.
*
* Copyright (c) 2000,2001 Anton Altaparmakov.
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the Linux-NTFS
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/string.h>
#include <linux/fs.h>
#include <asm/byteorder.h>
#include "unistr.h"
#include "macros.h"
/*
* This is used by the name collation functions to quickly determine what
* characters are (in)valid.
*/
const __u8 legal_ansi_char_array[0x40] = {
0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
0x17, 0x07, 0x18, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x18, 0x16, 0x16, 0x17, 0x07, 0x00,
0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17,
0x17, 0x17, 0x04, 0x16, 0x18, 0x16, 0x18, 0x18,
};
/**
* ntfs_are_names_equal - compare two Unicode names for equality
* @s1: name to compare to @s2
* @s1_len: length in Unicode characters of @s1
* @s2: name to compare to @s1
* @s2_len: length in Unicode characters of @s2
* @ic: ignore case bool
* @upcase: upcase table (only if @ic == IGNORE_CASE)
* @upcase_size: length in Unicode characters of @upcase (if present)
*
* Compare the names @s1 and @s2 and return TRUE (1) if the names are
* identical, or FALSE (0) if they are not identical. If @ic is IGNORE_CASE,
* the @upcase table is used to performa a case insensitive comparison.
*/
int ntfs_are_names_equal(wchar_t *s1, size_t s1_len,
wchar_t *s2, size_t s2_len, int ic,
wchar_t *upcase, __u32 upcase_size)
{
if (s1_len != s2_len)
return 0;
if (!ic)
return memcmp(s1, s2, s1_len << 1) ? 0: 1;
return ntfs_wcsncasecmp(s1, s2, s1_len, upcase, upcase_size) ? 0: 1;
}
/**
* ntfs_collate_names - collate two Unicode names
* @upcase: upcase table (ignored if @ic is CASE_SENSITIVE)
* @upcase_len: upcase table size (ignored if @ic is CASE_SENSITIVE)
* @name1: first Unicode name to compare
* @name2: second Unicode name to compare
* @ic: either CASE_SENSITIVE or IGNORE_CASE
* @err_val: if @name1 contains an invalid character return this value
*
* ntfs_collate_names collates two Unicode names and returns:
*
* -1 if the first name collates before the second one,
* 0 if the names match,
* 1 if the second name collates before the first one, or
* @ec if an invalid character is encountered in @name1 during the comparison.
*
* The following characters are considered invalid: '"', '*', '<', '>' and '?'.
*/
int ntfs_collate_names(wchar_t *upcase, __u32 upcase_len,
wchar_t *name1, __u32 name1_len,
wchar_t *name2, __u32 name2_len,
int ic, int err_val)
{
__u32 cnt, min_len;
wchar_t c1, c2;
min_len = name1_len;
if (min_len > name2_len)
min_len = name2_len;
for (cnt = 0; cnt < min_len; ++cnt) {
c1 = le16_to_cpu(*name1++);
c2 = le16_to_cpu(*name2++);
if (ic) {
if (c1 < upcase_len)
c1 = le16_to_cpu(upcase[c1]);
if (c2 < upcase_len)
c2 = le16_to_cpu(upcase[c2]);
}
if (c1 < 64 && legal_ansi_char_array[c1] & 8)
return err_val;
if (c1 < c2)
return -1;
if (c1 > c2)
return 1;
++name1;
++name2;
}
if (name1_len < name2_len)
return -1;
if (name1_len == name2_len)
return 0;
/* name1_len > name2_len */
c1 = le16_to_cpu(*name1);
if (c1 < 64 && legal_ansi_char_array[c1] & 8)
return err_val;
return 1;
}
/**
* ntfs_wcsncasecmp - compare two little endian Unicode strings, ignoring case
* @s1: first string
* @s2: second string
* @n: maximum unicode characters to compare
* @upcase: upcase table
* @upcase_size: upcase table size in Unicode characters
*
* Compare the first @n characters of the Unicode strings @s1 and @s2,
* ignoring case. The strings in little endian format and appropriate
* le16_to_cpu() conversion is performed on non-little endian machines.
*
* Each character is uppercased using the @upcase table before the comparison.
*
* The function returns an integer less than, equal to, or greater than zero
* if @s1 (or the first @n Unicode characters thereof) is found, respectively,
* to be less than, to match, or be greater than @s2.
*/
int ntfs_wcsncasecmp(wchar_t *s1, wchar_t *s2, size_t n,
wchar_t *upcase, __u32 upcase_size)
{
wchar_t c1, c2;
size_t i;
for (i = 0; i < n; ++i) {
if ((c1 = le16_to_cpu(s1[i])) < upcase_size)
c1 = le16_to_cpu(upcase[c1]);
if ((c2 = le16_to_cpu(s2[i])) < upcase_size)
c2 = le16_to_cpu(upcase[c2]);
if (c1 < c2)
return -1;
if (c1 > c2)
return 1;
if (!c1)
break;
}
return 0;
}
/*
* unistr.h - Exports for unicode string handling. Part of the Linux-NTFS
* project.
*
* Copyright (c) 2000,2001 Anton Altaparmakov.
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program/include file is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (in the main directory of the Linux-NTFS
* distribution in the file COPYING); if not, write to the Free Software
* Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _LINUX_NTFS_UNISTR_H
#define _LINUX_NTFS_UNISTR_H
#include <linux/types.h>
#include <linux/nls.h>
extern const __u8 legal_ansi_char_array[0x40];
int ntfs_are_names_equal(wchar_t *s1, size_t s1_len,
wchar_t *s2, size_t s2_len, int ic,
wchar_t *upcase, __u32 upcase_size);
int ntfs_collate_names(wchar_t *upcase, __u32 upcase_len,
wchar_t *name1, __u32 name1_len,
wchar_t *name2, __u32 name2_len,
int ic, int err_val);
int ntfs_wcsncasecmp(wchar_t *s1, wchar_t *s2, size_t n,
wchar_t *upcase, __u32 upcase_size);
#endif /* defined _LINUX_NTFS_UNISTR_H */
/*
* util.c - Miscellaneous support
*
* Copyright (C) 1997,1999 Martin von Lwis
* Copyright (C) 1997 Rgis Duchesne
* Copyright (C) 2001 Anton Altaparmakov (AIA)
*
* The utf8 routines are copied from Python wstrop module.
*/
#include "ntfstypes.h"
#include "struct.h"
#include "util.h"
#include <linux/string.h>
#include <linux/errno.h>
#include <asm/div64.h> /* For do_div(). */
#include "support.h"
/*
* Converts a single wide character to a sequence of utf8 bytes.
* The character is represented in host byte order.
* Returns the number of bytes, or 0 on error.
*/
static int to_utf8(ntfs_u16 c, unsigned char *buf)
{
if (c == 0)
return 0; /* No support for embedded 0 runes. */
if (c < 0x80) {
if (buf)
buf[0] = (unsigned char)c;
return 1;
}
if (c < 0x800) {
if (buf) {
buf[0] = 0xc0 | (c >> 6);
buf[1] = 0x80 | (c & 0x3f);
}
return 2;
}
/* c < 0x10000 */
if (buf) {
buf[0] = 0xe0 | (c >> 12);
buf[1] = 0x80 | ((c >> 6) & 0x3f);
buf[2] = 0x80 | (c & 0x3f);
}
return 3;
}
/*
* Decodes a sequence of utf8 bytes into a single wide character.
* The character is returned in host byte order.
* Returns the number of bytes consumed, or 0 on error.
*/
static int from_utf8(const unsigned char *str, ntfs_u16 *c)
{
int l = 0, i;
if (*str < 0x80) {
*c = *str;
return 1;
}
if (*str < 0xc0) /* Lead byte must not be 10xxxxxx. */
return 0; /* Is c0 a possible lead byte? */
if (*str < 0xe0) { /* 110xxxxx */
*c = *str & 0x1f;
l = 2;
} else if (*str < 0xf0) { /* 1110xxxx */
*c = *str & 0xf;
l = 3;
} else if (*str < 0xf8) { /* 11110xxx */
*c = *str & 7;
l = 4;
} else /* We don't support characters above 0xFFFF in NTFS. */
return 0;
for (i = 1; i < l; i++) {
/* All other bytes must be 10xxxxxx. */
if ((str[i] & 0xc0) != 0x80)
return 0;
*c <<= 6;
*c |= str[i] & 0x3f;
}
return l;
}
/*
* Converts wide string to UTF-8. Expects two in- and two out-parameters.
* Returns 0 on success, or error code.
* The caller has to free the result string.
*/
static int ntfs_dupuni2utf8(ntfs_u16 *in, int in_len, char **out, int *out_len)
{
int i, tmp;
int len8;
unsigned char *result;
ntfs_debug(DEBUG_NAME1, "converting l = %d\n", in_len);
/* Count the length of the resulting UTF-8. */
for (i = len8 = 0; i < in_len; i++) {
tmp = to_utf8(NTFS_GETU16(in + i), 0);
if (!tmp)
/* Invalid character. */
return -EILSEQ;
len8 += tmp;
}
*out = result = ntfs_malloc(len8 + 1); /* allow for zero-termination */
if (!result)
return -ENOMEM;
result[len8] = '\0';
*out_len = len8;
for (i = len8 = 0; i < in_len; i++)
len8 += to_utf8(NTFS_GETU16(in + i), result + len8);
ntfs_debug(DEBUG_NAME1, "result %p:%s\n", result, result);
return 0;
}
/*
* Converts an UTF-8 sequence to a wide string. Same conventions as the
* previous function.
*/
static int ntfs_duputf82uni(unsigned char* in, int in_len, ntfs_u16** out,
int *out_len)
{
int i, tmp;
int len16;
ntfs_u16* result;
ntfs_u16 wtmp;
for (i = len16 = 0; i < in_len; i += tmp, len16++) {
tmp = from_utf8(in + i, &wtmp);
if (!tmp)
return -EILSEQ;
}
*out = result = ntfs_malloc(2 * (len16 + 1));
if (!result)
return -ENOMEM;
result[len16] = 0;
*out_len = len16;
for (i = len16 = 0; i < in_len; i += tmp, len16++) {
tmp = from_utf8(in + i, &wtmp);
NTFS_PUTU16(result + len16, wtmp);
}
return 0;
}
/* Encodings dispatchers. */
int ntfs_encodeuni(ntfs_volume *vol, ntfs_u16 *in, int in_len, char **out,
int *out_len)
{
if (vol->nls_map)
return ntfs_dupuni2map(vol, in, in_len, out, out_len);
else
return ntfs_dupuni2utf8(in, in_len, out, out_len);
}
int ntfs_decodeuni(ntfs_volume *vol, char *in, int in_len, ntfs_u16 **out,
int *out_len)
{
if (vol->nls_map)
return ntfs_dupmap2uni(vol, in, in_len, out, out_len);
else
return ntfs_duputf82uni(in, in_len, out, out_len);
}
/* Same address space copies. */
void ntfs_put(ntfs_io *dest, void *src, ntfs_size_t n)
{
ntfs_memcpy(dest->param, src, n);
((char*)dest->param) += n;
}
void ntfs_get(void* dest, ntfs_io *src, ntfs_size_t n)
{
ntfs_memcpy(dest, src->param, n);
((char*)src->param) += n;
}
void *ntfs_calloc(int size)
{
void *result = ntfs_malloc(size);
if (result)
ntfs_bzero(result, size);
return result;
}
/* Copy len ascii characters from from to to. :) */
void ntfs_ascii2uni(short int *to, char *from, int len)
{
int i;
for (i = 0; i < len; i++)
NTFS_PUTU16(to + i, from[i]);
to[i] = 0;
}
/* strncmp for Unicode strings. */
int ntfs_uni_strncmp(short int* a, short int *b, int n)
{
int i;
for(i = 0; i < n; i++)
{
if (NTFS_GETU16(a + i) < NTFS_GETU16(b + i))
return -1;
if (NTFS_GETU16(b + i) < NTFS_GETU16(a + i))
return 1;
if (NTFS_GETU16(a + i) == 0)
break;
}
return 0;
}
/* strncmp between Unicode and ASCII strings. */
int ntfs_ua_strncmp(short int* a, char* b, int n)
{
int i;
for (i = 0; i < n; i++) {
if(NTFS_GETU16(a + i) < b[i])
return -1;
if(b[i] < NTFS_GETU16(a + i))
return 1;
if (b[i] == 0)
return 0;
}
return 0;
}
#define NTFS_TIME_OFFSET ((ntfs_time64_t)(369*365 + 89) * 24 * 3600 * 10000000)
/* Convert the NT UTC (based 1.1.1601, in hundred nanosecond units)
* into Unix UTC (based 1.1.1970, in seconds). */
ntfs_time_t ntfs_ntutc2unixutc(ntfs_time64_t ntutc)
{
/* Subtract the NTFS time offset, then convert to 1s intervals. */
ntfs_time64_t t = ntutc - NTFS_TIME_OFFSET;
do_div(t, 10000000);
return (ntfs_time_t)t;
}
/* Convert the Unix UTC into NT UTC. */
ntfs_time64_t ntfs_unixutc2ntutc(ntfs_time_t t)
{
/* Convert to 100ns intervals and then add the NTFS time offset. */
return (ntfs_time64_t)t * 10000000 + NTFS_TIME_OFFSET;
}
#undef NTFS_TIME_OFFSET
/* Fill index name. */
void ntfs_indexname(char *buf, int type)
{
char hex[] = "0123456789ABCDEF";
int index;
*buf++ = '$';
*buf++ = 'I';
for (index = 24; index > 0; index -= 4)
if ((0xF << index) & type)
break;
while (index >= 0) {
*buf++ = hex[(type >> index) & 0xF];
index -= 4;
}
*buf = '\0';
}
/*
* util.h - Header file for util.c
*
* Copyright (C) 1997 Rgis Duchesne
* Copyright (C) 2001 Anton Altaparmakov (AIA)
*/
/* The first 16 inodes correspond to NTFS special files. */
typedef enum {
FILE_Mft = 0,
FILE_MftMirr = 1,
FILE_LogFile = 2,
FILE_Volume = 3,
FILE_AttrDef = 4,
FILE_root = 5,
FILE_BitMap = 6,
FILE_Boot = 7,
FILE_BadClus = 8,
FILE_Secure = 9,
FILE_UpCase = 10,
FILE_Extend = 11,
FILE_Reserved12 = 12,
FILE_Reserved13 = 13,
FILE_Reserved14 = 14,
FILE_Reserved15 = 15,
} NTFS_SYSTEM_FILES;
/* Memory management */
void *ntfs_calloc(int size);
/* String operations */
/* Copy Unicode <-> ASCII */
void ntfs_ascii2uni(short int *to, char *from, int len);
/* Comparison */
int ntfs_uni_strncmp(short int* a, short int *b, int n);
int ntfs_ua_strncmp(short int* a, char* b, int n);
/* Same address space copies */
void ntfs_put(ntfs_io *dest, void *src, ntfs_size_t n);
void ntfs_get(void* dest, ntfs_io *src, ntfs_size_t n);
/* Charset conversion */
int ntfs_encodeuni(ntfs_volume *vol, ntfs_u16 *in, int in_len, char **out,
int *out_len);
int ntfs_decodeuni(ntfs_volume *vol, char *in, int in_len, ntfs_u16 **out,
int *out_len);
/* Time conversion */
/* NT <-> Unix */
ntfs_time_t ntfs_ntutc2unixutc(ntfs_time64_t ntutc);
ntfs_time64_t ntfs_unixutc2ntutc(ntfs_time_t t);
/* Attribute names */
void ntfs_indexname(char *buf, int type);
......@@ -652,7 +652,6 @@ struct quota_mount_options
#include <linux/ext2_fs_sb.h>
#include <linux/ext3_fs_sb.h>
#include <linux/hpfs_fs_sb.h>
#include <linux/ntfs_fs_sb.h>
#include <linux/msdos_fs_sb.h>
#include <linux/iso_fs_sb.h>
#include <linux/nfs_fs_sb.h>
......@@ -710,7 +709,6 @@ struct super_block {
struct ext2_sb_info ext2_sb;
struct ext3_sb_info ext3_sb;
struct hpfs_sb_info hpfs_sb;
struct ntfs_sb_info ntfs_sb;
struct msdos_sb_info msdos_sb;
struct isofs_sb_info isofs_sb;
struct nfs_sb_info nfs_sb;
......
#ifndef _LINUX_NTFS_FS_H
#define _LINUX_NTFS_FS_H
#include <asm/byteorder.h>
#define NTFS_SECTOR_BITS 9
#define NTFS_SECTOR_SIZE 512
/*
* Attribute flags (16-bit).
*/
typedef enum {
ATTR_IS_COMPRESSED = __constant_cpu_to_le16(0x0001),
ATTR_COMPRESSION_MASK = __constant_cpu_to_le16(0x00ff),
/* Compression method mask. Also,
* first illegal value. */
ATTR_IS_ENCRYPTED = __constant_cpu_to_le16(0x4000),
ATTR_IS_SPARSE = __constant_cpu_to_le16(0x8000),
} __attribute__ ((__packed__)) ATTR_FLAGS;
/*
* The two zones from which to allocate clusters.
*/
typedef enum {
MFT_ZONE,
DATA_ZONE
} NTFS_CLUSTER_ALLOCATION_ZONES;
#endif
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment