<commit_before>#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <fiob.h>

#include <sys/types.h>
#include <stdbool.h>
#include <sys/uio.h>

#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <say.h>
#include <assert.h>
#include <unistd.h>
#include <tarantool/config.h>

/* Use special implemention if we have O_DIRECT and FOPENCOOKIE or FUNOPEN */
#if defined(O_DIRECT) && (defined(HAVE_FUNOPEN) || defined(HAVE_FOPENCOOKIE))
#define FIOB_DIRECT
#endif

#if defined(FIOB_DIRECT)
enum {
	FIOB_ALIGN = 4096,
	FIOB_BSIZE = FIOB_ALIGN * 256
};

struct fiob {
	int fd;
	size_t bsize;
	size_t bfill;
	void *buf;
	char *path;
#ifdef HAVE_FUNOPEN
	struct {
		int     (*read)(void *cookie, char *buf, int len);
		int     (*write)(void *cookie, const char *buf, int len);
		fpos_t  (*seek)(void *cookie, fpos_t pos, int whence);
		int     (*close)(void *cookie);
	} io;
#else
	cookie_io_functions_t io;
#endif
};

static inline off_t
fiob_ceil(off_t off)
{
	/* ceil to FIOB_ALIGN */
	return (off + FIOB_ALIGN - 1) & ~(off_t) (FIOB_ALIGN - 1);
}

#ifdef HAVE_FUNOPEN
static int
fiob_read(void *cookie, char *buf, int len)
#else
static ssize_t
fiob_read(void *cookie, char *buf, size_t count)
#endif
{<commit_msg>Fix undeclaration count with funopen<commit_after>#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <fiob.h>

#include <sys/types.h>
#include <stdbool.h>
#include <sys/uio.h>

#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <say.h>
#include <assert.h>
#include <unistd.h>
#include <tarantool/config.h>

/* Use special implemention if we have O_DIRECT and FOPENCOOKIE or FUNOPEN */
#if defined(O_DIRECT) && (defined(HAVE_FUNOPEN) || defined(HAVE_FOPENCOOKIE))
#define FIOB_DIRECT
#endif

#if defined(FIOB_DIRECT)
enum {
	FIOB_ALIGN = 4096,
	FIOB_BSIZE = FIOB_ALIGN * 256
};

struct fiob {
	int fd;
	size_t bsize;
	size_t bfill;
	void *buf;
	char *path;
#ifdef HAVE_FUNOPEN
	struct {
		int     (*read)(void *cookie, char *buf, int len);
		int     (*write)(void *cookie, const char *buf, int len);
		fpos_t  (*seek)(void *cookie, fpos_t pos, int whence);
		int     (*close)(void *cookie);
	} io;
#else
	cookie_io_functions_t io;
#endif
};

static inline off_t
fiob_ceil(off_t off)
{
	/* ceil to FIOB_ALIGN */
	return (off + FIOB_ALIGN - 1) & ~(off_t) (FIOB_ALIGN - 1);
}

#ifdef HAVE_FUNOPEN
static int
fiob_read(void *cookie, char *buf, int count)
#else
static ssize_t
fiob_read(void *cookie, char *buf, size_t count)
#endif
{
{'fraction_non_alphanumeric': 0.1406799531066823, 'fraction_numerical': 0.007033997655334115, 'mean_word_length': 4.701559020044543, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1909694', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1071, 'n_words': 278}