]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
ext2_fs.h: Remove macros accessing u.ext2_sb field and use
authorAndreas Dilger <adilger@clusterfs.com>
Thu, 23 May 2002 06:32:34 +0000 (00:32 -0600)
committerAndreas Dilger <adilger@clusterfs.com>
Thu, 23 May 2002 06:32:34 +0000 (00:32 -0600)
the EXT2_SB() macro instead.  Remove kernel function
prototypes also.  This matches the 2.5 kernel, and
is also cleaner for other reasons.  Whitespace cleanup.

lib/ext2fs/ChangeLog
lib/ext2fs/ext2_fs.h

index f8d08d9696852306e9594ade4007b111a6556d68..6add955fb22232f1bf6bf1325f06816102af307a 100644 (file)
@@ -1,3 +1,10 @@
+2002-05-22  Andreas Dilger <adilger@clusterfs.com>
+
+       * ext2_fs.h: Remove macros accessing u.ext2_sb field and use
+               the EXT2_SB() macro instead.  Remove kernel function
+               prototypes also.  This matches the 2.5 kernel, and
+               is also cleaner for other reasons.  Whitespace cleanup.
+
 2002-05-21  Theodore Ts'o  <tytso@mit.edu>
 
        * ext2_ext_attr.h: Update to V2 version of the Bestbits format.
index b4d5ae69235875b969bacf51b0b3119dc69c223b..9309c49c079ad1f11652b66738129a7ff092c81f 100644 (file)
@@ -40,9 +40,9 @@
 #define EXT2FS_VERSION         "0.5b"
 
 /*
- * Special inodes numbers
+ * Special inode numbers
  */
-#define        EXT2_BAD_INO             1      /* Bad blocks inode */
+#define EXT2_BAD_INO            1      /* Bad blocks inode */
 #define EXT2_ROOT_INO           2      /* Root inode */
 #define EXT2_ACL_IDX_INO        3      /* ACL inode */
 #define EXT2_ACL_DATA_INO       4      /* ACL inode */
  */
 #define EXT2_SUPER_MAGIC       0xEF53
 
+#ifdef __KERNEL__
+#define EXT2_SB(sb)    (&((sb)->u.ext2_sb))
+#else
+/* Assume that user mode programs are passing in an ext2fs superblock, not
+ * a kernel struct super_block.  This will allow us to call the feature-test
+ * macros from user land. */
+#define EXT2_SB(sb)    (sb)
+#endif
+
 /*
  * Maximal count of links to a file
  */
 #define EXT2_MIN_BLOCK_LOG_SIZE                10      /* 1024 */
 #define EXT2_MAX_BLOCK_LOG_SIZE                13      /* 8192 */
 #define EXT2_MIN_BLOCK_SIZE            (1 << EXT2_MIN_BLOCK_LOG_SIZE)
-#define        EXT2_MAX_BLOCK_SIZE             (1 << EXT2_MAX_BLOCK_LOG_SIZE)
+#define EXT2_MAX_BLOCK_SIZE            (1 << EXT2_MAX_BLOCK_LOG_SIZE)
 #ifdef __KERNEL__
 # define EXT2_BLOCK_SIZE(s)            ((s)->s_blocksize)
 #else
 # define EXT2_BLOCK_SIZE(s)            (EXT2_MIN_BLOCK_SIZE << (s)->s_log_block_size)
 #endif
 #define EXT2_ACLE_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_acl_entry))
-#define        EXT2_ADDR_PER_BLOCK(s)          (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
+#define EXT2_ADDR_PER_BLOCK(s)         (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
 #ifdef __KERNEL__
 # define EXT2_BLOCK_SIZE_BITS(s)       ((s)->s_blocksize_bits)
 #else
 # define EXT2_BLOCK_SIZE_BITS(s)       ((s)->s_log_block_size + 10)
 #endif
 #ifdef __KERNEL__
