Merge /pub/scm/linux/kernel/git/torvalds/linux-2.6
[pandora-kernel.git] / include / linux / gfs2_ondisk.h
index ec432e0..8b7e4c1 100644 (file)
@@ -1,11 +1,11 @@
 /*
-* Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
-* Copyright (C) 2004-2005 Red Hat, Inc.  All rights reserved.
-*
-* This copyrighted material is made available to anyone wishing to use,
-* modify, copy, or redistribute it subject to the terms and conditions
-* of the GNU General Public License v.2.
-*/
+ * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
+ * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License v.2.
+ */
 
 #ifndef __GFS2_ONDISK_DOT_H__
 #define __GFS2_ONDISK_DOT_H__
@@ -36,7 +36,6 @@
 #define GFS2_FORMAT_LB         1000
 #define GFS2_FORMAT_EA         1600
 #define GFS2_FORMAT_ED         1700
-#define GFS2_FORMAT_UT         1300
 #define GFS2_FORMAT_QC         1400
 /* These are format numbers for entities contained in files */
 #define GFS2_FORMAT_RI         1100
  * An on-disk inode number
  */
 
-#define gfs2_inum_equal(ino1, ino2) \
-       (((ino1)->no_formal_ino == (ino2)->no_formal_ino) && \
-       ((ino1)->no_addr == (ino2)->no_addr))
-
 struct gfs2_inum {
        __be64 no_formal_ino;
        __be64 no_addr;
 };
 
+struct gfs2_inum_host {
+       __u64 no_formal_ino;
+       __u64 no_addr;
+};
+
+static inline int gfs2_inum_equal(const struct gfs2_inum_host *ino1,
+                                 const struct gfs2_inum_host *ino2)
+{
+       return ino1->no_formal_ino == ino2->no_formal_ino &&
+              ino1->no_addr == ino2->no_addr;
+}
+
 /*
  * Generic metadata head structure
  * Every inplace buffer logged in the journal must start with this.
@@ -77,7 +84,6 @@ struct gfs2_inum {
 #define GFS2_METATYPE_LB       12
 #define GFS2_METATYPE_EA       10
 #define GFS2_METATYPE_ED       11
-#define GFS2_METATYPE_UT       13
 #define GFS2_METATYPE_QC       14
 
 struct gfs2_meta_header {
@@ -88,6 +94,12 @@ struct gfs2_meta_header {
        __be32 __pad1;          /* Was incarnation number in gfs1 */
 };
 
+struct gfs2_meta_header_host {
+       __u32 mh_magic;
+       __u32 mh_type;
+       __u32 mh_format;
+};
+
 /*
  * super-block structure
  *
@@ -127,6 +139,23 @@ struct gfs2_sb {
        /* In gfs1, quota and license dinodes followed */
 };
 
+struct gfs2_sb_host {
+       struct gfs2_meta_header_host sb_header;
+
+       __u32 sb_fs_format;
+       __u32 sb_multihost_format;
+
+       __u32 sb_bsize;
+       __u32 sb_bsize_shift;
+
+       struct gfs2_inum_host sb_master_dir; /* Was jindex dinode in gfs1 */
+       struct gfs2_inum_host sb_root_dir;
+
+       char sb_lockproto[GFS2_LOCKNAME_LEN];
+       char sb_locktable[GFS2_LOCKNAME_LEN];
+       /* In gfs1, quota and license dinodes followed */
+};
+
 /*
  * resource index structure
  */
@@ -144,6 +173,14 @@ struct gfs2_rindex {
        __u8 ri_reserved[64];
 };
 
+struct gfs2_rindex_host {
+       __u64 ri_addr;  /* grp block disk address */
+       __u64 ri_data0; /* first data location */
+       __u32 ri_length;        /* length of rgrp header in fs blocks */
+       __u32 ri_data;  /* num of data blocks in rgrp */
+       __u32 ri_bitbytes;      /* number of bytes in data bitmaps */
+};
+
 /*
  * resource group header structure
  */
