From: Linus Torvalds <torvalds@osdl.org>
To: Evgeniy <dushistov@mail.ru>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2.6.15] ufs cleanup
Date: Fri, 13 Jan 2006 11:51:28 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0601131144520.13339@g5.osdl.org> (raw)
In-Reply-To: <20060113190524.GA31715@rain.homenetwork>
On Fri, 13 Jan 2006, Evgeniy wrote:
> +static inline struct ufs_super_block_second *
> +ubh_get_usb_second(struct ufs_sb_private_info *uspi)
> +{
> + char *res=uspi->s_ubh.bh[UFS_SECTOR_SIZE >> uspi->s_fshift]->b_data +
> + (UFS_SECTOR_SIZE & ~uspi->s_fmask);
> + return (struct ufs_super_block_second *)res;
> +}
I was thinking of something even more abstracted:
static inline void *get_usb_offset(struct ufs_sb_private_info *uspi,
unsigned int offset)
{
unsigned int index;
index = offset >> uspi->s_fshift;
offset &= ~uspi->s_fmask;
return uspi->s_ubh.bh[index]->b_data + offset;
}
and then just doing
#define ubs_get_usb_first(uspi) \
((struct ufs_super_block_first *)get_usb_offset(uspi, 0))
#define ubh_get_usb_second(uspi) \
((struct ufs_super_block_second *)get_usb_offset(uspi, UFS_SECTOR_SIZE))
#define ubh_get_usb_third(uspi) \
((struct ufs_super_block_third *)get_usb_offset(uspi, 2*UFS_SECTOR_SIZE))
or something similar. Which seems a hell of a lot more readable to me, and
assuming it passes testing (ie I didn't screw up), I think it's more
likely to stay correct in the future and just generally be maintainable.
Hmm?
Linus
next prev parent reply other threads:[~2006-01-13 19:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-13 0:54 Oops in ufs_fill_super at mount time Alexey Dobriyan
2006-01-13 1:14 ` Linus Torvalds
2006-01-13 10:21 ` Alexey Dobriyan
2006-01-13 15:45 ` Linus Torvalds
2006-01-13 16:36 ` Alexey Dobriyan
2006-01-13 19:05 ` [PATCH 2.6.15] ufs cleanup Evgeniy
2006-01-13 19:51 ` Linus Torvalds [this message]
2006-01-14 8:42 ` [PATCH 2.6.15] ufs cleanup v. 2 Evgeniy
2006-01-13 15:12 ` [PATCH 2.6.15] Re: Oops in ufs_fill_super at mount time Evgeniy
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=Pine.LNX.4.64.0601131144520.13339@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=dushistov@mail.ru \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).