OSDN Git Service

PR other/43620
[pf3gnuchains/gcc-fork.git] / libjava / classpath / native / jni / native-lib / cpio.h
1 /* cpio.h -
2    Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module.  An independent module is a module which is not derived from
33 or based on this library.  If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so.  If you do not wish to do so, delete this
36 exception statement from your version. */
37
38 #ifndef _CLASSPATH_IO_H_INCLUDED
39 #define _CLASSPATH_IO_H_INCLUDED
40
41 #include <jni.h>
42
43 #define CPFILE_FLAG_CREATE   0x0001
44 #define CPFILE_FLAG_APPEND   0x0002
45 #define CPFILE_FLAG_TRUNCATE 0x0004
46 #define CPFILE_FLAG_SYNC     0x0008
47 #define CPFILE_FLAG_DSYNC    0x0010
48 #define CPFILE_FLAG_BINARY   0x0020
49 #define CPFILE_FLAG_READ     0x0040
50 #define CPFILE_FLAG_WRITE    0x0080
51 #define CPFILE_FLAG_EXEC     0x0100
52 #define CPFILE_FLAG_USR      0x0400
53 #define CPFILE_FLAG_OFF      0x0800
54
55 #define CPFILE_PERMISSION_NORMAL 1
56
57 #define CPFILE_FLAG_READWRITE (CPFILE_FLAG_READ|CPFILE_FLAG_WRITE)
58
59 JNIEXPORT int cpio_openFile (const char *filename, int *fd, int flags, int permissions);
60 JNIEXPORT int cpio_closeFile (int fd);
61 JNIEXPORT int cpio_availableBytes (int fd, jlong *avail);
62 JNIEXPORT int cpio_getFileSize (int fd, jlong *filesize);
63 JNIEXPORT int cpio_setFileSize (int fd, jlong filesize);
64 JNIEXPORT int cpio_getFilePosition (int fd, jlong *position);
65 JNIEXPORT int cpio_setFilePosition (int fd, jlong position);
66 JNIEXPORT int cpio_read (int fd, void *data, jint len, jint *bytes_read);
67 JNIEXPORT int cpio_write (int fd, const void *data, jint len, jint *bytes_written);
68 JNIEXPORT int cpio_fsync (int fd);
69 JNIEXPORT int cpio_truncate (int fd, jlong size);
70 JNIEXPORT int cpio_closeOnExec(int fd);
71
72 #define CPFILE_FILE 0
73 #define CPFILE_DIRECTORY 1
74
75 JNIEXPORT int cpio_setFileReadonly (const char *filename);
76 JNIEXPORT int cpio_chmod (const char *filename, int permissions);
77 JNIEXPORT int cpio_checkAccess (const char *filename, unsigned int flag);
78 JNIEXPORT int cpio_isFileExists (const char *filename);
79 JNIEXPORT int cpio_checkType (const char *filename, jint *entryType);
80 JNIEXPORT int cpio_getModificationTime (const char *filename, jlong *mtime);
81 JNIEXPORT int cpio_setModificationTime (const char *filename, jlong mtime);
82 JNIEXPORT int cpio_removeFile (const char *filename);
83 JNIEXPORT int cpio_mkdir (const char *filename);
84 JNIEXPORT int cpio_rename (const char *old_name, const char *new_name);
85
86 /* to be used with cpio_df */
87 typedef enum {
88   TOTAL = 0,
89   FREE,
90   USABLE
91 } CPFILE_DF_TYPE;
92
93 JNIEXPORT long long cpio_df (const char *path, CPFILE_DF_TYPE type);
94
95 JNIEXPORT int cpio_openDir (const char *dirname, void **handle);
96 JNIEXPORT int cpio_closeDir (void *handle);
97 JNIEXPORT int cpio_readDir (void *handle, char *filename);
98
99 #endif