@@ -155,7 +192,7 @@ struct gfs2_rindex {
 
 #define GFS2_BLKST_FREE                0
 #define GFS2_BLKST_USED                1
-#define GFS2_BLKST_INVALID     2
+#define GFS2_BLKST_UNLINKED    2
 #define GFS2_BLKST_DINODE      3
 
 #define GFS2_RGF_JOURNAL       0x00000001
@@ -169,8 +206,17 @@ struct gfs2_rgrp {
        __be32 rg_flags;
        __be32 rg_free;
        __be32 rg_dinodes;
+       __be32 __pad;
+       __be64 rg_igeneration;
+
+       __u8 rg_reserved[80]; /* Several fields from gfs1 now reserved */
+};
 
-       __u8 rg_reserved[92]; /* Several fields from gfs1 now reserved */
+struct gfs2_rgrp_host {
+       __u32 rg_flags;
+       __u32 rg_free;
+       __u32 rg_dinodes;
+       __u64 rg_igeneration;
 };
 
 /*
@@ -184,6 +230,12 @@ struct gfs2_quota {
        __u8 qu_reserved[64];
 };
 
+struct gfs2_quota_host {
+       __u64 qu_limit;
+       __u64 qu_warn;
+       __u64 qu_value;
+};
+
 /*
  * dinode structure
  */
@@ -194,6 +246,22 @@ struct gfs2_quota {
 #define DT2IF(dt) (((dt) << 12) & S_IFMT)
 #define IF2DT(sif) (((sif) & S_IFMT) >> 12)
 
+enum {
+       gfs2fl_Jdata            = 0,
+       gfs2fl_ExHash           = 1,
+       gfs2fl_Unused           = 2,
+       gfs2fl_EaIndirect       = 3,
+       gfs2fl_Directio         = 4,
+       gfs2fl_Immutable        = 5,
+       gfs2fl_AppendOnly       = 6,
+       gfs2fl_NoAtime          = 7,
+       gfs2fl_Sync             = 8,
+       gfs2fl_System           = 9,
+       gfs2fl_TruncInProg      = 29,
+       gfs2fl_InheritDirectio  = 30,
+       gfs2fl_InheritJdata     = 31,
+};
+
 /* Dinode flags */
 #define GFS2_DIF_JDATA                 0x00000001
 #define GFS2_DIF_EXHASH                        0x00000002
@@ -231,7 +299,7 @@ struct gfs2_dinode {
         */
        __be64 di_goal_meta;    /* rgrp to alloc from next */
        __be64 di_goal_data;    /* data block goal */
-       __u32 __pad[2];
+       __be64 di_generation;   /* generation number for NFS */
 
        __be32 di_flags;        /* GFS2_DIF_... */
        __be32 di_payload_format;  /* GFS2_FORMAT_... */
@@ -251,6 +319,27 @@ struct gfs2_dinode {
        __u8 di_reserved[56];
 };
 
+struct gfs2_dinode_host {
+       __u64 di_size;  /* number of bytes in file */
+       __u64 di_blocks;        /* number of blocks in file */
+
+       /* This section varies from gfs1. Padding added to align with
+         * remainder of dinode
+        */
+       __u64 di_goal_meta;     /* rgrp to alloc from next */
+       __u64 di_goal_data;     /* data block goal */
+       __u64 di_generation;    /* generation number for NFS */
+
+       __u32 di_flags; /* GFS2_DIF_... */
+       __u16 di_height;        /* height of metadata */
+
+       /* These only apply to directories  */
+       __u16 di_depth; /* Number of bits in the table */
+       __u32 di_entries;       /* The number of entries in the directory */
+
+       __u64 di_eattr; /* extended attribute block number */
+};
+
 /*
  * directory structure - many of these per directory file
  */
@@ -292,8 +381,9 @@ struct gfs2_leaf {
 #define GFS2_EATYPE_UNUSED     0
 #define GFS2_EATYPE_USR                1
 #define GFS2_EATYPE_SYS                2
+#define GFS2_EATYPE_SECURITY   3
 
-#define GFS2_EATYPE_LAST       2
+#define GFS2_EATYPE_LAST       3
 #define GFS2_EATYPE_VALID(x)   ((x) <= GFS2_EATYPE_LAST)
 
 #define GFS2_EAFLAG_LAST       0x01    /* last ea in block */
@@ -324,6 +414,16 @@ struct gfs2_log_header {
        __be32 lh_hash;
 };
 
+struct gfs2_log_header_host {
+       struct gfs2_meta_header_host lh_header;
+
+       __u64 lh_sequence;      /* Sequence number of this transaction */
+       __u32 lh_flags; /* GFS2_LOG_HEAD_... */
+       __u32 lh_tail;          /* Block number of log tail */
+       __u32 lh_blkno;
+       __u32 lh_hash;
+};
+
 /*
  * Log type descriptor
  */
@@ -364,6 +464,11 @@ struct gfs2_inum_range {
        __be64 ir_length;
 };
 
+struct gfs2_inum_range_host {
+       __u64 ir_start;
+       __u64 ir_length;
+};
+
 /*
  * Statfs change
  * Describes an change to the pool of free and allocated
@@ -376,18 +481,10 @@ struct gfs2_statfs_change {
        __be64 sc_dinodes;
 };
 
-/*
- * Unlinked Tag
- * Describes an allocated inode that isn't linked into
- * the directory tree and might need to be deallocated.
- */
-
-#define GFS2_UTF_UNINIT                0x00000001
-
-struct gfs2_unlinked_tag {
-       struct gfs2_inum ut_inum;
-       __be32 ut_flags;        /* GFS2_UTF_... */
-       __u32 __pad;
+struct gfs2_statfs_change_host {
+       __u64 sc_total;
+       __u64 sc_free;
+       __u64 sc_dinodes;
 };
 
 /*
@@ -404,50 +501,38 @@ struct gfs2_quota_change {
        __be32 qc_id;
 };
 
+struct gfs2_quota_change_host {
+       __u64 qc_change;
+       __u32 qc_flags; /* GFS2_QCF_... */
+       __u32 qc_id;
+};
+
 #ifdef __KERNEL__
 /* Translation functions */
 
-extern void gfs2_inum_in(struct gfs2_inum *no, char *buf);
-extern void gfs2_inum_out(struct gfs2_inum *no, char *buf);
-extern void gfs2_sb_in(struct gfs2_sb *sb, char *buf);
-extern void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf);
-extern void gfs2_rindex_out(struct gfs2_rindex *ri, char *buf);
-extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf);
-extern void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf);
-extern void gfs2_quota_in(struct gfs2_quota *qu, char *buf);
-extern void gfs2_quota_out(struct gfs2_quota *qu, char *buf);
-extern void gfs2_dinode_in(struct gfs2_dinode *di, char *buf);
-extern void gfs2_dinode_out(struct gfs2_dinode *di, char *buf);
-extern void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf);
-extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf);
-extern void gfs2_ea_header_out(struct gfs2_ea_header *ea, char *buf);
-extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf);
-extern void gfs2_inum_range_in(struct gfs2_inum_range *ir, char *buf);
-extern void gfs2_inum_range_out(struct gfs2_inum_range *ir, char *buf);
-extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf);
-extern void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf);
-extern void gfs2_unlinked_tag_in(struct gfs2_unlinked_tag *ut, char *buf);
-extern void gfs2_unlinked_tag_out(struct gfs2_unlinked_tag *ut, char *buf);
-extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf);
+extern void gfs2_inum_in(struct gfs2_inum_host *no, const void *buf);
+extern void gfs2_inum_out(const struct gfs2_inum_host *no, void *buf);
+extern void gfs2_sb_in(struct gfs2_sb_host *sb, const void *buf);
+extern void gfs2_rindex_in(struct gfs2_rindex_host *ri, const void *buf);
+extern void gfs2_rindex_out(const struct gfs2_rindex_host *ri, void *buf);
+extern void gfs2_rgrp_in(struct gfs2_rgrp_host *rg, const void *buf);
+extern void gfs2_rgrp_out(const struct gfs2_rgrp_host *rg, void *buf);
+extern void gfs2_quota_in(struct gfs2_quota_host *qu, const void *buf);
+struct gfs2_inode;
+extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
+extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, const void *buf);
+extern void gfs2_ea_header_out(const struct gfs2_ea_header *ea, void *buf);
+extern void gfs2_log_header_in(struct gfs2_log_header_host *lh, const void *buf);
+extern void gfs2_inum_range_in(struct gfs2_inum_range_host *ir, const void *buf);
+extern void gfs2_inum_range_out(const struct gfs2_inum_range_host *ir, void *buf);
+extern void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf);
+extern void gfs2_statfs_change_out(const struct gfs2_statfs_change_host *sc, void *buf);
+extern void gfs2_quota_change_in(struct gfs2_quota_change_host *qc, const void *buf);
 
 /* Printing functions */
 
