I will look detail into what you mentioned.Thanks again

BR,
Wang Yan

2009/10/3 Yan Wang <[email protected]>

> First, thanks for all your suggestion.I will learn more
>
> 2009/10/2 Ed Cashin <[email protected]>
>
> Yan Wang <[email protected]> writes:
>>
>> > I wrote a piece of code trying to print all the mount point in the
>> system.
>> > But the is a issue with this code, when install this module to kernel it
>> premot
>> > a "Segmentation fault . [cid]
>> > From my understanding the vfsmount->mnt_list should be a loop.
>> > Anyone could help me on this issue?
>> >
>> > I post my code here, hope someone could help me:
>>
>> Hi, Yan Wang.  I have two suggestions.  One is to adopt the
>> recommendations in Documentation/CodingStyle, so that it is easier for
>> folks in this forum to help you.
>>
>> The second suggestion is to adopt Linux kernel idioms when possible.
>> If you search the kernel for instances where mnt_list is used, you
>> will find stuff like this, in kernel/audit_tree.c:
>>
>>        list_for_each_entry(mnt, &list, mnt_list) {
>>                if (mnt->mnt_root->d_inode == inode) {
>>                        node->index &= ~(1U<<31);
>>                        break;
>>                }
>>        }
>>
>> ... and this, in fs/namespace.c:
>>
>>        struct vfsmount *mnt = list_entry(v, struct vfsmount, mnt_list);
>>
>> Using the list macros will probably help you avoid bugs, but it will
>> certainly help you interact with the Linux kernel community
>> more efficiently.
>>
>> --
>>  Ed Cashin <[email protected]>
>>  http://noserose.net/e/
>>  http://www.coraid.com/
>>
>>
>> --
>> To unsubscribe from this list: send an email with
>> "unsubscribe kernelnewbies" to [email protected]
>> Please read the FAQ at http://kernelnewbies.org/FAQ
>>
>>
>

Reply via email to