fs.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #ifndef _FS_FS_H_
  2. #define _FS_FS_H_
  3. /*
  4. * Copyright (C) 2004-2005 by egnite Software GmbH. All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions
  8. * are met:
  9. *
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the copyright holders nor the names of
  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 COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30. * SUCH DAMAGE.
  31. *
  32. * For additional information see http://www.ethernut.de/
  33. *
  34. */
  35. /*!
  36. * \file fs/fs.h
  37. * \brief File system access.
  38. *
  39. * \verbatim
  40. *
  41. * $Log$
  42. * Revision 1.5 2008/08/11 07:00:19 haraldkipp
  43. * BSD types replaced by stdint types (feature request #1282721).
  44. *
  45. * Revision 1.4 2007/08/29 13:34:14 haraldkipp
  46. * Added function for renaming files (contrib by ZACK).
  47. *
  48. * Revision 1.3 2006/01/05 16:45:25 haraldkipp
  49. * New ioctl functions.
  50. *
  51. * Revision 1.2 2005/08/05 11:28:25 olereinhardt
  52. * Corrected typo
  53. *
  54. * Revision 1.1 2005/02/05 20:37:18 haraldkipp
  55. * Peanut added
  56. *
  57. *
  58. * \endverbatim
  59. */
  60. #include <sys/file.h>
  61. #include <stdint.h>
  62. /*!
  63. * \addtogroup xgFS
  64. */
  65. /*@{*/
  66. /*!
  67. * \name File System I/O Control Codes
  68. */
  69. /*@{*/
  70. /*!
  71. * \brief Obtain information about a specified file entry.
  72. */
  73. #define FS_STATUS 0x1101
  74. /*!
  75. * \brief Create a new directory entry.
  76. */
  77. #define FS_DIR_CREATE 0x1111
  78. /*!
  79. * \brief Remove a previously created directory entry.
  80. */
  81. #define FS_DIR_REMOVE 0x1112
  82. /*!
  83. * \brief Open a directory stream.
  84. */
  85. #define FS_DIR_OPEN 0x1113
  86. /*!
  87. * \brief Close a directory stream.
  88. */
  89. #define FS_DIR_CLOSE 0x1114
  90. /*!
  91. * \brief Read the next directory entry.
  92. */
  93. #define FS_DIR_READ 0x1115
  94. /*!
  95. * \brief Obtain information about an opened file.
  96. */
  97. #define FS_FILE_STATUS 0x1121
  98. /*!
  99. * \brief Remove a previously created file.
  100. */
  101. #define FS_FILE_DELETE 0x1122
  102. /*!
  103. * \brief Set a file pointer position.
  104. */
  105. #define FS_FILE_SEEK 0x1123
  106. /*@}*/
  107. #define FS_VOL_MOUNT 0x1130
  108. #define FS_VOL_UNMOUNT 0x1131
  109. #define FS_RENAME 0x1132
  110. #define NUTFS_UNLINK 0x1133
  111. #define NUTFS_MKDIR 0x1134
  112. #define NUTFS_RMDIR 0x1135
  113. /*!
  114. * \brief General structure for two arguments.
  115. *
  116. * Used to pass two arguments to an I/O control function.
  117. */
  118. typedef struct {
  119. void *arg1;
  120. void *arg2;
  121. } IOCTL_ARG2;
  122. /*!
  123. * \brief General structure for three arguments.
  124. *
  125. * Used to pass three arguments to an I/O control function.
  126. */
  127. typedef struct {
  128. void *arg1;
  129. void *arg2;
  130. void *arg3;
  131. } IOCTL_ARG3;
  132. typedef struct _FSCP_VOL_MOUNT {
  133. /*! \brief Block device mount. */
  134. NUTFILE *fscp_bmnt;
  135. /*! \brief Partition type. */
  136. uint8_t fscp_part_type;
  137. } FSCP_VOL_MOUNT;
  138. typedef struct _FSCP_RENAME {
  139. const char *par_old;
  140. const char *par_new;
  141. } FSCP_RENAME;
  142. typedef struct _FSCP_STATUS {
  143. const char *par_path;
  144. struct stat *par_stp;
  145. } FSCP_STATUS;
  146. /*@}*/
  147. #endif