summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 867f72b)
raw | patch | inline | side by side (parent: 867f72b)
author | Linus Torvalds <torvalds@linux-foundation.org> | |
Thu, 9 Jul 2009 20:35:31 +0000 (13:35 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Fri, 10 Jul 2009 03:05:19 +0000 (20:05 -0700) |
The threaded index preloading will want it, so that it can avoid
locking by simply using a per-thread symlink/directory cache.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
locking by simply using a per-thread symlink/directory cache.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
symlinks.c | patch | blob | history |
index 871c9844e88c8e73aa1bab0e079d0399bef1b11d..f1e5ede02189061a99bb1c8600cbe3f0e3c8e41b 100644 (file)
--- a/cache.h
+++ b/cache.h
};
extern int checkout_entry(struct cache_entry *ce, const struct checkout *state, char *topath);
+
+struct cache_def {
+ char path[PATH_MAX + 1];
+ int len;
+ int flags;
+ int track_flags;
+ int prefix_len_stat_func;
+};
+
extern int has_symlink_leading_path(const char *name, int len);
+extern int threaded_has_symlink_leading_path(struct cache_def *, const char *, int);
extern int has_symlink_or_noent_leading_path(const char *name, int len);
extern int has_dirs_only_path(const char *name, int len, int prefix_len);
extern void invalidate_lstat_cache(const char *name, int len);
diff --git a/symlinks.c b/symlinks.c
index 08ad35330f38aeec17c11223fc4c145d573f6739..4bdded39c5c5fc491189661bfeca045472970f5b 100644 (file)
--- a/symlinks.c
+++ b/symlinks.c
return match_len;
}
-static struct cache_def {
- char path[PATH_MAX + 1];
- int len;
- int flags;
- int track_flags;
- int prefix_len_stat_func;
-} default_cache;
+static struct cache_def default_cache;
static inline void reset_lstat_cache(struct cache_def *cache)
{
#define USE_ONLY_LSTAT 0
+/*
+ * Return non-zero if path 'name' has a leading symlink component
+ */
+int threaded_has_symlink_leading_path(struct cache_def *cache, const char *name, int len)
+{
+ return lstat_cache(cache, name, len, FL_SYMLINK|FL_DIR, USE_ONLY_LSTAT) & FL_SYMLINK;
+}
+
/*
* Return non-zero if path 'name' has a leading symlink component
*/
int has_symlink_leading_path(const char *name, int len)
{
- struct cache_def *cache = &default_cache; /* FIXME */
- return lstat_cache(cache, name, len,
- FL_SYMLINK|FL_DIR, USE_ONLY_LSTAT) &
- FL_SYMLINK;
+ return threaded_has_symlink_leading_path(&default_cache, name, len);
}
/*