LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-09-2017, 01:16 PM   #1
bogdann
LQ Newbie
 
Registered: Dec 2017
Posts: 3

Rep: Reputation: Disabled
Block driver sbull


Hi. I need to a simple sample block driver for 4.4.0-101-generic. I've found a sample(sbull) from this link (https://github.com/tatetian/linux-driver-examples), but i get a error:

include/linux/bio.h:237:9: error: incompatible types when assigning to type ‘struct bio_vec *’ from type ‘struct bio_vec’ ((bvl = bio_iter_iovec((bio), (iter))), 1);

include/linux/bio.h:238:45: error: request for member ‘bv_len’ in something not a structure or union bio_advance_iter((bio), &(iter), (bvl).bv_len))

Or maybe someone has a simple sample?
 
Old 12-17-2017, 12:28 AM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,400

Rep: Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584
seeing as the code on that github page is 4 years out of date and was last updated for the 3.2 kernel

trying to use that on a 4.? kernel will not work out well


please describe exactly what you need to do
 
Old 12-17-2017, 12:48 PM   #3
bogdann
LQ Newbie
 
Registered: Dec 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
I need a simple example of block driver (I'm a new on linux), which can work on 4.4.

Last edited by bogdann; 12-17-2017 at 12:50 PM.
 
Old 12-17-2017, 04:07 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,684

Rep: Reputation: 230Reputation: 230Reputation: 230
You can start from this driver: https://elixir.free-electrons.com/li...rs/block/brd.c

It's a mainline one so does work and that's the less complicated I could find for block devices. You can probably remove most of the code, but it depends on what you need.

If you have problems understanding the driver, let us know with the fragment that is difficult.
 
1 members found this post helpful.
Old 12-21-2017, 06:37 AM   #5
bogdann
LQ Newbie
 
Registered: Dec 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Thank you! It was very helpful!
 
Old 12-22-2017, 09:52 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171Reputation: 3171
I suggest that you install the "kernel source" packages for the kernel that you have, and examine the block-driver implementations that you will find there.

"Kit-bashing" is a time-honored way of doing things like this. Find an existing, up-to-date piece of kernel code that is very close to what you need. Copy it to your working-directory, put it under git version-control, and begin bashing it to become whatever you need, "committing" your changes frequently.

Use version-control "branches" as necessary when you want to experiment with this-or-that. Until finally you get it right. The version-control system can tell you exactly what you did to get from start to finish, and makes it possible for you to reliably get back to any other or previous state.

Last edited by sundialsvcs; 12-22-2017 at 09:53 AM.
 
Old 12-28-2017, 04:43 PM   #7
dr.SysMan
LQ Newbie
 
Registered: Dec 2017
Location: Sain-Petersburg
Distribution: Ubuntu
Posts: 13

Rep: Reputation: Disabled
Quote:
Originally Posted by bogdann View Post
I need a simple example of block driver (I'm a new on linux), which can work on 4.4.
Do your driver will work with the hardware directly or it'd a block layered driver ?
 
Old 11-13-2018, 09:27 AM   #8
dr.SysMan
LQ Newbie
 
Registered: Dec 2017
Location: Sain-Petersburg
Distribution: Ubuntu
Posts: 13

Rep: Reputation: Disabled
Quote:
Originally Posted by bogdann View Post
I need a simple example of block driver (I'm a new on linux), which can work on 4.4.
Take a look to:
https://github.com/SysMan-One/DUDRIVER
 
  


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
Block device driver beandigital Programming 2 02-07-2013 02:22 PM
more linux development newbie questions about sbull.c eantoranz Programming 3 12-05-2010 11:41 AM
block driver warning... archanac07 Linux - Software 1 02-02-2010 05:11 PM
linux block driver code archanac07 Linux - Software 1 01-22-2010 12:25 PM
Difference between the NAND and the SD block driver viswesh530 Linux - General 1 12-09-2009 04:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 02:55 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration