Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 06-12-2005, 07:01 PM   #1
LQ Newbie
Registered: Jan 2004
Posts: 28

Rep: Reputation: 15
C : get drive/partitions list

I'd like to retrieve drives and partitions in C language. I know I can read /proc/partitions (or mtab), but I'd like to learn the C way to access hardware in Linux.
Would you have a link website, book; etc. ?
Thanks for your help.
Old 06-13-2005, 12:37 AM   #2
Registered: Oct 2003
Location: Canada
Distribution: Slackware
Posts: 340

Rep: Reputation: 30

Wait for more experienced programmers, but I think thats a kernel land thing, not a user land thing. It depends what you mean by "access hardware", but generally you'd want to look into kernel programming in C?

I'm just trying to learn the Linux environment at the moment, generally working in user space. You might want to get started with the Linux Kernel Module Programming Guide that I've seen updated lately on tldp.

EDIT: I just looked at the guide a bit more, it might not be the best guide for a single task - like accessing your HDD, but you might still be interested.

Last edited by lowpro2k3; 06-13-2005 at 12:44 AM.
Old 06-13-2005, 12:55 AM   #3
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
Is this helpful?

First site I found on google with partitions ioctl as the search.
Old 06-13-2005, 09:57 AM   #4
LQ Newbie
Registered: Jan 2004
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks, both of you, for your help. I have a good starting point. I'll try and read partitions.c in kernel sources to see how it is done.


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
Ubuntu partitioner doesnt list all partitions ziphnor Ubuntu 1 04-14-2005 11:07 AM
Installing SuSE on an external FireWire drive: YaST can't edit partitions on drive kivimaki Linux - Distributions 2 09-13-2004 08:52 PM
SCSI Hard Drive Not On the List (Installing 10.0) tonylmiller Mandriva 5 05-17-2004 12:36 AM
Creating New Partitions on a Second Drive Flossie Mandriva 1 03-08-2004 06:02 AM
seeing the other partitions on a drive needforspeed Linux - General 2 11-07-2003 10:30 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:09 PM.

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