uio.h revision b819cea2f73f98c5662230cc9affc8cc84f77fcf
/*
* 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
* 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 2014 Garrett D'Amore <garrett@damore.org>
*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Copyright 2013 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2015, Joyent, Inc. All rights reserved.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* University Copyright- Copyright (c) 1982, 1986, 1988
* The Regents of the University of California
* All Rights Reserved
*
* University Acknowledgment- Portions of this document are derived from
* software developed by the University of California, Berkeley, and its
* contributors.
*/
#ifndef _SYS_UIO_H
#define _SYS_UIO_H
#include <sys/feature_tests.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* I/O parameter information. A uio structure describes the I/O which
* is to be performed by an operation. Typically the data movement will
* be performed by a routine such as uiomove(), which updates the uio
* structure to reflect what was done.
*/
#if defined(_XPG4_2)
typedef struct iovec {
void *iov_base;
} iovec_t;
#else
typedef struct iovec {
#if defined(_LP64)
#else
long iov_len;
#endif
} iovec_t;
#endif /* defined(_XPG4_2) */
#if defined(_SYSCALL32)
/* Kernel's view of user ILP32 iovec struct */
typedef struct iovec32 {
} iovec32_t;
#endif /* _SYSCALL32 */
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
/*
* Segment flag values.
*/
typedef struct uio {
int uio_iovcnt; /* number of iovecs */
} uio_t;
/*
* Extended uio_t uioa_t used for asynchronous uio.
*
* as there isn't a formal definition of IOV_MAX for the kernel.
*/
#define UIOA_IOV_MAX 16
typedef struct uioa_page_s { /* locked uio_iov state */
int uioa_pfncnt; /* count of pfn_t(s) in *uioa_ppp */
void **uioa_ppp; /* page_t or pfn_t arrary */
} uioa_page_t;
typedef struct uioa_s {
int uio_iovcnt; /* number of iovecs */
/*
* uioa extended members.
*/
void **uioa_lppp; /* pointer into lcur->uioa_ppp[] */
} uioa_t;
/*
* uio extensions
*
* PSARC 2009/478: Copy Reduction Interfaces
*/
typedef enum xuio_type {
} xuio_type_t;
typedef struct xuio {
/* Extended uio fields */
union {
/* Async I/O Support, intend to replace uioa_t. */
struct {
/* bytes that have been uioamove()ed */
/* pointer into lcur->uioa_ppp[] */
void **xu_a_lppp;
/* Per iov locked pages */
} xu_aio;
/*
* Copy Reduction Support -- facilate loaning / returning of
* filesystem cache buffers.
*/
struct {
int xu_zc_rw; /* read or write buffer */
void *xu_zc_priv; /* fs specific */
} xu_zc;
} xu_ext;
} xuio_t;
#if !defined(_LP64)
#else
#define uio_offset uio_loffset
#endif
#if !defined(_LP64)
#else
#define uio_limit uio_llimit
#endif
/*
* I/O direction.
*/
/*
* uio_extflg: extended flags
*
* NOTE: This flag will be used in uiomove to determine if non-temporal
* access, ie, access bypassing caches, should be used. Filesystems that
* don't initialize this field could experience suboptimal performance due to
* the random data the field contains.
*
* NOTE: This flag is also used by uioasync callers to pass an extended
* uio_t (uioa_t), to uioasync enabled consumers. Unlike above all
* consumers of a uioa_t require the uio_extflg to be initialized.
*/
/*
* Global uioasync capability shadow state.
*/
typedef struct uioasync_s {
} uioasync_t;
#endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
#if defined(_KERNEL) || defined(_FAKE_KERNEL)
extern uioasync_t uioasync;
#else /* defined(_KERNEL) */
/*
* When in the large file compilation environment,
*/
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
/* In the LP64 compilation environment, the APIs are already large file */
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#else /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* __PRAGMA_REDEFINE_EXTNAME */
#endif /* _LP64 && _LARGEFILE64_SOURCE */
/*
* preadv64 and pwritev64 should be defined when:
* - Using the transitional compilation environment, and not
* the large file compilation environment.
*/
!defined(__PRAGMA_REDEFINE_EXTNAME))
#endif /* _LARGEFILE64_SOURCE */
#endif /* defined(_KERNEL) */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_UIO_H */