From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 04 07:34:57 2018 Received: (at 30604) by debbugs.gnu.org; 4 Mar 2018 12:34:57 +0000 Received: from localhost ([127.0.0.1]:43516 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1esSqv-0005nq-KX for submit@debbugs.gnu.org; Sun, 04 Mar 2018 07:34:57 -0500 Received: from dd26836.kasserver.com ([85.13.145.193]:35974) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1esSqs-0005nh-VM for 30604@debbugs.gnu.org; Sun, 04 Mar 2018 07:34:55 -0500 Received: from localhost (77.118.231.171.wireless.dyn.drei.com [77.118.231.171]) by dd26836.kasserver.com (Postfix) with ESMTPSA id D0C543367616; Sun, 4 Mar 2018 13:34:52 +0100 (CET) Date: Sun, 4 Mar 2018 13:34:44 +0100 From: Danny Milosavljevic To: ludo@gnu.org (Ludovic =?ISO-8859-1?Q?Court=E8s?=) Subject: Re: [bug#30604] [PATCH v8 3/7] linux-boot: Load kernel modules only when the hardware is present. Message-ID: <20180304133444.4edceecd@scratchpost.org> In-Reply-To: <87sh9g4vy1.fsf@gnu.org> References: <20180302153408.14091-1-dannym@scratchpost.org> <20180303135533.6112-1-dannym@scratchpost.org> <20180303135533.6112-4-dannym@scratchpost.org> <87sh9g4vy1.fsf@gnu.org> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/war/2NgU7F4a1M/YUNS3K5e"; protocol="application/pgp-signature" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 30604 Cc: 30604@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --Sig_/war/2NgU7F4a1M/YUNS3K5e Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Ludo, I've been thinking about it some more - I think it can be made to work "you= r" way. I'm trying to integrate it right now. But! The module-aliases->module-file-names way I've been pursuing (which a= lso returns the recursive dependencies) has the advantage of using exactly the = same procedure for both flat-linux-module-directory (which copies files) and for our modprobe (which loads them later). This means that it's very likely these two will match. But if load-linux-module* recursively loads modules on its own it's easily possible that these will diverge - what flat-linux-module-directory is doing could (accidentially) differ in the future. Maybe that's overly defensive programming. What do you think? My flat-linux-module-directory basically just returns a subset of the direc= tory tree it gets as parameter (and flattens it for no reason). Also, I've been trying to use find-files for /sys before, like you do. It doesn't work correctly - probably because of the mutation that modprobe = does (find-files sorts - not sure whether that's the whole story). Integration tests just finished - even the basic system test fails because = of it now. I tried only this: (define (load-kernel-modules) "Examine /sys/devices to find out which modules to load and load them." - (define enter? - (const #t)) - (define (down! directory stat result) - ;; Note: modprobe mutates the tree starting with DIRECTORY. - (let ((modalias-name (string-append directory "/modalias"))) - (if (file-exists? modalias-name) - (let ((modalias - (string-trim-right (call-with-input-file modalias-name - read-string) - #\newline))) - (system* "/sbin/modprobe" "-q" "--" modalias)))) - #t) - (define up - (const #t)) - (define skip - (const #t)) - (define leaf - (const #t)) - (define (error name stat errno result) - (format (current-error-port) "warning: ~a: ~a~%" - name (strerror errno)) - result) - (file-system-fold enter? leaf down! up skip error #t "/sys/devices")) + (for-each (lambda (modalias) + (system* "/sbin/modprobe" "-q" "--" modalias)) + (system-device-aliases))) Doesn't work anymore... ERROR: In procedure network-interface-flags: In procedure network-interface-flags: No such device (I've exported system-device-aliases) --Sig_/war/2NgU7F4a1M/YUNS3K5e Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlqb5+QACgkQ5xo1VCww uqXJ9wf/UFzvHkvHtXvKpynbANSL48kLwGHYSKetR6r353nTtySJZV0kVrRf6aEk eLZnfbjOFX1Y7cQYKPgiC4/lg5JbqxWkWNR0R1zNQvUgXByL8hxfkuZYtwWE7z5G Buw/dZBJNdRcG8ZlaOw6r88bhD3CtnceI+XhcqH6sOGud2Bef3cn8HO2gLeA5vi9 DOmeXM1wlP45eYxZ+FNKRJ7WXQwsnGo3WTwowpttZQdA0p80BKmjy+7Jv2DOW3D9 z8lfZ/yHeOQkW1PE7vi0TsjTKy1ryFSBfI37MMcOfmFgenkMKG4K/+c9rMUPltGi 0rBPw7P1HKqxQAXWYaISS3MpQRrvpQ== =uxOr -----END PGP SIGNATURE----- --Sig_/war/2NgU7F4a1M/YUNS3K5e--