diff options
author | José Bollo <jose.bollo@iot.bzh> | 2018-09-11 11:28:34 +0200 |
---|---|---|
committer | Jose Bollo <jose.bollo@iot.bzh> | 2018-09-17 13:17:56 +0200 |
commit | 7ae3477d84ae13c5e9ef9bb1980a8f70f8b7e9bf (patch) | |
tree | 46c1ddda9a4dcc4782ceab8deb2f891ad3b0f2c8 /src/fbuf.h | |
parent | 11654afcb5753a54a033db12e1ed4a19b3f7c86e (diff) |
Make it work for AGL
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'src/fbuf.h')
-rw-r--r-- | src/fbuf.h | 40 |
1 files changed, 37 insertions, 3 deletions
@@ -1,3 +1,20 @@ +/* + * Copyright (C) 2018 "IoT.bzh" + * Author José Bollo <jose.bollo@iot.bzh> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #pragma once /** @@ -6,7 +23,7 @@ struct fbuf { /** filename for messages */ - const char *name; + char *name; /** in memory copy of the file */ void *buffer; @@ -25,18 +42,22 @@ struct fbuf /** opened file descriptor for the file */ int fd; + + /** opened file descriptor for the backup */ + int backup; }; /** short type */ typedef struct fbuf fbuf_t; -/** open in 'fb' the file of 'name' */ +/** open in 'fb' the file of 'name' and optionnal 'backup' name */ extern int fbuf_open( fbuf_t *fb, - const char *name + const char *name, + const char *backup ); /** close the file 'fb' */ @@ -105,7 +126,20 @@ int fbuf_open_identify( fbuf_t *fb, const char *name, + const char *backup, const char *id, uint32_t idlen ); +extern +int +fbuf_backup( + fbuf_t *fb +); + +extern +int +fbuf_recover( + fbuf_t *fb +); + |