Why doesn't rtems_blkdev_sg_buffer have next pointer?

Gedare Bloom gedare at rtems.org
Thu Jun 18 13:13:00 UTC 2015


On Thu, Jun 18, 2015 at 8:16 AM, Chan Kim <ckim at etri.re.kr> wrote:
> Hi all,
>
> I have a basic question.
> in rtems 4.10.99 version, I see in cpukit/libblock/include/rtems/blkdev.h,
> -------------------------------------
> typedef struct rtems_blkdev_sg_buffer {
> rtems_blkdev_bnum block;             // this seems to be the start block number of this access
> uint32_t length;
> void *buffer;
> void *user;
> } rtems_blkdev_sg_buffer;
>
> typedef struct rtems_blkdev_request {
>   rtems_blkdev_request_op req;
>   rtems_blkdev_request_cb done;
>   void *done_arg;
>   rtems_status_code status;
>   uint32_t bufnum;                       // this seems to be # of blocks
>   rtems_id io_task;
>   rtems_blkdev_sg_buffer        bufs[0];
> } rtems_blkdev_request;
> ---------------------------------------
>
> the rtems_blkdev_request has only a single entry of rtems_blkdev_sg_buffer. But usually scatter-list uses next pointer to link buffers in host memory together. But in rtems, why isn't there such link field? Does the block device request I/O with only a single buffer always?
> Could somebody please answer to this question?
https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html

I seem to be explaining these a lot lately. When you see an array of
size 0 at the end of a struct, it means the programmer has decided to
determine the actual size dynamically.

Gedare

> regards,
>
> Chan Kim
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users


More information about the users mailing list