Home | History | Annotate | Line # | Download | only in usb
utoppy.h revision 1.1
      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  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 #ifndef _DEV_USB_UTOPPY_H_
     40 #define _DEV_USB_UTOPPY_H_
     41 
     42 #include <sys/ioccom.h>
     43 
     44 #define	UTOPPY_MAX_FILENAME_LEN	95
     45 #define	UTOPPY_MAX_PATHNAME_LEN	((UTOPPY_MAX_FILENAME_LEN + 1) * 6)
     46 
     47 /* Set/clear turbo mode */
     48 #define	UTOPPYIOTURBO		_IOW('t', 1, int)
     49 
     50 /* Cancel previous op */
     51 #define	UTOPPYIOCANCEL		_IO('t', 2)
     52 
     53 /* Reboot the toppy */
     54 #define	UTOPPYIOREBOOT		_IO('t', 3)
     55 
     56 /* Get status of Toppy's hard disk drive */
     57 #define	UTOPPYIOSTATS		_IOR('t', 4, struct utoppy_stats)
     58 struct utoppy_stats {
     59 	uint64_t us_hdd_size;
     60 	uint64_t us_hdd_free;
     61 };
     62 
     63 /* Rename a file/directory */
     64 #define	UTOPPYIORENAME		_IOW('t', 5, struct utoppy_rename)
     65 struct utoppy_rename {
     66 	char *ur_old_path;
     67 	char *ur_new_path;
     68 };
     69 
     70 /* Create a directory */
     71 #define	UTOPPYIOMKDIR		_IOW('t', 6, char *)
     72 
     73 /* Delete a file/directory */
     74 #define	UTOPPYIODELETE		_IOW('t', 7, char *)
     75 
     76 /* Initiate reading of the contents of a directory */
     77 #define	UTOPPYIOREADDIR		_IOW('t', 8, char *)
     78 struct utoppy_dirent {
     79 	char ud_path[UTOPPY_MAX_FILENAME_LEN + 1];
     80 	enum {
     81 		UTOPPY_DIRENT_UNKNOWN,
     82 		UTOPPY_DIRENT_DIRECTORY,
     83 		UTOPPY_DIRENT_FILE
     84 	} ud_type;
     85 	off_t ud_size;
     86 	time_t ud_mtime;
     87 	uint32_t ud_attributes;
     88 };
     89 
     90 /* Initiate reading from a specific file */
     91 #define	UTOPPYIOREADFILE	_IOW('t', 9, struct utoppy_readfile)
     92 struct utoppy_readfile {
     93 	char *ur_path;
     94 	off_t ur_offset;
     95 };
     96 
     97 /* Initiate writing to a new file */
     98 #define	UTOPPYIOWRITEFILE	_IOW('t', 10, struct utoppy_writefile)
     99 struct utoppy_writefile {
    100 	char *uw_path;
    101 	off_t uw_offset;
    102 	off_t uw_size;
    103 	time_t uw_mtime;
    104 };
    105 
    106 #endif /* _DEV_USB_UTOPPY_H_ */
    107