FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 02-17-2012, 02:56 PM
Andrew Price
 
Default gfs2_utils: Improve error messages

Currently gfs2_edit complains that it doesn't know what 'master' means
when it can't find the master directory. This patch catches the case
where the master directory hasn't been found and reports the error more
clearly to the user. It also updates a terse 'out of space' error
message in blk_alloc_i to be more clear.

rhbz#742293

Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/edit/hexedit.c | 10 +++++++---
gfs2/libgfs2/fs_ops.c | 2 +-
2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 4b992de..69d1940 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -1700,10 +1700,14 @@ uint64_t check_keywords(const char *kword)
else if (!strcmp(kword, "root") || !strcmp(kword, "rootdir"))
blk = sbd.sd_sb.sb_root_dir.no_addr;
else if (!strcmp(kword, "master")) {
- if (!sbd.gfs1)
- blk = sbd.sd_sb.sb_master_dir.no_addr;
- else
+ if (sbd.gfs1)
fprintf(stderr, "This is GFS1; there's no master directory.
");
+ else if (!sbd.sd_sb.sb_master_dir.no_addr) {
+ fprintf(stderr, "GFS2 master directory not found on %s
",
+ sbd.device_name);
+ exit(-1);
+ } else
+ blk = sbd.sd_sb.sb_master_dir.no_addr;
}
else if (!strcmp(kword, "jindex")) {
if (sbd.gfs1)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index def6f80..a72394f 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -137,7 +137,7 @@ static uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
}

if (n == NULL) {
- fprintf(stderr, "out of space
");
+ fprintf(stderr, "Not enough space available on device
");
exit(1);
}

--
1.7.7.6
 
Old 02-17-2012, 03:00 PM
Steven Whitehouse
 
Default gfs2_utils: Improve error messages

Hi,

looks good to me,

Steve.

On Fri, 2012-02-17 at 15:56 +0000, Andrew Price wrote:
> Currently gfs2_edit complains that it doesn't know what 'master' means
> when it can't find the master directory. This patch catches the case
> where the master directory hasn't been found and reports the error more
> clearly to the user. It also updates a terse 'out of space' error
> message in blk_alloc_i to be more clear.
>
> rhbz#742293
>
> Signed-off-by: Andrew Price <anprice@redhat.com>
> ---
> gfs2/edit/hexedit.c | 10 +++++++---
> gfs2/libgfs2/fs_ops.c | 2 +-
> 2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
> index 4b992de..69d1940 100644
> --- a/gfs2/edit/hexedit.c
> +++ b/gfs2/edit/hexedit.c
> @@ -1700,10 +1700,14 @@ uint64_t check_keywords(const char *kword)
> else if (!strcmp(kword, "root") || !strcmp(kword, "rootdir"))
> blk = sbd.sd_sb.sb_root_dir.no_addr;
> else if (!strcmp(kword, "master")) {
> - if (!sbd.gfs1)
> - blk = sbd.sd_sb.sb_master_dir.no_addr;
> - else
> + if (sbd.gfs1)
> fprintf(stderr, "This is GFS1; there's no master directory.
");
> + else if (!sbd.sd_sb.sb_master_dir.no_addr) {
> + fprintf(stderr, "GFS2 master directory not found on %s
",
> + sbd.device_name);
> + exit(-1);
> + } else
> + blk = sbd.sd_sb.sb_master_dir.no_addr;
> }
> else if (!strcmp(kword, "jindex")) {
> if (sbd.gfs1)
> diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
> index def6f80..a72394f 100644
> --- a/gfs2/libgfs2/fs_ops.c
> +++ b/gfs2/libgfs2/fs_ops.c
> @@ -137,7 +137,7 @@ static uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
> }
>
> if (n == NULL) {
> - fprintf(stderr, "out of space
");
> + fprintf(stderr, "Not enough space available on device
");
> exit(1);
> }
>
 

Thread Tools




All times are GMT. The time now is 03:31 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org