Skip to content

Commit bf21fc2

Browse files
authored
Merge pull request #8 from bbockelm/cvmfs_cksum
Add support for `CVMFS` checksum type
2 parents e566f5d + 5a19bb7 commit bf21fc2

4 files changed

Lines changed: 304 additions & 30 deletions

File tree

conf/gridftp-hdfs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
# Comment out the following line to disable on-the-fly GridFTP checksum calculations
3232
# Alternately, remove one or more checksum format from the list to reduce CPU usage.
33-
export GRIDFTP_HDFS_CHECKSUMS="MD5,ADLER32,CRC32,CKSUM"
33+
export GRIDFTP_HDFS_CHECKSUMS="MD5,ADLER32,CRC32,CKSUM,CVMFS"
3434

3535
# By default, reduce the amount of memory that HDFS uses for its embedded JVM.
3636
# This is typically a safe setting as long as the process only has one file

src/gridftp_hdfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,7 @@ hdfs_destroy(
846846
globus_free(hdfs_handle->mutex);
847847
}
848848
globus_free(hdfs_handle);
849+
free(hdfs_handle->cvmfs_graft);
849850
}
850851
closelog();
851852
}

src/gridftp_hdfs.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <hdfs.h>
1212
#include <stdint.h>
1313
#include <openssl/md5.h>
14+
#include <openssl/evp.h>
1415

1516
#include "globus_gridftp_server.h"
1617
#include "gridftp_hdfs_error.h"
@@ -34,6 +35,9 @@ extern globus_version_t gridftp_hdfs_local_version;
3435
#define HDFS_CKSM_TYPE_CRC32 2
3536
#define HDFS_CKSM_TYPE_ADLER32 4
3637
#define HDFS_CKSM_TYPE_MD5 8
38+
// Create checksums compatible with CVMFS's grafting tool; allows easy publication of files
39+
// from HDFS into CVMFS.
40+
#define HDFS_CKSM_TYPE_CVMFS 16
3741

3842
typedef struct globus_l_gfs_hdfs_handle_s
3943
{
@@ -82,6 +86,15 @@ typedef struct globus_l_gfs_hdfs_handle_s
8286
MD5_CTX md5;
8387
char md5_output[MD5_DIGEST_LENGTH];
8488
char md5_output_human[MD5_DIGEST_LENGTH*2+1];
89+
EVP_MD_CTX *file_sha1;
90+
EVP_MD_CTX *chunk_sha1;
91+
char file_sha1_human[EVP_MAX_MD_SIZE*2+1];
92+
char **chunk_sha1_human;
93+
globus_size_t cur_chunk_bytes;
94+
globus_size_t *chunk_offsets;
95+
globus_size_t chunk_count;
96+
globus_size_t chunk_array_size;
97+
char *cvmfs_graft;
8598
uint32_t adler32;
8699
char adler32_human[2*sizeof(uint32_t)+1];
87100
uint32_t crc32;

0 commit comments

Comments
 (0)