gfs2_utils: Improve error messages
PATCH 1/1 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
--- gfs2/edit/hexedit.c | 10 +++++++--- gfs2/libgfs2/fs_ops.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-)
gfs2/edit/hexedit.c +7 -3
@@ -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.\n" ); +else if (!sbd.sd_sb.sb_master_dir.no_addr) { +fprintf (stderr,"GFS2 master directory not found on %s\n" , + sbd.device_name); +exit (-1 ); + }else + blk = sbd.sd_sb.sb_master_dir.no_addr; }else if (!strcmp (kword,"jindex" )) {if (sbd.gfs1)
gfs2/libgfs2/fs_ops.c +1 -1
@@ -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\n" ); +fprintf (stderr,"Not enough space available on device\n" );exit (1 ); }
Signature · 1 line
1.7.7.6
PATCH 1/1 gfs2_utils: Improve error messages
Hi,
looks good to me,
Steve.
Quoted 49 lines · Andrew Price
Currently
gfs2_editcomplains 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 inblk_alloc_ito be more clear.rhbz#742293
Signed-off-by Andrew Price <[email protected]>--- gfs2/edit/hexedit.c | 10 +++++++--- gfs2/libgfs2/fs_ops.c | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-)gfs2/edit/hexedit.c +7
-3@@ -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.\n" ); +else if (!sbd.sd_sb.sb_master_dir.no_addr) { +fprintf (stderr,"GFS2 master directory not found on %s\n" , + sbd.device_name); +exit (-1 ); + }else + blk = sbd.sd_sb.sb_master_dir.no_addr; }else if (!strcmp (kword,"jindex" )) {if (sbd.gfs1)gfs2/libgfs2/fs_ops.c +1
-1@@ -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\n" ); +fprintf (stderr,"Not enough space available on device\n" );exit (1 ); }