kopia lustrzana https://gitlab.com/sane-project/website
158 wiersze
5.9 KiB
HTML
158 wiersze
5.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
|
|
"http://www.w3.org/TR/REC-html40/loose.dtd">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE>sane-devel: Re: scsi buffer size handling for backends</TITLE>
|
|
<META NAME="Author" CONTENT="abel deuring (a.deuring@satzbau-gmbh.de)">
|
|
<META NAME="Subject" CONTENT="Re: scsi buffer size handling for backends">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
<H1>Re: scsi buffer size handling for backends</H1>
|
|
<!-- received="Sat Feb 5 07:52:32 2000" -->
|
|
<!-- isoreceived="20000205155232" -->
|
|
<!-- sent="Sat, 05 Feb 2000 16:39:18 +0100" -->
|
|
<!-- isosent="20000205153918" -->
|
|
<!-- name="abel deuring" -->
|
|
<!-- email="a.deuring@satzbau-gmbh.de" -->
|
|
<!-- subject="Re: scsi buffer size handling for backends" -->
|
|
<!-- id="389C4426.9B5559F4@satzbau-gmbh.de" -->
|
|
<!-- inreplyto="389BD5C4.43577948@wolfsburg.de" -->
|
|
<STRONG>From:</STRONG> abel deuring (<A HREF="mailto:a.deuring@satzbau-gmbh.de?Subject=Re:%20scsi%20buffer%20size%20handling%20for%20backends&In-Reply-To=<389C4426.9B5559F4@satzbau-gmbh.de>"><EM>a.deuring@satzbau-gmbh.de</EM></A>)<BR>
|
|
<STRONG>Date:</STRONG> Sat Feb 05 2000 - 07:39:18 PST
|
|
<P>
|
|
<!-- next="start" -->
|
|
<LI><STRONG>Next message:</STRONG> <A HREF="0050.html">Bernd Schroeder: "Re: Failure to recognize Microtek ScanMaker V310"</A>
|
|
<UL>
|
|
<LI><STRONG>Previous message:</STRONG> <A HREF="0048.html">Yuri Dario: "Re: fork or pthread for async I/O?"</A>
|
|
<LI><STRONG>In reply to:</STRONG> <A HREF="0046.html">Oliver Rauch: "scsi buffer size handling for backends"</A>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
<LI><STRONG>Messages sorted by:</STRONG>
|
|
<A HREF="date.html#49">[ date ]</A>
|
|
<A HREF="index.html#49">[ thread ]</A>
|
|
<A HREF="subject.html#49">[ subject ]</A>
|
|
<A HREF="author.html#49">[ author ]</A>
|
|
</UL>
|
|
<HR NOSHADE><P>
|
|
<!-- body="start" -->
|
|
<P>
|
|
Oliver Rauch wrote:
|
|
<BR>
|
|
<EM>>
|
|
</EM><BR>
|
|
<EM>> Hi,
|
|
</EM><BR>
|
|
<EM>>
|
|
</EM><BR>
|
|
<EM>> there has changed a lot in the scsi buffer size handling in the past
|
|
</EM><BR>
|
|
<EM>> and I watched at it with one eye.
|
|
</EM><BR>
|
|
<EM>>
|
|
</EM><BR>
|
|
<EM>> Can someone tell me what must be done to implement it in a backend?
|
|
</EM><BR>
|
|
<EM>> Is it already really stable and will the interface keep the same in the future?
|
|
</EM><BR>
|
|
<P>The simplest way to change the buffer size for existing backends, is to
|
|
<BR>
|
|
set the environment variable SANE_SG_BUFFERSIZE. If an SG driver >= 2.0
|
|
<BR>
|
|
is installed, sanei_scsi_open tries to allocate a buffer of the size
|
|
<BR>
|
|
specified in that variable. Technically, sanei_scsi_max_request_size is
|
|
<BR>
|
|
set to this value.
|
|
<BR>
|
|
<P>A problem with this approach is the following: Most backends open device
|
|
<BR>
|
|
files in sane_init (or in a fucntion called from sane_init) to detect
|
|
<BR>
|
|
the scanner model, and to set up the "usual internal stuff". Here, a
|
|
<BR>
|
|
backend might allocate buffers, where the buffer size is based on the
|
|
<BR>
|
|
value of sanei_scsi_max_request_size. Then, the device files are closed.
|
|
<BR>
|
|
When a scan is started, the device file is opened again. This means,
|
|
<BR>
|
|
that the SG driver needs again to allocate its internal buffer, and it
|
|
<BR>
|
|
can happen, that it cannot allocate as much memory as requested.
|
|
<BR>
|
|
Therefore, sanei_scsi_open will fail, if this happens. Otherwise,
|
|
<BR>
|
|
sanei_scsi_max_request_size would not be constant during program run
|
|
<BR>
|
|
time, and I was afraid, that this might crashes with some backends.
|
|
<BR>
|
|
<P>Practically, one should not choose too larger buffer sizes for the old
|
|
<BR>
|
|
open call, since for larger buffers there increasing probability that
|
|
<BR>
|
|
the SG driver cannot allocate the requested amount of memory.
|
|
<BR>
|
|
<P>Regarding switching to sanei_scsi_open_extended, the main task is to get
|
|
<BR>
|
|
rid of sanei_scsi_max_request_size in the backend's sources, and to
|
|
<BR>
|
|
replace it with the value returned in int *buffersize (the last argument
|
|
<BR>
|
|
of sanei_scsi_open_extended). All mallocs and related stuff should be
|
|
<BR>
|
|
based on the actual value of that variable. The practical aspects of
|
|
<BR>
|
|
this work can be a little bit nasty: I was quite surprised when I
|
|
<BR>
|
|
discovered, at how many occasions the Sharp backend used this variable,
|
|
<BR>
|
|
and "cleaning" the backend from it took some time.
|
|
<BR>
|
|
<P>A more formal problem I saw in sanei_scsi.c, is the function
|
|
<BR>
|
|
sanei_scsi_req_flush_all. This function "eats" _all_ queued SCSI
|
|
<BR>
|
|
commands, without checking the destination device. Right now, this does
|
|
<BR>
|
|
not hurt, but it would cause trouble for a frontend which is able to
|
|
<BR>
|
|
operate more that one scanner simultaneously. (yes, that's a quite
|
|
<BR>
|
|
theoretical question, but on the other hand, all backends seem to be
|
|
<BR>
|
|
able to handle more than one scanner.)
|
|
<BR>
|
|
<P>Abel
|
|
<BR>
|
|
<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?Subject=Re:%20scsi%20buffer%20size%20handling%20for%20backends&In-Reply-To=<389C4426.9B5559F4@satzbau-gmbh.de>">majordomo@mostang.com</A>
|
|
</PRE>
|
|
<P><!-- body="end" -->
|
|
<HR NOSHADE>
|
|
<UL>
|
|
<!-- next="start" -->
|
|
<LI><STRONG>Next message:</STRONG> <A HREF="0050.html">Bernd Schroeder: "Re: Failure to recognize Microtek ScanMaker V310"</A>
|
|
<LI><STRONG>Previous message:</STRONG> <A HREF="0048.html">Yuri Dario: "Re: fork or pthread for async I/O?"</A>
|
|
<LI><STRONG>In reply to:</STRONG> <A HREF="0046.html">Oliver Rauch: "scsi buffer size handling for backends"</A>
|
|
<!-- nextthread="start" -->
|
|
<!-- reply="end" -->
|
|
<LI><STRONG>Messages sorted by:</STRONG>
|
|
<A HREF="date.html#49">[ date ]</A>
|
|
<A HREF="index.html#49">[ thread ]</A>
|
|
<A HREF="subject.html#49">[ subject ]</A>
|
|
<A HREF="author.html#49">[ author ]</A>
|
|
</UL>
|
|
<!-- trailer="footer" -->
|
|
<HR NOSHADE>
|
|
<P>
|
|
<SMALL>
|
|
<EM>
|
|
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
|
|
: <EM>Sat Feb 05 2000 - 07:54:11 PST</EM>
|
|
</EM>
|
|
</SMALL>
|
|
</BODY>
|
|
</HTML>
|