Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
BaDiskIo.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Embedded Web-Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: BaDiskIo.h 5978 2026-09-11 16:13:48Z wini $
15 *
16 * COPYRIGHT: Real Time Logic, 2006
17 *
18 * This software is copyrighted by and is the sole property of Real
19 * Time Logic LLC. All rights, title, ownership, or other interests in
20 * the software remain the property of Real Time Logic LLC. This
21 * software may only be used in accordance with the terms and
22 * conditions stipulated in the corresponding license agreement under
23 * which the software has been supplied. Any unauthorized use,
24 * duplication, transmission, distribution, or disclosure of this
25 * software is expressly forbidden.
26 *
27 * This Copyright notice may not be removed or modified without prior
28 * written consent of Real Time Logic LLC.
29 *
30 * Real Time Logic LLC. reserves the right to modify this software
31 * without notice.
32 *
33 * http://www.realtimelogic.com
34 ****************************************************************************
35 *
36 * DiskIo implements the abstract class IoIntf. See the reference
37 * manual for more information on the IoIntf (IO interface)
38 * requirements.
39 *
40 * This is a generic header file for all file systems and
41 * platforms. See the sub-directories for platform specific
42 * implementations.
43 */
44
47#ifndef _DiskIo_h
48#define _DiskIo_h
49
50#include "HttpServer.h"
51#include "IoIntf.h"
52
53#ifndef ROOTPT
54#define ROOTPT void*
55#endif
56
57#ifndef DiskIo_DATA
58#define DiskIo_DATA void* data
59#endif
60
61
62
88typedef struct DiskIo
89#ifdef __cplusplus
90: public IoIntf
91{
92 void *operator new(size_t s) { return ::baMalloc(s); }
93 void operator delete(void* d) { if(d) ::baFree(d); }
94 void *operator new(size_t, void *place) { return place; }
95 void operator delete(void*, void *) { }
96
104 DiskIo();
105
110 ~DiskIo();
111
121 int setRootDir(const char* root);
122
135 int getRootDir(char* buf, int len);
136#if 0
137}
138#endif
139#else
140{
141 IoIntf super; /* Inherits from IoIntf */
142#endif
143 ROOTPT rootPath;
144 int rootPathLen;
145 DiskIo_DATA; /* Used internally if needed by the implementation */
147
148
149#ifdef __cplusplus
150extern "C" {
151#endif
159BA_API void DiskIo_destructor(DiskIo* o);
162BA_API int DiskIo_setRootDir(DiskIo* o, const char* root);
165BA_API int DiskIo_getRootDir(DiskIo* o, char* buf, int len);
166#ifdef __cplusplus
167}
168
170 DiskIo_constructor(this);
171}
173 DiskIo_destructor(this);
174}
175inline int DiskIo::setRootDir(const char* root) {
176 return DiskIo_setRootDir(this, root);
177}
178inline int DiskIo::getRootDir(char* buf, int len) {
179 return DiskIo_getRootDir(this, buf, len);
180}
181
182#endif
183 /* end of IO */
185
186#endif
void * baMalloc(size_t size)
Allocate uninitialized storage using the target's configured allocator.
void baFree(void *p)
Release storage using the target's configured allocator.
int getRootDir(char *buf, int len)
Copy the configured root representation.
Definition: BaDiskIo.h:178
BA_API void DiskIo_destructor(DiskIo *o)
Release configuration after dependent users and open handles have stopped.
BA_API int DiskIo_setRootDir(DiskIo *o, const char *root)
Select the filesystem location exposed as this I/O interface's root.
int setRootDir(const char *root)
Select the filesystem location exposed as this I/O interface's root.
Definition: BaDiskIo.h:175
BA_API int DiskIo_getRootDir(DiskIo *o, char *buf, int len)
Copy the configured root representation.
BA_API void DiskIo_constructor(DiskIo *o)
Initialize the platform DiskIo implementation.
~DiskIo()
Release the root configuration and notify an attached I/O interface.
Definition: BaDiskIo.h:172
DiskIo DiskIo
The DiskIo class makes it possible for the web server to work with resources on a hard drive.
DiskIo()
Create a DiskIo instance and set the root directory to '/'.
Definition: BaDiskIo.h:169
The DiskIo class makes it possible for the web server to work with resources on a hard drive.
Definition: BaDiskIo.h:91
The IoIntf class specifies an abstract file API, implementations include ZipIo, DiskIo,...
Definition: IoIntf.h:482