summaryrefslogtreecommitdiff
path: root/src/lib/efreet/efreet_cache_private.h
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-18 11:03:02 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-06-18 11:13:52 +0100
commita5b84c6c6e7fb6b98d561335c1d72926db1f0e40 (patch)
tree7e3460457dd1368a984dcdadee133a11c717667a /src/lib/efreet/efreet_cache_private.h
parentcd9059d13ef6ec378f6e7b57b700be6b73850dac (diff)
efreetd - cache - add more statinfo work around 0 mtime distros
some distros 9notably in this case nixos) want to do reproducible builds. to them this means going around setting mtime for all files to 0. this means efreetd not only thinks mtime is invalid/stupid (0 is generally just that as midnight on jan 1 1970 is not exactly a sensible dare for a modified timestamp of a file as no filesystem with any sanity will have not been modified since that time), but it keeps mtime at 0 even when things update. this totally breaks efreetd that expects to find mtime increases over time as things change. it's necessary because it has to perform a "are mu caches up to date" scan of all file data it caches and it needs to know if it should rebuild something based on this. so this does a few things: 1. it makes mtime have to be an exact match to the cache, not cache mtime >= file mtime. so any change forward or back is an inavlidation. 2. it now also uses ctime, mode, size, uid, gid, block count and if a symlink, the sha1 of the symlink path in addition and any change to these == invalid. this adds a lot of code and changes how dirs get scanned a bit but it means it can pick up changes on these 0 mtime distros. interestingly the policy of mtime being 0 is to have a reprodcible fs ... but ctime still changes and is > 0, as does inode info, so it's not actually possible to have it totally work... but they try still, so this is a fix for that problem. whilst i was doing thisi also noticed efreetd re-red dirs many times due to icon theme inhritance. i also fixed that to do a LOT less syscalls by only scanning a dir once as i was rejigging the scanning code at the time anyway. this should optimize thr scan costs at efreetd startup too. @fix @opt
Diffstat (limited to '')
-rw-r--r--src/lib/efreet/efreet_cache_private.h28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/lib/efreet/efreet_cache_private.h b/src/lib/efreet/efreet_cache_private.h
index 97dbd45a1e..1edbb3b5ff 100644
--- a/src/lib/efreet/efreet_cache_private.h
+++ b/src/lib/efreet/efreet_cache_private.h
@@ -38,11 +38,20 @@
38# endif 38# endif
39#endif 39#endif
40 40
41typedef struct _Efreet_Cache_Check Efreet_Cache_Check;
42
43typedef struct _Efreet_Cache_Icon_Theme Efreet_Cache_Icon_Theme;
44typedef struct _Efreet_Cache_Directory Efreet_Cache_Directory;
45typedef struct _Efreet_Cache_Desktop Efreet_Cache_Desktop;
46
41EAPI const char *efreet_desktop_util_cache_file(void); 47EAPI const char *efreet_desktop_util_cache_file(void);
42EAPI const char *efreet_desktop_cache_file(void); 48EAPI const char *efreet_desktop_cache_file(void);
43EAPI const char *efreet_icon_cache_file(const char *theme); 49EAPI const char *efreet_icon_cache_file(const char *theme);
44EAPI const char *efreet_icon_theme_cache_file(void); 50EAPI const char *efreet_icon_theme_cache_file(void);
45 51
52EAPI Eina_Bool efreet_file_cache_fill(const char *file, Efreet_Cache_Check *check);
53EAPI Eina_Bool efreet_file_cache_check(const Efreet_Cache_Check *check1, const Efreet_Cache_Check *check2);
54
46EAPI Eet_Data_Descriptor *efreet_version_edd(void); 55EAPI Eet_Data_Descriptor *efreet_version_edd(void);
47EAPI Eet_Data_Descriptor *efreet_desktop_edd(void); 56EAPI Eet_Data_Descriptor *efreet_desktop_edd(void);
48EAPI Eet_Data_Descriptor *efreet_hash_array_string_edd(void); 57EAPI Eet_Data_Descriptor *efreet_hash_array_string_edd(void);
@@ -52,15 +61,23 @@ EAPI Eet_Data_Descriptor *efreet_icon_theme_edd(Eina_Bool cache);
52EAPI Eet_Data_Descriptor *efreet_icon_edd(void); 61EAPI Eet_Data_Descriptor *efreet_icon_edd(void);
53EAPI Eet_Data_Descriptor *efreet_icon_fallback_edd(void); 62EAPI Eet_Data_Descriptor *efreet_icon_fallback_edd(void);
54 63
55typedef struct _Efreet_Cache_Icon_Theme Efreet_Cache_Icon_Theme; 64struct _Efreet_Cache_Check
56typedef struct _Efreet_Cache_Directory Efreet_Cache_Directory; 65{
57typedef struct _Efreet_Cache_Desktop Efreet_Cache_Desktop; 66 unsigned long long uid;
67 unsigned long long gid;
68 unsigned long long size;
69 unsigned long long blocks;
70 unsigned long long mtime;
71 unsigned long long chtime;
72 unsigned int mode;
73 unsigned char link_sha1[20];
74};
58 75
59struct _Efreet_Cache_Icon_Theme 76struct _Efreet_Cache_Icon_Theme
60{ 77{
61 Efreet_Icon_Theme theme; 78 Efreet_Icon_Theme theme;
62 79
63 long long last_cache_check; /**< Last time the cache was checked */ 80 Efreet_Cache_Check check; /**< relevant stat info from last check */
64 81
65 Eina_Hash *dirs; /**< All possible icon paths for this theme */ 82 Eina_Hash *dirs; /**< All possible icon paths for this theme */
66 83
@@ -73,13 +90,14 @@ struct _Efreet_Cache_Icon_Theme
73 90
74struct _Efreet_Cache_Directory 91struct _Efreet_Cache_Directory
75{ 92{
76 long long modified_time; 93 Efreet_Cache_Check check; /**< relevant stat info from last check */
77}; 94};
78 95
79struct _Efreet_Cache_Desktop 96struct _Efreet_Cache_Desktop
80{ 97{
81 Efreet_Desktop desktop; 98 Efreet_Desktop desktop;
82 99
100 Efreet_Cache_Check check; /**< relevant stat info from last check */
83 double check_time; /**< Last time we check for disk modification */ 101 double check_time; /**< Last time we check for disk modification */
84}; 102};
85 103