[lkml]   [2009]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Re: [PATCH] btrfs: Simplify offset calculation method for ctree.h
sniper wrote:
> No, many pointers in btrfs function arguments are not pointing to an
> absolute address, but relative to the start address of extent.
> Take following function as example, argument inode_item is an offset
> value to the beginning of leaf. So we can't reach its member with
> &inode_item->xxx

Notice that we are not reach its member, we are getting pointer of its
member with &inode_item->mtime.
This operation have same effect as old one.


>> static inline struct btrfs_timespec *
>> btrfs_inode_mtime(struct btrfs_inode_item *inode_item)
>> {
>> - unsigned long ptr = (unsigned long)inode_item;
>> - ptr += offsetof(struct btrfs_inode_item, mtime);
>> - return (struct btrfs_timespec *)ptr;
>> + return &inode_item->mtime;
>> }

 \ /
  Last update: 2009-12-18 06:51    [W:0.044 / U:2.196 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site