FreeBSD/Linux Kernel Cross Reference
sys/device/cirbuf.h
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: cirbuf.h,v $
29 * Revision 2.6 93/01/14 17:26:37 danner
30 * Added function prototypes. Added cb_clear.
31 * [92/11/17 dbg]
32 * Added function prototypes. Added cb_clear.
33 * [92/11/17 dbg]
34 *
35 * Revision 2.5 92/05/05 10:46:18 danner
36 * Added c_hog.
37 * [92/05/04 11:31:37 af]
38 *
39 * Revision 2.4 91/05/14 15:39:43 mrt
40 * Correcting copyright
41 *
42 * Revision 2.3 91/02/05 17:08:06 mrt
43 * Changed to new Mach copyright
44 * [91/01/31 17:26:40 mrt]
45 *
46 * Revision 2.2 90/08/27 21:54:39 dbg
47 * Created.
48 * [90/07/09 dbg]
49 *
50 */
51 /*
52 * Author: David B. Golub, Carnegie Mellon University
53 * Date: 7/90
54 */
55
56 #ifndef _DEVICE_CIRBUF_H_
57 #define _DEVICE_CIRBUF_H_
58
59 /*
60 * Circular buffers for TTY
61 */
62
63 struct cirbuf {
64 char * c_start; /* start of buffer */
65 char * c_end; /* end of buffer + 1*/
66 char * c_cf; /* read pointer */
67 char * c_cl; /* write pointer */
68 short c_cc; /* current number of characters
69 (compatibility) */
70 short c_hog; /* max ever */
71 };
72
73 /*
74 * Exported routines
75 */
76 extern int putc(int, struct cirbuf *);
77 extern int getc(struct cirbuf *);
78 extern int q_to_b(struct cirbuf *, char *, int);
79 extern int b_to_q(char *, int, struct cirbuf *);
80 extern int nqdb(struct cirbuf *, int);
81 extern void ndflush(struct cirbuf *, int);
82 extern void cb_clear(struct cirbuf *);
83
84 extern void cb_alloc(struct cirbuf *, int);
85 extern void cb_free(struct cirbuf *);
86
87 #endif /* _DEVICE_CIRBUF_H_ */
Cache object: cb957af2f2c5df4e2ea0fa64bfda35a7
|