Import changeset
[linux-flexiantxendom0-3.2.10.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  */
7
8 #define NTFS_FD(vol)            ((vol)->u.fd)
9
10 /* Linux */
11 #ifdef NTFS_IN_LINUX_KERNEL
12 #define NTFS_SB(vol)            ((struct super_block*)(vol)->sb)
13 #define NTFS_SB2VOL(sb)         (&(sb)->u.ntfs_sb)
14 #define NTFS_INO2VOL(ino)       (&((ino)->i_sb->u.ntfs_sb))
15 #define NTFS_LINO2NINO(ino)     (&((ino)->u.ntfs_i))
16 #else
17 #define NTFS_SB(vol)            ((struct super_block*)(vol)->u.sb)
18 #define NTFS_SB2VOL(sb)         ((ntfs_volume*)(sb)->u.generic_sbp)
19 #define NTFS_INO2VOL(ino)       ((ntfs_volume*)((ino)->i_sb->u.generic_sbp))
20 #define NTFS_LINO2NINO(ino)     ((ntfs_inode*)((ino)->u.generic_ip))
21 #endif
22
23 /* BSD */
24 #define NTFS_MNT(vol)           ((struct mount*)(vol)->u.sb)
25 #define NTFS_MNT2VOL(sb)        ((ntfs_volume*)(sb)->mnt_data)
26 #define NTFS_V2INO(ino)         ((ntfs_inode*)((ino)->v_data))
27
28 /* Classical min and max macros still missing in standard headers... */
29 #ifndef min
30 #define min(a,b)        ((a) <= (b) ? (a) : (b))
31 #define max(a,b)        ((a) >= (b) ? (a) : (b))
32 #endif
33
34 #define IS_MAGIC(a,b)           (*(int*)(a)==*(int*)(b))
35 #define IS_MFT_RECORD(a)        IS_MAGIC((a),"FILE")
36 #define IS_NTFS_VOLUME(a)       IS_MAGIC((a)+3,"NTFS")
37 #define IS_INDEX_RECORD(a)      IS_MAGIC((a),"INDX")
38
39 /* 'NTFS' in little endian */
40 #define NTFS_SUPER_MAGIC        0x5346544E
41
42 #define NTFS_AFLAG_RO           1
43 #define NTFS_AFLAG_HIDDEN       2
44 #define NTFS_AFLAG_SYSTEM       4
45 #define NTFS_AFLAG_ARCHIVE      20
46 #define NTFS_AFLAG_COMPRESSED   0x800
47 #define NTFS_AFLAG_DIR          0x10000000
48
49 /*
50  * Local variables:
51  *  c-file-style: "linux"
52  * End:
53  */