2015-11-06 14:25:48 +00:00
/*
* virrotatingfile . h : reading / writing of auto - rotating files
*
* Copyright ( C ) 2015 Red Hat , Inc .
*
* This library is free software ; you can redistribute it and / or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation ; either
* version 2.1 of the License , or ( at your option ) any later version .
*
* This library is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
* Lesser General Public License for more details .
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library . If not , see
* < http : //www.gnu.org/licenses/>.
*
*/
2019-06-18 11:13:08 -05:00
# pragma once
2015-11-06 14:25:48 +00:00
2019-06-18 11:13:08 -05:00
# include "internal.h"
2015-11-06 14:25:48 +00:00
typedef struct virRotatingFileWriter virRotatingFileWriter ;
typedef struct virRotatingFileReader virRotatingFileReader ;
2021-03-11 08:16:13 +01:00
virRotatingFileWriter * virRotatingFileWriterNew ( const char * path ,
2015-11-06 14:25:48 +00:00
off_t maxlen ,
size_t maxbackup ,
2015-11-30 15:30:33 +01:00
bool trunc ,
2015-11-06 14:25:48 +00:00
mode_t mode ) ;
2021-03-11 08:16:13 +01:00
virRotatingFileReader * virRotatingFileReaderNew ( const char * path ,
2015-11-06 14:25:48 +00:00
size_t maxbackup ) ;
2021-03-11 08:16:13 +01:00
const char * virRotatingFileWriterGetPath ( virRotatingFileWriter * file ) ;
2015-11-06 14:25:48 +00:00
2021-03-11 08:16:13 +01:00
ino_t virRotatingFileWriterGetINode ( virRotatingFileWriter * file ) ;
off_t virRotatingFileWriterGetOffset ( virRotatingFileWriter * file ) ;
2015-11-06 14:25:48 +00:00
2021-03-11 08:16:13 +01:00
ssize_t virRotatingFileWriterAppend ( virRotatingFileWriter * file ,
2015-11-06 14:25:48 +00:00
const char * buf ,
size_t len ) ;
2021-03-11 08:16:13 +01:00
int virRotatingFileReaderSeek ( virRotatingFileReader * file ,
2015-11-06 14:25:48 +00:00
ino_t inode ,
off_t offset ) ;
2021-03-11 08:16:13 +01:00
ssize_t virRotatingFileReaderConsume ( virRotatingFileReader * file ,
2015-11-06 14:25:48 +00:00
char * buf ,
size_t len ) ;
2021-03-11 08:16:13 +01:00
void virRotatingFileWriterFree ( virRotatingFileWriter * file ) ;
void virRotatingFileReaderFree ( virRotatingFileReader * file ) ;