[syslinux:master] xfs: rename xfs_is_valid_magicnum to xfs_is_valid_sb

syslinux-bot for Paulo Alcantara pcacjr at zytor.com
Wed Nov 11 03:00:03 PST 2015


Commit-ID:  e2ba978566e44c976919b0382d3b185e9ef0db1f
Gitweb:     http://www.syslinux.org/commit/e2ba978566e44c976919b0382d3b185e9ef0db1f
Author:     Paulo Alcantara <pcacjr at zytor.com>
AuthorDate: Sat, 18 Jul 2015 10:26:34 -0300
Committer:  Paulo Alcantara <pcacjr at zytor.com>
CommitDate: Sun, 8 Nov 2015 19:26:48 -0200

xfs: rename xfs_is_valid_magicnum to xfs_is_valid_sb

xfs_is_valid_magicnum is not actually a generic function that checks for
magic numbers, instead it checks only for superblock's one.

Signed-off-by: Paulo Alcantara <pcacjr at zytor.com>
Reviewed-by: Gene Cumm <gene.cumm at gmail.com>

---
 core/fs/xfs/xfs.c | 13 +++++--------
 core/fs/xfs/xfs.h | 19 ++++++++++---------
 2 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/core/fs/xfs/xfs.c b/core/fs/xfs/xfs.c
index e42e952..8dbc803 100644
--- a/core/fs/xfs/xfs.c
+++ b/core/fs/xfs/xfs.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013 Paulo Alcantara <pcacjr at zytor.com>
+ * Copyright (c) 2012-2015 Paulo Alcantara <pcacjr at zytor.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -331,7 +331,7 @@ out:
     return NULL;
 }
 
-static inline int xfs_read_superblock(struct fs_info *fs, xfs_sb_t *sb)
+static inline int xfs_read_sb(struct fs_info *fs, xfs_sb_t *sb)
 {
     struct disk *disk = fs->fs_dev->disk;
 
@@ -376,24 +376,21 @@ static int xfs_fs_init(struct fs_info *fs)
     SECTOR_SHIFT(fs) = disk->sector_shift;
     SECTOR_SIZE(fs) = 1 << SECTOR_SHIFT(fs);
 
-    if (xfs_read_superblock(fs, &sb)) {
+    if (xfs_read_sb(fs, &sb)) {
 	xfs_error("Superblock read failed");
 	goto out;
     }
-
-    if (!xfs_is_valid_magicnum(&sb)) {
+    if (!xfs_is_valid_sb(&sb)) {
 	xfs_error("Invalid superblock");
 	goto out;
     }
-
-    xfs_debug("magicnum 0x%lX", be32_to_cpu(sb.sb_magicnum));
+    xfs_debug("sb magic: 0x%lX", be32_to_cpu(sb.sb_magicnum));
 
     info = xfs_new_sb_info(&sb);
     if (!info) {
 	xfs_error("Failed to fill in filesystem-specific info structure");
 	goto out;
     }
-
     fs->fs_info = info;
 
     xfs_debug("block_shift %u blocksize 0x%lX (%lu)", info->block_shift,
diff --git a/core/fs/xfs/xfs.h b/core/fs/xfs/xfs.h
index 0d953d8..a8bfa93 100644
--- a/core/fs/xfs/xfs.h
+++ b/core/fs/xfs/xfs.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013 Paulo Alcantara <pcacjr at zytor.com>
+ * Copyright (c) 2012-2015 Paulo Alcantara <pcacjr at zytor.com>
  *
  * Some parts borrowed from Linux kernel tree (linux/fs/xfs):
  *
@@ -30,15 +30,16 @@
 #include "xfs_types.h"
 #include "xfs_ag.h"
 
-#define xfs_error(fmt, args...)						\
-    ({									\
-	printf("%s:%u: xfs - [ERROR] " fmt "\n", __func__, __LINE__, ## args); \
+#define xfs_error(fmt, args...)                                         \
+    ({                                                                  \
+        dprintf("%s:%u: xfs - [error] " fmt "\n", __func__, __LINE__,   \
+                ## args);                                               \
     })
 
-#define xfs_debug(fmt, args...)						\
-    ({									\
-	dprintf("%s:%u: xfs - [DEBUG] " fmt "\n", __func__, __LINE__,	\
-		## args);						\
+#define xfs_debug(fmt, args...)                                         \
+    ({                                                                  \
+        dprintf("%s:%u: xfs - [debug] " fmt "\n", __func__, __LINE__,   \
+                ## args);                                               \
     })
 
 struct xfs_fs_info;
@@ -617,7 +618,7 @@ typedef struct xfs_da_intnode {
 typedef struct xfs_da_node_hdr xfs_da_node_hdr_t;
 typedef struct xfs_da_node_entry xfs_da_node_entry_t;
 
-static inline bool xfs_is_valid_magicnum(const xfs_sb_t *sb)
+static inline bool xfs_is_valid_sb(const xfs_sb_t *sb)
 {
     return sb->sb_magicnum == *(uint32_t *)XFS_SB_MAGIC;
 }


More information about the Syslinux-commits mailing list