LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 02-02-2011, 12:12 AM   #1
ankur0921
LQ Newbie
 
Registered: May 2009
Posts: 25

Rep: Reputation: 0
Thumbs up Kernel API *get_super (struct block_device *bdev) producing error with Fedora Core 5


Dear All,

Below is a test program, with error produced.I understand that block_device pointer *bd sholuld get initialized.Program should produce initialization error for *bd. Compiler is producing '->'.I am not understanding why ?

Can anybody help me to get this program working fine ?
I have doubt of its working in user space as this program is accessing the kernel resources.

If anybody can provide me working code would be a great help, just to initiate things.Just a working this or any other kernel-API Code, would be a great help.

[#include<stdio.h>
#include</usr/include/sys/vfs.h>
int main()
{
//struct super_block * get_super (struct block_device *bdev);
struct block_device *bd;
printf("Block size in bytes = %ld",*get_super(bd)->s_blocksize);
}]

error:
sp.c: In function ‘main’:
sp.c:7: error: invalid type argument of ‘->’

Thanks & Regards.

ankur

Last edited by ankur0921; 02-02-2011 at 12:19 AM.
 
Old 02-02-2011, 04:24 AM   #2
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,732
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by ankur0921 View Post
I have doubt of its working in user space as this program is accessing the kernel resources.
You need to write a make file for that and then insmod the module:
1. http://tldp.org/LDP/lkmpg/2.6/html/x181.html
2. http://tldp.org/HOWTO/Module-HOWTO/

Quote:
Originally Posted by ankur0921 View Post
Just a working ... any other kernel-API Code, would be a great help.
Check this out:
1. http://www.ibm.com/developerworks/li...s-#ibm-content
2. http://www.ibm.com/developerworks/vi...kernel%20apis,

Last edited by Aquarius_Girl; 02-02-2011 at 04:30 AM. Reason: Added link
 
  


Reply



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] Question about Kernel pid_namespace - struct pid and struct upid sreeharsha.t Linux - Kernel 4 03-19-2010 04:41 AM
Error compiling Linux kernel API headers development LFS krzysz00 Linux From Scratch 3 03-14-2009 04:51 PM
upgrading Fedora Core 3 kernel 2.6.9-1.667 to 2.6.26.3 manually+kernel panic error LinuxLovinNoob Linux - Newbie 7 12-17-2008 08:45 PM
How to get all block device's block_device pointer in kernel yinyang80 Linux - Kernel 0 12-16-2006 06:07 AM
where are the snmp api in Fedora Core 3 ? juan_de_margo Linux - Networking 0 01-10-2005 05:07 AM

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

All times are GMT -5. The time now is 11:48 AM.

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