kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Linux 4 block device driver infrastructure
@ 2023-11-30 16:06 Alexandru Goia
  2023-11-30 16:41 ` Fwd: " Alexandru Goia
  2023-12-08  1:25 ` jim.cromie
  0 siblings, 2 replies; 3+ messages in thread
From: Alexandru Goia @ 2023-11-30 16:06 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 955 bytes --]

Greetings !

I am a Unix/Linux hobbyist from Romania, interested in kernel stuff.
I need some clarifications, related to block device subsystem in Linux 4,
so I will ask them here, if you can answer me, please...

1) Why (in Linux 4) in struct block_device_operations, the (*open)(struct
block_device *, fmode_t)
has a different signature than the (*release)(struct gendisk *, fmode_t) ?
Why open()
uses block_device, while release() uses gendisk ? They are both in a struct
block_device_operations. Why they not refer to the same thing ?

I understand that gendisk refer to a real disk, and block_device (s) to
logical disk (s)
and partitions. But why the kernel developers have chosen to use different
signatures ?

2) Release() is also synonim to close() ?
3) Why is not explicitely present a close() function ?
4) Why struct gendisk does not have inside it pointers to struct
block_device ?

Thank you very much,
Alexander,
Computer hobbyist,
Romania

[-- Attachment #1.2: Type: text/html, Size: 1352 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Fwd: Linux 4 block device driver infrastructure
  2023-11-30 16:06 Linux 4 block device driver infrastructure Alexandru Goia
@ 2023-11-30 16:41 ` Alexandru Goia
  2023-12-08  1:25 ` jim.cromie
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandru Goia @ 2023-11-30 16:41 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1112 bytes --]

Buna ziua,

Mai jos este un email scris in engleza pentru dezvoltatorii Linux.
Imi puteti raspunde la el, va rog frumos ?

Cu multe multumiri !
Alexandru



Greetings !

I am a Unix/Linux hobbyist from Romania, interested in kernel stuff.
I need some clarifications, related to block device subsystem in Linux 4,
so I will ask them here, if you can answer me, please...

1) Why (in Linux 4) in struct block_device_operations, the (*open)(struct
block_device *, fmode_t)
has a different signature than the (*release)(struct gendisk *, fmode_t) ?
Why open()
uses block_device, while release() uses gendisk ? They are both in a struct
block_device_operations. Why they not refer to the same thing ?

I understand that gendisk refer to a real disk, and block_device (s) to
logical disk (s)
and partitions. But why the kernel developers have chosen to use different
signatures ?

2) Release() is also synonim to close() ?
3) Why is not explicitely present a close() function ?
4) Why struct gendisk does not have inside it pointers to struct
block_device ?

Thank you very much,
Alexander,
Computer hobbyist,
Romania

[-- Attachment #1.2: Type: text/html, Size: 1649 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux 4 block device driver infrastructure
  2023-11-30 16:06 Linux 4 block device driver infrastructure Alexandru Goia
  2023-11-30 16:41 ` Fwd: " Alexandru Goia
@ 2023-12-08  1:25 ` jim.cromie
  1 sibling, 0 replies; 3+ messages in thread
From: jim.cromie @ 2023-12-08  1:25 UTC (permalink / raw)
  To: Alexandru Goia; +Cc: kernelnewbies

On Thu, Nov 30, 2023 at 9:08 AM Alexandru Goia
<goia.i.alexandru@gmail.com> wrote:
>
> Greetings !
>
> I am a Unix/Linux hobbyist from Romania, interested in kernel stuff.
> I need some clarifications, related to block device subsystem in Linux 4,
> so I will ask them here, if you can answer me, please...
>
> 1) Why (in Linux 4) in struct block_device_operations, the (*open)(struct block_device *, fmode_t)
> has a different signature than the (*release)(struct gendisk *, fmode_t) ? Why open()
> uses block_device, while release() uses gendisk ? They are both in a struct
> block_device_operations. Why they not refer to the same thing ?
>

in linux current, its not like that:

struct block_device_operations {
        void (*submit_bio)(struct bio *bio);
        int (*poll_bio)(struct bio *bio, struct io_comp_batch *iob,
                        unsigned int flags);
        int (*open)(struct gendisk *disk, blk_mode_t mode);
        void (*release)(struct gendisk *disk);

Old books are still useful, but new code is a much better place to look.



> I understand that gendisk refer to a real disk, and block_device (s) to logical disk (s)
> and partitions. But why the kernel developers have chosen to use different signatures ?
>
> 2) Release() is also synonim to close() ?
> 3) Why is not explicitely present a close() function ?
> 4) Why struct gendisk does not have inside it pointers to struct block_device ?
>
> Thank you very much,
> Alexander,
> Computer hobbyist,
> Romania
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-08  1:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-30 16:06 Linux 4 block device driver infrastructure Alexandru Goia
2023-11-30 16:41 ` Fwd: " Alexandru Goia
2023-12-08  1:25 ` jim.cromie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).