1 /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
3 Copyright (c) 2014-2015 Datalight, Inc.
4 All Rights Reserved Worldwide.
6 This program 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; use version 2 of the License.
10 This program is distributed in the hope that it will be useful,
11 but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
12 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 /* Businesses and individuals that for commercial or other reasons cannot
20 comply with the terms of the GPLv2 license may obtain a commercial license
21 before incorporating Reliance Edge into proprietary software for
22 distribution in any form. Visit http://www.datalight.com/reliance-edge for
31 #define HOST_PATH_MAX MAX_PATH
33 #include <linux/limits.h>
34 #define HOST_PATH_MAX PATH_MAX
38 #if REDCONF_IMAGE_BUILDER == 1
40 #define MACRO_NAME_MAX_LEN 32
45 const char *pszInputDir;
46 const char *pszOutputFile;
47 #if REDCONF_API_POSIX == 1
48 const char *pszVolName;
50 const char *pszMapFile;
51 const char *pszDefineFile;
57 void ImgbldParseParams(int argc, char *argv [], IMGBLDPARAM *pParam);
58 int ImgbldStart(IMGBLDPARAM *pParam);
63 #if REDCONF_API_POSIX == 1
64 char asOutFilePath[HOST_PATH_MAX];
66 uint32_t ulOutFileIndex;
68 char asInFilePath[HOST_PATH_MAX];
72 extern void *gpCopyBuffer;
73 extern uint32_t gulCopyBufferSize;
76 /* Implemented in ibposix.c
78 #if REDCONF_API_POSIX == 1
79 REDSTATUS IbPosixCopyDir(const char *pszVolName, const char *pszInDir);
80 int IbPosixCreateDir(const char *pszVolName, const char *pszFullPath, const char *pszBasePath);
81 int IbConvertPath(const char *pszVolName, const char *pszFullPath, const char *pszBasePath, char *szOutPath);
85 /* Implemented in ibfse.c
87 #if REDCONF_API_FSE == 1
88 typedef struct sFILELISTENTRY FILELISTENTRY;
91 FILEMAPPING fileMapping;
96 void FreeFileList(FILELISTENTRY **ppsFileList);
98 int IbFseGetFileList(const char *pszPath, const char *pszIndirPath, FILELISTENTRY **ppFileListHead);
99 int IbFseOutputDefines(FILELISTENTRY *pFileList, const IMGBLDPARAM *pOptions);
100 int IbFseCopyFiles(int volNum, const FILELISTENTRY *pFileList);
104 /* Implemented in os-specific space (ibwin.c and iblinux.c)
106 #if REDCONF_API_POSIX == 1
107 int IbPosixCopyDirRecursive(const char *pszVolName, const char *pszInDir);
109 #if REDCONF_API_FSE == 1
110 int IbFseBuildFileList(const char *pszDirPath, FILELISTENTRY **ppFileListHead);
112 #if REDCONF_API_FSE == 1
113 int IbSetRelativePath(char *pszPath, const char *pszParentPath);
115 bool IsRegularFile(const char *pszPath);
118 /* Implemented in ibcommon.c
120 int IbCopyFile(int volNum, const FILEMAPPING *pFileMapping);
121 int IbCheckFileExists(const char *pszPath, bool *pfExists);
124 /* Implemented separately in ibfse.c and ibposix.c
127 int IbApiUninit(void);
128 int IbWriteFile(int volNum, const FILEMAPPING *pFileMapping, uint64_t ullOffset, void *pData, uint32_t ulDataLen);
130 #endif /* IMAGE_BUILDER */
132 /* For image copier tool
136 #define HOST_PSEP '\\'
138 #define snprintf _snprintf
140 #define S_IFDIR _S_IFDIR
144 #define HOST_PSEP '/'
150 const char *pszOutputDir;
151 const char *pszBDevSpec;
152 #if REDCONF_API_POSIX == 1
153 const char *pszVolName;
160 #if REDCONF_API_POSIX == 1
161 const char *pszVolume; /* Volume path prefix. */
162 uint32_t ulVolPrefixLen; /* strlen(COPIER::pszVolume) */
164 uint8_t bVolNum; /* Volume number. */
166 const char *pszOutputDir; /* Output directory path. */
167 bool fNoWarn; /* If true, no warning to overwrite. */
168 uint8_t *pbCopyBuffer; /* Buffer for copying file data. */
172 void ImgcopyParseParams(int argc, char *argv [], IMGCOPYPARAM *pParam);
173 int ImgcopyStart(IMGCOPYPARAM *pParam);
175 /* Implemented separately in imgcopywin.c and imgcopylinux.c. These functions
176 print an error message and abort on failure.
178 void ImgcopyMkdir(const char *pszDir);
179 void ImgcopyRecursiveRmdir(const char *pszDir);
182 #endif /* REDTOOLS_H */