1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2013-2014 Planets Communications B.V.
5    Copyright (C) 2013-2014 Bareos GmbH & Co. KG
6 
7    This program is Free Software; you can redistribute it and/or
8    modify it under the terms of version three of the GNU Affero General Public
9    License as published by the Free Software Foundation, which is
10    listed in the file LICENSE.
11 
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15    Affero General Public License for more details.
16 
17    You should have received a copy of the GNU Affero General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301, USA.
21 */
22 /*
23  * Windows File API device abstraction.
24  *
25  * Marco van Wieringen, December 2013
26  */
27 
28 #ifndef BAREOS_WIN32_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
29 #define BAREOS_WIN32_STORED_BACKENDS_WIN32_FILE_DEVICE_H_
30 #include "lib/util.h"
31 
32 namespace storagedaemon {
33 
34 class win32_file_device : public Device {
35  public:
36   win32_file_device();
37   ~win32_file_device();
38 
39   /*
40    * Interface from Device
41    */
42   bool MountBackend(DeviceControlRecord* dcr, int timeout) override;
43   bool UnmountBackend(DeviceControlRecord* dcr, int timeout) override;
44   int d_close(int) override;
45   int d_open(const char* pathname, int flags, int mode) override;
46   int d_ioctl(int fd, ioctl_req_t request, char* mt = NULL) override;
47   ssize_t d_read(int fd, void* buffer, size_t count) override;
48   ssize_t d_write(int fd, const void* buffer, size_t count) override;
49   boffset_t d_lseek(DeviceControlRecord* dcr,
50                     boffset_t offset,
51                     int whence) override;
52   bool d_truncate(DeviceControlRecord* dcr) override;
53 };
54 
55 } /* namespace storagedaemon */
56 #endif /* BAREOS_WIN32_STORED_BACKENDS_WIN32_FILE_DEVICE_H_ */
57