LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2011, 08:38 AM   #1
ankur0921
LQ Newbie
 
Registered: May 2009
Posts: 25

Rep: Reputation: 0
Thumbs up Accessing and performing operations on Base level kernel structure


Dear All,

We all know linux kernel base layer is made up of structures, in which every object of kernel is well defined. Structure members correspond to object properties required to define object behavior.

For example if we take case of File system.It composed of four objects , superblock objects, inode objects, file objects and dentry object.Each having well defined structure which is being operated by system call handler and by system call service routine in the kernel mode.

Now my question is even in kernel mode we do not have some mechanism by which we can get access to pointer of these structures.We have some macro.

If I want to manipulate structure on my on way, or performing some more operation defined by me.For example after the crash of Hard Disk Drive, having ext2/3 file system, If i want to know all the inode pointers, and block details.

Can I have some way out to do desired operation ??

Can anybody suggest me some mechanism to operate on these base label structures, even in kernel mode ..

All suggestions are welcomed.

Thanks & Regards.

Ankur

Last edited by ankur0921; 01-20-2011 at 08:40 AM.
 
Old 01-20-2011, 11:45 AM   #2
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
You need a Linux kernel debugger, for example kdb, and a kernel with debugging enabled (CONFIG_KDB=y). If you have a serial or ethernet connection to another machine, you can also use kgdb from the other machine. The starting point for further Linux kernel debugging information is here.

Hope this helps,
Nominal Animal

Last edited by Nominal Animal; 03-21-2011 at 06:09 AM.
 
Old 01-23-2011, 12:54 AM   #3
ankur0921
LQ Newbie
 
Registered: May 2009
Posts: 25

Original Poster
Rep: Reputation: 0
Dear Nominal Animal,

Thanks for the information, you have provided.But All this I knew earlier.I asked how to take base level structure pointers under our control to perform desired task ?

If you knew please help me in this regard.

Ankur
 
Old 01-23-2011, 04:32 AM   #4
Nominal Animal
Senior Member
 
Registered: Dec 2010
Location: Finland
Distribution: Xubuntu, CentOS, LFS
Posts: 1,723
Blog Entries: 3

Rep: Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948Reputation: 948
Quote:
Originally Posted by ankur0921 View Post
Now my question is even in kernel mode we do not have some mechanism by which we can get access to pointer of these structures.We have some macro.

If I want to manipulate structure on my on way, or performing some more operation defined by me.
I don't really understand what you mean; a macro is a perfectly useful mechanism. I assume you have read Documentation/kdb.mm (part of KDB patches), which describes how to access those structures using KDB. There may be ready-made KDB "packages" (macros for KDB) that let you access the structures in an easier manner, but in any case, you can unravel the kernel macros yourself and do the necessary accesses directly yourself.

One way you can unravel the kernel access macros and inline functions is to write a small test function, and compile it to symbolic assembly in the kernel tree.

Perhaps you can give a more detailed description on what you actually want to accomplish?
Nominal Animal

Last edited by Nominal Animal; 03-21-2011 at 06:01 AM.
 
Old 01-26-2011, 12:53 AM   #5
ankur0921
LQ Newbie
 
Registered: May 2009
Posts: 25

Original Poster
Rep: Reputation: 0
Thumbs up

Dear Nominal Animal,

I am struggling with the installation of KDB with Fedora Core 5.In fact I am not getting the proper documentation of KDB.Even stated on the sgi website or stated by you.It would be a great help if you can provide me the link of documentation you have stated.Or it you have some good documents, please do the great favor by mailing me at smile.ankur@gmail.com.

It would be a great help in my work.

Thanks and Regards.

Ankur
 
Old 01-26-2011, 04:58 AM   #6
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,732
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Does this help a bit: http://bobcares.com/blog/?p=188 for installation of Kdb?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] syntax error in accessing a structure jamesbon Programming 2 09-26-2010 08:06 AM
accessing SPI from kernel level and user level ramya_ts Programming 1 01-06-2009 07:30 AM
lowest level of interrupt handling in kernel ashok449 Linux - Kernel 6 07-28-2008 08:44 AM
Linux: get low-level file structure information in userspace using C sam_vde Programming 6 07-25-2008 04:42 PM
error in accessing structure variable in kernel modules dypgrp Programming 3 01-17-2005 07:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration