public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Linus Torvalds <torvalds@transmeta.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	akpm@zip.com.au, Thomas Sailer <sailer@ife.ee.ethz.ch>,
	Jose Orlando Pereira <jop@di.uminho.pt>,
	J.E.J.Bottomley@HansenPartnership.com
Subject: Re: [PATCH] Deprecated exec_usermodehelper, enhance call_usermodehelper
Date: 07 Jan 2003 04:12:18 +0100	[thread overview]
Message-ID: <1041909147.1016.12.camel@pegasus.local> (raw)
In-Reply-To: <20030106053144.083C72C276@lists.samba.org>

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

Hi Rusty,

> OK.  This patch does that.  Thomas, Marcel, James?  This touches code
> I don't use, so although the transformation is fairly trivial...

it looks ok to me, but I like to have the attached patch for the bt3c_cs
driver. My test yesterday was successful and so I vote for inclusion,
like Thomas does.

Regards

Marcel


[-- Attachment #2: patch-2.4.54-bt3c --]
[-- Type: text/x-patch, Size: 2837 bytes --]

diff -urN linux-2.5.54/drivers/bluetooth/bt3c_cs.c linux-2.5.54-mh/drivers/bluetooth/bt3c_cs.c
--- linux-2.5.54/drivers/bluetooth/bt3c_cs.c	Thu Jan  2 04:23:16 2003
+++ linux-2.5.54-mh/drivers/bluetooth/bt3c_cs.c	Mon Jan  6 22:25:30 2003
@@ -24,18 +24,14 @@
 #include <linux/config.h>
 #include <linux/module.h>
 
-#define __KERNEL_SYSCALLS__
-
 #include <linux/kernel.h>
 #include <linux/kmod.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/sched.h>
-#include <linux/delay.h>
 #include <linux/timer.h>
 #include <linux/errno.h>
-#include <linux/unistd.h>
 #include <linux/ptrace.h>
 #include <linux/ioport.h>
 #include <linux/spinlock.h>
@@ -405,7 +401,6 @@
 
 
 
-
 /* ======================== HCI interface ======================== */
 
 
@@ -489,65 +484,23 @@
 
 
 #define FW_LOADER  "/sbin/bluefw"
-static int errno;
-
-
-static int bt3c_fw_loader_exec(void *dev)
-{
-	char *argv[] = { FW_LOADER, "pccard", dev, NULL };
-	char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
-	int err;
-
-	err = exec_usermodehelper(FW_LOADER, argv, envp);
-	if (err)
-		printk(KERN_WARNING "bt3c_cs: Failed to exec \"%s pccard %s\".\n", FW_LOADER, (char *)dev);
-
-	return err;
-}
 
 
 static int bt3c_firmware_load(bt3c_info_t *info)
 {
-	sigset_t tmpsig;
 	char dev[16];
-	pid_t pid;
-	int result;
+	int err;
 
-	/* Check if root fs is mounted */
-	if (!current->fs->root) {
-		printk(KERN_WARNING "bt3c_cs: Root filesystem is not mounted.\n");
-		return -EPERM;
-	}
+	char *argv[] = { FW_LOADER, "pccard", dev, NULL };
+	char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
 
 	sprintf(dev, "%04x", info->link.io.BasePort1);
 
-	pid = kernel_thread(bt3c_fw_loader_exec, (void *)dev, 0);
-	if (pid < 0) {
-		printk(KERN_WARNING "bt3c_cs: Forking of kernel thread failed (errno=%d).\n", -pid);
-		return pid;
-	}
-
-	/* Block signals, everything but SIGKILL/SIGSTOP */
-	spin_lock_irq(&current->sig->siglock);
-	tmpsig = current->blocked;
-	siginitsetinv(&current->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP));
-	recalc_sigpending();
-	spin_unlock_irq(&current->sig->siglock);
-
-	result = waitpid(pid, NULL, __WCLONE);
-
-	/* Allow signals again */
-	spin_lock_irq(&current->sig->siglock);
-	current->blocked = tmpsig;
-	recalc_sigpending();
-	spin_unlock_irq(&current->sig->siglock);
-
-	if (result != pid) {
-		printk(KERN_WARNING "bt3c_cs: Waiting for pid %d failed (errno=%d).\n", pid, -result);
-		return -result;
-	}
+	err = call_usermodehelper(FW_LOADER, argv, envp, 1);
+	if (err)
+		printk(KERN_WARNING "bt3c_cs: Failed to run \"%s pccard %s\" (errno=%d).\n", FW_LOADER, dev, err);
 
-	return 0;
+	return err;
 }
 
 

  parent reply	other threads:[~2003-01-07  3:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-06  5:31 [PATCH] Deprecated exec_usermodehelper, enhance call_usermodehelper Rusty Russell
2003-01-06 18:39 ` Thomas Sailer
2003-01-07  3:12 ` Marcel Holtmann [this message]
2003-01-10  8:14   ` Rusty Russell
  -- strict thread matches above, loose matches on Subject: below --
2003-01-06  1:47 Rusty Russell
2003-01-06  3:54 ` Linus Torvalds
2003-01-06  4:35   ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1041909147.1016.12.camel@pegasus.local \
    --to=marcel@holtmann.org \
    --cc=J.E.J.Bottomley@HansenPartnership.com \
    --cc=akpm@zip.com.au \
    --cc=jop@di.uminho.pt \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --cc=sailer@ife.ee.ethz.ch \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox