[Ocfs2-tools-devel] [PATCH] libocfs2: Fix up stale DEBUG_EXE code
Joel Becker
Joel.Becker at oracle.com
Mon Jun 30 15:30:17 PDT 2008
Looks like multiple changes were made without testing the DEBUG_EXE test
code. Let's clean that up. While were at it, fix some whitespace in
those files.
Signed-off-by: Joel Becker <joel.becker at oracle.com>
---
libocfs2/dlm.c | 16 +++++++++-------
libocfs2/extend_file.c | 2 +-
libocfs2/extent_map.c | 46 ++++++++++------------------------------------
libocfs2/extents.c | 9 +++++----
4 files changed, 25 insertions(+), 48 deletions(-)
diff --git a/libocfs2/dlm.c b/libocfs2/dlm.c
index c04ab8d..cf5f61b 100644
--- a/libocfs2/dlm.c
+++ b/libocfs2/dlm.c
@@ -10,12 +10,12 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License, version 2, as published by the Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -25,7 +25,7 @@
#define _XOPEN_SOURCE 600 /* Triggers magic in features.h */
#define _LARGEFILE64_SOURCE
-
+
#include "ocfs2/ocfs2.h"
#define DEFAULT_DLMFS_PATH "/dlm/"
@@ -270,10 +270,10 @@ errcode_t ocfs2_super_unlock(ocfs2_filesys *fs)
0, lock_name);
ret = o2dlm_unlock(fs->fs_dlm_ctxt, lock_name);
-
+
return ret;
}
-
+
errcode_t ocfs2_meta_lock(ocfs2_filesys *fs,
ocfs2_cached_inode *ci,
enum o2dlm_lock_level level,
@@ -311,6 +311,8 @@ errcode_t ocfs2_meta_unlock(ocfs2_filesys *fs,
#include <stdlib.h>
#include <libgen.h>
+#define DEBUG_SERVICE "debug"
+
static void print_usage(void)
{
fprintf(stderr, "Usage: dlm <filename>\n");
@@ -345,7 +347,7 @@ int main(int argc, char *argv[])
goto out;
}
- ret = ocfs2_initialize_dlm(fs);
+ ret = ocfs2_initialize_dlm(fs, DEBUG_SERVICE);
if (ret) {
com_err(progname, ret, "while initializing dlm");
goto out;
@@ -371,7 +373,7 @@ int main(int argc, char *argv[])
out:
if (fs->fs_dlm_ctxt) {
- ret = ocfs2_shutdown_dlm(fs);
+ ret = ocfs2_shutdown_dlm(fs, DEBUG_SERVICE);
if (ret)
com_err(progname, ret, "while shutting down dlm");
}
diff --git a/libocfs2/extend_file.c b/libocfs2/extend_file.c
index 0b7310f..1cb4a00 100644
--- a/libocfs2/extend_file.c
+++ b/libocfs2/extend_file.c
@@ -268,7 +268,7 @@ static errcode_t ocfs2_sync_path_to_disk(ocfs2_filesys *fs,
struct ocfs2_path *right_path,
int subtree_index)
{
- errcode_t ret;
+ errcode_t ret = 0;
struct ocfs2_path *path = NULL;
assert(left_path || right_path);
diff --git a/libocfs2/extent_map.c b/libocfs2/extent_map.c
index eb8595a..7e5f8fe 100644
--- a/libocfs2/extent_map.c
+++ b/libocfs2/extent_map.c
@@ -10,12 +10,12 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License, version 2, as published by the Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -335,32 +335,6 @@ static int read_b_numbers(const char *num, uint64_t *blkno, int *count)
return 0;
}
-static int read_c_numbers(const char *num, uint32_t *cpos, int *count)
-{
- uint64_t val;
- char *ptr;
-
- val = strtoull(num, &ptr, 0);
- if (!ptr)
- return 1;
- if (*ptr != ':')
- return 1;
- if (val > UINT32_MAX)
- return 1;
- *cpos = (uint32_t)val;
-
- ptr++;
-
- val = strtoull(ptr, &ptr, 0);
- if (!ptr || *ptr)
- return 1;
- if (val > INT_MAX)
- return 1;
- *count = (int)val;
-
- return 0;
-}
-
static void print_usage(void)
{
fprintf(stderr,
@@ -373,14 +347,13 @@ extern char *optarg;
int main(int argc, char *argv[])
{
errcode_t ret;
- uint64_t blkno, blkoff;
- uint32_t cpos, coff;
- int count, contig;
+ uint64_t blkno, contig, blkoff = 0;
+ uint16_t ext_flags;
+ int count = 0;
int c, op = 0;
char *filename;
ocfs2_filesys *fs;
ocfs2_cached_inode *cinode;
- struct ocfs2_extent_rec *rec;
blkno = OCFS2_SUPER_BLOCK_BLKNO;
@@ -420,7 +393,7 @@ int main(int argc, char *argv[])
break;
}
}
-
+
if (!op) {
fprintf(stderr, "Missing operation\n");
print_usage();
@@ -433,7 +406,7 @@ int main(int argc, char *argv[])
return 1;
}
filename = argv[optind];
-
+
ret = ocfs2_open(filename, OCFS2_FLAG_RO, 0, 0, &fs);
if (ret) {
com_err(argv[0], ret,
@@ -455,13 +428,14 @@ int main(int argc, char *argv[])
blkoff,
count,
&blkno,
- &contig);
+ &contig,
+ &ext_flags);
if (ret) {
com_err(argv[0], ret,
"looking up block range %"PRIu64":%d", blkoff, count);
goto out_free;
}
- fprintf(stdout, "Lookup of block range %"PRIu64":%d returned %"PRIu64":%d\n",
+ fprintf(stdout, "Lookup of block range %"PRIu64":%d returned %"PRIu64":%"PRIu64"\n",
blkoff, count, blkno, contig);
out_free:
diff --git a/libocfs2/extents.c b/libocfs2/extents.c
index 7c6afe0..51b1aae 100644
--- a/libocfs2/extents.c
+++ b/libocfs2/extents.c
@@ -11,12 +11,12 @@
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License, version 2, as published by the Free Software Foundation.
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -646,7 +646,7 @@ static int walk_extents_func(ocfs2_filesys *fs,
fprintf(stdout, " ");
fprintf(stdout, "(%08"PRIu32", %08"PRIu32", %08"PRIu64") |"
" + %08"PRIu32" = %08"PRIu32" / %08"PRIu32"\n",
- rec->e_cpos, ocfs2_rec_clustes(tree_depth, rec),
+ rec->e_cpos, ocfs2_rec_clusters(tree_depth, rec),
rec->e_blkno, ccount,
ccount + ocfs2_rec_clusters(tree_depth, rec),
wi->di->i_clusters);
@@ -670,6 +670,7 @@ struct walk_block {
static int walk_blocks_func(ocfs2_filesys *fs,
uint64_t blkno,
uint64_t bcount,
+ uint16_t ext_flags,
void *priv_data)
{
struct walk_block *wb = priv_data;
@@ -777,7 +778,7 @@ int main(int argc, char *argv[])
return 1;
}
filename = argv[optind];
-
+
if (!(walk_blocks + walk_extents)) {
fprintf(stderr,
"No operation specified\n");
--
1.5.5.4
--
Life's Little Instruction Book #274
"Leave everything a little better than you found it."
Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127
More information about the Ocfs2-tools-devel
mailing list