Skip to content

Commit

Permalink
osd-target: FreeBSD compatibility
Browse files Browse the repository at this point in the history
* osd-target/Makefile: sqlite3 is expected at /usr/local/{include,lib}/
* osd-target/Makefile: Add tgt/usr/bsd first in include path to override
                       some system headers and missing Linux headers.

* osd-target/osd.c: Include linux/fs.h that has some Linux specific
                    definitions used by osd-target code.

* osd-target/osd.c: under BSD define sync_file_range().
                    (os.h/c can not be used because it causes link
                     problems, not worth it for now)

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
  • Loading branch information
Boaz Harrosh committed Mar 2, 2009
1 parent 79563ae commit 868be91
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
15 changes: 11 additions & 4 deletions osd-target/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DEP := .depend
OBJ := $(SRC:.c=.o)
TESTDIR := ./tests/
UTILDIR := ../osd-util/
STGTDIR := ../stgt/
STGTDIR := ../tgt/
INITDIR := ../osd-initiator/
OSDTARGETLIB := libosdtgt.a

Expand All @@ -19,7 +19,14 @@ UTILLIB := ../osd-util/libosdutil.a

IB_HW_OF_LIBS= -L/usr/local/openib-iser/lib

LIBS := -lm -lcrypto -lsqlite3 -laio -lavahi-core -lavahi-common \
UNAME= $(shell uname)
ifeq (FreeBSD,$(UNAME))
LIBS += -L/usr/local/lib/
CFLAGS += -I/usr/local/include -I$(STGTDIR)/usr/bsd -I$(STGTDIR)/usr
CFLAGS += -D__MAKE_BSD_BUILD__
endif

LIBS += -lm -lcrypto -lsqlite3 -laio -lavahi-core -lavahi-common \
$(IB_HW_OF_LIBS) -libverbs -lrdmacm

-include ../Makedefs
Expand All @@ -32,7 +39,7 @@ COPTS += -fPIC -foptimize-sibling-calls -D_GNU_SOURCE
CWARN := -Wall -W -Wpointer-arith -Wwrite-strings -Wcast-align -Wcast-qual \
-Wbad-function-cast -Wundef -Wmissing-prototypes \
-Wmissing-declarations -Wnested-externs
CFLAGS := $(COPTS) $(CWARN) -I.. -Wno-unused -I../osd-util
CFLAGS += $(COPTS) $(CWARN) -I.. -Wno-unused -I../osd-util

ifeq ($(PVFS_OSD_INTEGRATED),1)
CFLAGS += -DPVFS_OSD_INTEGRATED
Expand Down Expand Up @@ -69,7 +76,7 @@ $(STGTLIB): STGT
$(UTILLIB): UTIL
make -C $(UTILDIR)

%.o: %.c
%.o: %.c Makefile
$(CC) $(CFLAGS) -c $< -o $@

osd-schema.c: osd.schema
Expand Down
10 changes: 10 additions & 0 deletions osd-target/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <dirent.h>
#include <assert.h>

#include <linux/fs.h>

#include "osd.h"
#include "osd-util/osd-defs.h"
#include "target-sense.h"
Expand All @@ -39,6 +41,14 @@
#include "osd-util/osd-sense.h"
#include "list-entry.h"

#ifdef __MAKE_BSD_BUILD__
static int os_sync_file_range(int fd, __off64_t offset, __off64_t bytes,
unsigned int flags)
{
return fsync(fd);
}
#endif

struct incits_page_id {
const char root_dir_page[40];
const char root_info_page[40];
Expand Down

0 comments on commit 868be91

Please sign in to comment.