Why doesn't rtems_blkdev_sg_buffer have next pointer?

Chan Kim ckim at etri.re.kr
Fri Jun 19 01:42:09 UTC 2015



> > 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.

Oh, I didn't know that. Thanks.
I should have known the bufnum field of rtems_blkdev_request was the number of sg_buffers linked.

Chan




보낸 사람 : "Gedare Bloom" <gedare at rtems.org>
보낸 날짜 : 2015-06-18 22:13:02 ( +09:00 )
받는 사람 : 김찬 <ckim at etri.re.kr>
참조 : users at rtems.org <users at rtems.org>
제목 : Re: Why doesn't rtems_blkdev_sg_buffer have next pointer?

On Thu, Jun 18, 2015 at 8:16 AM, Chan Kim 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