[PATCH 109/194] object-store: move check_sha1_signature to object-store.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jonathan Nieder <jrnieder@xxxxxxxxx>

When map == NULL, check_sha1_signature reads the object from the
object store to hash it.  Move the declaration of this function to
object-store.h to make it easier to find.

While at it, clarify the comment describing its API.

Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
Signed-off-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
---
 cache.h        | 2 --
 object-store.h | 9 +++++++++
 sha1_file.c    | 6 ------
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/cache.h b/cache.h
index 634172cec4..15ba480ac3 100644
--- a/cache.h
+++ b/cache.h
@@ -1195,8 +1195,6 @@ extern int git_open_cloexec(const char *name, int flags);
 extern int unpack_sha1_header(git_zstream *stream, unsigned char *map, unsigned long mapsize, void *buffer, unsigned long bufsiz);
 extern int parse_sha1_header(const char *hdr, unsigned long *sizep);
 
-extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned long size, const char *type);
-
 extern int finalize_object_file(const char *tmpfile, const char *filename);
 
 /* Helper to check and "touch" a file */
diff --git a/object-store.h b/object-store.h
index d009f952f8..a0e9824406 100644
--- a/object-store.h
+++ b/object-store.h
@@ -99,6 +99,15 @@ extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned c
 extern int force_object_loose(const unsigned char *sha1, time_t mtime);
 extern void *map_sha1_file(struct repository *r, const unsigned char *sha1, unsigned long *size);
 
+/*
+ * Rehash an object's data to make sure the object name actually matches
+ * "sha1" to detect object corruption.
+ *
+ * The in-core object data should be in "map". If "map" == NULL, reads the
+ * named object using the streaming interface and rehashes it on the fly.
+ */
+extern int check_sha1_signature(const unsigned char *sha1, void *buf, unsigned long size, const char *type);
+
 /*
  * Convenience for sha1_object_info_extended() with a NULL struct
  * object_info. OBJECT_INFO_SKIP_CACHED is automatically set; pass
diff --git a/sha1_file.c b/sha1_file.c
index aa564e3ad4..3262075497 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -802,12 +802,6 @@ void *xmmap(void *start, size_t length,
 	return ret;
 }
 
-/*
- * With an in-core object data in "map", rehash it to make sure the
- * object name actually matches "sha1" to detect object corruption.
- * With "map" == NULL, try reading the object named with "sha1" using
- * the streaming interface and rehash it to do the same.
- */
 int check_sha1_signature(const unsigned char *sha1, void *map,
 			 unsigned long size, const char *type)
 {
-- 
2.15.1.433.g936d1b9894.dirty




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux