The one caller sets sdp->gfs1 and modifies the mode itself so we can use sdp->gfs1 in __createi() and update the caller to use lgfs2_createi() instead.
Signed-off-by: Andrew Price <anpr...@redhat.com> --- gfs2/fsck/lost_n_found.c | 6 +----- gfs2/libgfs2/fs_ops.c | 19 ++++++------------- gfs2/libgfs2/libgfs2.h | 3 --- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c index ca5ab89e..97fc16b0 100644 --- a/gfs2/fsck/lost_n_found.c +++ b/gfs2/fsck/lost_n_found.c @@ -109,11 +109,7 @@ void make_sure_lf_exists(struct fsck_cx *cx, struct lgfs2_inode *ip) if (sdp->gfs1) sdp->md.next_inum = find_free_blk(sdp); mode = (sdp->gfs1 ? DT2IF(GFS_FILE_DIR) : S_IFDIR) | 0700; - if (sdp->gfs1) - lf_dip = lgfs2_gfs_createi(sdp->md.rooti, "lost+found", mode, 0); - else - lf_dip = lgfs2_createi(sdp->md.rooti, "lost+found", - S_IFDIR | 0700, 0); + lf_dip = lgfs2_createi(sdp->md.rooti, "lost+found", mode, 0); if (lf_dip == NULL) { log_crit(_("Error creating lost+found: %s\n"), strerror(errno)); diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c index e72871ed..5003c1ae 100644 --- a/gfs2/libgfs2/fs_ops.c +++ b/gfs2/libgfs2/fs_ops.c @@ -1497,9 +1497,8 @@ int lgfs2_write_filemeta(struct lgfs2_inode *ip) return 0; } -static struct lgfs2_inode *__createi(struct lgfs2_inode *dip, - const char *filename, unsigned int mode, - uint32_t flags, int if_gfs1) +static struct lgfs2_inode *__createi(struct lgfs2_inode *dip, const char *filename, + unsigned int mode, uint32_t flags) { struct lgfs2_sbd *sdp = dip->i_sbd; uint64_t bn; @@ -1517,7 +1516,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip, if (err != 0) return NULL; - if (if_gfs1) + if (sdp->gfs1) inum.in_formal_ino = bn; else inum.in_formal_ino = sdp->md.next_inum++; @@ -1527,7 +1526,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip, if (err) return NULL; - if (if_gfs1) + if (sdp->gfs1) is_dir = (IF2DT(mode) == GFS_FILE_DIR); else is_dir = S_ISDIR(mode); @@ -1536,7 +1535,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip, dip->i_nlink++; } - err = __init_dinode(sdp, &bh, &inum, mode, flags, &parent, if_gfs1); + err = __init_dinode(sdp, &bh, &inum, mode, flags, &parent, sdp->gfs1); if (err != 0) return NULL; @@ -1552,13 +1551,7 @@ static struct lgfs2_inode *__createi(struct lgfs2_inode *dip, struct lgfs2_inode *lgfs2_createi(struct lgfs2_inode *dip, const char *filename, unsigned int mode, uint32_t flags) { - return __createi(dip, filename, mode, flags, 0); -} - -struct lgfs2_inode *lgfs2_gfs_createi(struct lgfs2_inode *dip, const char *filename, - unsigned int mode, uint32_t flags) -{ - return __createi(dip, filename, mode, flags, 1); + return __createi(dip, filename, mode, flags); } /** diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index bcbc5e47..69a7552f 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -515,9 +515,6 @@ extern int lgfs2_init_dinode(struct lgfs2_sbd *sdp, struct lgfs2_buffer_head **b unsigned int mode, uint32_t flags, struct lgfs2_inum *parent); extern struct lgfs2_inode *lgfs2_createi(struct lgfs2_inode *dip, const char *filename, unsigned int mode, uint32_t flags); -extern struct lgfs2_inode *lgfs2_gfs_createi(struct lgfs2_inode *dip, - const char *filename, unsigned int mode, - uint32_t flags); extern void lgfs2_dirent2_del(struct lgfs2_inode *dip, struct lgfs2_buffer_head *bh, struct gfs2_dirent *prev, struct gfs2_dirent *cur); extern int lgfs2_dir_search(struct lgfs2_inode *dip, const char *filename, int len, -- 2.39.0