import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / fs / ntfs / macros.h
1 /*
2  * macros.h
3  *
4  * Copyright (C) 1995 Martin von Löwis
5  * Copyright (C) 1996 Régis Duchesne
6  * Copyright (c) 2001 Anton Altaparmakov
7  */
8 #include <linux/ntfs_fs_i.h>
9 #include <linux/fs.h>
10 #include <asm/page.h>
11
12 #define NTFS_FD(vol)            ((vol)->u.fd)
13
14 #define NTFS_SB(vol)            ((struct super_block*)(vol)->sb)
15 #define NTFS_SB2VOL(sb)         (&(sb)->u.ntfs_sb)
16 #define NTFS_INO2VOL(ino)       (&((ino)->i_sb->u.ntfs_sb))
17 #define NTFS_LINO2NINO(ino)     ((struct ntfs_inode_info*)(&((ino)->u.ntfs_i)))
18 static inline struct inode *VFS_I(struct ntfs_inode_info *ntfs_ino)
19 {
20         struct inode *i = (struct inode*)((char*)ntfs_ino -
21                         ((char*)&(((struct inode*)NULL)->u.ntfs_i) -
22                         (char*)NULL));
23 #ifdef DEBUG
24         if ((char*)NTFS_LINO2NINO(i) != (char*)ntfs_ino)
25                 BUG();
26 #endif
27         return i;
28 }
29
30 #define IS_MAGIC(a,b)           (*(int*)(a) == *(int*)(b))
31 #define IS_MFT_RECORD(a)        IS_MAGIC((a),"FILE")
32 #define IS_INDEX_RECORD(a)      IS_MAGIC((a),"INDX")
33
34 /* 'NTFS' in little endian */
35 #define NTFS_SUPER_MAGIC        0x5346544E
36
37 #define NTFS_AFLAG_RO           1
38 #define NTFS_AFLAG_HIDDEN       2
39 #define NTFS_AFLAG_SYSTEM       4
40 #define NTFS_AFLAG_ARCHIVE      20
41 #define NTFS_AFLAG_COMPRESSED   0x800
42 #define NTFS_AFLAG_DIR          0x10000000
43