xref: /netbsd-src/sys/sys/tape.h (revision 908a91f5db6f9ecabee7aad862f3ec0225dd669d)
1 /*	$NetBSD: tape.h,v 1.4 2016/01/22 23:44:33 dholland Exp $	*/
2 
3 /*-
4  * Copyright (c) 2005 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Brett Lymn
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Neither the name of The NetBSD Foundation nor the names of its
16  *    contributors may be used to endorse or promote products derived
17  *    from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 #ifndef _SYS_TAPE_H_
33 #define _SYS_TAPE_H_
34 
35 #include <sys/queue.h>
36 #include <sys/time.h>
37 
38 #define	TAPENAMELEN	16
39 
40 /* The following structure is 64-bit alignment safe */
41 struct tape_sysctl {
42 	char		name[TAPENAMELEN];
43 	int32_t		busy;
44 	int32_t		pad;
45 	uint64_t	xfer;
46 	uint64_t	bytes;
47 	uint32_t	attachtime_sec;
48 	uint32_t	attachtime_usec;
49 	uint32_t	timestamp_sec;
50 	uint32_t	timestamp_usec;
51 	uint32_t	time_sec;
52 	uint32_t	time_usec;
53 	uint64_t	rxfer;
54 	uint64_t	rbytes;
55 	uint64_t	wxfer;
56 	uint64_t	wbytes;
57 };
58 
59 /*
60  * Statistics for the tape device - in a separate structure so userland can
61  * see them.
62  */
63 
64 struct tape {
65 	char		*name; 		/* name of drive */
66 	int		busy;		/* drive is busy */
67 	uint64_t       rxfer;		/* total number of read transfers */
68 	uint64_t       wxfer;		/* total number of write transfers */
69 	uint64_t       rbytes;		/* total bytes read */
70 	uint64_t       wbytes;		/* total bytes written */
71 	struct timeval  attachtime;	/* time tape was attached */
72 	struct timeval  timestamp;	/* timestamp of last unbusy */
73 	struct timeval  time;		/* total time spent busy */
74 
75 	TAILQ_ENTRY(tape) link;
76 };
77 
78 /* Head of the tape stats list, define here so userland can get at it */
79 TAILQ_HEAD(tapelist_head, tape);	/* the tapelist is a TAILQ */
80 
81 #endif
82 
83