Wed Jan 2 19:35:44 2013 UTC ()
Expose the DTYPE_xxx (names) defines even if _KERNEL isn't defined.
There is no other excuse for including this file in userspace.


(dsl)
diff -r1.74 -r1.75 src/sys/sys/file.h

cvs diff -r1.74 -r1.75 src/sys/sys/file.h (expand / switch to unified diff)

--- src/sys/sys/file.h 2011/04/24 18:46:24 1.74
+++ src/sys/sys/file.h 2013/01/02 19:35:43 1.75
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: file.h,v 1.74 2011/04/24 18:46:24 rmind Exp $ */ 1/* $NetBSD: file.h,v 1.75 2013/01/02 19:35:43 dsl Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -106,43 +106,47 @@ struct file { @@ -106,43 +106,47 @@ struct file {
106 void *f_data; /* descriptor data, e.g. vnode/socket */ 106 void *f_data; /* descriptor data, e.g. vnode/socket */
107 LIST_ENTRY(file) f_list; /* list of active files */ 107 LIST_ENTRY(file) f_list; /* list of active files */
108 kmutex_t f_lock; /* lock on structure */ 108 kmutex_t f_lock; /* lock on structure */
109 int f_flag; /* see fcntl.h */ 109 int f_flag; /* see fcntl.h */
110 u_int f_marker; /* traversal marker (sysctl) */ 110 u_int f_marker; /* traversal marker (sysctl) */
111 u_int f_type; /* descriptor type */ 111 u_int f_type; /* descriptor type */
112 u_int f_advice; /* access pattern hint; UVM_ADV_* */ 112 u_int f_advice; /* access pattern hint; UVM_ADV_* */
113 u_int f_count; /* reference count */ 113 u_int f_count; /* reference count */
114 u_int f_msgcount; /* references from message queue */ 114 u_int f_msgcount; /* references from message queue */
115 u_int f_unpcount; /* deferred close: see uipc_usrreq.c */ 115 u_int f_unpcount; /* deferred close: see uipc_usrreq.c */
116 SLIST_ENTRY(file) f_unplist; /* deferred close: see uipc_usrreq.c */ 116 SLIST_ENTRY(file) f_unplist; /* deferred close: see uipc_usrreq.c */
117}; 117};
118 118
 119#endif
 120
119/* 121/*
120 * Descriptor types. 122 * Descriptor types.
121 */ 123 */
122 124
123#define DTYPE_VNODE 1 /* file */ 125#define DTYPE_VNODE 1 /* file */
124#define DTYPE_SOCKET 2 /* communications endpoint */ 126#define DTYPE_SOCKET 2 /* communications endpoint */
125#define DTYPE_PIPE 3 /* pipe */ 127#define DTYPE_PIPE 3 /* pipe */
126#define DTYPE_KQUEUE 4 /* event queue */ 128#define DTYPE_KQUEUE 4 /* event queue */
127#define DTYPE_MISC 5 /* misc file descriptor type */ 129#define DTYPE_MISC 5 /* misc file descriptor type */
128#define DTYPE_CRYPTO 6 /* crypto */ 130#define DTYPE_CRYPTO 6 /* crypto */
129#define DTYPE_MQUEUE 7 /* message queue */ 131#define DTYPE_MQUEUE 7 /* message queue */
130#define DTYPE_SEM 8 /* semaphore */ 132#define DTYPE_SEM 8 /* semaphore */
131 133
132#define DTYPE_NAMES \ 134#define DTYPE_NAMES \
133 "0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue", \ 135 "0", "file", "socket", "pipe", "kqueue", "misc", "crypto", "mqueue", \
134 "semaphore" 136 "semaphore"
135 137
 138#ifdef _KERNEL
 139
136/* 140/*
137 * Flags for fo_read and fo_write and do_fileread/write/v 141 * Flags for fo_read and fo_write and do_fileread/write/v
138 */ 142 */
139#define FOF_UPDATE_OFFSET 0x0001 /* update the file offset */ 143#define FOF_UPDATE_OFFSET 0x0001 /* update the file offset */
140#define FOF_IOV_SYSSPACE 0x0100 /* iov structure in kernel memory */ 144#define FOF_IOV_SYSSPACE 0x0100 /* iov structure in kernel memory */
141 145
142LIST_HEAD(filelist, file); 146LIST_HEAD(filelist, file);
143extern struct filelist filehead; /* head of list of open files */ 147extern struct filelist filehead; /* head of list of open files */
144extern u_int maxfiles; /* kernel limit on # of open files */ 148extern u_int maxfiles; /* kernel limit on # of open files */
145 149
146extern const struct fileops vnops; /* vnode operations for files */ 150extern const struct fileops vnops; /* vnode operations for files */
147 151
148int dofileread(int, struct file *, void *, size_t, 152int dofileread(int, struct file *, void *, size_t,