|
Packit Service |
392537 |
/*
|
|
Packit Service |
392537 |
* Copyright (c) 2005-2012 Zmanda Inc. All Rights Reserved.
|
|
Packit Service |
392537 |
*
|
|
Packit Service |
392537 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
392537 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
392537 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
392537 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
392537 |
*
|
|
Packit Service |
392537 |
* This library is distributed in the hope that it will be useful, but
|
|
Packit Service |
392537 |
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
Packit Service |
392537 |
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
Packit Service |
392537 |
* License for more details.
|
|
Packit Service |
392537 |
*
|
|
Packit Service |
392537 |
* You should have received a copy of the GNU Lesser General Public License
|
|
Packit Service |
392537 |
* along with this library; if not, write to the Free Software Foundation,
|
|
Packit Service |
392537 |
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
|
Packit Service |
392537 |
*
|
|
Packit Service |
392537 |
* Contact information: Zmanda Inc., 465 S Mathlida Ave, Suite 300
|
|
Packit Service |
392537 |
* Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
|
|
Packit Service |
392537 |
*/
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
#ifndef __VFS_DEVICE_H__
|
|
Packit Service |
392537 |
#define __VFS_DEVICE_H__
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
#include "device.h"
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/*
|
|
Packit Service |
392537 |
* Type checking and casting macros
|
|
Packit Service |
392537 |
*/
|
|
Packit Service |
392537 |
#define TYPE_VFS_DEVICE (vfs_device_get_type())
|
|
Packit Service |
392537 |
#define VFS_DEVICE(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), vfs_device_get_type(), VfsDevice)
|
|
Packit Service |
392537 |
#define VFS_DEVICE_CONST(obj) G_TYPE_CHECK_INSTANCE_CAST((obj), vfs_device_get_type(), VfsDevice const)
|
|
Packit Service |
392537 |
#define VFS_DEVICE_CLASS(klass) G_TYPE_CHECK_CLASS_CAST((klass), vfs_device_get_type(), VfsDeviceClass)
|
|
Packit Service |
392537 |
#define IS_VFS_DEVICE(obj) G_TYPE_CHECK_INSTANCE_TYPE((obj), vfs_device_get_type ())
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
#define VFS_DEVICE_GET_CLASS(obj) G_TYPE_INSTANCE_GET_CLASS((obj), vfs_device_get_type(), VfsDeviceClass)
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* This looks dangerous, but is actually modified by the umask. */
|
|
Packit Service |
392537 |
#define VFS_DEVICE_CREAT_MODE 0666
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
#define VFS_DEVICE_LABEL_SIZE (32768)
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
GType vfs_device_get_type (void);
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/*
|
|
Packit Service |
392537 |
* Main object structure
|
|
Packit Service |
392537 |
*/
|
|
Packit Service |
392537 |
typedef struct {
|
|
Packit Service |
392537 |
Device __parent__;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/*< private >*/
|
|
Packit Service |
392537 |
char * dir_name;
|
|
Packit Service |
392537 |
char * file_name;
|
|
Packit Service |
392537 |
int open_file_fd;
|
|
Packit Service |
392537 |
gboolean leom;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* Properties */
|
|
Packit Service |
392537 |
guint64 volume_bytes;
|
|
Packit Service |
392537 |
guint64 volume_limit;
|
|
Packit Service |
392537 |
gboolean enforce_volume_limit;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* should we monitor free space? (controlled by MONITOR_FREE_SPACE property) */
|
|
Packit Service |
392537 |
gboolean monitor_free_space;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* should the data subdir must be use */
|
|
Packit Service |
392537 |
int use_data;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* how many bytes were free at last check */
|
|
Packit Service |
392537 |
guint64 checked_fs_free_bytes;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* when was that check performed? */
|
|
Packit Service |
392537 |
time_t checked_fs_free_time;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* for testing */
|
|
Packit Service |
392537 |
gboolean slow_write;
|
|
Packit Service |
392537 |
int slow_count;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* and how many bytes have been written since the last check? */
|
|
Packit Service |
392537 |
guint64 checked_bytes_used;
|
|
Packit Service |
392537 |
gboolean (* clear_and_prepare_label)(Device *dself, char *label, char *timestamp);
|
|
Packit Service |
392537 |
void (* release_file)(Device *dself);
|
|
Packit Service |
392537 |
void (* update_volume_size)(Device *dself);
|
|
Packit Service |
392537 |
gboolean (* device_start_file_open)(Device *dself, dumpfile_t *ji);
|
|
Packit Service |
392537 |
gboolean (* validate)(Device *dself);
|
|
Packit Service |
392537 |
} VfsDevice;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/*
|
|
Packit Service |
392537 |
* Class definition
|
|
Packit Service |
392537 |
*/
|
|
Packit Service |
392537 |
typedef struct {
|
|
Packit Service |
392537 |
DeviceClass __parent__;
|
|
Packit Service |
392537 |
} VfsDeviceClass;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* Possible (abstracted) results from a system I/O operation. */
|
|
Packit Service |
392537 |
typedef enum {
|
|
Packit Service |
392537 |
RESULT_SUCCESS,
|
|
Packit Service |
392537 |
RESULT_ERROR, /* Undefined error. */
|
|
Packit Service |
392537 |
RESULT_NO_DATA, /* End of File, while reading */
|
|
Packit Service |
392537 |
RESULT_NO_SPACE, /* Out of space. Sometimes we don't know if
|
|
Packit Service |
392537 |
it was this or I/O error, but this is the
|
|
Packit Service |
392537 |
preferred explanation. */
|
|
Packit Service |
392537 |
RESULT_MAX
|
|
Packit Service |
392537 |
} IoResult;
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
/* Implementation functions */
|
|
Packit Service |
392537 |
void delete_vfs_files(VfsDevice * self);
|
|
Packit Service |
392537 |
|
|
Packit Service |
392537 |
IoResult vfs_device_robust_write(VfsDevice *self, char *buf, int count);
|
|
Packit Service |
392537 |
IoResult vfs_device_robust_read(VfsDevice *self, char *buf, int *count);
|
|
Packit Service |
392537 |
gboolean vfs_write_amanda_header(VfsDevice *self, const dumpfile_t *header);
|
|
Packit Service |
392537 |
#endif
|