#include "ext4_utils.h"
#include "allocate.h"
-#include "ext4.h"
#include <sparse/sparse.h>
#define EXT4_ALLOCATE_FAILED (u32)(~0)
#include "ext4_utils.h"
-#include "ext4.h"
-#include "xattr.h"
struct block_allocation;
#define XATTR_CAPS_SUFFIX "capability"
#include "ext4_utils.h"
-#include "ext4.h"
#include "make_ext4fs.h"
#include "allocate.h"
#include "contents.h"
#include "extent.h"
#include "indirect.h"
-#include "xattr.h"
#ifdef USE_MINGW
#define S_IFLNK 0 /* used by make_link, not needed under mingw */
static void ext4_xattr_hash_entry(struct ext4_xattr_header *header,
struct ext4_xattr_entry *entry)
{
- __u32 hash = 0;
+ u32 hash = 0;
char *name = entry->e_name;
int n;
}
if (entry->e_value_block == 0 && entry->e_value_size != 0) {
- __le32 *value = (__le32 *)((char *)header +
+ u32 *value = (u32 *)((char *)header +
le16_to_cpu(entry->e_value_offs));
for (n = (le32_to_cpu(entry->e_value_size) +
EXT4_XATTR_ROUND) >> EXT4_XATTR_PAD_BITS; n; n--) {
+++ /dev/null
-/****************************************************************************
- ****************************************************************************
- ***
- *** This header was automatically generated from a Linux kernel header
- *** of the same name, to make information necessary for userspace to
- *** call into the kernel available to libc. It contains only constants,
- *** structures, and macros generated from the original header, and thus,
- *** contains no copyrightable information.
- ***
- ****************************************************************************
- ****************************************************************************/
-#ifndef _EXT4_JBD2_H
-#define _EXT4_JBD2_H
-
-#include "ext4.h"
-
-#define EXT4_JOURNAL(inode) (EXT4_SB((inode)->i_sb)->s_journal)
-
-#define EXT4_SINGLEDATA_TRANS_BLOCKS(sb) (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_EXTENTS) ? 27U : 8U)
-
-#define EXT4_XATTR_TRANS_BLOCKS 6U
-
-#define EXT4_DATA_TRANS_BLOCKS(sb) (EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + EXT4_XATTR_TRANS_BLOCKS - 2 + EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
-
-#define EXT4_META_TRANS_BLOCKS(sb) (EXT4_XATTR_TRANS_BLOCKS + EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
-
-#define EXT4_DELETE_TRANS_BLOCKS(sb) (2 * EXT4_DATA_TRANS_BLOCKS(sb) + 64)
-
-#define EXT4_MAX_TRANS_DATA 64U
-
-#define EXT4_RESERVE_TRANS_BLOCKS 12U
-
-#define EXT4_INDEX_EXTRA_TRANS_BLOCKS 8
-
-#define EXT4_QUOTA_TRANS_BLOCKS(sb) 0
-#define EXT4_QUOTA_INIT_BLOCKS(sb) 0
-#define EXT4_QUOTA_DEL_BLOCKS(sb) 0
-#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
-#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
-#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
-
-#define ext4_journal_get_undo_access(handle, bh) __ext4_journal_get_undo_access(__func__, (handle), (bh))
-#define ext4_journal_get_write_access(handle, bh) __ext4_journal_get_write_access(__func__, (handle), (bh))
-#define ext4_forget(handle, is_metadata, inode, bh, block_nr) __ext4_forget(__func__, (handle), (is_metadata), (inode), (bh), (block_nr))
-#define ext4_journal_get_create_access(handle, bh) __ext4_journal_get_create_access(__func__, (handle), (bh))
-#define ext4_handle_dirty_metadata(handle, inode, bh) __ext4_handle_dirty_metadata(__func__, (handle), (inode), (bh))
-
-#define EXT4_NOJOURNAL_MAX_REF_COUNT ((unsigned long) 4096)
-
-#define ext4_journal_stop(handle) __ext4_journal_stop(__func__, (handle))
-
-#endif
-
--- /dev/null
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _EXT4_UTILS_EXT4_KERNEL_HEADERS_H_
+#define _EXT4_UTILS_EXT4_KERNEL_HEADERS_H_
+
+#include <stdint.h>
+
+#ifdef __BIONIC__
+#include <sys/types.h>
+#else
+#define __le64 uint64_t
+#define __le32 uint32_t
+#define __le16 uint16_t
+
+#define __be64 uint64_t
+#define __be32 uint32_t
+#define __be16 uint16_t
+
+#define __u64 uint64_t
+#define __u32 uint32_t
+#define __u16 uint16_t
+#define __u8 uint8_t
+#endif
+
+#include "ext4.h"
+#include "xattr.h"
+#include "ext4_extents.h"
+#include "jbd2.h"
+
+#ifndef __BIONIC__
+#undef __le64
+#undef __le32
+#undef __le16
+
+#undef __be64
+#undef __be32
+#undef __be16
+
+#undef __u64
+#undef __u32
+#undef __u16
+#undef __u8
+#endif
+
+#endif
#include <sys/disk.h>
#endif
-#include "ext4.h"
-#include "jbd2.h"
-
int force = 0;
struct fs_info info;
struct fs_aux_info aux_info;
#define off64_t off_t
#endif
+#include "ext4_kernel_headers.h"
+
extern int force;
#define warn(fmt, args...) do { fprintf(stderr, "warning: %s: " fmt "\n", __func__, ## args); } while (0)
#define DIV_ROUND_UP(x, y) (((x) + (y) - 1)/(y))
#define ALIGN(x, y) ((y) * DIV_ROUND_UP((x), (y)))
-#define __le64 u64
-#define __le32 u32
-#define __le16 u16
-
-#define __be64 u64
-#define __be32 u32
-#define __be16 u16
-
-#define __u64 u64
-#define __u32 u32
-#define __u16 u16
-#define __u8 u8
-
/* XXX */
#define cpu_to_le32(x) (x)
#define cpu_to_le16(x) (x)
struct xattr_list_element;
struct ext2_group_desc {
- __le32 bg_block_bitmap;
- __le32 bg_inode_bitmap;
- __le32 bg_inode_table;
- __le16 bg_free_blocks_count;
- __le16 bg_free_inodes_count;
- __le16 bg_used_dirs_count;
- __le16 bg_flags;
- __le32 bg_reserved[2];
- __le16 bg_reserved16;
- __le16 bg_checksum;
+ u32 bg_block_bitmap;
+ u32 bg_inode_bitmap;
+ u32 bg_inode_table;
+ u16 bg_free_blocks_count;
+ u16 bg_free_inodes_count;
+ u16 bg_used_dirs_count;
+ u16 bg_flags;
+ u32 bg_reserved[2];
+ u16 bg_reserved16;
+ u16 bg_checksum;
};
struct fs_info {
*/
#include "ext4_utils.h"
-#include "ext4.h"
-#include "ext4_extents.h"
#include "extent.h"
#include <sparse/sparse.h>
*/
#include "ext4_utils.h"
-#include "ext4.h"
-#include "ext4_extents.h"
#include "indirect.h"
#include "allocate.h"
#define JBD2_CRC32_CHKSUM_SIZE 4
-#define JBD2_CHECKSUM_BYTES (32 / sizeof(u32))
+#define JBD2_CHECKSUM_BYTES (32 / sizeof(__u32))
struct commit_header {
__be32 h_magic;
(char *)(entry) + EXT4_XATTR_LEN((entry)->e_name_len)))
#define EXT4_XATTR_SIZE(size) \
(((size) + EXT4_XATTR_ROUND) & ~EXT4_XATTR_ROUND)
-#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
+#define IS_LAST_ENTRY(entry) (*(uint32_t *)(entry) == 0)
#endif /* !_SYSTEM_EXTRAS_EXT4_UTILS_XATTR_H */