-#define        EXT2_ADDR_PER_BLOCK_BITS(s)     ((s)->u.ext2_sb.s_addr_per_block_bits)
-#define EXT2_INODE_SIZE(s)             ((s)->u.ext2_sb.s_inode_size)
-#define EXT2_FIRST_INO(s)              ((s)->u.ext2_sb.s_first_ino)
+#define EXT2_ADDR_PER_BLOCK_BITS(s)    (EXT2_SB(s)->addr_per_block_bits)
+#define EXT2_INODE_SIZE(s)             (EXT2_SB(s)->s_inode_size)
+#define EXT2_FIRST_INO(s)              (EXT2_SB(s)->s_first_ino)
 #else
 #define EXT2_INODE_SIZE(s)     (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
                                 EXT2_GOOD_OLD_INODE_SIZE : \
  * Macro-instructions used to manage fragments
  */
 #define EXT2_MIN_FRAG_SIZE             EXT2_MIN_BLOCK_SIZE
-#define        EXT2_MAX_FRAG_SIZE              EXT2_MAX_BLOCK_SIZE
+#define EXT2_MAX_FRAG_SIZE             EXT2_MAX_BLOCK_SIZE
 #define EXT2_MIN_FRAG_LOG_SIZE         EXT2_MIN_BLOCK_LOG_SIZE
 #ifdef __KERNEL__
-# define EXT2_FRAG_SIZE(s)             ((s)->u.ext2_sb.s_frag_size)
-# define EXT2_FRAGS_PER_BLOCK(s)       ((s)->u.ext2_sb.s_frags_per_block)
+# define EXT2_FRAG_SIZE(s)             (EXT2_SB(s)->s_frag_size)
+# define EXT2_FRAGS_PER_BLOCK(s)       (EXT2_SB(s)->s_frags_per_block)
 #else
 # define EXT2_FRAG_SIZE(s)             (EXT2_MIN_FRAG_SIZE << (s)->s_log_frag_size)
 # define EXT2_FRAGS_PER_BLOCK(s)       (EXT2_BLOCK_SIZE(s) / EXT2_FRAG_SIZE(s))
