| 1 | /* $OpenBSD: fileext.h,v 1.2 2005/06/17 20:40:32 espie Exp $ */ |
| 2 | /* $NetBSD: fileext.h,v 1.5 2003/07/18 21:46:41 nathanw Exp $ */ |
| 3 | |
| 4 | /* |
| 5 | * SPDX-License-Identifier: BSD-2-Clause |
| 6 | * |
| 7 | * Copyright (C)2001 Citrus Project, |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * $Citrus$ |
| 11 | */ |
| 12 | |
| 13 | /* |
| 14 | * file extension |
| 15 | */ |
| 16 | struct __lttng_ust_sfileext { |
| 17 | struct __lttng_ust_sbuf _ub; /* ungetc buffer */ |
| 18 | struct wchar_io_data _wcio; /* wide char io status */ |
| 19 | }; |
| 20 | |
| 21 | #define _EXT(fp) ((struct __lttng_ust_sfileext *)((fp)->_ext._base)) |
| 22 | #define _UB(fp) _EXT(fp)->_ub |
| 23 | |
| 24 | #define _FILEEXT_INIT(fp) \ |
| 25 | do { \ |
| 26 | _UB(fp)._base = NULL; \ |
| 27 | _UB(fp)._size = 0; \ |
| 28 | WCIO_INIT(fp); \ |
| 29 | } while (0) |
| 30 | |
| 31 | #define _FILEEXT_SETUP(f, fext) \ |
| 32 | do { \ |
| 33 | (f)->_ext._base = (unsigned char *)(fext); \ |
| 34 | _FILEEXT_INIT(f); \ |
| 35 | } while (0) |