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)  

stat_cache.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 #ifndef CFENGINE_STAT_CACHE_H
25 #define CFENGINE_STAT_CACHE_H
26 
27 #include <platform.h>
28 #include <cfnet.h>
29 
30 
31 typedef enum
32 {
38  FILE_TYPE_CHAR_, /* Conflict with winbase.h */
41 
42 typedef struct Stat_ Stat;
43 struct Stat_
44 {
45  char *cf_filename; /* What file are we statting? */
46  char *cf_server; /* Which server did this come from? */ //WHY? Isn't this in AgentConn?
47  FileType cf_type; /* enum filetype */
48  mode_t cf_lmode; /* Mode of link, if link */
49  mode_t cf_mode; /* Mode of remote file, not link */
50  uid_t cf_uid; /* User ID of the file's owner */
51  gid_t cf_gid; /* Group ID of the file's group */
52  off_t cf_size; /* File size in bytes */
53  time_t cf_atime; /* Time of last access */
54  time_t cf_mtime; /* Time of last data modification */
55  time_t cf_ctime; /* Time of last file status change */
56  char cf_makeholes; /* what we need to know from blksize and blks */
57  char *cf_readlink; /* link value or NULL */
58  int cf_failed; /* stat returned -1 */
59  int cf_nlink; /* Number of hard links */
60  int cf_ino; /* inode number on server */
61  dev_t cf_dev; /* device number */
63 };
64 
65 void DestroyStatCache(Stat *data);
66 int cf_remote_stat(AgentConnection *conn, bool encrypt, const char *file,
67  struct stat *statbuf, const char *stattype);
68 const Stat *StatCacheLookup(const AgentConnection *conn, const char *file_name,
69  const char *server_name);
70 mode_t FileTypeToMode(const FileType type);
71 bool StatParseResponse(const char *const buf, Stat *statbuf);
72 
73 
74 #endif
FileType
Definition: stat_cache.h:32
@ FILE_TYPE_SOCK
Definition: stat_cache.h:39
@ FILE_TYPE_FIFO
Definition: stat_cache.h:36
@ FILE_TYPE_LINK
Definition: stat_cache.h:34
@ FILE_TYPE_CHAR_
Definition: stat_cache.h:38
@ FILE_TYPE_REGULAR
Definition: stat_cache.h:33
@ FILE_TYPE_BLOCK
Definition: stat_cache.h:37
@ FILE_TYPE_DIR
Definition: stat_cache.h:35
int cf_remote_stat(AgentConnection *conn, bool encrypt, const char *file, struct stat *statbuf, const char *stattype)
Definition: stat_cache.c:108
mode_t FileTypeToMode(const FileType type)
Definition: stat_cache.c:317
void DestroyStatCache(Stat *data)
Definition: stat_cache.c:44
bool StatParseResponse(const char *const buf, Stat *statbuf)
Definition: stat_cache.c:352
const Stat * StatCacheLookup(const AgentConnection *conn, const char *file_name, const char *server_name)
Definition: stat_cache.c:300
time_t cf_atime
Definition: stat_cache.h:53
mode_t cf_lmode
Definition: stat_cache.h:48
off_t cf_size
Definition: stat_cache.h:52
gid_t cf_gid
Definition: stat_cache.h:51
time_t cf_mtime
Definition: stat_cache.h:54
time_t cf_ctime
Definition: stat_cache.h:55
dev_t cf_dev
Definition: stat_cache.h:61
int cf_ino
Definition: stat_cache.h:60
char * cf_filename
Definition: stat_cache.h:45
char * cf_server
Definition: stat_cache.h:46
int cf_nlink
Definition: stat_cache.h:59
Stat * next
Definition: stat_cache.h:62
char * cf_readlink
Definition: stat_cache.h:57
char cf_makeholes
Definition: stat_cache.h:56
mode_t cf_mode
Definition: stat_cache.h:49
int cf_failed
Definition: stat_cache.h:58
uid_t cf_uid
Definition: stat_cache.h:50
FileType cf_type
Definition: stat_cache.h:47