Skip to contentSkip to conversation

fio netbsd support

PATCH YAMAMOTO Takashi 2 participants 6 messages May 12, 2010 – May 21, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

hi,

the attached patch is for preliminary support for netbsd.

YAMAMOTO Takashi

Makefile.NetBSD new file +75 -0
new file mode 100644
index 0000000..2fb089e
@@ -0,0 +1,75 @@
+CC	= gcc
+DEBUGFLAGS = -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
+OPTFLAGS= -O2 -g $(EXTFLAGS)
+CFLAGS	= -Wwrite-strings -Wall -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(OPTFLAGS) $(DEBUGFLAGS) -rdynamic
+PROGS	= fio
+SCRIPTS = fio_generate_plots
+OBJS = gettime.o fio.o ioengines.o init.o stat.o log.o time.o filesetup.o \
+	eta.o verify.o memory.o io_u.o parse.o mutex.o options.o \
+	rbtree.o smalloc.o filehash.o helpers.o profile.o debug.o
+
+OBJS += crc/crc7.o
+OBJS += crc/crc16.o
+OBJS += crc/crc32.o
+OBJS += crc/crc32c.o
+OBJS += crc/crc32c-intel.o
+OBJS += crc/crc64.o
+OBJS += crc/sha1.o
+OBJS += crc/sha256.o
+OBJS += crc/sha512.o
+OBJS += crc/md5.o
+
+OBJS += engines/cpu.o
+OBJS += engines/mmap.o
+OBJS += engines/posixaio.o
+OBJS += engines/sync.o
+OBJS += engines/null.o
+OBJS += engines/net.o
+
+SOURCE = eta.c filehash.c filesetup.c fio.c gettime.c init.c ioengines.c \
+	 io_u.c log.c memory.c mutex.c options.c parse.c rbtree.c smalloc.c \
+	 stat.c parse.c crc/*.c engines/cpu.c engines/mmap.c \
+	 engines/posixaio.c engines/sync.c engines/null.c engines/net.c \
+	 *.h arch/*.h compiler/*.h crc/*.h lib/*.h \
+	 os/indirect.h os/kcompat.h os/os-freebsd.h os/os.h os/syslet.h
+
+ifneq ($(findstring $(MAKEFLAGS),s),s)
+ifndef V
+	QUIET_CC	= @echo '   ' CC $@;
+	QUIET_DEP	= @echo '   ' DEP $@;
+endif
+endif
+
+INSTALL = install
+prefix = /usr/local
+bindir = $(prefix)/bin
+mandir = $(prefix)/man
+
+%.o: %.c
+	$(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
+fio: $(OBJS)
+	$(QUIET_CC)$(CC) $(CFLAGS) -o $@ $(filter %.o,$^) $(EXTLIBS) -lpthread -lm -lrt
+
+depend:
+	$(QUIET_DEP)$(CC) -MM $(ALL_CFLAGS) $(SOURCE) 1> .depend
+
+$(PROGS): depend
+
+all: depend $(PROGS) $(SCRIPTS)
+
+clean:
+	-rm -f .depend cscope.out $(OBJS) $(PROGS) core.* core
+
+cscope:
+	@cscope -b
+
+install: $(PROGS) $(SCRIPTS)
+	$(INSTALL) -m755 -d $(DESTDIR)$(bindir)
+	$(INSTALL) $(PROGS) $(SCRIPTS) $(DESTDIR)$(bindir)
+	$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
+	$(INSTALL) -m 644 fio.1 $(DESTDIR)$(mandir)/man1
+	$(INSTALL) -m 644 fio_generate_plots.1 $(DESTDIR)$(mandir)/man1
+
+ifneq ($(wildcard .depend),)
+include .depend
+endif
mutex.c +4 -0
index e148430..abe073f 100644
@@ -65,14 +65,18 @@ struct fio_mutex *fio_mutex_init(int value)
 		log_err("pthread_mutexattr_init: %s\n", strerror(ret));
 		goto err;
 	}
+#ifdef FIO_HAVE_PSHARED_MUTEX
 	ret = pthread_mutexattr_setpshared(&attr, mflag);
 	if (ret) {
 		log_err("pthread_mutexattr_setpshared: %s\n", strerror(ret));
 		goto err;
 	}
+#endif
 
 	pthread_condattr_init(&cond);
+#ifdef FIO_HAVE_PSHARED_MUTEX
 	pthread_condattr_setpshared(&cond, mflag);
+#endif
 	pthread_cond_init(&mutex->cond, &cond);
 
 	ret = pthread_mutex_init(&mutex->lock, &attr);
os/os-freebsd.h +0 -2
index 8d965aa..d1313e8 100644
@@ -11,8 +11,6 @@
 
 #define OS_MAP_ANON		MAP_ANON
 
-typedef unsigned long os_cpu_mask_t;
-
 static inline int blockdev_invalidate_cache(int fd)
 {
 	return EINVAL;
os/os-mac.h +0 -1
index be25458..1b786f8 100644
@@ -18,7 +18,6 @@
 
 #define OS_MAP_ANON		MAP_ANON
 
-typedef unsigned long os_cpu_mask_t;
 typedef unsigned int clockid_t;
 typedef off_t off64_t;
 
os/os-netbsd.h new file +50 -0

50 lines not on this page · raw message

os/os.h +3 -0
index d128f02..b7fce80 100644
@@ -8,6 +8,8 @@
 #include "os-linux.h"
 #elif defined(__FreeBSD__)
 #include "os-freebsd.h"
+#elif defined(__NetBSD__)
+#include "os-netbsd.h"
 #elif defined(__sun__)
 #include "os-solaris.h"
 #elif defined(__APPLE__)
@@ -48,6 +50,7 @@
 #define fio_getaffinity(pid, mask)	do { } while (0)
 #define fio_cpu_clear(mask, cpu)	do { } while (0)
 #define fio_cpuset_exit(mask)		(-1)
+typedef unsigned long os_cpu_mask_t;
 #endif
 
 #ifndef FIO_HAVE_IOPRIO
#1 lore raw
Quoted 3 lines · YAMAMOTO Takashi

hi,

the attached patch is for preliminary support for netbsd.

Thanks, looks good. Applied. The rb bit is a bit icky, but we can fix that up later.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 10 lines · YAMAMOTO Takashi
Quoted 3 lines

hi,

the attached patch is for preliminary support for netbsd.

Thanks, looks good. Applied. The rb bit is a bit icky, but we can fix that up later.

Signature · 1 line
Jens Axboe

thanks.

it seems that the following small change is necessary to catch up with the recent changes.

YAMAMOTO Takashi

Makefile.NetBSD +3 -0
index 2fb089e..c223ab2 100644
@@ -8,6 +8,9 @@ OBJS = gettime.o fio.o ioengines.o init.o stat.o log.o time.o filesetup.o \
 	eta.o verify.o memory.o io_u.o parse.o mutex.o options.o \
 	rbtree.o smalloc.o filehash.o helpers.o profile.o debug.o
 
+OBJS += lib/rand.o
+OBJS += lib/flist_sort.o
+
 OBJS += crc/crc7.o
 OBJS += crc/crc16.o
 OBJS += crc/crc32.o
#3 lore raw
Quoted 8 lines · YAMAMOTO Takashi
Quoted 8 lines · YAMAMOTO Takashi
Quoted 3 lines

hi,

the attached patch is for preliminary support for netbsd.

Thanks, looks good. Applied. The rb bit is a bit icky, but we can fix that up later.

Quoted 7 lines
Quoted 2 lines
Signature · 1 line
Jens Axboe

thanks.

it seems that the following small change is necessary to catch up with the recent changes.

Indeed, thanks. I should have noticed that. I have committed it.

Signature · 1 line
Jens Axboe
#4 lore raw

hi,

Quoted 12 lines · YAMAMOTO Takashi
Quoted 11 lines
Quoted 10 lines · YAMAMOTO Takashi
Quoted 3 lines

hi,

the attached patch is for preliminary support for netbsd.

Thanks, looks good. Applied. The rb bit is a bit icky, but we can fix that up later.

Signature · 1 line
Jens Axboe
Quoted 6 lines
Quoted 4 lines

thanks.

it seems that the following small change is necessary to catch up with the recent changes.

Indeed, thanks. I should have noticed that. I have committed it.

and it seems that you forgot to add os-netbsd.h.

YAMAMOTO Takashi

Quoted 3 lines
Signature · 2 lines
-- 
Jens Axboe
#5 lore raw
Quoted 14 lines · YAMAMOTO Takashi

hi,

Quoted 12 lines · YAMAMOTO Takashi
Quoted 11 lines
Quoted 10 lines · YAMAMOTO Takashi
Quoted 3 lines

hi,

the attached patch is for preliminary support for netbsd.

Thanks, looks good. Applied. The rb bit is a bit icky, but we can fix that up later.

Signature · 1 line
Jens Axboe
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

thanks.

it seems that the following small change is necessary to catch up with the recent changes.

Indeed, thanks. I should have noticed that. I have committed it.

and it seems that you forgot to add os-netbsd.h.

Seems so indeed, should be there now :-)

Signature · 1 line
Jens Axboe