aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <pcacjr@zytor.com>2012-07-20 22:08:31 -0300
committerPaulo Alcantara <pcacjr@zytor.com>2012-07-21 01:21:47 -0300
commit0aa04a4525792e12e247abe8def31a68de40d91f (patch)
tree95faba48c60df649992ac716e265fefd6151d3d8
parentfa2b511f8b46c32c8dd1708d429331afa52d2003 (diff)
downloadsyslinux-0aa04a4525792e12e247abe8def31a68de40d91f.tar.gz
syslinux-0aa04a4525792e12e247abe8def31a68de40d91f.tar.xz
syslinux-0aa04a4525792e12e247abe8def31a68de40d91f.zip
xfs: Cleanup
This patch basically cleanups the previous one. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
-rw-r--r--core/fs/xfs/xfs.c45
-rw-r--r--core/fs/xfs/xfs.h29
2 files changed, 39 insertions, 35 deletions
diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c
index 354e465a..cebba035 100644
--- a/core/fs/xfs/xfs.c
+++ b/core/fs/xfs/xfs.c
@@ -34,7 +34,6 @@
#include "xfs.h"
#include "xfs_ag.h"
-
static inline struct inode *xfs_new_inode(struct fs_info *fs)
{
struct inode *inode;
@@ -137,7 +136,6 @@ static void *get_dirblk(struct fs_info *fs, block_t startblock)
return buf;
}
-
struct inode *xfs_fmt_local_find_entry(const char *dname, struct inode *parent,
xfs_dinode_t *core)
@@ -284,9 +282,9 @@ out:
return -1;
}
-static struct inode *dir2_block_find_entry(const char *dname,
- struct inode *parent,
- xfs_dinode_t *core)
+static struct inode *xfs_dir2_block_find_entry(const char *dname,
+ struct inode *parent,
+ xfs_dinode_t *core)
{
xfs_bmbt_irec_t r;
block_t dir_blk;
@@ -330,7 +328,7 @@ static struct inode *dir2_block_find_entry(const char *dname,
}
dep = (xfs_dir2_data_entry_t *)p;
-
+
start_name = &dep->name[0];
end_name = start_name + dep->namelen;
name = get_entry_name(start_name, end_name);
@@ -357,12 +355,13 @@ found:
xfs_debug("entry inode's number %lu", ino);
ncore = xfs_get_ino_core(fs, ino);
- fill_xfs_inode_pvt(inode, fs, ino);
if (!ncore) {
xfs_error("Failed to get dinode!");
goto failed;
}
+ fill_xfs_inode_pvt(fs, inode, ino);
+
inode->ino = ino;
XFS_PVT(inode)->i_ino_blk = ino_to_bytes(fs, ino) >> BLOCK_SHIFT(fs);
inode->size = be64_to_cpu(ncore->di_size);
@@ -389,23 +388,25 @@ failed:
return NULL;
}
-static struct inode *dir2_leaf_find_entry(const char *dname,
- struct inode *parent,
- xfs_dinode_t *core)
+static struct inode *xfs_dir2_leaf_find_entry(const char *dname,
+ struct inode *parent,
+ xfs_dinode_t *core)
{
- (void) dname;
- (void) parent;
- (void) core;
+ (void)dname;
+ (void)parent;
+ (void)core;
+
return NULL;
}
-static struct inode *dir2_node_find_entry(const char *dname,
- struct inode *parent,
- xfs_dinode_t *core)
+static struct inode *xfs_dir2_node_find_entry(const char *dname,
+ struct inode *parent,
+ xfs_dinode_t *core)
{
- (void) dname;
- (void) parent;
- (void) core;
+ (void)dname;
+ (void)parent;
+ (void)core;
+
return NULL;
}
@@ -417,13 +418,13 @@ static struct inode *xfs_fmt_extents_find_entry(const char *dname,
if (be32_to_cpu(core->di_nextents) <= 1) {
/* Single-block Directories */
- inode = dir2_block_find_entry(dname, parent, core);
+ inode = xfs_dir2_block_find_entry(dname, parent, core);
} else if (xfs_dir2_isleaf(core)) {
/* Leaf Directory */
- inode = dir2_leaf_find_entry(dname, parent, core);
+ inode = xfs_dir2_leaf_find_entry(dname, parent, core);
} else {
/* Node Directory */
- inode = dir2_node_find_entry(dname, parent, core);
+ inode = xfs_dir2_node_find_entry(dname, parent, core);
}
return inode;
diff --git a/core/fs/xfs/xfs.h b/core/fs/xfs/xfs.h
index e0684689..52380aec 100644
--- a/core/fs/xfs/xfs.h
+++ b/core/fs/xfs/xfs.h
@@ -260,15 +260,18 @@ typedef struct xfs_inobt_rec {
* l1:0-20 are blockcount.
*/
typedef struct xfs_bmbt_rec {
- uint64_t l0, l1;
-} xfs_bmbt_rec_t;
+ uint64_t l0;
+ uint64_t l1;
+} __attribute__((__packed__)) xfs_bmbt_rec_t;
/*
* Possible extent states.
*/
typedef enum {
- XFS_EXT_NORM, XFS_EXT_UNWRITTEN,
- XFS_EXT_DMAPI_OFFLINE, XFS_EXT_INVALID
+ XFS_EXT_NORM,
+ XFS_EXT_UNWRITTEN,
+ XFS_EXT_DMAPI_OFFLINE,
+ XFS_EXT_INVALID,
} xfs_exntst_t;
typedef struct xfs_bmbt_irec
@@ -277,7 +280,7 @@ typedef struct xfs_bmbt_irec
xfs_fsblock_t br_startblock; /* starting block number */
xfs_filblks_t br_blockcount; /* number of blocks */
xfs_exntst_t br_state; /* extent state */
-} xfs_bmbt_irec_t;
+} __attribute__((__packed__)) xfs_bmbt_irec_t;
static inline void bmbt_irec_get(xfs_bmbt_irec_t *dest,
const xfs_bmbt_rec_t *src)
@@ -291,7 +294,8 @@ static inline void bmbt_irec_get(xfs_bmbt_irec_t *dest,
dest->br_startblock = (((xfs_fsblock_t)l0 & 0x00000000000001ffULL) << 43) |
(((xfs_fsblock_t)l1) >> 21);
dest->br_blockcount = (xfs_filblks_t)(l1 & 0x00000000001fffffULL);
- dest->br_state = (l0 & 0x8000000000000000ULL) ? XFS_EXT_UNWRITTEN : XFS_EXT_NORM;
+ dest->br_state = (l0 & 0x8000000000000000ULL) ?
+ XFS_EXT_UNWRITTEN : XFS_EXT_NORM;
}
typedef struct xfs_timestamp {
@@ -409,7 +413,6 @@ static inline xfs_intino_t xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp,
* most structures are also used for the combined data/freespace "block"
* format below.
*/
-
#define XFS_DIR2_DATA_ALIGN_LOG 3
#define XFS_DIR2_DATA_ALIGN (1 << XFS_DIR2_DATA_ALIGN_LOG)
#define XFS_DIR2_DATA_FREE_TAG 0xffff
@@ -418,26 +421,26 @@ static inline xfs_intino_t xfs_dir2_sf_get_inumber(xfs_dir2_sf_t *sfp,
typedef struct xfs_dir2_data_free {
uint16_t offset;
uint16_t length;
-} xfs_dir2_data_free_t;
+} __attribute__((__packed__)) xfs_dir2_data_free_t;
typedef struct xfs_dir2_data_hdr {
uint32_t magic;
xfs_dir2_data_free_t bestfree[XFS_DIR2_DATA_FD_COUNT];
-} xfs_dir2_data_hdr_t;
+} __attribute__((__packed__)) xfs_dir2_data_hdr_t;
typedef struct xfs_dir2_data_entry {
uint64_t inumber; /* inode number */
uint8_t namelen; /* name length */
uint8_t name[]; /* name types, no null */
/* uint16_t tag; */ /* starting offset of us */
-} xfs_dir2_data_entry_t;
+} __attribute__((__packed__)) xfs_dir2_data_entry_t;
typedef struct xfs_dir2_data_unused {
uint16_t freetag; /* XFS_DIR2_DATA_FREE_TAG */
uint16_t length; /* total free length */
/* variable offset */
/* uint16_t tag; */ /* starting offset of us */
-} xfs_dir2_data_unused_t;
+} __attribute__((__packed__)) xfs_dir2_data_unused_t;
#define roundup(x, y) ( \
{ \
@@ -469,7 +472,7 @@ xfs_dir2_data_unused_tag_p(struct xfs_dir2_data_unused *dup)
typedef struct xfs_dir2_block_tail {
uint32_t count; /* count of leaf entries */
uint32_t stale; /* count of stale lf entries */
-} xfs_dir2_block_tail_t;
+} __attribute__((__packed__)) xfs_dir2_block_tail_t;
static inline struct xfs_dir2_block_tail *
xfs_dir2_block_tail_p(struct xfs_fs_info *fs_info, struct xfs_dir2_data_hdr *hdr)
@@ -481,7 +484,7 @@ xfs_dir2_block_tail_p(struct xfs_fs_info *fs_info, struct xfs_dir2_data_hdr *hdr
typedef struct xfs_dir2_leaf_entry {
uint32_t hashval; /* hash value of name */
uint32_t address; /* address of data entry */
-} xfs_dir2_leaf_entry_t;
+} __attribute__((__packed__)) xfs_dir2_leaf_entry_t;
static inline bool xfs_is_valid_magicnum(const xfs_sb_t *sb)
{