From 26db75ea69d9f097c5de207d180fd58909c4fbec Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 19 Sep 2015 10:06:44 +0200 Subject: [PATCH] Fix compilation on Solaris/FreeBSD --- bacula/src/filed/acl.c | 56 ++++++++++++++++++------------------- bacula/src/findlib/fstype.c | 6 ++-- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/bacula/src/filed/acl.c b/bacula/src/filed/acl.c index 8a63b6bbf4..916ee694d7 100644 --- a/bacula/src/filed/acl.c +++ b/bacula/src/filed/acl.c @@ -927,7 +927,7 @@ static bacl_rtn_code generic_set_acl_on_os(JCR *jcr, * Define the supported ACL streams for this OS */ static int os_access_acl_streams[1] = { - STREAM_ACL_DARWIN_ACCESS_ACL + STREAM_ACL_DARWIN_ACCESS }; static int os_default_acl_streams[1] = { -1 @@ -988,11 +988,11 @@ static bacl_rtn_code (*os_restore_acl_streams) * Define the supported ACL streams for these OSes */ static int os_access_acl_streams[2] = { - STREAM_ACL_FREEBSD_ACCESS_ACL, - STREAM_ACL_FREEBSD_NFS4_ACL + STREAM_ACL_FREEBSD_ACCESS, + STREAM_ACL_FREEBSD_NFS4 }; static int os_default_acl_streams[1] = { - STREAM_ACL_FREEBSD_DEFAULT_ACL + STREAM_ACL_FREEBSD_DEFAULT }; static bacl_rtn_code freebsd_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt) @@ -1065,7 +1065,7 @@ static bacl_rtn_code freebsd_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt) return bacl_rtn_fatal; if (jcr->acl_ctx->content_length > 0) { - if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_NFS4_ACL) == bacl_rtn_fatal) + if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_NFS4) == bacl_rtn_fatal) return bacl_rtn_fatal; } break; @@ -1077,7 +1077,7 @@ static bacl_rtn_code freebsd_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt) return bacl_rtn_fatal; if (jcr->acl_ctx->content_length > 0) { - if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_ACCESS_ACL) == bacl_rtn_fatal) + if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_ACCESS) == bacl_rtn_fatal) return bacl_rtn_fatal; } @@ -1088,7 +1088,7 @@ static bacl_rtn_code freebsd_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt) if (generic_get_acl_from_os(jcr, BACL_TYPE_DEFAULT) == bacl_rtn_fatal) return bacl_rtn_fatal; if (jcr->acl_ctx->content_length > 0) { - if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_DEFAULT_ACL) == bacl_rtn_fatal) + if (send_acl_stream(jcr, STREAM_ACL_FREEBSD_DEFAULT) == bacl_rtn_fatal) return bacl_rtn_fatal; } } @@ -1113,13 +1113,13 @@ static bacl_rtn_code freebsd_restore_acl_streams(JCR *jcr, */ switch (stream) { case STREAM_UNIX_ACCESS_ACL: - case STREAM_ACL_FREEBSD_ACCESS_ACL: + case STREAM_ACL_FREEBSD_ACCESS: case STREAM_UNIX_DEFAULT_ACL: - case STREAM_ACL_FREEBSD_DEFAULT_ACL: + case STREAM_ACL_FREEBSD_DEFAULT: acl_enabled = pathconf(jcr->last_fname, _PC_ACL_EXTENDED); acl_type_name = "POSIX"; break; - case STREAM_ACL_FREEBSD_NFS4_ACL: + case STREAM_ACL_FREEBSD_NFS4: #if defined(_PC_ACL_NFS4) acl_enabled = pathconf(jcr->last_fname, _PC_ACL_NFS4); #endif @@ -1159,12 +1159,12 @@ static bacl_rtn_code freebsd_restore_acl_streams(JCR *jcr, */ switch (stream) { case STREAM_UNIX_ACCESS_ACL: - case STREAM_ACL_FREEBSD_ACCESS_ACL: + case STREAM_ACL_FREEBSD_ACCESS: return generic_set_acl_on_os(jcr, BACL_TYPE_ACCESS, content, content_length); case STREAM_UNIX_DEFAULT_ACL: - case STREAM_ACL_FREEBSD_DEFAULT_ACL: + case STREAM_ACL_FREEBSD_DEFAULT: return generic_set_acl_on_os(jcr, BACL_TYPE_DEFAULT, content, content_length); - case STREAM_ACL_FREEBSD_NFS4_ACL: + case STREAM_ACL_FREEBSD_NFS4: return generic_set_acl_on_os(jcr, BACL_TYPE_NFS4, content, content_length); default: break; @@ -1273,11 +1273,11 @@ static bacl_rtn_code (*os_restore_acl_streams) * Define the supported ACL streams for this OS */ static int os_access_acl_streams[1] = { - STREAM_ACL_TRU64_ACCESS_ACL + STREAM_ACL_TRU64_ACCESS }; static int os_default_acl_streams[2] = { - STREAM_ACL_TRU64_DEFAULT_ACL, - STREAM_ACL_TRU64_DEFAULT_DIR_ACL + STREAM_ACL_TRU64_DEFAULT, + STREAM_ACL_TRU64_DEFAULT_DIR }; static bacl_rtn_code tru64_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt) @@ -1564,8 +1564,8 @@ char *acl_strerror(int); * Define the supported ACL streams for this OS */ static int os_access_acl_streams[2] = { - STREAM_ACL_SOLARIS_ACLENT, - STREAM_ACL_SOLARIS_ACE + STREAM_ACL_SOLARIS_POSIX, + STREAM_ACL_SOLARIS_NFS4 }; static int os_default_acl_streams[1] = { -1 @@ -1653,10 +1653,10 @@ static bacl_rtn_code solaris_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt) switch (acl_type(aclp)) { case ACLENT_T: - stream_status = send_acl_stream(jcr, STREAM_ACL_SOLARIS_ACLENT); + stream_status = send_acl_stream(jcr, STREAM_ACL_SOLARIS_POSIX); break; case ACE_T: - stream_status = send_acl_stream(jcr, STREAM_ACL_SOLARIS_ACE); + stream_status = send_acl_stream(jcr, STREAM_ACL_SOLARIS_NFS4); break; default: break; @@ -1673,8 +1673,8 @@ static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *con acl_t *aclp; int acl_enabled, error; - if (stream != STREAM_UNIX_ACCESS_ACL || stream != STREAM_ACL_SOLARIS_ACLENT || - stream != STREAM_ACL_SOLARIS_ACE) { + if (stream != STREAM_UNIX_ACCESS_ACL || stream != STREAM_ACL_SOLARIS_POSIX || + stream != STREAM_ACL_SOLARIS_NFS4) { return bacl_rtn_error; } @@ -1709,7 +1709,7 @@ static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *con * On a filesystem with ACL support make sure this particular ACL type can be restored. */ switch (stream) { - case STREAM_ACL_SOLARIS_ACLENT: + case STREAM_ACL_SOLARIS_POSIX: /* * An aclent can be restored on filesystems with _ACL_ACLENT_ENABLED or _ACL_ACE_ENABLED support. */ @@ -1720,7 +1720,7 @@ static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *con return bacl_rtn_error; } break; - case STREAM_ACL_SOLARIS_ACE: + case STREAM_ACL_SOLARIS_NFS4: /* * An ace can only be restored on a filesystem with _ACL_ACE_ENABLED support. */ @@ -1750,7 +1750,7 @@ static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *con * Validate that the conversion gave us the correct acl type. */ switch (stream) { - case STREAM_ACL_SOLARIS_ACLENT: + case STREAM_ACL_SOLARIS_POSIX: if (acl_type(aclp) != ACLENT_T) { Mmsg1(jcr->errmsg, _("wrong encoding of acl type in acl stream on file \"%s\"\n"), @@ -1758,7 +1758,7 @@ static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *con return bacl_rtn_error; } break; - case STREAM_ACL_SOLARIS_ACE: + case STREAM_ACL_SOLARIS_NFS4: if (acl_type(aclp) != ACE_T) { Mmsg1(jcr->errmsg, _("wrong encoding of acl type in acl stream on file \"%s\"\n"), @@ -1802,7 +1802,7 @@ static bacl_rtn_code solaris_restore_acl_streams(JCR *jcr, int stream, char *con * Define the supported ACL streams for this OS */ static int os_access_acl_streams[1] = { - STREAM_ACL_SOLARIS_ACLENT + STREAM_ACL_SOLARIS_POSIX }; static int os_default_acl_streams[1] = { -1 @@ -1861,7 +1861,7 @@ static bacl_rtn_code solaris_backup_acl_streams(JCR *jcr, FF_PKT *ff_pkt) pm_strcpy(jcr->acl_ctx->content, acl_text); actuallyfree(acl_text); free(acls); - return send_acl_stream(jcr, STREAM_ACL_SOLARIS_ACLENT); + return send_acl_stream(jcr, STREAM_ACL_SOLARIS_POSIX); } berrno be; diff --git a/bacula/src/findlib/fstype.c b/bacula/src/findlib/fstype.c index 3ed575d088..5e92fb8ea5 100644 --- a/bacula/src/findlib/fstype.c +++ b/bacula/src/findlib/fstype.c @@ -31,7 +31,9 @@ #include "find.h" #include #include - +#ifdef HAVE_SUN_OS + #include +#endif #else /* Set up for testing a stand alone program */ #include @@ -373,7 +375,7 @@ bool read_mtab(mtab_handler_t *mtab_handler, void *user_ctx) mtab_handler(user_ctx, &st, mnt.mnt_fstype, mnt.mnt_mountp, mnt.mnt_mntopts, mnt.mnt_special); } - fclose(fp); + fclose(mntfp); V(mutex); #endif -- 2.39.5