Re: Why use "." in the struct in this way?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29 July 2013 17:56, lx <lxlenovostar@xxxxxxxxx> wrote:
> hi all:
>        why use the struct in this way by "."
>
> for example, .owner instead of owner , why?
> Thank you.
>
> 1203 static struct file_system_type ext2_fs_type = {
> 1204         .owner          = THIS_MODULE,
> 1205         .name           = "ext2",
> 1206         .get_sb         = ext2_get_sb,
> 1207         .kill_sb        = kill_block_super,
> 1208         .fs_flags       = FS_REQUIRES_DEV,
> 1209 };
> 1210


If you notice the definition of struct file_system_type [1], you will
see that the structure has more fields than you are initiating. In
this case, you just want to refer to some of the fields in the
structure.
You either give all fields a value (in order), or use the .field to
just refer to a single field and set a value for it.

[1] http://lxr.oss.org.cn/source/include/linux/fs.h?v=2.6.16#L1240

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux