From 3be3acc20d541981156ce7b058db57293f289b47 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Thu, 4 Jul 2019 10:36:20 +0200 Subject: Haiku patch. diff --git a/src/fstorture/cmpdir.h b/src/fstorture/cmpdir.h index c3df7a0..3b00b01 100644 --- a/src/fstorture/cmpdir.h +++ b/src/fstorture/cmpdir.h @@ -20,7 +20,9 @@ /* ------------------------------------------------------------------------- */ #include "basictypes.h" +#ifndef __HAIKU__ #include +#endif #define CMPDIR_MAX_FILES 10 diff --git a/src/fstorture/cmpfile.h b/src/fstorture/cmpfile.h index 8b03014..57dec92 100644 --- a/src/fstorture/cmpfile.h +++ b/src/fstorture/cmpfile.h @@ -31,7 +31,9 @@ value is 1 on success, 0 on failure. /* ------------------------------------------------------------------------- */ #include "basictypes.h" +#ifndef __HAIKU__ #include +#endif #define THREADS 5 diff --git a/src/fstorture/fstorture.c b/src/fstorture/fstorture.c index e291bcb..2af9f49 100644 --- a/src/fstorture/fstorture.c +++ b/src/fstorture/fstorture.c @@ -47,7 +47,11 @@ static btbool WinVolume = 0; static btbool noStats = 0; static btbool noPerms = 0; static btbool softlinks = 1; +#ifdef __HAIKU__ +static btbool hardlinks = 0; +#else static btbool hardlinks = 1; +#endif static btbool sleepy = 0; static btbool acl = 0; static btbool nocache = 0; @@ -739,7 +743,9 @@ int main(int argc, char **argv) { int n, i; struct stat sbuf; +#ifndef __HAIKU__ struct statfs st; +#endif int dirs = 0; if(argc < 4) diff --git a/src/fstorture/stdheaders.h b/src/fstorture/stdheaders.h index 94d84d5..14f3eb0 100644 --- a/src/fstorture/stdheaders.h +++ b/src/fstorture/stdheaders.h @@ -33,11 +33,21 @@ This header includes all system headers that are needed. #include #include #include +#ifndef __HAIKU__ #include +#endif #include +#ifndef __HAIKU__ #include +#else +#include +#endif #include #ifdef NeXT # include #endif + +#ifdef __HAIKU__ +# include +#endif diff --git a/src/fsx/Makefile b/src/fsx/Makefile index e1ee651..7257a27 100644 --- a/src/fsx/Makefile +++ b/src/fsx/Makefile @@ -1,7 +1,128 @@ -# $FreeBSD$ +## Haiku Generic Makefile v2.6 ## -PROG= fsx +## Fill in this file to specify the project being created, and the referenced +## Makefile-Engine will do all of the hard work for you. This handles any +## architecture of Haiku. -MAN= +# The name of the binary. +NAME = fsx -.include +# The type of binary, must be one of: +# APP: Application +# SHARED: Shared library or add-on +# STATIC: Static library archive +# DRIVER: Kernel driver +TYPE = APP + +# If you plan to use localization, specify the application's MIME signature. +APP_MIME_SIG = + +# The following lines tell Pe and Eddie where the SRCS, RDEFS, and RSRCS are +# so that Pe and Eddie can fill them in for you. +#%{ +# @src->@ + +# Specify the source files to use. Full paths or paths relative to the +# Makefile can be included. All files, regardless of directory, will have +# their object files created in the common object directory. Note that this +# means this Makefile will not work correctly if two source files with the +# same name (source.c or source.cpp) are included from different directories. +# Also note that spaces in folder names do not work well with this Makefile. +SRCS = fsx.c + +# Specify the resource definition files to use. Full or relative paths can be +# used. +RDEFS = + +# Specify the resource files to use. Full or relative paths can be used. +# Both RDEFS and RSRCS can be utilized in the same Makefile. +RSRCS = + +# End Pe/Eddie support. +# @<-src@ +#%} + +# Specify libraries to link against. +# There are two acceptable forms of library specifications: +# - if your library follows the naming pattern of libXXX.so or libXXX.a, +# you can simply specify XXX for the library. (e.g. the entry for +# "libtracker.so" would be "tracker") +# +# - for GCC-independent linking of standard C++ libraries, you can use +# $(STDCPPLIBS) instead of the raw "stdc++[.r4] [supc++]" library names. +# +# - if your library does not follow the standard library naming scheme, +# you need to specify the path to the library and it's name. +# (e.g. for mylib.a, specify "mylib.a" or "path/mylib.a") +LIBS = + +# Specify additional paths to directories following the standard libXXX.so +# or libXXX.a naming scheme. You can specify full paths or paths relative +# to the Makefile. The paths included are not parsed recursively, so +# include all of the paths where libraries must be found. Directories where +# source files were specified are automatically included. +LIBPATHS = + +# Additional paths to look for system headers. These use the form +# "#include
". Directories that contain the files in SRCS are +# NOT auto-included here. +SYSTEM_INCLUDE_PATHS = + +# Additional paths paths to look for local headers. These use the form +# #include "header". Directories that contain the files in SRCS are +# automatically included. +LOCAL_INCLUDE_PATHS = + +# Specify the level of optimization that you want. Specify either NONE (O0), +# SOME (O1), FULL (O2), or leave blank (for the default optimization level). +OPTIMIZE := + +# Specify the codes for languages you are going to support in this +# application. The default "en" one must be provided too. "make catkeys" +# will recreate only the "locales/en.catkeys" file. Use it as a template +# for creating catkeys for other languages. All localization files must be +# placed in the "locales" subdirectory. +LOCALES = + +# Specify all the preprocessor symbols to be defined. The symbols will not +# have their values set automatically; you must supply the value (if any) to +# use. For example, setting DEFINES to "DEBUG=1" will cause the compiler +# option "-DDEBUG=1" to be used. Setting DEFINES to "DEBUG" would pass +# "-DDEBUG" on the compiler's command line. +DEFINES = + +# Specify the warning level. Either NONE (suppress all warnings), +# ALL (enable all warnings), or leave blank (enable default warnings). +WARNINGS = + +# With image symbols, stack crawls in the debugger are meaningful. +# If set to "TRUE", symbols will be created. +SYMBOLS := + +# Includes debug information, which allows the binary to be debugged easily. +# If set to "TRUE", debug info will be created. +DEBUGGER := + +# Specify any additional compiler flags to be used. +COMPILER_FLAGS = + +# Specify any additional linker flags to be used. +LINKER_FLAGS = + +# Specify the version of this binary. Example: +# -app 3 4 0 d 0 -short 340 -long "340 "`echo -n -e '\302\251'`"1999 GNU GPL" +# This may also be specified in a resource. +APP_VERSION := + +# (Only used when "TYPE" is "DRIVER"). Specify the desired driver install +# location in the /dev hierarchy. Example: +# DRIVER_PATH = video/usb +# will instruct the "driverinstall" rule to place a symlink to your driver's +# binary in ~/add-ons/kernel/drivers/dev/video/usb, so that your driver will +# appear at /dev/video/usb when loaded. The default is "misc". +DRIVER_PATH = + +## Include the Makefile-Engine +DEVEL_DIRECTORY := \ + $(shell findpaths -r "makefile_engine" B_FIND_PATH_DEVELOP_DIRECTORY) +include $(DEVEL_DIRECTORY)/etc/makefile-engine diff --git a/src/fsx/fsx.c b/src/fsx/fsx.c index 00ad178..dfc5d51 100644 --- a/src/fsx/fsx.c +++ b/src/fsx/fsx.c @@ -50,7 +50,9 @@ #endif #include #include +#ifndef __HAIKU__ #include +#endif #include #ifndef MAP_FILE # define MAP_FILE 0 @@ -103,9 +105,11 @@ char *temp_buf; /* a pointer to the current data */ char *fname; /* name of our test file */ int fd; /* fd for our test file */ int ea = 0; /* -e flag */ +#ifndef __HAIKU__ int ea_lastwrite = 0; /* Size of the last EA Write */ char eaname[MAXPATHLEN]; /* Name of the EA key */ int eanamespace = EXTATTR_NAMESPACE_USER; +#endif off_t file_size = 0; off_t biggest = 0; @@ -462,8 +466,10 @@ doread(unsigned offset, unsigned size) off_t ret; unsigned iret; +#ifndef __HAIKU__ if (ea) size = ea_lastwrite; +#endif offset -= offset % readbdy; if (size == 0 && !ea) { @@ -502,7 +508,9 @@ doread(unsigned offset, unsigned size) } iret = read(fd, temp_buf, size); } else { +#ifndef __HAIKU__ iret = extattr_get_fd(fd, eanamespace, eaname, temp_buf, size); +#endif } if (iret != size) { @@ -665,6 +673,7 @@ dowrite(unsigned offset, unsigned size) } iret = write(fd, good_buf + offset, size); } else { +#ifndef __HAIKU__ if (random() % 100 == 0) { iret = extattr_delete_fd(fd, eanamespace, eaname); if (iret != 0) { @@ -680,6 +689,7 @@ dowrite(unsigned offset, unsigned size) } iret = extattr_set_fd(fd, eanamespace, eaname, good_buf, size); ea_lastwrite = size; +#endif } if (iret != size) { @@ -1043,7 +1053,9 @@ main(int argc, char **argv) char goodfile[1024]; char logfile[1024]; +#ifndef __HAIKU__ sprintf(eaname, "%d_%s", getpid(), argv[0]); +#endif goodfile[0] = 0; logfile[0] = 0; @@ -1078,6 +1090,7 @@ main(int argc, char **argv) debug = 1; break; case 'e': +#ifndef __HAIKU__ ea = 1; mapped_writes = 0; mapped_reads = 0; @@ -1086,6 +1099,10 @@ main(int argc, char **argv) maxoplen = getnum(optarg, &endp); maxfilelen = maxoplen; printf("Writing into extended attribute maxoplen = %d\n", maxoplen); +#else + printf("Extended attribute disabled\n"); + usage(); +#endif break; case 'i': invlprob = getnum(optarg, &endp); @@ -1223,8 +1240,10 @@ main(int argc, char **argv) exit(91); } +#ifndef __HAIKU__ if(ea) extattr_set_fd(fd, 1, eaname, NULL, 0); +#endif strncat(goodfile, fname, 256); strcat (goodfile, ".fsxgood"); -- 2.21.0