-extern void gfs2_inum_print(struct gfs2_inum *no);
-extern void gfs2_meta_header_print(struct gfs2_meta_header *mh);
-extern void gfs2_sb_print(struct gfs2_sb *sb);
-extern void gfs2_rindex_print(struct gfs2_rindex *ri);
-extern void gfs2_rgrp_print(struct gfs2_rgrp *rg);
-extern void gfs2_quota_print(struct gfs2_quota *qu);
-extern void gfs2_dinode_print(struct gfs2_dinode *di);
-extern void gfs2_dirent_print(struct gfs2_dirent *de, char *name);
-extern void gfs2_leaf_print(struct gfs2_leaf *lf);
-extern void gfs2_ea_header_print(struct gfs2_ea_header *ea, char *name);
-extern void gfs2_log_header_print(struct gfs2_log_header *lh);
-extern void gfs2_log_descriptor_print(struct gfs2_log_descriptor *ld);
-extern void gfs2_inum_range_print(struct gfs2_inum_range *ir);
-extern void gfs2_statfs_change_print(struct gfs2_statfs_change *sc);
-extern void gfs2_unlinked_tag_print(struct gfs2_unlinked_tag *ut);
-extern void gfs2_quota_change_print(struct gfs2_quota_change *qc);
+extern void gfs2_rindex_print(const struct gfs2_rindex_host *ri);
+extern void gfs2_dinode_print(const struct gfs2_inode *ip);
 
 #endif /* __KERNEL__ */