All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Garzik <jeff@garzik.org>
To: Pete Zaitcev <zaitcev@redhat.com>
Cc: Rick Peralta <fbp@tiac.net>,
	Project Hail List <hail-devel@vger.kernel.org>
Subject: Re: [Patch] chunkd: use port xxx82 to build
Date: Mon, 10 Aug 2009 13:37:51 -0400	[thread overview]
Message-ID: <4A805AEF.7070500@garzik.org> (raw)
In-Reply-To: <20090807185556.65b19934@redhat.com>

Pete Zaitcev wrote:
> On Fri, 7 Aug 2009 19:36:28 -0400 (EDT), Rick Peralta <fbp@tiac.net> wrote:
> 
>> I was looking from net_write() & net_read() to see where they were
>> called and what was passed to them.  struct chunksrv_req & struct
>> chunksrv_resp_get seem to be the primary structures.
> 
> I didn't know how serious you were about it, so I went ahead and
> looked at the endian stuff. The immediate issue - the hang of
> basic-object - was addressed with the following fix:
> 
> diff --git a/server/object.c b/server/object.c
> index 4eb62f7..6ea1500 100644
> --- a/server/object.c
> +++ b/server/object.c
> @@ -290,7 +290,7 @@ bool object_get(struct client *cli, bool want_body)
>  
>  	cli->in_len = obj->size;
>  
> -	resp->req.data_len = GUINT32_TO_LE(obj->size);
> +	resp->req.data_len = GUINT64_TO_LE((uint64_t)obj->size);
>  	memcpy(resp->req.checksum, obj->hashstr, sizeof(obj->hashstr));
>  	resp->req.checksum[sizeof(obj->hashstr)] = 0;
>  	resp->mtime = GUINT64_TO_LE(obj->mtime);
> diff --git a/server/server.c b/server/server.c
> index 2ad3db2..161dc67 100644
> --- a/server/server.c
> +++ b/server/server.c
> @@ -639,7 +639,7 @@ static bool cli_resp_xml(struct client *cli, GList *content)
>  {
>  	int rc;
>  	bool rcb;
> -	int content_len = strlist_len(content);
> +	size_t content_len = strlist_len(content);
>  	struct chunksrv_req *resp = NULL;
>  
>  	resp = malloc(sizeof(*resp));
> @@ -650,7 +650,7 @@ static bool cli_resp_xml(struct client *cli, GList *content)
>  
>  	memcpy(resp, &cli->creq, sizeof(cli->creq));
>  
> -	resp->data_len = GUINT64_TO_LE(content_len);
> +	resp->data_len = GUINT64_TO_LE((uint64_t)content_len);
>  
>  	cli->state = evt_recycle;

I think type-safety should win the day.  So, I am going to work on a set 
of 'static inline' functions that wrap GUINT* macros.  We shouldn't need 
to add casts to achieve type promotion, in that case.

I think I will name them le32_to_cpu, cpu_to_le16, le64_to_cpu, etc. :)

	Jeff




  reply	other threads:[~2009-08-10 17:37 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07 23:36 [Patch] chunkd: use port xxx82 to build Rick Peralta
2009-08-07 23:47 ` Jeff Garzik
2009-08-08  0:55 ` Pete Zaitcev
2009-08-10 17:37   ` Jeff Garzik [this message]
2009-08-10 18:07     ` Pete Zaitcev
2009-08-12  6:49   ` Jeff Garzik
  -- strict thread matches above, loose matches on Subject: below --
2009-08-13 16:59 Rick Peralta
2009-08-13 14:46 Rick Peralta
2009-08-13 15:27 ` Jeff Garzik
2009-08-12 23:42 Rick Peralta
2009-08-13  0:11 ` Jeff Garzik
2009-08-08  4:24 Rick Peralta
2009-08-08  4:47 ` Jeff Garzik
2009-08-08  3:27 Rick Peralta
2009-08-08  3:38 ` Jeff Garzik
2009-08-07 14:11 Rick Peralta
2009-08-07 14:16 ` Fabian Deutsch
2009-08-07 14:23 ` Jeff Garzik
     [not found] <16874317.1249435954950.JavaMail.root@mswamui-andean.atl.sa.earthlink.net>
     [not found] ` <4A78E306.7000707@garzik.org>
2009-08-05  1:43   ` Pete Zaitcev
2009-08-05  1:50     ` Jeff Garzik
2009-08-05  0:34 Pete Zaitcev
2009-08-05  0:57 ` Jeff Garzik
2009-08-05  1:00   ` Jeff Garzik
2009-08-05  1:11     ` Pete Zaitcev
2009-08-05  1:26       ` Jeff Garzik
2009-08-05  1:04   ` Pete Zaitcev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A805AEF.7070500@garzik.org \
    --to=jeff@garzik.org \
    --cc=fbp@tiac.net \
    --cc=hail-devel@vger.kernel.org \
    --cc=zaitcev@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.