kopia lustrzana https://gitlab.com/sane-project/website
111 wiersze
4.6 KiB
HTML
111 wiersze
4.6 KiB
HTML
<!-- received="Mon Jan 25 21:33:16 1999 PST" -->
|
|
<!-- sent="Mon, 25 Jan 1999 22:28:39 -0700 (MST)" -->
|
|
<!-- name="Andreas Dilger" -->
|
|
<!-- email="adilger@enel.ucalgary.ca" -->
|
|
<!-- subject="Re: SG_BIG_BUFF woes on Linux" -->
|
|
<!-- id="199901260528.WAA01076@andreas.dilger.net" -->
|
|
<!-- inreplyto="Pine.LNX.3.96.990125102334.27890A-100000@cornea.retina.net" -->
|
|
<title>sane-devel: Re: SG_BIG_BUFF woes on Linux</title>
|
|
<h1>Re: SG_BIG_BUFF woes on Linux</h1>
|
|
<b>Andreas Dilger</b> (<a href="mailto:adilger@enel.ucalgary.ca"><i>adilger@enel.ucalgary.ca</i></a>)<br>
|
|
<i>Mon, 25 Jan 1999 22:28:39 -0700 (MST)</i>
|
|
<p>
|
|
<ul>
|
|
<li> <b>Messages sorted by:</b> <a href="date.html#221">[ date ]</a><a href="index.html#221">[ thread ]</a><a href="subject.html#221">[ subject ]</a><a href="author.html#221">[ author ]</a>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0222.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Previous message:</b> <a href="0220.html">Cory Kempf: "SANE 1.0 broken on FreeBSD-Current"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0222.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Reply:</b> <a href="0222.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|
|
<!-- body="start" -->
|
|
Gerald Turner writes:<br>
|
|
<i>> This function would indeed be nice, but the value is only used once to</i><br>
|
|
<i>> create this structure:</i><br>
|
|
<i>> </i><br>
|
|
<i>> static struct req</i><br>
|
|
<i>> {</i><br>
|
|
<i>> int fd;</i><br>
|
|
<i>> u_int running:1, done:1;</i><br>
|
|
<i>> SANE_Status status;</i><br>
|
|
<i>> size_t *dst_len;</i><br>
|
|
<i>> void *dst;</i><br>
|
|
<i>> struct</i><br>
|
|
<i>> {</i><br>
|
|
<i>> struct sg_header hdr;</i><br>
|
|
<i>> u_int8_t data[SG_BIG_BUFF];</i><br>
|
|
<i>> }</i><br>
|
|
<i>> cdb;</i><br>
|
|
<i>> struct req *next;</i><br>
|
|
<i>> }</i><br>
|
|
<p>
|
|
Not quite true. It appears that SG_BIG_BUFF is also used to set the value:<br>
|
|
<p>
|
|
<i>> #ifdef SG_BIG_BUFF</i><br>
|
|
<i>> # define MAX_DATA SG_BIG_BUFF</i><br>
|
|
<i>> #endif</i><br>
|
|
.<br>
|
|
.<br>
|
|
.<br>
|
|
<i>> int sanei_scsi_max_request_size = MAX_DATA;</i><br>
|
|
<p>
|
|
so it would be possible to have a function which returns this value. If I<br>
|
|
look farther down in sanei_scsi.c, I see that:<br>
|
|
<p>
|
|
#if USE == LINUX_INTERFACE<br>
|
|
if (first_time)<br>
|
|
{<br>
|
|
char buf[32];<br>
|
|
size_t len;<br>
|
|
int fd;<br>
|
|
<p>
|
|
first_time = 0;<br>
|
|
<p>
|
|
fd = open ("/proc/sys/kernel/sg-big-buff", O_RDONLY);<br>
|
|
if (fd > 0 && (len = read (fd, buf, sizeof (buf) - 1)) > 0)<br>
|
|
{<br>
|
|
buf[len] = '\0';<br>
|
|
sanei_scsi_max_request_size = atoi (buf);<br>
|
|
DBG (1, "sanei_scsi_open: sanei_scsi_max_request_size=%d bytes\n",<br>
|
|
sanei_scsi_max_request_size);<br>
|
|
}<br>
|
|
}<br>
|
|
#endif<br>
|
|
<p>
|
|
so it appears we are already doing what everyone wanted to do (ie have<br>
|
|
dynamic SG_BIG_BUFF for Linux), at least partially. However, we still<br>
|
|
have a fixed value for the size of the buffer in req->cdb.data, which<br>
|
|
can easily be changed to req->cdb->data in all occurrences, and simply<br>
|
|
change the type of cdb.data to be *u_int8_t, and malloc cdb.data in <br>
|
|
sanei_scsi_req_enter() and free it in ??? - where are req structs freed?<br>
|
|
<p>
|
|
I'm not 100% sure this will work, since it is possible that the SCSI IOCTL<br>
|
|
which needs the format of the cdb struct as-is. Will have to dig deeper...<br>
|
|
<p>
|
|
Cheers, Andreas<br>
|
|
<pre>
|
|
--
|
|
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
|
|
<<a href="http://www-mddsp.enel.ucalgary.ca/People/adilger/">http://www-mddsp.enel.ucalgary.ca/People/adilger/</a>> hungry?" -- Dogbert
|
|
<p>
|
|
<pre>
|
|
--
|
|
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
|
|
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
|
|
</pre>
|
|
<!-- body="end" -->
|
|
<p>
|
|
<ul>
|
|
<!-- next="start" -->
|
|
<li> <b>Next message:</b> <a href="0222.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Previous message:</b> <a href="0220.html">Cory Kempf: "SANE 1.0 broken on FreeBSD-Current"</a>
|
|
<!-- nextthread="start" -->
|
|
<li> <b>Next in thread:</b> <a href="0222.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<li> <b>Reply:</b> <a href="0222.html">Gerald Turner: "Re: SG_BIG_BUFF woes on Linux"</a>
|
|
<!-- reply="end" -->
|
|
</ul>
|