cpio.h 4.0 KB

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