libgfs2: Remove exit calls from inode_read and inode_get
PATCH 1/3 libgfs2: Remove exit calls from inode_read and inode_get
- Remove exit calls from inode_read and inode_get
- Fix error handling for the functions up the call tree
- The two functions are almost identical so define inode_read using inode_get
- Update their names with an lgfs2_ prefix
- Move block_is_in_per_node into savemeta.c and make it static
--- gfs2/convert/gfs2_convert.c | 24 ++++++++++++---- gfs2/edit/extended.c | 24 ++++++++++++---- gfs2/edit/hexedit.c | 47 ++++++++++++------------------- gfs2/edit/hexedit.h | 1 - gfs2/edit/savemeta.c | 56 ++++++++++++++++++++++++++++++++----- gfs2/fsck/fs_recovery.c | 4 ++- gfs2/fsck/initialize.c | 68 +++++++++++++++++++++++++++++++++------------ gfs2/fsck/metawalk.c | 4 +-- gfs2/libgfs2/fs_ops.c | 34 +++++++++++++---------- gfs2/libgfs2/libgfs2.h | 4 +-- gfs2/libgfs2/structures.c | 8 ++++-- gfs2/mkfs/main_grow.c | 7 +++-- 12 files changed, 192 insertions(+), 89 deletions(-)
gfs2/convert/gfs2_convert.c +19 -5
@@ -1092,7 +1092,9 @@ static int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock, {struct gfs2_inode *fix_inode; - fix_inode =inode_read (sbp, iblock); + fix_inode =lgfs2_inode_read (sbp, iblock); +if (fix_inode ==NULL ) +return 1 ; inum->no_formal_ino = fix_inode->i_di.di_num.no_formal_ino; inum->no_addr = fix_inode->i_di.di_num.no_addr;if (eablk)
@@ -1289,7 +1291,9 @@ static int process_directory(struct gfs2_sbd *sbp, uint64_t dirblock, uint64_t dstruct gfs2_inode *dip;int error =0 ;/* read in the directory inode */ - dip =inode_read (sbp, dirblock); + dip =lgfs2_inode_read (sbp, dirblock); +if (dip ==NULL ) +return -1 ;/* fix the directory: either exhash (leaves) or linear (stuffed) */ if (dip->i_di.di_flags &GFS2_DIF_EXHASH ) {if (fix_one_directory_exhash (sbp, dip, dentmod)) {
@@ -1391,7 +1395,9 @@ static int fix_cdpn_symlinks(struct gfs2_sbd *sbp, osi_list_t *cdpn_to_fix)/* initialize the symlink inode to be a directory */ bh =init_dinode (sbp, &fix,S_IFDIR |0755 ,0 , &dir); - fix_inode =inode_get (sbp, bh); + fix_inode =lgfs2_inode_get (sbp, bh); +if (fix_inode ==NULL ) +return -1 ; fix_inode->i_di.di_eattr = eablk;/*fix extended attribute */ inode_put (&fix_inode);bmodified (bh);
@@ -1588,7 +1594,11 @@ static int init(struct gfs2_sbd *sbp) sbp->md.riinode =gfs_inode_read (sbp, inum.no_addr);/* get gfs1 jindex inode - gfs1's journal index inode ptr became master */ gfs2_inum_in (&inum, (char *)&raw_gfs1_ondisk_sb.sb_jindex_di); - sbp->md.jiinode =inode_read (sbp, inum.no_addr); + sbp->md.jiinode =lgfs2_inode_read (sbp, inum.no_addr); +if (sbp->md.jiinode ==NULL ) { +log_crit (_ ("Could not read journal index: %s\n" ),strerror (errno)); +exit (-1 ); + }/* read in the journal index data */ read_gfs1_jiindex (sbp);/* read in the resource group index data: */
@@ -2056,7 +2066,11 @@ static void copy_quotas(struct gfs2_sbd *sdp) }gfs2_inum_in (&inum, (char *)&raw_gfs1_ondisk_sb.sb_quota_di); - oq_ip =inode_read (sdp, inum.no_addr); + oq_ip =lgfs2_inode_read (sdp, inum.no_addr); +if (oq_ip ==NULL ) { +fprintf (stderr,_ ("Couldn't lookup old quota file: %s\n" ),strerror (errno)); +exit (1 ); + } nq_ip->i_di.di_height = oq_ip->i_di.di_height; nq_ip->i_di.di_size = oq_ip->i_di.di_size;
gfs2/edit/extended.c +18 -6
@@ -654,7 +654,9 @@ int display_extended(void)/* Display any indirect pointers that we have. */ if (block_is_rindex ()) { tmp_bh =bread (&sbd, block); - tmp_inode =inode_get (&sbd, tmp_bh); + tmp_inode =lgfs2_inode_get (&sbd, tmp_bh); +if (tmp_inode ==NULL ) +return -1 ;parse_rindex (tmp_inode, TRUE);inode_put (&tmp_inode);brelse (tmp_bh);
@@ -669,35 +671,45 @@ int display_extended(void) tmp_bh =bread (&sbd, sbd1->sb_rindex_di.no_addr); else tmp_bh =bread (&sbd,masterblock ("rindex" )); - tmp_inode =inode_get (&sbd, tmp_bh); + tmp_inode =lgfs2_inode_get (&sbd, tmp_bh); +if (tmp_inode ==NULL ) +return -1 ;parse_rindex (tmp_inode, FALSE);inode_put (&tmp_inode);brelse (tmp_bh); }else if (block_is_jindex ()) { tmp_bh =bread (&sbd, block); - tmp_inode =inode_get (&sbd, tmp_bh); + tmp_inode =lgfs2_inode_get (&sbd, tmp_bh); +if (tmp_inode ==NULL ) +return -1 ;print_jindex (tmp_inode);inode_put (&tmp_inode);brelse (tmp_bh); }else if (block_is_inum_file ()) { tmp_bh =bread (&sbd, block); - tmp_inode =inode_get (&sbd, tmp_bh); + tmp_inode =lgfs2_inode_get (&sbd, tmp_bh); +if (tmp_inode ==NULL ) +return -1 ;print_inum (tmp_inode);inode_put (&tmp_inode);brelse (tmp_bh); }else if (block_is_statfs_file ()) { tmp_bh =bread (&sbd, block); - tmp_inode =inode_get (&sbd, tmp_bh); + tmp_inode =lgfs2_inode_get (&sbd, tmp_bh); +if (tmp_inode ==NULL ) +return -1 ;print_statfs (tmp_inode);inode_put (&tmp_inode);brelse (tmp_bh); }else if (block_is_quota_file ()) { tmp_bh =bread (&sbd, block); - tmp_inode =inode_get (&sbd, tmp_bh); + tmp_inode =lgfs2_inode_get (&sbd, tmp_bh); +if (tmp_inode ==NULL ) +return -1 ;print_quota (tmp_inode);inode_put (&tmp_inode);brelse (tmp_bh);
gfs2/edit/hexedit.c +18 -29
83 lines not on this page · raw message
gfs2/edit/hexedit.h +0 -1
@@ -217,7 +217,6 @@ extern int block_is_inum_file(void);extern int block_is_statfs_file (void );extern int block_is_quota_file (void );extern int block_is_per_node (void ); -extern int block_is_in_per_node (void );extern int display_block_type (int from_restore);extern void gfs_jindex_in (struct gfs_jindex *jindex,char *buf); extern void gfs_log_header_in(struct gfs_log_header *head,
gfs2/edit/savemeta.c +49 -7
84 lines not on this page · raw message
gfs2/fsck/fs_recovery.c +3 -1
@@ -667,7 +667,9 @@ int ji_update(struct gfs2_sbd *sdp)return -1 ; }gfs_jindex_in (&ji, buf); - sdp->md.journal[i] =inode_read (sdp, ji.ji_addr); + sdp->md.journal[i] =lgfs2_inode_read (sdp, ji.ji_addr); +if (sdp->md.journal[i] ==NULL ) +return -1 ; }else {/* FIXME check snprintf return code */ snprintf(journal_name, JOURNAL_NAME_SIZE,
gfs2/fsck/initialize.c +51 -17
147 lines not on this page · raw message
gfs2/fsck/metawalk.c +2 -2
@@ -227,7 +227,7 @@ struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block)return ip;if (sdp->gfs1)return gfs_inode_read (sdp, block); -return inode_read (sdp, block); +return lgfs2_inode_read (sdp, block); }/* fsck_inode_get - same as inode_get() in libgfs2 but system inodes
@@ -243,7 +243,7 @@ struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,if (sdp->gfs1)return gfs_inode_get (sdp, bh); -return inode_get (sdp, bh); +return lgfs2_inode_get (sdp, bh); }/* fsck_inode_put - same as inode_put() in libgfs2 but system inodes
gfs2/libgfs2/fs_ops.c +19 -15
@@ -34,34 +34,32 @@ static int inode_is_stuffed(struct gfs2_inode *ip)return !ip->i_di.di_height; } -struct gfs2_inode *inode_get (struct gfs2_sbd *sdp,struct gfs2_buffer_head *bh) +struct gfs2_inode *lgfs2_inode_get (struct gfs2_sbd *sdp,struct gfs2_buffer_head *bh) {struct gfs2_inode *ip; ip =calloc (1 ,sizeof (struct gfs2_inode ));if (ip ==NULL ) { -fprintf (stderr,"Out of memory in %s\n" , __FUNCTION__); -exit (-1 ); +return NULL ; }gfs2_dinode_in (&ip->i_di, bh); ip->i_bh = bh; ip->i_sbd = sdp; - ip->bh_owned =0 ;/* caller did the bread so we don't own the bh */ return ip; } -struct gfs2_inode *inode_read (struct gfs2_sbd *sdp,uint64_t di_addr) +struct gfs2_inode *lgfs2_inode_read (struct gfs2_sbd *sdp,uint64_t di_addr) {struct gfs2_inode *ip; - - ip =calloc (1 ,sizeof (struct gfs2_inode )); +struct gfs2_buffer_head *bh =bread (sdp, di_addr); +if (bh ==NULL ) { +return NULL ; + } + ip =lgfs2_inode_get (sdp, bh);if (ip ==NULL ) { -fprintf (stderr,"Out of memory in %s\n" , __FUNCTION__); -exit (-1 ); +brelse (bh); +return NULL ; } - ip->i_bh =bread (sdp, di_addr); -gfs2_dinode_in (&ip->i_di, ip->i_bh); - ip->i_sbd = sdp; ip->bh_owned =1 ;/* We did the bread so we own the bh */ return ip; }
@@ -1405,7 +1403,9 @@ static struct gfs2_inode *__createi(struct gfs2_inode *dip, bh =__init_dinode (sdp, &inum, mode, flags, &dip->i_di.di_num, if_gfs1); - ip =inode_get (sdp, bh); + ip =lgfs2_inode_get (sdp, bh); +if (ip ==NULL ) +return NULL ;bmodified (bh); } ip->bh_owned =1 ;
@@ -1764,7 +1764,7 @@ int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,return 0 ; }else - *ipp =inode_read (sdp, inum.no_addr); + *ipp =lgfs2_inode_read (sdp, inum.no_addr);return error; }
@@ -1808,7 +1808,11 @@ int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)osi_list_init (&metalist[h]); bh =bread (sdp, diblock); - ip =inode_get (sdp, bh); +if (bh ==NULL ) +return -1 ; + ip =lgfs2_inode_get (sdp, bh); +if (ip ==NULL ) +return -1 ; height = ip->i_di.di_height;osi_list_add (&bh->b_altlist, &metalist[0 ]);
gfs2/libgfs2/libgfs2.h +2 -2
@@ -425,9 +425,9 @@ extern struct metapath *find_metapath(struct gfs2_inode *ip, uint64_t block);extern void lookup_block (struct gfs2_inode *ip,struct gfs2_buffer_head *bh,unsigned int height,struct metapath *mp,int create,int *new,uint64_t *block); -extern struct gfs2_inode *inode_get (struct gfs2_sbd *sdp, +extern struct gfs2_inode *lgfs2_inode_get (struct gfs2_sbd *sdp,struct gfs2_buffer_head *bh); -extern struct gfs2_inode *inode_read (struct gfs2_sbd *sdp,uint64_t di_addr); +extern struct gfs2_inode *lgfs2_inode_read (struct gfs2_sbd *sdp,uint64_t di_addr);extern struct gfs2_inode *is_system_inode (struct gfs2_sbd *sdp,uint64_t block);extern void inode_put (struct gfs2_inode **ip);
gfs2/libgfs2/structures.c +6 -2
@@ -26,7 +26,9 @@ int build_master(struct gfs2_sbd *sdp) bh =init_dinode (sdp, &inum,S_IFDIR |0755 ,GFS2_DIF_SYSTEM , &inum); - sdp->master_dir =inode_get (sdp, bh); + sdp->master_dir =lgfs2_inode_get (sdp, bh); +if (sdp->master_dir ==NULL ) +return -1 ;if (sdp->debug) {printf ("\nMaster dir:\n" );
@@ -429,7 +431,9 @@ int build_root(struct gfs2_sbd *sdp) inum.no_addr = bn; bh =init_dinode (sdp, &inum,S_IFDIR |0755 ,0 , &inum); - sdp->md.rooti =inode_get (sdp, bh); + sdp->md.rooti =lgfs2_inode_get (sdp, bh); +if (sdp->md.rooti ==NULL ) +return -1 ;if (sdp->debug) {printf ("\nRoot directory:\n" );
gfs2/mkfs/main_grow.c +5 -2
@@ -376,8 +376,11 @@ main_grow(int argc, char *argv[])die (_ ("GFS2 rindex not found. Please run gfs2_fsck.\n" )); }/* Get master dinode */ - sdp->master_dir = -inode_read (sdp, sdp->sd_sb.sb_master_dir.no_addr); + sdp->master_dir =lgfs2_inode_read (sdp, sdp->sd_sb.sb_master_dir.no_addr); +if (sdp->master_dir ==NULL ) { +perror ("Could not read master" ); +exit (EXIT_FAILURE ); + }gfs2_lookupi (sdp->master_dir,"rindex" ,6 , &sdp->md.riinode);/* Fetch the rindex from disk. We aren't using gfs2 here, */ /* which means that the bitmaps will most likely be cached */
Signature · 1 line
1.7.11.4
PATCH 2/3 libgfs2: Remove exit call from __gfs_inode_get
Return NULL instead of exiting on a failed calloc() and handle the error at all call points. Also update the names of gfs_inode_{get,read} with the lgfs2_ prefix.
--- gfs2/convert/gfs2_convert.c | 12 ++++++++++-- gfs2/edit/savemeta.c | 30 +++++++++++++++++------------- gfs2/fsck/metawalk.c | 4 ++-- gfs2/libgfs2/gfs1.c | 7 +++---- gfs2/libgfs2/libgfs2.h | 4 ++-- 5 files changed, 34 insertions(+), 23 deletions(-)
gfs2/convert/gfs2_convert.c +10 -2
@@ -895,7 +895,11 @@ static int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)struct inode_block *fixdir;int inode_was_gfs1; - inode =gfs_inode_get (sbp, bh); + inode =lgfs2_gfs_inode_get (sbp, bh); +if (inode ==NULL ) { +log_crit (_ ("Error reading inode: %s\n" ),strerror (errno)); +return -1 ; + } inode_was_gfs1 = (inode->i_di.di_num.no_formal_ino == inode->i_di.di_num.no_addr);
@@ -1591,7 +1595,11 @@ static int init(struct gfs2_sbd *sbp) }/* get gfs1 rindex inode - gfs1's rindex inode ptr became __pad2 */ gfs2_inum_in (&inum, (char *)&raw_gfs1_ondisk_sb.sb_rindex_di); - sbp->md.riinode =gfs_inode_read (sbp, inum.no_addr); + sbp->md.riinode =lgfs2_gfs_inode_read (sbp, inum.no_addr); +if (sbp->md.riinode ==NULL ) { +log_crit (_ ("Could not read resource group index: %s\n" ),strerror (errno)); +exit (-1 ); + }/* get gfs1 jindex inode - gfs1's journal index inode ptr became master */ gfs2_inum_in (&inum, (char *)&raw_gfs1_ondisk_sb.sb_jindex_di); sbp->md.jiinode =lgfs2_inode_read (sbp, inum.no_addr);
gfs2/edit/savemeta.c +17 -13
@@ -147,13 +147,13 @@ static int get_gfs_struct_info(struct gfs2_buffer_head *lbh, int *block_type,break ;case GFS2_METATYPE_DI :/* 4 (disk inode) */ if (sbd.gfs1) { - inode =gfs_inode_get (&sbd, lbh); + inode =lgfs2_gfs_inode_get (&sbd, lbh); }else { inode =lgfs2_inode_get (&sbd, lbh); -if (inode ==NULL ) { -fprintf (stderr,"Out of memory\n" ); -exit (-1 ); - } + } +if (inode ==NULL ) { +perror ("Error reading inode" ); +exit (-1 ); }if (S_ISDIR (inode->i_di.di_mode) || (sbd.gfs1 && inode->i_di.__pad1 ==GFS_FILE_DIR ))
@@ -488,14 +488,14 @@ static void save_inode_data(struct metafd *mfd)for (i =0 ; i <GFS2_MAX_META_HEIGHT ; i++)osi_list_init (&metalist[i]); metabh =bread (&sbd, block); -if (sbd.gfs1) - inode =gfs_inode_get (&sbd, metabh); -else { +if (sbd.gfs1) { + inode =lgfs2_gfs_inode_get (&sbd, metabh); + }else { inode =lgfs2_inode_get (&sbd, metabh); -if (inode ==NULL ) { -fprintf (stderr,"Failed to read inode: %s\n" ,strerror (errno)); -exit (-1 ); - } + } +if (inode ==NULL ) { +perror ("Failed to read inode" ); +exit (-1 ); } height = inode->i_di.di_height;/* If this is a user inode, we don't follow to the file height.
@@ -611,8 +611,12 @@ static void get_journal_inode_blocks(void)struct gfs_jindex ji;char jbuf[sizeof (struct gfs_jindex )]; - j_inode =gfs_inode_read (&sbd, + j_inode =lgfs2_gfs_inode_read (&sbd, sbd1->sb_jindex_di.no_addr); +if (j_inode ==NULL ) { +fprintf (stderr,"Error reading journal inode: %s\n" ,strerror (errno)); +return ; + } amt =gfs2_readi (j_inode, (void *)&jbuf, journal *sizeof (struct gfs_jindex ),sizeof (struct gfs_jindex ));
gfs2/fsck/metawalk.c +2 -2
@@ -226,7 +226,7 @@ struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sdp, uint64_t block)if (ip)return ip;if (sdp->gfs1) -return gfs_inode_read (sdp, block); +return lgfs2_gfs_inode_read (sdp, block);return lgfs2_inode_read (sdp, block); }
@@ -242,7 +242,7 @@ struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,return sysip;if (sdp->gfs1) -return gfs_inode_get (sdp, bh); +return lgfs2_gfs_inode_get (sdp, bh);return lgfs2_inode_get (sdp, bh); }
gfs2/libgfs2/gfs1.c +3 -4
@@ -293,8 +293,7 @@ static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp, ip =calloc (1 ,sizeof (struct gfs2_inode ));if (ip ==NULL ) { -fprintf (stderr,"Out of memory in %s\n" , __FUNCTION__); -exit (-1 ); +return NULL ; } ip->bh_owned =0 ;
@@ -332,13 +331,13 @@ static struct gfs2_inode *__gfs_inode_get(struct gfs2_sbd *sdp,return ip; } -struct gfs2_inode *gfs_inode_get (struct gfs2_sbd *sdp, +struct gfs2_inode *lgfs2_gfs_inode_get (struct gfs2_sbd *sdp,struct gfs2_buffer_head *bh) {return __gfs_inode_get (sdp, bh,0 ); } -struct gfs2_inode *gfs_inode_read (struct gfs2_sbd *sdp,uint64_t di_addr) +struct gfs2_inode *lgfs2_gfs_inode_read (struct gfs2_sbd *sdp,uint64_t di_addr) {return __gfs_inode_get (sdp,NULL , di_addr); }
gfs2/libgfs2/libgfs2.h +2 -2
@@ -646,9 +646,9 @@ extern void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,extern int gfs1_writei (struct gfs2_inode *ip,char *buf,uint64_t offset,unsigned int size);extern int gfs1_ri_update (struct gfs2_sbd *sdp,int fd,int *rgcount,int quiet); -extern struct gfs2_inode *gfs_inode_get (struct gfs2_sbd *sdp, +extern struct gfs2_inode *lgfs2_gfs_inode_get (struct gfs2_sbd *sdp,struct gfs2_buffer_head *bh); -extern struct gfs2_inode *gfs_inode_read (struct gfs2_sbd *sdp, +extern struct gfs2_inode *lgfs2_gfs_inode_read (struct gfs2_sbd *sdp,uint64_t di_addr);extern void gfs_jindex_in (struct gfs_jindex *jindex,char *buf);extern void gfs_rgrp_in (struct gfs_rgrp *rg,struct gfs2_buffer_head *bh);
Signature · 1 line
1.7.11.4
PATCH 3/3 gfs2_edit: Some comment cleanups
In reply to Andrew PriceRemove some empty function comments to make things a bit more readable.
--- gfs2/edit/extended.c | 45 ---------------------------------- gfs2/edit/gfs2hex.c | 68 +++------------------------------------------------- gfs2/edit/hexedit.c | 10 -------- 3 files changed, 3 insertions(+), 120 deletions(-)
gfs2/edit/extended.c +0 -45
@@ -30,9 +30,6 @@static void print_block_details (struct iinfo *ind,int level,int cur_height,int pndx,uint64_t file_offset); -/* ------------------------------------------------------------------------ */ -/* get_height */ -/* ------------------------------------------------------------------------ */ static int get_height (void ) {int cur_height =0 , i;
@@ -49,9 +46,6 @@ static int get_height(void)return cur_height; } -/* ------------------------------------------------------------------------ */ -/* _do_indirect_extended */ -/* ------------------------------------------------------------------------ */ static int _do_indirect_extended (char *diebuf,struct iinfo *iinf,int hgt) {unsigned int x, y;
@@ -81,9 +75,6 @@ static int _do_indirect_extended(char *diebuf, struct iinfo *iinf, int hgt)return i_blocks; } -/* ------------------------------------------------------------------------ */ -/* do_indirect_extended */ -/* ------------------------------------------------------------------------ */ int do_indirect_extended (char *diebuf,struct iinfo *iinf) {return _do_indirect_extended (diebuf, iinf,get_height ());
@@ -107,9 +98,6 @@ static int dinode_valid(void)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* metapath_to_lblock - convert from metapath, height to logical block */ -/* ------------------------------------------------------------------------ */ static uint64_t metapath_to_lblock (struct metapath *mp,int hgt) {int h;
@@ -128,9 +116,6 @@ static uint64_t metapath_to_lblock(struct metapath *mp, int hgt)return lblock; } -/* ------------------------------------------------------------------------ */ -/* display_indirect */ -/* ------------------------------------------------------------------------ */ static int display_indirect (struct iinfo *ind,int indblocks,int level,uint64_t startoff) {
@@ -246,9 +231,6 @@ static int display_indirect(struct iinfo *ind, int indblocks, int level,return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_inode_type */ -/* ------------------------------------------------------------------------ */ static void print_inode_type (__be16 de_type) {if (sbd.gfs1) {
@@ -314,9 +296,6 @@ static void print_inode_type(__be16 de_type) } } -/* ------------------------------------------------------------------------ */ -/* display_leaf - display directory leaf */ -/* ------------------------------------------------------------------------ */ static int display_leaf (struct iinfo *ind) {int start_line, total_dirents = start_row[dmode];
@@ -374,9 +353,6 @@ static int display_leaf(struct iinfo *ind)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_block_details */ -/* ------------------------------------------------------------------------ */ static void print_block_details (struct iinfo *ind,int level,int cur_height,int pndx,uint64_t file_offset) {
@@ -441,9 +417,6 @@ static void print_block_details(struct iinfo *ind, int level, int cur_height,free (more_indir); } -/* ------------------------------------------------------------------------ */ -/* gfs_jindex_print - print an jindex entry. */ -/* ------------------------------------------------------------------------ */ static void gfs_jindex_print (struct gfs_jindex *ji) {pv ((unsigned long long )ji, ji_addr,"%llu" ,"0x%llx" );
@@ -451,9 +424,6 @@ static void gfs_jindex_print(struct gfs_jindex *ji)pv (ji, ji_pad,"%u" ,"0x%x" ); } -/* ------------------------------------------------------------------------ */ -/* print_jindex - print the jindex file. */ -/* ------------------------------------------------------------------------ */ static int print_jindex (struct gfs2_inode *dij) {int error, start_line;
@@ -494,9 +464,6 @@ static int print_jindex(struct gfs2_inode *dij)return error; } -/* ------------------------------------------------------------------------ */ -/* parse_rindex - print the rgindex file. */ -/* ------------------------------------------------------------------------ */ static int parse_rindex (struct gfs2_inode *dip,int print_rindex) {int error, start_line;
@@ -562,9 +529,6 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)return error; } -/* ------------------------------------------------------------------------ */ -/* print_inum - print the inum file. */ -/* ------------------------------------------------------------------------ */ static int print_inum (struct gfs2_inode *dii) {uint64_t inum, inodenum;
@@ -587,9 +551,6 @@ static int print_inum(struct gfs2_inode *dii)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_statfs - print the statfs file. */ -/* ------------------------------------------------------------------------ */ static int print_statfs (struct gfs2_inode *dis) {struct gfs2_statfs_change sfb, sfc;
@@ -613,9 +574,6 @@ static int print_statfs(struct gfs2_inode *dis)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_quota - print the quota file. */ -/* ------------------------------------------------------------------------ */ static int print_quota (struct gfs2_inode *diq) {struct gfs2_quota qbuf, q;
@@ -642,9 +600,6 @@ static int print_quota(struct gfs2_inode *diq)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* display_extended */ -/* ------------------------------------------------------------------------ */ int display_extended (void ) {struct gfs2_inode *tmp_inode;
gfs2/edit/gfs2hex.c +3 -65
98 lines not on this page · raw message
gfs2/edit/hexedit.c +0 -10
@@ -3101,16 +3101,6 @@ static void process_parameters(int argc, char *argv[], int pass) }/* for */ }/* process_parameters */ -/****************************************************************************** -******************************************************************************* -** -** main() -** -** Description: -** Do everything -** -******************************************************************************* -******************************************************************************/ int main (int argc,char *argv[]) {int i, j, fd;
Signature · 1 line
1.7.11.4
PATCH 3/3 gfs2_edit: Some comment cleanups
Hi,
Those three all look ok to me,
Steve.
Quoted 291 lines · Andrew Price
Remove some empty function comments to make things a bit more readable.
Signed-off-by Andrew Price <[email protected]>--- gfs2/edit/extended.c | 45 ---------------------------------- gfs2/edit/gfs2hex.c | 68 +++------------------------------------------------- gfs2/edit/hexedit.c | 10 -------- 3 files changed, 3 insertions(+), 120 deletions(-)gfs2/edit/extended.c +0
-45@@ -30,9 +30,6 @@static void print_block_details (struct iinfo *ind,int level,int cur_height,int pndx,uint64_t file_offset); -/* ------------------------------------------------------------------------ */ -/* get_height */ -/* ------------------------------------------------------------------------ */ static int get_height (void ) {int cur_height =0 , i;@@ -49,9 +46,6 @@ static int get_height(void)return cur_height; } -/* ------------------------------------------------------------------------ */ -/* _do_indirect_extended */ -/* ------------------------------------------------------------------------ */ static int _do_indirect_extended (char *diebuf,struct iinfo *iinf,int hgt) {unsigned int x, y;@@ -81,9 +75,6 @@ static int _do_indirect_extended(char *diebuf, struct iinfo *iinf, int hgt)return i_blocks; } -/* ------------------------------------------------------------------------ */ -/* do_indirect_extended */ -/* ------------------------------------------------------------------------ */ int do_indirect_extended (char *diebuf,struct iinfo *iinf) {return _do_indirect_extended (diebuf, iinf,get_height ());@@ -107,9 +98,6 @@ static int dinode_valid(void)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* metapath_to_lblock - convert from metapath, height to logical block */ -/* ------------------------------------------------------------------------ */ static uint64_t metapath_to_lblock (struct metapath *mp,int hgt) {int h;@@ -128,9 +116,6 @@ static uint64_t metapath_to_lblock(struct metapath *mp, int hgt)return lblock; } -/* ------------------------------------------------------------------------ */ -/* display_indirect */ -/* ------------------------------------------------------------------------ */ static int display_indirect (struct iinfo *ind,int indblocks,int level,uint64_t startoff) {@@ -246,9 +231,6 @@ static int display_indirect(struct iinfo *ind, int indblocks, int level,return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_inode_type */ -/* ------------------------------------------------------------------------ */ static void print_inode_type (__be16 de_type) {if (sbd.gfs1) {@@ -314,9 +296,6 @@ static void print_inode_type(__be16 de_type) } } -/* ------------------------------------------------------------------------ */ -/* display_leaf - display directory leaf */ -/* ------------------------------------------------------------------------ */ static int display_leaf (struct iinfo *ind) {int start_line, total_dirents = start_row[dmode];@@ -374,9 +353,6 @@ static int display_leaf(struct iinfo *ind)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_block_details */ -/* ------------------------------------------------------------------------ */ static void print_block_details (struct iinfo *ind,int level,int cur_height,int pndx,uint64_t file_offset) {@@ -441,9 +417,6 @@ static void print_block_details(struct iinfo *ind, int level, int cur_height,free (more_indir); } -/* ------------------------------------------------------------------------ */ -/* gfs_jindex_print - print an jindex entry. */ -/* ------------------------------------------------------------------------ */ static void gfs_jindex_print (struct gfs_jindex *ji) {pv ((unsigned long long )ji, ji_addr,"%llu" ,"0x%llx" );@@ -451,9 +424,6 @@ static void gfs_jindex_print(struct gfs_jindex *ji)pv (ji, ji_pad,"%u" ,"0x%x" ); } -/* ------------------------------------------------------------------------ */ -/* print_jindex - print the jindex file. */ -/* ------------------------------------------------------------------------ */ static int print_jindex (struct gfs2_inode *dij) {int error, start_line;@@ -494,9 +464,6 @@ static int print_jindex(struct gfs2_inode *dij)return error; } -/* ------------------------------------------------------------------------ */ -/* parse_rindex - print the rgindex file. */ -/* ------------------------------------------------------------------------ */ static int parse_rindex (struct gfs2_inode *dip,int print_rindex) {int error, start_line;@@ -562,9 +529,6 @@ static int parse_rindex(struct gfs2_inode *dip, int print_rindex)return error; } -/* ------------------------------------------------------------------------ */ -/* print_inum - print the inum file. */ -/* ------------------------------------------------------------------------ */ static int print_inum (struct gfs2_inode *dii) {uint64_t inum, inodenum;@@ -587,9 +551,6 @@ static int print_inum(struct gfs2_inode *dii)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_statfs - print the statfs file. */ -/* ------------------------------------------------------------------------ */ static int print_statfs (struct gfs2_inode *dis) {struct gfs2_statfs_change sfb, sfc;@@ -613,9 +574,6 @@ static int print_statfs(struct gfs2_inode *dis)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* print_quota - print the quota file. */ -/* ------------------------------------------------------------------------ */ static int print_quota (struct gfs2_inode *diq) {struct gfs2_quota qbuf, q;@@ -642,9 +600,6 @@ static int print_quota(struct gfs2_inode *diq)return 0 ; } -/* ------------------------------------------------------------------------ */ -/* display_extended */ -/* ------------------------------------------------------------------------ */ int display_extended (void ) {struct gfs2_inode *tmp_inode;gfs2/edit/gfs2hex.c +3
-65@@ -19,7 +19,6 @@#include "extended.h" #include "gfs2hex.h" -/* from libgfs2: */ #include "libgfs2.h" #define pv (struct, member, fmt, fmt2) do { \@@ -255,21 +254,6 @@ static int indirect_dirent(struct indirect_info *indir, char *ptr, int d)return de.de_rec_len; } -/****************************************************************************** -******************************************************************************* -** -** do_dinode_extended() -** -** Description: -** -** Input(s): -** -** Output(s): -** -** Returns: -** -******************************************************************************* -******************************************************************************/ void do_dinode_extended (struct gfs2_dinode *dine,struct gfs2_buffer_head *lbh) {unsigned int x, y, ptroff =0 ;@@ -350,21 +334,9 @@ void do_dinode_extended(struct gfs2_dinode *dine, struct gfs2_buffer_head *lbh) }/* if exhash */ }/* do_dinode_extended */ -/****************************************************************************** -******************************************************************************* -** -** do_leaf_extended() -** -** Description: -** -** Input(s): -** -** Output(s): -** -** Returns: next leaf block, if any, in a chain of leaf blocks -** -******************************************************************************* -******************************************************************************/ +/** +* Returns: next leaf block, if any, in a chain of leaf blocks +*/ uint64_t do_leaf_extended (char *dlebuf,struct iinfo *indir) {int x, i;@@ -403,23 +375,6 @@ uint64_t do_leaf_extended(char *dlebuf, struct iinfo *indir)return leaf.lf_next; } - -/****************************************************************************** -******************************************************************************* -** -** do_eattr_extended() -** -** Description: -** -** Input(s): -** -** Output(s): -** -** Returns: -** -******************************************************************************* -******************************************************************************/ -static void do_eattr_extended (struct gfs2_buffer_head *ebh) {struct gfs2_ea_header ea;@@ -524,23 +479,6 @@ static void gfs1_rgrp_print(struct gfs1_rgrp *rg)pv (rg, rg_freemeta,"%u" ,"0x%x" ); } -/****************************************************************************** -******************************************************************************* -** -** int display_gfs2() -** -** Description: -** This routine... -** -** Input(s): -** *buffer - -** extended - -** -** Returns: -** 0 if OK, 1 on error. -** -******************************************************************************* -******************************************************************************/ int display_gfs2 (void ) {struct gfs2_meta_header mh;gfs2/edit/hexedit.c +0
-10@@ -3101,16 +3101,6 @@ static void process_parameters(int argc, char *argv[], int pass) }/* for */ }/* process_parameters */ -/****************************************************************************** -******************************************************************************* -** -** main() -** -** Description: -** Do everything -** -******************************************************************************* -******************************************************************************/ int main (int argc,char *argv[]) {int i, j, fd;
PATCH 3/3 gfs2_edit: Some comment cleanups
In reply to Andrew Price----- Original Message -----
| Remove some empty function comments to make things a bit more | readable. | | Signed-off-by: Andrew Price <[email protected]> | ---
Hi,
ACK to all three patches.
Regards,
Bob Peterson
Red Hat File Systems