| 1 | /* |
| 2 | Copyright (c) 2012, Broadcom Europe Ltd |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | * Redistributions of source code must retain the above copyright |
| 8 | notice, this list of conditions and the following disclaimer. |
| 9 | * Redistributions in binary form must reproduce the above copyright |
| 10 | notice, this list of conditions and the following disclaimer in the |
| 11 | documentation and/or other materials provided with the distribution. |
| 12 | * Neither the name of the copyright holder nor the |
| 13 | names of its contributors may be used to endorse or promote products |
| 14 | derived from this software without specific prior written permission. |
| 15 | |
| 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
| 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 | */ |
| 27 | |
| 28 | // File service required types |
| 29 | |
| 30 | #ifndef VCFILESYS_DEFS_H |
| 31 | #define VCFILESYS_DEFS_H |
| 32 | |
| 33 | #include <time.h> // for time_t |
| 34 | |
| 35 | /* Define type fattributes_t and struct dirent for use in file system functions */ |
| 36 | |
| 37 | typedef int fattributes_t; |
| 38 | //enum {ATTR_RDONLY=1, ATTR_DIRENT=2}; |
| 39 | #define ATTR_RDONLY 0x01 /* Read only file attributes */ |
| 40 | #define ATTR_HIDDEN 0x02 /* Hidden file attributes */ |
| 41 | #define ATTR_SYSTEM 0x04 /* System file attributes */ |
| 42 | #define ATTR_VOLUME 0x08 /* Volume Label file attributes */ |
| 43 | #define ATTR_DIRENT 0x10 /* Dirrectory file attributes */ |
| 44 | #define ATTR_ARCHIVE 0x20 /* Archives file attributes */ |
| 45 | #define ATTR_NORMAL 0x00 /* Normal file attributes */ |
| 46 | |
| 47 | #define D_NAME_MAX_SIZE 256 |
| 48 | |
| 49 | #ifndef _DIRENT_H // This should really be in a dirent.h header to avoid conflicts |
| 50 | struct dirent |
| 51 | { |
| 52 | char d_name[D_NAME_MAX_SIZE]; |
| 53 | unsigned int d_size; |
| 54 | fattributes_t d_attrib; |
| 55 | time_t d_creatime; |
| 56 | time_t d_modtime; |
| 57 | }; |
| 58 | #endif // ifndef _DIRENT_H |
| 59 | |
| 60 | #define FS_MAX_PATH 256 // The maximum length of a pathname |
| 61 | /* Although not used in the API, this value is required on the host and |
| 62 | VC01 sides of the file system, even if there is no host side. Putting it in |
| 63 | vc_fileservice_defs.h is not appropriate as it would only be included if there |
| 64 | was a host side. */ |
| 65 | |
| 66 | /* File system error codes */ |
| 67 | #define FS_BAD_USER -7000 // The task isn't registered as a file system user |
| 68 | |
| 69 | #define FS_BAD_FILE -7001 // The path or filename or file descriptor is invalid |
| 70 | #define FS_BAD_PARM -7002 // Invalid parameter given |
| 71 | #define FS_ACCESS -7003 // File access conflict |
| 72 | #define FS_MAX_FILES -7004 // Maximum number of files already open |
| 73 | #define FS_NOEMPTY -7005 // Directory isn't empty |
| 74 | #define FS_MAX_SIZE -7006 // File is over the maximum file size |
| 75 | |
| 76 | #define FS_NO_DISK -7007 // No disk is present, or the disk has not been opened |
| 77 | #define FS_DISK_ERR -7008 // There is a problem with the disk |
| 78 | |
| 79 | #define FS_IO_ERROR -7009 // Driver level error |
| 80 | |
| 81 | #define FS_FMT_ERR -7010 // Format error |
| 82 | |
| 83 | #define FS_NO_BUFFER -7011 // Internal Nucleus File buffer not available |
| 84 | #define FS_NUF_INT -7012 // Internal Nucleus File error |
| 85 | |
| 86 | #define FS_UNSPEC_ERR -7013 // Unspecified error |
| 87 | |
| 88 | #endif |
| 89 | |