Sunday, February 20, 2022

[SOLVED] Retrieving bytes from scatterlist

Issue

Given

int *text = "string_test";

We know that

sg_set_buf(struct scatterlist *sg, const void *buf, unsigned int buflen)

include/linux/scatterlist.h

If we do

  sg_set_buf(req.src, text, strlen(text));

How do we retrieve text bytes from the scatterlist?


Solution

I could solve the problem using:

char *buf;
buf = sg_virt (sg);


Answered By - Moirisa Dikaiosýni
Answer Checked By - David Marino (WPSolving Volunteer)