[master] 1752321 Make struct storage fields used onlyr for SENDFILE_WORKS conditional.

Poul-Henning Kamp phk at varnish-cache.org
Tue May 17 21:43:30 CEST 2011


commit 17523212895f272476ee7dc0823c5fdd5f8cabe7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue May 17 19:42:59 2011 +0000

    Make struct storage fields used onlyr for SENDFILE_WORKS conditional.
    
    Spotted by:	sky

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 2d75137..f7b9083 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -382,8 +382,10 @@ struct storage {
 	unsigned		len;
 	unsigned		space;
 
+#ifdef SENDFILE_WORKS
 	int			fd;
 	off_t			where;
+#endif
 };
 
 /* Object core structure ---------------------------------------------
diff --git a/bin/varnishd/storage_file.c b/bin/varnishd/storage_file.c
index 63bcdf3..eca769a 100644
--- a/bin/varnishd/storage_file.c
+++ b/bin/varnishd/storage_file.c
@@ -487,8 +487,10 @@ smf_alloc(struct stevedore *st, size_t size)
 	smf->s.ptr = smf->ptr;
 	smf->s.len = 0;
 	smf->s.stevedore = st;
+#ifdef SENDFILE_WORKS
 	smf->s.fd = smf->sc->fd;
 	smf->s.where = smf->offset;
+#endif
 	return (&smf->s);
 }
 
diff --git a/bin/varnishd/storage_malloc.c b/bin/varnishd/storage_malloc.c
index 5cd6b84..18a9cbf 100644
--- a/bin/varnishd/storage_malloc.c
+++ b/bin/varnishd/storage_malloc.c
@@ -95,7 +95,9 @@ sma_alloc(struct stevedore *st, size_t size)
 	}
 	sma->s.len = 0;
 	sma->s.space = size;
+#ifdef SENDFILE_WORKS
 	sma->s.fd = -1;
+#endif
 	sma->s.stevedore = st;
 	sma->s.magic = STORAGE_MAGIC;
 	return (&sma->s);
diff --git a/bin/varnishd/storage_persistent.c b/bin/varnishd/storage_persistent.c
index dd43ba2..6add1c7 100644
--- a/bin/varnishd/storage_persistent.c
+++ b/bin/varnishd/storage_persistent.c
@@ -450,7 +450,9 @@ smp_allocx(struct stevedore *st, size_t min_size, size_t max_size,
 	ss->space = max_size;
 	ss->priv = sc;
 	ss->stevedore = st;
+#ifdef SENDFILE_WORKS
 	ss->fd = sc->fd;
+#endif
 	if (ssg != NULL)
 		*ssg = sg;
 	return (ss);
diff --git a/bin/varnishd/storage_synth.c b/bin/varnishd/storage_synth.c
index b70e609..f21158c 100644
--- a/bin/varnishd/storage_synth.c
+++ b/bin/varnishd/storage_synth.c
@@ -91,7 +91,9 @@ SMS_Makesynth(struct object *obj)
 	sto->priv = vsb;
 	sto->len = 0;
 	sto->space = 0;
+#ifdef SENDFILE_WORKS
 	sto->fd = -1;
+#endif
 	sto->stevedore = &sms_stevedore;
 	sto->magic = STORAGE_MAGIC;
 



More information about the varnish-commit mailing list