summaryrefslogtreecommitdiffstats
path: root/xlators/features/protect
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-06-21 02:00:23 -0700
committerHarshavardhana <harsha@harshavardhana.net>2014-07-02 17:20:34 -0700
commit1b74cf992986287a510fe3b28a8ee7554e8b0992 (patch)
treea5fad911274080947f5874b4d90cc4f67b6f4473 /xlators/features/protect
parente4a3566681acbadfe0f7bd879443116885ada4eb (diff)
porting: Port for FreeBSD rebased from Mike Ma's efforts
- Provides a working Gluster Management Daemon, CLI - Provides a working GlusterFS server, GlusterNFS server - Provides a working GlusterFS client - execinfo port from FreeBSD is moved into ./contrib/libexecinfo for ease of portability on NetBSD. (FreeBSD 10 and OSX provide execinfo natively) - More portability cleanups for Darwin, FreeBSD and NetBSD - Provides a new rc script for FreeBSD Change-Id: I8dff336f97479ca5a7f9b8c6b730051c0f8ac46f BUG: 1111774 Original-Author: Mike Ma <mikemandarine@gmail.com> Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/8141 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/features/protect')
-rw-r--r--xlators/features/protect/src/Makefile.am6
-rw-r--r--xlators/features/protect/src/prot_client.c44
2 files changed, 26 insertions, 24 deletions
diff --git a/xlators/features/protect/src/Makefile.am b/xlators/features/protect/src/Makefile.am
index 968e88c457a..fdfed4b219e 100644
--- a/xlators/features/protect/src/Makefile.am
+++ b/xlators/features/protect/src/Makefile.am
@@ -14,8 +14,8 @@ prot_server_la_LDFLAGS = -module -avoid-version
prot_server_la_SOURCES = prot_server.c
prot_server_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la
-AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src
+AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
+ -I$(CONTRIBDIR)/libexecinfo
AM_CFLAGS = -Wall $(GF_CFLAGS)
-CLEANFILES =
-
+CLEANFILES =
diff --git a/xlators/features/protect/src/prot_client.c b/xlators/features/protect/src/prot_client.c
index d09715067bd..500c772bedd 100644
--- a/xlators/features/protect/src/prot_client.c
+++ b/xlators/features/protect/src/prot_client.c
@@ -15,8 +15,10 @@
#include "xlator.h"
#include "defaults.h"
-#ifndef __NetBSD__
+#ifdef HAVE_BACKTRACE
#include <execinfo.h>
+#else
+#include "execinfo_compat.h"
#endif
#define NUM_FRAMES 20
@@ -44,20 +46,20 @@ pcli_print_trace (char *name, call_frame_t *frame)
frame = frame->next;
}
- size = backtrace(frames,NUM_FRAMES);
+ size = backtrace (frames, NUM_FRAMES);
if (size <= 0) {
return;
}
- symbols = backtrace_symbols(frames,size);
+ symbols = backtrace_symbols (frames, size);
if (!symbols) {
return;
}
- gf_log(name, GF_LOG_INFO, "Processor stack:");
+ gf_log (name, GF_LOG_INFO, "Processor stack:");
for (i = 0; i < size; ++i) {
gf_log (name, GF_LOG_INFO, "%s", symbols[i]);
}
- free(symbols);
+ free (symbols);
}
int32_t
@@ -73,14 +75,14 @@ pcli_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
if (!oldloc->parent) {
goto simple_unwind;
}
- if (inode_ctx_get(oldloc->parent,this,&value) != 0) {
+ if (inode_ctx_get (oldloc->parent, this, &value) != 0) {
goto simple_unwind;
}
if (value != PROT_ACT_NONE) {
gf_log (this->name, GF_LOG_WARNING,
"got rename for protected %s", oldloc->path);
- pcli_print_trace(this->name,frame->next);
+ pcli_print_trace (this->name, frame->next);
if (value == PROT_ACT_REJECT) {
STACK_UNWIND_STRICT (rename, frame, -1, EPERM,
NULL, NULL, NULL, NULL, NULL,
@@ -181,25 +183,25 @@ simple_unwind:
int32_t
init (xlator_t *this)
{
- if (!this->children || this->children->next) {
- gf_log (this->name, GF_LOG_ERROR,
- "translator not configured with exactly one child");
- return -1;
- }
-
- if (!this->parents) {
- gf_log (this->name, GF_LOG_WARNING,
- "dangling volume. check volfile ");
- }
-
- return 0;
+ if (!this->children || this->children->next) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "translator not configured with exactly one child");
+ return -1;
+ }
+
+ if (!this->parents) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "dangling volume. check volfile ");
+ }
+
+ return 0;
}
void
fini (xlator_t *this)
{
- return;
+ return;
}
@@ -213,5 +215,5 @@ struct xlator_cbks cbks = {
};
struct volume_options options[] = {
- { .key = {NULL} },
+ { .key = {NULL} },
};