From: Boaz Harrosh <bharrosh@panasas.com>
To: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Cc: Christoph Hellwig <hch@infradead.org>,
Chris Leech <christopher.leech@intel.com>,
jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
devel@open-fcoe.org
Subject: Re: [PATCH 1/3] 24-bit types: typedef and macros for accessing 3-byte arrays as integers
Date: Wed, 10 Sep 2008 19:11:09 +0300 [thread overview]
Message-ID: <48C7F19D.3080507@panasas.com> (raw)
In-Reply-To: <1221061241.27385.14.camel@norville.austin.ibm.com>
Dave Kleikamp wrote:
> On Wed, 2008-09-10 at 10:07 -0400, Christoph Hellwig wrote:
>
>> JFS already defines an __le24, see fs/jfs/endian24.h. Please try to
>> cover it, too or at least make sure you don't break it.
>
> Chris,
> This patch takes care of jfs. Please add it to your patchset.
>
> Thanks,
> Shaggy
>
> 24-bit types: Convert jfs to use the common 24-bit types
>
> This patch cleans up some of the ugliness in the jfs headers and
> uses the common 24-bit types instead of its private definitions.
>
> Signed-off-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
>
> diff --git a/fs/jfs/endian24.h b/fs/jfs/endian24.h
> deleted file mode 100644
> index fa92f7f..0000000
> --- a/fs/jfs/endian24.h
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -/*
> - * Copyright (C) International Business Machines Corp., 2001
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
> - * the GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> - */
> -#ifndef _H_ENDIAN24
> -#define _H_ENDIAN24
> -
> -/*
> - * endian24.h:
> - *
> - * Endian conversion for 24-byte data
> - *
> - */
> -#define __swab24(x) \
> -({ \
> - __u32 __x = (x); \
> - ((__u32)( \
> - ((__x & (__u32)0x000000ffUL) << 16) | \
> - (__x & (__u32)0x0000ff00UL) | \
> - ((__x & (__u32)0x00ff0000UL) >> 16) )); \
> -})
> -
> -#if (defined(__KERNEL__) && defined(__LITTLE_ENDIAN)) || (defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN))
> - #define __cpu_to_le24(x) ((__u32)(x))
> - #define __le24_to_cpu(x) ((__u32)(x))
> -#else
> - #define __cpu_to_le24(x) __swab24(x)
> - #define __le24_to_cpu(x) __swab24(x)
> -#endif
> -
> -#ifdef __KERNEL__
> - #define cpu_to_le24 __cpu_to_le24
> - #define le24_to_cpu __le24_to_cpu
> -#endif
> -
> -#endif /* !_H_ENDIAN24 */
> diff --git a/fs/jfs/jfs_types.h b/fs/jfs/jfs_types.h
> index 649f981..6c49b93 100644
> --- a/fs/jfs/jfs_types.h
> +++ b/fs/jfs/jfs_types.h
> @@ -30,8 +30,6 @@
> #include <linux/types.h>
> #include <linux/nls.h>
>
> -#include "endian24.h"
> -
> /*
> * transaction and lock id's
> *
> @@ -62,7 +60,7 @@ struct timestruc_t {
> */
> typedef struct {
> unsigned len:24;
> - unsigned off1:8;
> + u8 off1;
> u32 off2;
> } lxd_t;
>
Why is the difference from below definition. That is the
use/not of __le24?
> @@ -90,8 +88,8 @@ struct lxdlist {
> * physical xd (pxd)
> */
> typedef struct {
> - unsigned len:24;
> - unsigned addr1:8;
> + __le24 len;
Is this stuff on-the-wire?
Do you need a:
+ __le24 len __packed;
> + u8 addr1;
> __le32 addr2;
> } pxd_t;
and:
} pxd_t __packed ;
>
> @@ -122,13 +120,13 @@ struct pxdlist {
> * data extent descriptor (dxd)
> */
> typedef struct {
> - unsigned flag:8; /* 1: flags */
> - unsigned rsrvd:24;
> - __le32 size; /* 4: size in byte */
> - unsigned len:24; /* 3: length in unit of fsblksize */
> - unsigned addr1:8; /* 1: address in unit of fsblksize */
> - __le32 addr2; /* 4: address in unit of fsblksize */
> -} dxd_t; /* - 16 - */
> + u8 flag; /* 1: flags */
> + u8 rsrvd[3];
> + __le32 size; /* 4: size in byte */
> + __le24 len; /* 3: length in unit of fsblksize */
> + u8 addr1; /* 1: address in unit of fsblksize */
> + __le32 addr2; /* 4: address in unit of fsblksize */
> +} dxd_t; /* - 16 - */
>
> /* dxd_t flags */
> #define DXD_INDEX 0x80 /* B+-tree index */
> diff --git a/fs/jfs/jfs_xtree.h b/fs/jfs/jfs_xtree.h
> index 70815c8..92beff3 100644
> --- a/fs/jfs/jfs_xtree.h
> +++ b/fs/jfs/jfs_xtree.h
> @@ -29,14 +29,14 @@
> * extent allocation descriptor (xad)
> */
> typedef struct xad {
> - unsigned flag:8; /* 1: flag */
> - unsigned rsvrd:16; /* 2: reserved */
> - unsigned off1:8; /* 1: offset in unit of fsblksize */
> - __le32 off2; /* 4: offset in unit of fsblksize */
> - unsigned len:24; /* 3: length in unit of fsblksize */
> - unsigned addr1:8; /* 1: address in unit of fsblksize */
> - __le32 addr2; /* 4: address in unit of fsblksize */
> -} xad_t; /* (16) */
> + u8 flag; /* 1: flag */
> + u8 rsvrd[2]; /* 2: reserved */
> + u8 off1; /* 1: offset in unit of fsblksize */
> + __le32 off2; /* 4: offset in unit of fsblksize */
> + __le24 len; /* 3: length in unit of fsblksize */
> + u8 addr1; /* 1: address in unit of fsblksize */
> + __le32 addr2; /* 4: address in unit of fsblksize */
> +} xad_t; /* (16) */
>
> #define MAXXLEN ((1 << 24) - 1)
>
>
Note that before the :24 bit-field was kept packed but now
with the use of struct at the __le24 definition it might
choose to pad them.
Chris you might want to change the definitions at linux/types.h
to:
typedef struct { __u8 b[3]; } __be24, __le24 __packed;
With gcc it will not help with the proceeding fields, and the
containing struct will need it's own "__packed" declaration
but it will keep it packed with previous fields.
Just my $0.017
Boaz
next prev parent reply other threads:[~2008-09-10 16:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-05 16:57 [PATCH 1/3] 24-bit types: typedef and macros for accessing 3-byte arrays as integers Chris Leech
2008-09-05 16:57 ` Chris Leech
[not found] ` <20080905165732.16689.50256.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-09-05 16:57 ` [PATCH 2/3] 24-bit types: convert iSCSI to use the __be24 type and macros Chris Leech
2008-09-05 16:57 ` Chris Leech
[not found] ` <20080905165738.16689.31487.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-09-05 17:03 ` Mike Christie
2008-09-05 17:03 ` [Open-FCoE] " Mike Christie
2008-09-05 16:57 ` [PATCH 3/3] 24-bit types: Convert Open-FCoE to use " Chris Leech
2008-09-05 16:57 ` Chris Leech
2008-09-07 9:36 ` [PATCH 1/3] 24-bit types: typedef and macros for accessing 3-byte arrays as integers Boaz Harrosh
2008-09-07 15:56 ` Chris Leech
2008-09-07 17:21 ` Boaz Harrosh
2008-09-07 17:52 ` Chris Leech
2008-09-09 22:59 ` [PATCH] 24-bit types: typedef and functions " Chris Leech
2008-09-10 12:57 ` Boaz Harrosh
2008-09-07 9:57 ` [PATCH 1/3] 24-bit types: typedef and macros " Boaz Harrosh
2008-09-10 14:07 ` Christoph Hellwig
2008-09-10 15:40 ` Dave Kleikamp
2008-09-10 16:11 ` Boaz Harrosh [this message]
2008-09-10 16:25 ` [PATCH " Boaz Harrosh
[not found] ` <48C7F19D.3080507-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2008-09-10 19:20 ` Dave Kleikamp
2008-09-10 19:20 ` Dave Kleikamp
2008-09-11 8:30 ` Boaz Harrosh
2008-09-11 1:51 ` Chris Leech
2008-09-10 16:25 ` Chris Leech
2008-09-10 17:45 ` [Open-FCoE] " Chris Leech
2008-09-10 18:04 ` Boaz Harrosh
2008-09-10 18:04 ` Boaz Harrosh
2008-09-10 18:23 ` Dave Kleikamp
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=48C7F19D.3080507@panasas.com \
--to=bharrosh@panasas.com \
--cc=christopher.leech@intel.com \
--cc=devel@open-fcoe.org \
--cc=hch@infradead.org \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=shaggy@linux.vnet.ibm.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.