1/*	$NetBSD: utoppy.h,v 1.1 2006/04/03 08:15:48 scw Exp $	*/
2
3/*-
4 * Copyright (c) 2006 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Steve C. Woodford.
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. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
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 _DEV_USB_UTOPPY_H_
33#define _DEV_USB_UTOPPY_H_
34
35#include <sys/ioccom.h>
36
37#define	UTOPPY_MAX_FILENAME_LEN	95
38#define	UTOPPY_MAX_PATHNAME_LEN	((UTOPPY_MAX_FILENAME_LEN + 1) * 6)
39
40/* Set/clear turbo mode */
41#define	UTOPPYIOTURBO		_IOW('t', 1, int)
42
43/* Cancel previous op */
44#define	UTOPPYIOCANCEL		_IO('t', 2)
45
46/* Reboot the toppy */
47#define	UTOPPYIOREBOOT		_IO('t', 3)
48
49/* Get status of Toppy's hard disk drive */
50#define	UTOPPYIOSTATS		_IOR('t', 4, struct utoppy_stats)
51struct utoppy_stats {
52	uint64_t us_hdd_size;
53	uint64_t us_hdd_free;
54};
55
56/* Rename a file/directory */
57#define	UTOPPYIORENAME		_IOW('t', 5, struct utoppy_rename)
58struct utoppy_rename {
59	char *ur_old_path;
60	char *ur_new_path;
61};
62
63/* Create a directory */
64#define	UTOPPYIOMKDIR		_IOW('t', 6, char *)
65
66/* Delete a file/directory */
67#define	UTOPPYIODELETE		_IOW('t', 7, char *)
68
69/* Initiate reading of the contents of a directory */
70#define	UTOPPYIOREADDIR		_IOW('t', 8, char *)
71struct utoppy_dirent {
72	char ud_path[UTOPPY_MAX_FILENAME_LEN + 1];
73	enum {
74		UTOPPY_DIRENT_UNKNOWN,
75		UTOPPY_DIRENT_DIRECTORY,
76		UTOPPY_DIRENT_FILE
77	} ud_type;
78	off_t ud_size;
79	time_t ud_mtime;
80	uint32_t ud_attributes;
81};
82
83/* Initiate reading from a specific file */
84#define	UTOPPYIOREADFILE	_IOW('t', 9, struct utoppy_readfile)
85struct utoppy_readfile {
86	char *ur_path;
87	off_t ur_offset;
88};
89
90/* Initiate writing to a new file */
91#define	UTOPPYIOWRITEFILE	_IOW('t', 10, struct utoppy_writefile)
92struct utoppy_writefile {
93	char *uw_path;
94	off_t uw_offset;
95	off_t uw_size;
96	time_t uw_mtime;
97};
98
99#endif /* _DEV_USB_UTOPPY_H_ */
100