cfengine  3.15.4
About: CFEngine is a configuration management system for configuring and maintaining Unix-like computers (using an own high level policy language). Community version.
  Fossies Dox: cfengine-3.15.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

files_lib.h
Go to the documentation of this file.
1 /*
2  Copyright 2019 Northern.tech AS
3 
4  This file is part of CFEngine 3 - written and maintained by Northern.tech AS.
5 
6  This program is free software; you can redistribute it and/or modify it
7  under the terms of the GNU General Public License as published by the
8  Free Software Foundation; version 3.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
18 
19  To the extent this program is licensed as part of the Enterprise
20  versions of CFEngine, the applicable Commercial Open Source License
21  (COSL) may apply to this file if you as a licensee so wish it. See
22  included file COSL.txt.
23 */
24 
25 #ifndef CFENGINE_FILES_LIB_H
26 #define CFENGINE_FILES_LIB_H
27 
28 #include <cf3.defs.h>
29 #include <file_lib.h>
30 
31 void PurgeItemList(Item **list, char *name);
32 bool FileWriteOver(char *filename, char *contents);
33 
34 bool LoadFileAsItemList(Item **liststart, const char *file, EditDefaults edits);
35 
36 bool MakeParentDirectory(const char *parentandchild, bool force);
37 bool MakeParentDirectory2(char *parentandchild, int force, bool enforce_promise);
38 
39 void RotateFiles(char *name, int number);
40 void CreateEmptyFile(char *name);
41 
42 
43 /**
44  * @brief This is a somewhat simpler version of nftw that support user_data.
45  * Callback function must return 0 to indicate success, -1 for failure.
46  * @param path Path to traverse
47  * @param user_data User data carry
48  * @return True if successful
49  */
50 bool TraverseDirectoryTree(const char *path,
51  int (*callback)(const char *path, const struct stat *sb, void *user_data),
52  void *user_data);
53 
54 bool HashDirectoryTree(const char *path,
55  const char **extensions_filter,
56  EVP_MD_CTX *crypto_context);
57 
58 #include <file_lib.h>
59 
60 #endif
void RotateFiles(char *name, int number)
Definition: files_lib.c:546
bool HashDirectoryTree(const char *path, const char **extensions_filter, EVP_MD_CTX *crypto_context)
Definition: files_lib.c:534
bool TraverseDirectoryTree(const char *path, int(*callback)(const char *path, const struct stat *sb, void *user_data), void *user_data)
This is a somewhat simpler version of nftw that support user_data. Callback function must return 0 to...
void PurgeItemList(Item **list, char *name)
Definition: files_lib.c:44
bool FileWriteOver(char *filename, char *contents)
Definition: files_lib.c:65
bool LoadFileAsItemList(Item **liststart, const char *file, EditDefaults edits)
Definition: files_lib.c:342
bool MakeParentDirectory(const char *parentandchild, bool force)
Definition: files_lib.c:133
bool MakeParentDirectory2(char *parentandchild, int force, bool enforce_promise)
Definition: files_lib.c:105
void CreateEmptyFile(char *name)
Definition: files_lib.c:641
Definition: item_lib.h:33