[PATCH] mark struct inode_operations const 2
[powerpc.git] / fs / ntfs / layout.h
index 609ad17..1e38332 100644 (file)
@@ -123,7 +123,7 @@ enum {
        magic_RCRD = const_cpu_to_le32(0x44524352), /* Log record page. */
 
        /* Found in $LogFile/$DATA.  (May be found in $MFT/$DATA, also?) */
        magic_RCRD = const_cpu_to_le32(0x44524352), /* Log record page. */
 
        /* Found in $LogFile/$DATA.  (May be found in $MFT/$DATA, also?) */
-       magic_CHKD = const_cpu_to_le32(0x424b4843), /* Modified by chkdsk. */
+       magic_CHKD = const_cpu_to_le32(0x444b4843), /* Modified by chkdsk. */
 
        /* Found in all ntfs record containing records. */
        magic_BAAD = const_cpu_to_le32(0x44414142), /* Failed multi sector
 
        /* Found in all ntfs record containing records. */
        magic_BAAD = const_cpu_to_le32(0x44414142), /* Failed multi sector
@@ -142,13 +142,13 @@ typedef le32 NTFS_RECORD_TYPE;
  * operator! (-8
  */
 
  * operator! (-8
  */
 
-static inline BOOL __ntfs_is_magic(le32 x, NTFS_RECORD_TYPE r)
+static inline bool __ntfs_is_magic(le32 x, NTFS_RECORD_TYPE r)
 {
        return (x == r);
 }
 #define ntfs_is_magic(x, m)    __ntfs_is_magic(x, magic_##m)
 
 {
        return (x == r);
 }
 #define ntfs_is_magic(x, m)    __ntfs_is_magic(x, magic_##m)
 
-static inline BOOL __ntfs_is_magicp(le32 *p, NTFS_RECORD_TYPE r)
+static inline bool __ntfs_is_magicp(le32 *p, NTFS_RECORD_TYPE r)
 {
        return (*p == r);
 }
 {
        return (*p == r);
 }
@@ -308,10 +308,8 @@ typedef le16 MFT_RECORD_FLAGS;
  * The _LE versions are to be applied on little endian MFT_REFs.
  * Note: The _LE versions will return a CPU endian formatted value!
  */
  * The _LE versions are to be applied on little endian MFT_REFs.
  * Note: The _LE versions will return a CPU endian formatted value!
  */
-typedef enum {
-       MFT_REF_MASK_CPU        = 0x0000ffffffffffffULL,
-       MFT_REF_MASK_LE         = const_cpu_to_le64(0x0000ffffffffffffULL),
-} MFT_REF_CONSTS;
+#define MFT_REF_MASK_CPU 0x0000ffffffffffffULL
+#define MFT_REF_MASK_LE const_cpu_to_le64(MFT_REF_MASK_CPU)
 
 typedef u64 MFT_REF;
 typedef le64 leMFT_REF;
 
 typedef u64 MFT_REF;
 typedef le64 leMFT_REF;
@@ -325,7 +323,7 @@ typedef le64 leMFT_REF;
 #define MREF_LE(x)     ((unsigned long)(le64_to_cpu(x) & MFT_REF_MASK_CPU))
 #define MSEQNO_LE(x)   ((u16)((le64_to_cpu(x) >> 48) & 0xffff))
 
 #define MREF_LE(x)     ((unsigned long)(le64_to_cpu(x) & MFT_REF_MASK_CPU))
 #define MSEQNO_LE(x)   ((u16)((le64_to_cpu(x) >> 48) & 0xffff))
 
-#define IS_ERR_MREF(x) (((x) & 0x0000800000000000ULL) ? 1 : 0)
+#define IS_ERR_MREF(x) (((x) & 0x0000800000000000ULL) ? true : false)
 #define ERR_MREF(x)    ((u64)((s64)(x)))
 #define MREF_ERR(x)    ((int)((s64)(x)))
 
 #define ERR_MREF(x)    ((u64)((s64)(x)))
 #define MREF_ERR(x)    ((int)((s64)(x)))
 
@@ -771,7 +769,7 @@ typedef struct {
                                compressed.  (This effectively limits the
                                compression unit size to be a power of two
                                clusters.)  WinNT4 only uses a value of 4.
                                compressed.  (This effectively limits the
                                compression unit size to be a power of two
                                clusters.)  WinNT4 only uses a value of 4.
-                               Sparse files also have this set to 4. */
+                               Sparse files have this set to 0 on XPSP2. */
 /* 35*/                        u8 reserved[5];         /* Align to 8-byte boundary. */
 /* The sizes below are only used when lowest_vcn is zero, as otherwise it would
    be difficult to keep them up-to-date.*/
 /* 35*/                        u8 reserved[5];         /* Align to 8-byte boundary. */
 /* The sizes below are only used when lowest_vcn is zero, as otherwise it would
    be difficult to keep them up-to-date.*/
@@ -803,13 +801,16 @@ typedef struct {
 typedef ATTR_RECORD ATTR_REC;
 
 /*
 typedef ATTR_RECORD ATTR_REC;
 
 /*
- * File attribute flags (32-bit).
+ * File attribute flags (32-bit) appearing in the file_attributes fields of the
+ * STANDARD_INFORMATION attribute of MFT_RECORDs and the FILENAME_ATTR
+ * attributes of MFT_RECORDs and directory index entries.
+ *
+ * All of the below flags appear in the directory index entries but only some
+ * appear in the STANDARD_INFORMATION attribute whilst only some others appear
+ * in the FILENAME_ATTR attribute of MFT_RECORDs.  Unless otherwise stated the
+ * flags appear in all of the above.
  */
 enum {
  */
 enum {
-       /*
-        * The following flags are only present in the STANDARD_INFORMATION
-        * attribute (in the field file_attributes).
-        */
        FILE_ATTR_READONLY              = const_cpu_to_le32(0x00000001),
        FILE_ATTR_HIDDEN                = const_cpu_to_le32(0x00000002),
        FILE_ATTR_SYSTEM                = const_cpu_to_le32(0x00000004),
        FILE_ATTR_READONLY              = const_cpu_to_le32(0x00000001),
        FILE_ATTR_HIDDEN                = const_cpu_to_le32(0x00000002),
        FILE_ATTR_SYSTEM                = const_cpu_to_le32(0x00000004),
@@ -840,10 +841,10 @@ enum {
           F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT,
           F_A_COMPRESSED, and F_A_ENCRYPTED and preserves the rest.  This mask
           is used to to obtain all flags that are valid for setting. */
           F_A_DEVICE, F_A_DIRECTORY, F_A_SPARSE_FILE, F_A_REPARSE_POINT,
           F_A_COMPRESSED, and F_A_ENCRYPTED and preserves the rest.  This mask
           is used to to obtain all flags that are valid for setting. */
-
        /*
        /*
-        * The following flags are only present in the FILE_NAME attribute (in
-        * the field file_attributes).
+        * The flag FILE_ATTR_DUP_FILENAME_INDEX_PRESENT is present in all
+        * FILENAME_ATTR attributes but not in the STANDARD_INFORMATION
+        * attribute of an mft record.
         */
        FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT   = const_cpu_to_le32(0x10000000),
        /* Note, this is a copy of the corresponding bit from the mft record,
         */
        FILE_ATTR_DUP_FILE_NAME_INDEX_PRESENT   = const_cpu_to_le32(0x10000000),
        /* Note, this is a copy of the corresponding bit from the mft record,
@@ -889,7 +890,7 @@ typedef struct {
                                           Windows this is only updated when
                                           accessed if some time delta has
                                           passed since the last update. Also,
                                           Windows this is only updated when
                                           accessed if some time delta has
                                           passed since the last update. Also,
-                                          last access times updates can be
+                                          last access time updates can be
                                           disabled altogether for speed. */
 /* 32*/        FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */
 /* 36*/        union {
                                           disabled altogether for speed. */
 /* 32*/        FILE_ATTR_FLAGS file_attributes; /* Flags describing the file. */
 /* 36*/        union {
@@ -1023,10 +1024,17 @@ enum {
        FILE_NAME_POSIX         = 0x00,
        /* This is the largest namespace. It is case sensitive and allows all
           Unicode characters except for: '\0' and '/'.  Beware that in
        FILE_NAME_POSIX         = 0x00,
        /* This is the largest namespace. It is case sensitive and allows all
           Unicode characters except for: '\0' and '/'.  Beware that in
-          WinNT/2k files which eg have the same name except for their case
-          will not be distinguished by the standard utilities and thus a "del
-          filename" will delete both "filename" and "fileName" without
-          warning. */
+          WinNT/2k/2003 by default files which eg have the same name except
+          for their case will not be distinguished by the standard utilities
+          and thus a "del filename" will delete both "filename" and "fileName"
+          without warning.  However if for example Services For Unix (SFU) are
+          installed and the case sensitive option was enabled at installation
+          time, then you can create/access/delete such files.
+          Note that even SFU places restrictions on the filenames beyond the
+          '\0' and '/' and in particular the following set of characters is
+          not allowed: '"', '/', '<', '>', '\'.  All other characters,
+          including the ones no allowed in WIN32 namespace are allowed.
+          Tested with SFU 3.5 (this is now free) running on Windows XP. */
        FILE_NAME_WIN32         = 0x01,
        /* The standard WinNT/2k NTFS long filenames. Case insensitive.  All
           Unicode chars except: '\0', '"', '*', '/', ':', '<', '>', '?', '\',
        FILE_NAME_WIN32         = 0x01,
        /* The standard WinNT/2k NTFS long filenames. Case insensitive.  All
           Unicode chars except: '\0', '"', '*', '/', ':', '<', '>', '?', '\',
@@ -1066,11 +1074,22 @@ typedef struct {
                                           modified. */
 /* 20*/        sle64 last_access_time;         /* Time this mft record was last
                                           accessed. */
                                           modified. */
 /* 20*/        sle64 last_access_time;         /* Time this mft record was last
                                           accessed. */
-/* 28*/        sle64 allocated_size;           /* Byte size of allocated space for the
-                                          data attribute. NOTE: Is a multiple
-                                          of the cluster size. */
-/* 30*/        sle64 data_size;                /* Byte size of actual data in data
-                                          attribute. */
+/* 28*/        sle64 allocated_size;           /* Byte size of on-disk allocated space
+                                          for the unnamed data attribute.  So
+                                          for normal $DATA, this is the
+                                          allocated_size from the unnamed
+                                          $DATA attribute and for compressed
+                                          and/or sparse $DATA, this is the
+                                          compressed_size from the unnamed
+                                          $DATA attribute.  For a directory or
+                                          other inode without an unnamed $DATA
+                                          attribute, this is always 0.  NOTE:
+                                          This is a multiple of the cluster
+                                          size. */
+/* 30*/        sle64 data_size;                /* Byte size of actual data in unnamed
+                                          data attribute.  For a directory or
+                                          other inode without an unnamed $DATA
+                                          attribute, this is always 0. */
 /* 38*/        FILE_ATTR_FLAGS file_attributes;        /* Flags describing the file. */
 /* 3c*/        union {
        /* 3c*/ struct {
 /* 38*/        FILE_ATTR_FLAGS file_attributes;        /* Flags describing the file. */
 /* 3c*/        union {
        /* 3c*/ struct {
@@ -1899,12 +1918,13 @@ enum {
        VOLUME_DELETE_USN_UNDERWAY      = const_cpu_to_le16(0x0010),
        VOLUME_REPAIR_OBJECT_ID         = const_cpu_to_le16(0x0020),
 
        VOLUME_DELETE_USN_UNDERWAY      = const_cpu_to_le16(0x0010),
        VOLUME_REPAIR_OBJECT_ID         = const_cpu_to_le16(0x0020),
 
+       VOLUME_CHKDSK_UNDERWAY          = const_cpu_to_le16(0x4000),
        VOLUME_MODIFIED_BY_CHKDSK       = const_cpu_to_le16(0x8000),
 
        VOLUME_MODIFIED_BY_CHKDSK       = const_cpu_to_le16(0x8000),
 
-       VOLUME_FLAGS_MASK               = const_cpu_to_le16(0x803f),
+       VOLUME_FLAGS_MASK               = const_cpu_to_le16(0xc03f),
 
        /* To make our life easier when checking if we must mount read-only. */
 
        /* To make our life easier when checking if we must mount read-only. */
-       VOLUME_MUST_MOUNT_RO_MASK       = const_cpu_to_le16(0x8027),
+       VOLUME_MUST_MOUNT_RO_MASK       = const_cpu_to_le16(0xc027),
 } __attribute__ ((__packed__));
 
 typedef le16 VOLUME_FLAGS;
 } __attribute__ ((__packed__));
 
 typedef le16 VOLUME_FLAGS;
@@ -2369,7 +2389,9 @@ typedef struct {
  * Extended attribute flags (8-bit).
  */
 enum {
  * Extended attribute flags (8-bit).
  */
 enum {
-       NEED_EA = 0x80
+       NEED_EA = 0x80          /* If set the file to which the EA belongs
+                                  cannot be interpreted without understanding
+                                  the associates extended attributes. */
 } __attribute__ ((__packed__));
 
 typedef u8 EA_FLAGS;
 } __attribute__ ((__packed__));
 
 typedef u8 EA_FLAGS;
@@ -2377,20 +2399,20 @@ typedef u8 EA_FLAGS;
 /*
  * Attribute: Extended attribute (EA) (0xe0).
  *
 /*
  * Attribute: Extended attribute (EA) (0xe0).
  *
- * NOTE: Always non-resident. (Is this true?)
+ * NOTE: Can be resident or non-resident.
  *
  * Like the attribute list and the index buffer list, the EA attribute value is
  * a sequence of EA_ATTR variable length records.
  *
  * Like the attribute list and the index buffer list, the EA attribute value is
  * a sequence of EA_ATTR variable length records.
- *
- * FIXME: It appears weird that the EA name is not unicode. Is it true?
  */
 typedef struct {
        le32 next_entry_offset; /* Offset to the next EA_ATTR. */
        EA_FLAGS flags;         /* Flags describing the EA. */
  */
 typedef struct {
        le32 next_entry_offset; /* Offset to the next EA_ATTR. */
        EA_FLAGS flags;         /* Flags describing the EA. */
-       u8 ea_name_length;      /* Length of the name of the EA in bytes. */
+       u8 ea_name_length;      /* Length of the name of the EA in bytes
+                                  excluding the '\0' byte terminator. */
        le16 ea_value_length;   /* Byte size of the EA's value. */
        le16 ea_value_length;   /* Byte size of the EA's value. */
-       u8 ea_name[0];          /* Name of the EA. */
-       u8 ea_value[0];         /* The value of the EA. Immediately follows
+       u8 ea_name[0];          /* Name of the EA.  Note this is ASCII, not
+                                  Unicode and it is zero terminated. */
+       u8 ea_value[0];         /* The value of the EA.  Immediately follows
                                   the name. */
 } __attribute__ ((__packed__)) EA_ATTR;
 
                                   the name. */
 } __attribute__ ((__packed__)) EA_ATTR;