Not quite true. It appears that SG_BIG_BUFF is also used to set the value:
> #ifdef SG_BIG_BUFF
> # define MAX_DATA SG_BIG_BUFF
> #endif
.
.
.
> int sanei_scsi_max_request_size = MAX_DATA;
so it would be possible to have a function which returns this value. If I
look farther down in sanei_scsi.c, I see that:
#if USE == LINUX_INTERFACE
if (first_time)
{
char buf[32];
size_t len;
int fd;
first_time = 0;
fd = open ("/proc/sys/kernel/sg-big-buff", O_RDONLY);
if (fd > 0 && (len = read (fd, buf, sizeof (buf) - 1)) > 0)
{
buf[len] = '\0';
sanei_scsi_max_request_size = atoi (buf);
DBG (1, "sanei_scsi_open: sanei_scsi_max_request_size=%d bytes\n",
sanei_scsi_max_request_size);
}
}
#endif
so it appears we are already doing what everyone wanted to do (ie have
dynamic SG_BIG_BUFF for Linux), at least partially. However, we still
have a fixed value for the size of the buffer in req->cdb.data, which
can easily be changed to req->cdb->data in all occurrences, and simply
change the type of cdb.data to be *u_int8_t, and malloc cdb.data in
sanei_scsi_req_enter() and free it in ??? - where are req structs freed?
I'm not 100% sure this will work, since it is possible that the SCSI IOCTL
which needs the format of the cdb struct as-is. Will have to dig deeper...
Cheers, Andreas
-- Andreas Dilger University of Calgary \ "If a man ate a pound of pasta and Micronet Research Group \ a pound of antipasto, would they Dept of Electrical & Computer Engineering \ cancel out, leaving him still <http://www-mddsp.enel.ucalgary.ca/People/adilger/> hungry?" -- Dogbert
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com