@@ -182,10 +191,10 @@ struct ext2_dx_countlimit {
  * Macro-instructions used to manage group descriptors
  */
 #ifdef __KERNEL__
-# define EXT2_BLOCKS_PER_GROUP(s)      ((s)->u.ext2_sb.s_blocks_per_group)
-# define EXT2_DESC_PER_BLOCK(s)                ((s)->u.ext2_sb.s_desc_per_block)
-# define EXT2_INODES_PER_GROUP(s)      ((s)->u.ext2_sb.s_inodes_per_group)
-# define EXT2_DESC_PER_BLOCK_BITS(s)   ((s)->u.ext2_sb.s_desc_per_block_bits)
+# define EXT2_BLOCKS_PER_GROUP(s)      (EXT2_SB(s)->s_blocks_per_group)
+# define EXT2_DESC_PER_BLOCK(s)                (EXT2_SB(s)->s_desc_per_block)
+# define EXT2_INODES_PER_GROUP(s)      (EXT2_SB(s)->s_inodes_per_group)
+# define EXT2_DESC_PER_BLOCK_BITS(s)   (EXT2_SB(s)->s_desc_per_block_bits)
 #else
 # define EXT2_BLOCKS_PER_GROUP(s)      ((s)->s_blocks_per_group)
 # define EXT2_DESC_PER_BLOCK(s)                (EXT2_BLOCK_SIZE(s) / sizeof (struct ext2_group_desc))
@@ -195,18 +204,18 @@ struct ext2_dx_countlimit {
 /*
  * Constants relative to the data blocks
  */
-#define        EXT2_NDIR_BLOCKS                12
-#define        EXT2_IND_BLOCK                  EXT2_NDIR_BLOCKS
-#define        EXT2_DIND_BLOCK                 (EXT2_IND_BLOCK + 1)
-#define        EXT2_TIND_BLOCK                 (EXT2_DIND_BLOCK + 1)
-#define        EXT2_N_BLOCKS                   (EXT2_TIND_BLOCK + 1)
+#define EXT2_NDIR_BLOCKS               12
+#define EXT2_IND_BLOCK                 EXT2_NDIR_BLOCKS
+#define EXT2_DIND_BLOCK                        (EXT2_IND_BLOCK + 1)
+#define EXT2_TIND_BLOCK                        (EXT2_DIND_BLOCK + 1)
+#define EXT2_N_BLOCKS                  (EXT2_TIND_BLOCK + 1)
 
 /*
  * Inode flags
  */
-#define        EXT2_SECRM_FL                   0x00000001 /* Secure deletion */
-#define        EXT2_UNRM_FL                    0x00000002 /* Undelete */
-#define        EXT2_COMPR_FL                   0x00000004 /* Compress file */
+#define EXT2_SECRM_FL                  0x00000001 /* Secure deletion */
+#define EXT2_UNRM_FL                   0x00000002 /* Undelete */
+#define EXT2_COMPR_FL                  0x00000004 /* Compress file */
 #define EXT2_SYNC_FL                   0x00000008 /* Synchronous updates */
 #define EXT2_IMMUTABLE_FL              0x00000010 /* Immutable file */
 #define EXT2_APPEND_FL                 0x00000020 /* writes to file may only append */
@@ -215,9 +224,9 @@ struct ext2_dx_countlimit {
 /* Reserved for compression usage... */
 #define EXT2_DIRTY_FL                  0x00000100
 #define EXT2_COMPRBLK_FL               0x00000200 /* One or more compressed clusters */
-#define EXT2_NOCOMPR_FL                0x00000400 /* Access raw compressed data */
+#define EXT2_NOCOMPR_FL                        0x00000400 /* Access raw compressed data */
 #define EXT2_ECOMPR_FL                 0x00000800 /* Compression error */
-/* End compression flags --- maybe not all used */     
+/* End compression flags --- maybe not all used */
 #define EXT2_BTREE_FL                  0x00001000 /* btree format dir */
 #define EXT2_INDEX_FL                  0x00001000 /* hash-indexed directory */
 #define EXT2_IMAGIC_FL                 0x00002000
@@ -231,10 +240,10 @@ struct ext2_dx_countlimit {
 /*
  * ioctl commands
  */
-#define        EXT2_IOC_GETFLAGS               _IOR('f', 1, long)
-#define        EXT2_IOC_SETFLAGS               _IOW('f', 2, long)
-#define        EXT2_IOC_GETVERSION             _IOR('v', 1, long)
-#define        EXT2_IOC_SETVERSION             _IOW('v', 2, long)
+#define EXT2_IOC_GETFLAGS              _IOR('f', 1, long)
+#define EXT2_IOC_SETFLAGS              _IOW('f', 2, long)
+#define EXT2_IOC_GETVERSION            _IOR('v', 1, long)
+#define EXT2_IOC_SETVERSION            _IOW('v', 2, long)
 
 /*
  * Structure of an inode on the disk
@@ -326,8 +335,8 @@ struct ext2_inode {
 /*
  * File system states
  */
-#define        EXT2_VALID_FS                   0x0001  /* Unmounted cleanly */
-#define        EXT2_ERROR_FS                   0x0002  /* Errors detected */
+#define EXT2_VALID_FS                  0x0001  /* Unmounted cleanly */
+#define EXT2_ERROR_FS                  0x0002  /* Errors detected */
 
 /*
  * Mount flags
@@ -343,7 +352,7 @@ struct ext2_inode {
 
 #define clear_opt(o, opt)              o &= ~EXT2_MOUNT_##opt
 #define set_opt(o, opt)                        o |= EXT2_MOUNT_##opt
-#define test_opt(sb, opt)              ((sb)->u.ext2_sb.s_mount_opt & \
+#define test_opt(sb, opt)              (EXT2_SB(sb)->s_mount_opt & \
                                         EXT2_MOUNT_##opt)
 /*
  * Maximal mount counts between two filesystem checks
@@ -381,7 +390,7 @@ struct ext2_super_block {
        __u16   s_magic;                /* Magic signature */
        __u16   s_state;                /* File system state */
        __u16   s_errors;               /* Behaviour when detecting errors */
-       __u16   s_minor_rev_level;      /* minor revision level */
+       __u16   s_minor_rev_level;      /* minor revision level */
        __u32   s_lastcheck;            /* time of last check */
        __u32   s_checkinterval;        /* max. time between checks */
        __u32   s_creator_os;           /* OS */
@@ -395,21 +404,21 @@ struct ext2_super_block {
         * the incompatible feature set is that if there is a bit set
         * in the incompatible feature set that the kernel doesn't
         * know about, it should refuse to mount the filesystem.
-        * 
+        *
         * e2fsck's requirements are more strict; if it doesn't know
         * about a feature in either the compatible or incompatible
         * feature set, it must abort and not try to meddle with
         * things it doesn't understand...
         */
-       __u32   s_first_ino;            /* First non-reserved inode */
-       __u16   s_inode_size;           /* size of inode structure */
-       __u16   s_block_group_nr;       /* block group # of this superblock */
-       __u32   s_feature_compat;       /* compatible feature set */
-       __u32   s_feature_incompat;     /* incompatible feature set */
-       __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
+       __u32   s_first_ino;            /* First non-reserved inode */
+       __u16   s_inode_size;           /* size of inode structure */
+       __u16   s_block_group_nr;       /* block group # of this superblock */
+       __u32   s_feature_compat;       /* compatible feature set */
+       __u32   s_feature_incompat;     /* incompatible feature set */
+       __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
        __u8    s_uuid[16];             /* 128-bit uuid for volume */
-       char    s_volume_name[16];      /* volume name */
-       char    s_last_mounted[64];     /* directory where last mounted */
+       char    s_volume_name[16];      /* volume name */
+       char    s_last_mounted[64];     /* directory where last mounted */
        __u32   s_algorithm_usage_bitmap; /* For compression */
        /*
         * Performance hints.  Directory preallocation should only
@@ -418,26 +427,17 @@ struct ext2_super_block {
        __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
        __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
        __u16   s_padding1;
-       /* 
+       /*
         * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
         */
        __u8    s_journal_uuid[16];     /* uuid of journal superblock */
        __u32   s_journal_inum;         /* inode number of journal file */
        __u32   s_journal_dev;          /* device number of journal file */
        __u32   s_last_orphan;          /* start of list of inodes to delete */
-       
+
        __u32   s_reserved[197];        /* Padding to the end of the block */
 };
 
-#ifdef __KERNEL__
-#define EXT2_SB(sb)    (&((sb)->u.ext2_sb))
-#else
-/* Assume that user mode programs are passing in an ext2fs superblock, not
- * a kernel struct super_block.  This will allow us to call the feature-test
- * macros from user land. */
-#define EXT2_SB(sb)    (sb)
-#endif
-
 /*
  * Codes for operating systems
  */
@@ -451,7 +451,7 @@ struct ext2_super_block {
  * Revision levels
  */
 #define EXT2_GOOD_OLD_REV      0       /* The good old (original) format */
-#define EXT2_DYNAMIC_REV       1       /* V2 format w/ dynamic inode sizes */
+#define EXT2_DYNAMIC_REV       1       /* V2 format w/ dynamic inode sizes */
 
 #define EXT2_CURRENT_REV       EXT2_GOOD_OLD_REV
 #define EXT2_MAX_SUPP_REV      EXT2_DYNAMIC_REV
@@ -494,8 +494,8 @@ struct ext2_super_block {
 /*
  * Default values for user and/or group using reserved blocks
  */
-#define        EXT2_DEF_RESUID         0
-#define        EXT2_DEF_RESGID         0
+#define EXT2_DEF_RESUID                0
+#define EXT2_DEF_RESGID                0
 
 /*
  * Structure of a directory entry
@@ -531,7 +531,7 @@ struct ext2_dir_entry_2 {
 #define EXT2_FT_REG_FILE       1
 #define EXT2_FT_DIR            2
 #define EXT2_FT_CHRDEV         3
-#define EXT2_FT_BLKDEV                 4
+#define EXT2_FT_BLKDEV         4
 #define EXT2_FT_FIFO           5
 #define EXT2_FT_SOCK           6
 #define EXT2_FT_SYMLINK                7
@@ -543,115 +543,9 @@ struct ext2_dir_entry_2 {
  *
  * NOTE: It must be a multiple of 4
  */
-#define EXT2_DIR_PAD                   4
-#define EXT2_DIR_ROUND                         (EXT2_DIR_PAD - 1)
+#define EXT2_DIR_PAD                   4
+#define EXT2_DIR_ROUND                 (EXT2_DIR_PAD - 1)
 #define EXT2_DIR_REC_LEN(name_len)     (((name_len) + 8 + EXT2_DIR_ROUND) & \
                                         ~EXT2_DIR_ROUND)
 
-#ifdef __KERNEL__
-/*
- * Function prototypes
- */
-
-/*
- * Ok, these declarations are also in <linux/kernel.h> but none of the
- * ext2 source programs needs to include it so they are duplicated here.
- */
-# define NORET_TYPE    /**/
-# define ATTRIB_NORET  __attribute__((noreturn))
-# define NORET_AND     noreturn,
-
-/* acl.c */
-extern int ext2_permission (struct inode *, int);
-
-/* balloc.c */
-extern int ext2_bg_has_super(struct super_block *sb, int group);
-extern unsigned long ext2_bg_num_gdb(struct super_block *sb, int group);
-extern int ext2_new_block (const struct inode *, unsigned long,
-                          __u32 *, __u32 *, int *);
-extern void ext2_free_blocks (const struct inode *, unsigned long,
-                             unsigned long);
-extern unsigned long ext2_count_free_blocks (struct super_block *);
-extern void ext2_check_blocks_bitmap (struct super_block *);
-extern struct ext2_group_desc * ext2_get_group_desc(struct super_block * sb,
-                                                   unsigned int block_group,
-                                                   struct buffer_head ** bh);
-
-/* bitmap.c */
-extern unsigned long ext2_count_free (struct buffer_head *, unsigned);
-
-/* dir.c */
-extern int ext2_check_dir_entry (const char *, struct inode *,
-                                struct ext2_dir_entry_2 *, struct buffer_head *,
-                                unsigned long);
-
-/* file.c */
-extern int ext2_read (struct inode *, struct file *, char *, int);
-extern int ext2_write (struct inode *, struct file *, char *, int);
-
-/* fsync.c */
-extern int ext2_sync_file (struct file *, struct dentry *, int);
-extern int ext2_fsync_inode (struct inode *, int);
-
-/* ialloc.c */
-extern struct inode * ext2_new_inode (const struct inode *, int);
-extern void ext2_free_inode (struct inode *);
-extern unsigned long ext2_count_free_inodes (struct super_block *);
-extern void ext2_check_inodes_bitmap (struct super_block *);
-
-/* inode.c */
-
-extern struct buffer_head * ext2_getblk (struct inode *, long, int, int *);
-extern struct buffer_head * ext2_bread (struct inode *, int, int, int *);
-
-extern void ext2_read_inode (struct inode *);
-extern void ext2_write_inode (struct inode *, int);
-extern void ext2_put_inode (struct inode *);
-extern void ext2_delete_inode (struct inode *);
-extern int ext2_sync_inode (struct inode *);
-extern void ext2_discard_prealloc (struct inode *);
-
-/* ioctl.c */
-extern int ext2_ioctl (struct inode *, struct file *, unsigned int,
-                      unsigned long);
-
-/* namei.c */
-extern struct inode_operations ext2_dir_inode_operations;
-
-/* super.c */
-extern void ext2_error (struct super_block *, const char *, const char *, ...)
-       __attribute__ ((format (printf, 3, 4)));
-extern NORET_TYPE void ext2_panic (struct super_block *, const char *,
-                                  const char *, ...)
-       __attribute__ ((NORET_AND format (printf, 3, 4)));
-extern void ext2_warning (struct super_block *, const char *, const char *, ...)
-       __attribute__ ((format (printf, 3, 4)));
-extern void ext2_update_dynamic_rev (struct super_block *sb);
-extern void ext2_put_super (struct super_block *);
-extern void ext2_write_super (struct super_block *);
-extern int ext2_remount (struct super_block *, int *, char *);
-extern struct super_block * ext2_read_super (struct super_block *,void *,int);
-extern int ext2_statfs (struct super_block *, struct statfs *);
-
-/* truncate.c */
-extern void ext2_truncate (struct inode *);
-
-/*
- * Inodes and files operations
- */
-
-/* dir.c */
-extern struct file_operations ext2_dir_operations;
-
-/* file.c */
-extern struct inode_operations ext2_file_inode_operations;
-extern struct file_operations ext2_file_operations;
-
-/* symlink.c */
-extern struct inode_operations ext2_fast_symlink_inode_operations;
-
-extern struct address_space_operations ext2_aops;
-
-#endif /* __KERNEL__ */
-
 #endif /* _LINUX_EXT2_FS_H */