[syslinux:elflink] xfs: Fix the way we check di_mode of an inode
syslinux-bot for Paulo Alcantara
pcacjr at zytor.com
Tue Nov 27 12:57:27 PST 2012
Commit-ID: 75cf6cebf0ffdf75f359528b01fc9039062e7b34
Gitweb: http://www.syslinux.org/commit/75cf6cebf0ffdf75f359528b01fc9039062e7b34
Author: Paulo Alcantara <pcacjr at zytor.com>
AuthorDate: Sun, 2 Sep 2012 20:03:13 -0300
Committer: Paulo Alcantara <pcacjr at zytor.com>
CommitDate: Sun, 2 Sep 2012 20:07:20 -0300
xfs: Fix the way we check di_mode of an inode
The previous way to judge the di_mode of an inode could not distinguish
S_IFREG and S_IFLNK. Fix it to a better judgement.
Signed-off-by: Paulo Alcantara <pcacjr at zytor.com>
---
core/fs/xfs/xfs.c | 2 +-
core/fs/xfs/xfs_dir2.c | 24 ++++++++++++------------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c
index 7102d7a..98d6255 100644
--- a/core/fs/xfs/xfs.c
+++ b/core/fs/xfs/xfs.c
@@ -322,7 +322,7 @@ static struct inode *xfs_iget_root(struct fs_info *fs)
xfs_debug("Root inode has been found!");
- if (!(be16_to_cpu(core->di_mode) & S_IFDIR)) {
+ if ((be16_to_cpu(core->di_mode) & S_IFMT) != S_IFDIR) {
xfs_error("root inode is not a directory ?! No makes sense...");
goto out;
}
diff --git a/core/fs/xfs/xfs_dir2.c b/core/fs/xfs/xfs_dir2.c
index 45b4ff1..c52196a 100644
--- a/core/fs/xfs/xfs_dir2.c
+++ b/core/fs/xfs/xfs_dir2.c
@@ -158,14 +158,14 @@ found:
inode->ino = ino;
inode->size = be64_to_cpu(ncore->di_size);
- if (be16_to_cpu(ncore->di_mode) & S_IFDIR) {
+ if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFDIR) {
inode->mode = DT_DIR;
xfs_debug("Found a directory inode!");
- } else if (be16_to_cpu(ncore->di_mode) & S_IFREG) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFREG) {
inode->mode = DT_REG;
xfs_debug("Found a file inode!");
xfs_debug("inode size %llu", inode->size);
- } else if (be16_to_cpu(ncore->di_mode) & S_IFLNK) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFLNK) {
inode->mode = DT_LNK;
xfs_debug("Found a symbolic link inode!");
}
@@ -260,14 +260,14 @@ found:
XFS_PVT(inode)->i_ino_blk = ino_to_bytes(fs, ino) >> BLOCK_SHIFT(fs);
inode->size = be64_to_cpu(ncore->di_size);
- if (be16_to_cpu(ncore->di_mode) & S_IFDIR) {
+ if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFDIR) {
inode->mode = DT_DIR;
xfs_debug("Found a directory inode!");
- } else if (be16_to_cpu(ncore->di_mode) & S_IFREG) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFREG) {
inode->mode = DT_REG;
xfs_debug("Found a file inode!");
xfs_debug("inode size %llu", inode->size);
- } else if (be16_to_cpu(ncore->di_mode) & S_IFLNK) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFLNK) {
inode->mode = DT_LNK;
xfs_debug("Found a symbolic link inode!");
}
@@ -414,14 +414,14 @@ found:
BLOCK_SHIFT(parent->fs);
ip->size = be64_to_cpu(ncore->di_size);
- if (be16_to_cpu(ncore->di_mode) & S_IFDIR) {
+ if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFDIR) {
ip->mode = DT_DIR;
xfs_debug("Found a directory inode!");
- } else if (be16_to_cpu(ncore->di_mode) & S_IFREG) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFREG) {
ip->mode = DT_REG;
xfs_debug("Found a file inode!");
xfs_debug("inode size %llu", ip->size);
- } else if (be16_to_cpu(ncore->di_mode) & S_IFLNK) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFLNK) {
ip->mode = DT_LNK;
xfs_debug("Found a symbolic link inode!");
}
@@ -731,14 +731,14 @@ found:
BLOCK_SHIFT(parent->fs);
ip->size = be64_to_cpu(ncore->di_size);
- if (be16_to_cpu(ncore->di_mode) & S_IFDIR) {
+ if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFDIR) {
ip->mode = DT_DIR;
xfs_debug("Found a directory inode!");
- } else if (be16_to_cpu(ncore->di_mode) & S_IFREG) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFREG) {
ip->mode = DT_REG;
xfs_debug("Found a file inode!");
xfs_debug("inode size %llu", ip->size);
- } else if (be16_to_cpu(ncore->di_mode) & S_IFLNK) {
+ } else if ((be16_to_cpu(ncore->di_mode) & S_IFMT) == S_IFLNK) {
ip->mode = DT_LNK;
xfs_debug("Found a symbolic link inode!");
}
More information about the Syslinux-commits
mailing list