Skip to content

Commit

Permalink
Windows: add new files
Browse files Browse the repository at this point in the history
  • Loading branch information
lundman committed Jul 1, 2021
1 parent 8f622c8 commit b4b6418
Show file tree
Hide file tree
Showing 4 changed files with 181 additions and 0 deletions.
72 changes: 72 additions & 0 deletions lib/libspl/include/os/windows/aio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

/*
* Copyright (c) 2017 Jorgen Lundman <lundman@lundman.net>
*/

#ifndef _SPL_AIO_H
#define _SPL_AIO_H

#include <sys/types.h>

#define LIO_NOWAIT 0
#define LIO_WAIT 1

#define LIO_NOP 0
#define LIO_READ 0x01 /* Must match value of FREAD in sys/file.h */
#define LIO_WRITE 0x02 /* Must match value of FWRITE in sys/file.h */

typedef struct aiocb {
int aio_fildes;
volatile void *aio_buf; /* buffer location */
size_t aio_nbytes; /* length of transfer */
off_t aio_offset; /* file offset */
int aio_reqprio; /* request priority offset */
// struct sigevent aio_sigevent; /* notification type */
int aio_lio_opcode; /* listio operation */
// aio_result_t aio_resultp; /* results */
int aio_state; /* state flag for List I/O */
int aio__pad[1]; /* extension padding */
} aiocb_t;


static inline int lio_listio(int mode, struct aiocb * aiocb_list[],
int nitems, void * sevp)
{
return (-1);
}

static inline int
aio_error(const struct aiocb *aiocbp)
{
errno = EINVAL;
return (-1);
}

static inline ssize_t
aio_return(const struct aiocb *aiocbp)
{
errno = EINVAL;
return (-1);
}

#endif
77 changes: 77 additions & 0 deletions lib/libspl/include/os/windows/string.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

#ifndef _LIBSPL_WINDOWS_STRING_H
#define _LIBSPL_WINDOWS_STRING_H

#pragma message ("this we want")

#include_next <string.h>

static inline char *
strtok_r(char *s, const char *delim, char **last)
{
char *spanp, *tok;
int c, sc;

if (s == NULL && (s = *last) == NULL)
return (NULL);

/*
* Skip (span) leading delimiters (s += strspn(s, delim), sort of).
*/
cont:
c = *s++;
for (spanp = (char *)delim; (sc = *spanp++) != 0;) {
if (c == sc)
goto cont;
}

if (c == 0) { /* no non-delimiter characters */
*last = NULL;
return (NULL);
}
tok = s - 1;

/*
* Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
* Note that delim must have one NUL; we stop if we see that, too.
*/
for (;;) {
c = *s++;
spanp = (char *)delim;
do {
if ((sc = *spanp++) == c) {
if (c == 0)
s = NULL;
else
s[-1] = '\0';
*last = s;
return (tok);
}
} while (sc != 0);
}
/* NOTREACHED */
}


#endif
Empty file.
32 changes: 32 additions & 0 deletions module/os/windows/zfs/zfs_racct.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/

#include <sys/zfs_racct.h>

void
zfs_racct_read(uint64_t size, uint64_t iops)
{
}

void
zfs_racct_write(uint64_t size, uint64_t iops)
{
}

0 comments on commit b4b6418

Please sign in to comment.