On Tue, Aug 5, 2008 at 11:41 AM, Rene Herman <[EMAIL PROTECTED]>wrote:
> On 05-08-08 07:51, Prasad Joshi wrote: > > Thanks a lot Rene and Mark, >> >> I am in a phase of learning the Linux Device Drivers. I am trying to write >> a KDB module. This will add a new command in KDB to display the registered >> filesystem specific data. Hence I need a way to read all the registered >> filesystems. >> >> Instead of exporting the function get_filesystem_list() and rebuilding the >> kernel. I used the other function which is exported get_fs_type(char *); ==> >> and in the first call to it I passed sysfs (which is the first filesystem >> registerd, atleast on my machine.) >> >> I got a pointer of type file_system_type and then onwards followed the >> linklist to get the list of other filesystems registerd. >> > > Well, that's not really a lot of use other than as a quick hack I'm afraid. > First, sysfs needn't even be compiled in, second, I doubt you have any > guarentee on ordering even if it is and third, you're racy. > Got it you are correct. Whatever I have done is not the correct way to do it. > > See how get_filesystem_list() grabs a lock to make sure the list is not > changed while you're reading it. You can't provide that guarantee without > grabbing that same lock and you can't do that since it's local to > fs/filesystems.c. > Hmmm, I should use locks, I have not used it. Thanks a lot for letting me know. > > You do need get_filesystem_list(). I have played around with kdb but it was > long ago. It does have parts which are compiled statically into the kernel, > does it not? If so and if this interface is intended to be more than > playground you could provide an indirect kdb interface there that calls > get_filesystem_list(). > I guess that's the best way to do it. Yes, kdb's most part is compiled statically into the kernel. I can export a function in kdb which just calls get_filesystem_list() and returns me the list of filesystems. Thanks Rene, that is what I wanted. Thanks a lot for spending time and guiding. > > Rene. >
