commit df2b32923008c31a8b660638d07446a8d1bb5318 Author: Bob Peterson <rpeterso@redhat.com> Date: Tue Aug 11 16:19:22 2009 -0500 Add #ifdefs to allow gfs2-utils to compile on older kernels This patch pulls in a bunch of #ifdef statements, as they appear upstream, to allow gfs2-utils to compile properly on older kernels. rhbz#515370 diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c index 869ee00..977770d 100644 --- a/gfs2/edit/gfs2hex.c +++ b/gfs2/edit/gfs2hex.c @@ -469,7 +469,9 @@ void gfs2_sb_print2(struct gfs2_sb *sb) gfs2_inum_print2("quota ino ", &gfs1_quota_di); gfs2_inum_print2("license ", &gfs1_license_di); } +#ifdef GFS2_HAS_UUID print_it(" sb_uuid", "%s", NULL, str_uuid(sb->sb_uuid)); +#endif } /****************************************************************************** diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c index 4d14448..60a0bd8 100644 --- a/gfs2/libgfs2/ondisk.c +++ b/gfs2/libgfs2/ondisk.c @@ -112,7 +112,9 @@ void gfs2_sb_in(struct gfs2_sb *sb, char *buf) CPIN_08(sb, str, sb_lockproto, GFS2_LOCKNAME_LEN); CPIN_08(sb, str, sb_locktable, GFS2_LOCKNAME_LEN); +#ifdef GFS2_HAS_UUID CPIN_08(sb, str, sb_uuid, sizeof(sb->sb_uuid)); +#endif } void gfs2_sb_out(struct gfs2_sb *sb, char *buf) @@ -132,7 +134,9 @@ void gfs2_sb_out(struct gfs2_sb *sb, char *buf) CPOUT_08(sb, str, sb_lockproto, GFS2_LOCKNAME_LEN); CPOUT_08(sb, str, sb_locktable, GFS2_LOCKNAME_LEN); +#ifdef GFS2_HAS_UUID CPOUT_08(sb, str, sb_uuid, sizeof(sb->sb_uuid)); +#endif } const char *str_uuid(const unsigned char *uuid) @@ -154,10 +158,12 @@ const char *str_uuid(const unsigned char *uuid) return str; } +#ifdef GFS2_HAS_UUID void gfs2_print_uuid(const unsigned char *uuid) { print_it(" uuid", "%s", NULL, str_uuid(uuid)); } +#endif void gfs2_sb_print(struct gfs2_sb *sb) { @@ -175,7 +181,9 @@ void gfs2_sb_print(struct gfs2_sb *sb) pv(sb, sb_lockproto, "%s", NULL); pv(sb, sb_locktable, "%s", NULL); +#ifdef GFS2_HAS_UUID gfs2_print_uuid(sb->sb_uuid); +#endif } void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf) diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c index 8a7dc07..e5507ca 100644 --- a/gfs2/libgfs2/structures.c +++ b/gfs2/libgfs2/structures.c @@ -71,8 +71,9 @@ build_sb(struct gfs2_sbd *sdp, const unsigned char *uuid) sb.sb_root_dir = sdp->md.rooti->i_di.di_num; strcpy(sb.sb_lockproto, sdp->lockproto); strcpy(sb.sb_locktable, sdp->locktable); +#ifdef GFS2_HAS_UUID memcpy(sb.sb_uuid, uuid, sizeof(sb.sb_uuid)); - +#endif bh = bget(&sdp->buf_list, sdp->sb_addr); gfs2_sb_out(&sb, bh->b_data); brelse(bh, updated); diff --git a/gfs2/tool/sb.c b/gfs2/tool/sb.c index 5cd91eb..ccf4039 100644 --- a/gfs2/tool/sb.c +++ b/gfs2/tool/sb.c @@ -164,6 +164,7 @@ do_sb(int argc, char **argv) printf("new multihost format = %u\n", sb.sb_multihost_format); } +#ifdef GFS2_HAS_UUID } else if (strcmp(field, "uuid") == 0) { printf("current uuid = %s\n", str_uuid(sb.sb_uuid)); @@ -193,6 +194,7 @@ do_sb(int argc, char **argv) memcpy(sb.sb_uuid, uuid, 16); printf("new uuid = %s\n", str_uuid(sb.sb_uuid)); } +#endif } else if (strcmp(field, "all") == 0) { gfs2_sb_print(&sb); newval = FALSE;