Re: Need Suggestions

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

 



> 
> And the K&R book on C does successive trimming of an strcpy(),
> and finishes with
> 
> void strcpy(char *a, *b) { while (*a++ = *b++); }
> 
> The thing that's actually used a lot in the Linux kernel that gives
> a lot of C newcomers heartburn is the widespread use of
> structures of function pointers.. For example, this from include/linux/fs.h:
> 
> struct lock_manager_operations {
> 	int (*lm_compare_owner)(struct file_lock *, struct file_lock *);
> 	unsigned long (*lm_owner_key)(struct file_lock *);
> 	fl_owner_t (*lm_get_owner)(fl_owner_t);
> 	void (*lm_put_owner)(fl_owner_t);
> 	void (*lm_notify)(struct file_lock *);	/* unblock callback */
> 	int (*lm_grant)(struct file_lock *, int);
> 	bool (*lm_break)(struct file_lock *);
> 	int (*lm_change)(struct file_lock *, int, struct list_head *);
> 	void (*lm_setup)(struct file_lock *, void **);
> };
> 
> That's the structure definition.  Novice challenge: Find one or more places
> where this structure is initialized, and understand how and why that works.


That kind of stuff is not taught in C programming.  An answer can be
very educating.




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


-- 
So many immigrant groups have swept through our town
that Brooklyn, like Atlantis, reaches mythological
proportions in the mind of the world - RI Safir 1998
http://www.mrbrklyn.com 

DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002
http://www.nylxs.com - Leadership Development in Free Software
http://www2.mrbrklyn.com/resources - Unpublished Archive 
http://www.coinhangout.com - coins!
http://www.brooklyn-living.com 

Being so tracked is for FARM ANIMALS and and extermination camps, 
but incompatible with living as a free human being. -RI Safir 2013


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://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