linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH obexd] Add copy and move support for filesystem plugin
@ 2011-06-21  8:37 Luiz Augusto von Dentz
  2011-06-21  8:37 ` [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb Luiz Augusto von Dentz
  2011-06-28  8:01 ` [PATCH obexd] Add copy and move support for filesystem plugin Johan Hedberg
  0 siblings, 2 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2011-06-21  8:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Move is implemented using rename and copy uses sendfile, both part of
POSIX.
---
 plugins/filesystem.c |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/plugins/filesystem.c b/plugins/filesystem.c
index b4ff556..4b0665f 100644
--- a/plugins/filesystem.c
+++ b/plugins/filesystem.c
@@ -36,6 +36,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/statvfs.h>
+#include <sys/sendfile.h>
 #include <fcntl.h>
 #include <wait.h>
 
@@ -234,6 +235,99 @@ static ssize_t filesystem_write(void *object, const void *buf, size_t count)
 	return ret;
 }
 
+static int filesystem_rename(const char *name, const char *destname)
+{
+	int ret;
+
+	ret = rename(name, destname);
+	if (ret < 0) {
+		error("rename(%s, %s): %s (%d)", name, destname,
+						strerror(errno), errno);
+		return -errno;
+	}
+
+	return ret;
+}
+
+static int sendfile_async(int out_fd, int in_fd, off_t *offset, size_t count)
+{
+	int pid;
+
+	/* Run sendfile on child process */
+	pid = fork();
+	switch (pid) {
+		case 0:
+			break;
+		case -1:
+			error("fork() %s (%d)", strerror(errno), errno);
+			return -errno;
+		default:
+			DBG("child %d forked", pid);
+			return pid;
+	}
+
+	/* At child */
+	if (sendfile(out_fd, in_fd, offset, count) < 0)
+		error("sendfile(): %s (%d)", strerror(errno), errno);
+
+	close(in_fd);
+	close(out_fd);
+
+	exit(errno);
+}
+
+static int filesystem_copy(const char *name, const char *destname)
+{
+	void *in, *out;
+	ssize_t ret;
+	size_t size;
+	struct stat st;
+	int in_fd, out_fd, err;
+
+	in = filesystem_open(name, O_RDONLY, 0, NULL, &size, &err);
+	if (in == NULL) {
+		error("open(%s): %s (%d)", name, strerror(-err), -err);
+		return -err;
+	}
+
+	in_fd = GPOINTER_TO_INT(in);
+	ret = fstat(in_fd, &st);
+	if (ret < 0) {
+		error("stat(%s): %s (%d)", name, strerror(errno), errno);
+		return -errno;
+	}
+
+	out = filesystem_open(destname, O_WRONLY | O_CREAT | O_TRUNC,
+					st.st_mode, NULL, &size, &err);
+	if (out == NULL) {
+		error("open(%s): %s (%d)", destname, strerror(-err), -err);
+		filesystem_close(in);
+		return -errno;
+	}
+
+	out_fd = GPOINTER_TO_INT(out);
+
+	/* Check if sendfile is supported */
+	ret = sendfile(out_fd, in_fd, NULL, 0);
+	if (ret < 0) {
+		ret = -errno;
+		error("sendfile: %s (%zd)", strerror(-ret), -ret);
+		goto done;
+	}
+
+	ret = sendfile_async(out_fd, in_fd, NULL, st.st_size);
+	if (ret < 0)
+		goto done;
+
+	return 0;
+
+done:
+	filesystem_close(in);
+	filesystem_close(out);
+
+	return ret;
+}
+
 struct capability_object {
 	int pid;
 	int output;
@@ -555,6 +649,8 @@ static struct obex_mime_type_driver file = {
 	.read = filesystem_read,
 	.write = filesystem_write,
 	.remove = remove,
+	.move = filesystem_rename,
+	.copy = filesystem_copy,
 };
 
 static struct obex_mime_type_driver capability = {
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
  2011-06-21  8:37 [PATCH obexd] Add copy and move support for filesystem plugin Luiz Augusto von Dentz
@ 2011-06-21  8:37 ` Luiz Augusto von Dentz
  2011-06-21  9:37   ` Li, Nami
  2011-06-28  8:01 ` [PATCH obexd] Add copy and move support for filesystem plugin Johan Hedberg
  1 sibling, 1 reply; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2011-06-21  8:37 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

The callback function actually needs the bluetooth_service structure not
obex_service_driver.
---
 plugins/bluetooth.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index fe508f4..1037b24 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -459,10 +459,11 @@ static int request_service_authorization(struct bluetooth_service *service,
 
 static void confirm_event(GIOChannel *io, void *user_data)
 {
-	struct bluetooth_service *service = user_data;
+	struct bluetooth_service *service;
 	GError *err = NULL;
 	char address[18];
 	uint8_t channel;
+	struct obex_service_driver *driver = user_data;
 
 	bt_io_get(io, BT_IO_RFCOMM, &err,
 			BT_IO_OPT_DEST, address,
@@ -477,7 +478,13 @@ static void confirm_event(GIOChannel *io, void *user_data)
 	info("bluetooth: New connection from: %s, channel %u", address,
 			channel);
 
-	if (service->driver->service != OBEX_OPP) {
+	service = find_service(driver, 0);
+	if (service == NULL) {
+		error("bluetooth: Unable to find service");
+		goto drop;
+	}
+
+	if (driver->service != OBEX_OPP) {
 		if (request_service_authorization(service, io, address) < 0)
 			goto drop;
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
  2011-06-21  8:37 ` [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb Luiz Augusto von Dentz
@ 2011-06-21  9:37   ` Li, Nami
  2011-06-21  9:47     ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 7+ messages in thread
From: Li, Nami @ 2011-06-21  9:37 UTC (permalink / raw)
  To: Luiz Augusto von Dentz, linux-bluetooth@vger.kernel.org

SGksDQoNCi0tLS0tT3JpZ2luYWwgTWV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2hhbm5lbCk7DQoNCisJaWYgKHNlcnZpY2UgPT0gTlVMTCkgew0KKwkJZXJyb3IoImJsdWV0b290
aDogVW5hYmxlIHRvIGZpbmQgc2VydmljZSIpOw0KKwkJZ290byBkcm9wOw0KKwl9DQorDQorCWlm
IChkcml2ZXItPnNlcnZpY2UgIT0gT0JFWF9PUFApIHsNCiAJCWlmIChyZXF1ZXN0X3NlcnZpY2Vf
YXV0aG9yaXphdGlvbihzZXJ2aWNlLCBpbywgYWRkcmVzcykgPCAwKQ0KIAkJCWdvdG8gZHJvcDsN
CiANCi0tDQoxLjcuNS40DQoNCi0tDQpUbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgbGlzdDogc2Vu
ZCB0aGUgbGluZSAidW5zdWJzY3JpYmUgbGludXgtYmx1ZXRvb3RoIiBpbiB0aGUgYm9keSBvZiBh
IG1lc3NhZ2UgdG8gbWFqb3Jkb21vQHZnZXIua2VybmVsLm9yZyBNb3JlIG1ham9yZG9tbyBpbmZv
IGF0ICBodHRwOi8vdmdlci5rZXJuZWwub3JnL21ham9yZG9tby1pbmZvLmh0bWwNCg==

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
  2011-06-21  9:37   ` Li, Nami
@ 2011-06-21  9:47     ` Luiz Augusto von Dentz
  2011-06-21 10:19       ` Li, Nami
  0 siblings, 1 reply; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2011-06-21  9:47 UTC (permalink / raw)
  To: Li, Nami; +Cc: linux-bluetooth@vger.kernel.org

Hi Nami,

2011/6/21 Li, Nami <nami@qca.qualcomm.com>:
> Hi,
>
> -----Original Message-----
> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth-owner@vger.kernel.org] On Behalf Of Luiz Augusto von Dentz
> Sent: 2011年6月21日 16:38
> To: linux-bluetooth@vger.kernel.org
> Subject: [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
>
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> The callback function actually needs the bluetooth_service structure not obex_service_driver.
> ---
>  plugins/bluetooth.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index fe508f4..1037b24 100644
> --- a/plugins/bluetooth.c
> +++ b/plugins/bluetooth.c
> @@ -459,10 +459,11 @@ static int request_service_authorization(struct bluetooth_service *service,
>
>  static void confirm_event(GIOChannel *io, void *user_data)  {
> -       struct bluetooth_service *service = user_data;
> +       struct bluetooth_service *service;
>        GError *err = NULL;
>        char address[18];
>        uint8_t channel;
> +       struct obex_service_driver *driver = user_data;
>
>        bt_io_get(io, BT_IO_RFCOMM, &err,
>                        BT_IO_OPT_DEST, address,
> @@ -477,7 +478,13 @@ static void confirm_event(GIOChannel *io, void *user_data)
>        info("bluetooth: New connection from: %s, channel %u", address,
>                        channel);
>
> -       if (service->driver->service != OBEX_OPP) {
> +       service = find_service(driver, 0);
>
> Will it be better to write as "service = find_service(driver, channel);" ?
> Or if you choose not to use channel, I think you could omit channel variable and omit bt_io_get(BT_IO_OPT_CHANNEL, &channel);

I only leave the channel there for logging, as for the find_service it
is really useless to use the channel if we are going to support L2CAP
in future, so in theory this should work regardless of the transport.

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
  2011-06-21  9:47     ` Luiz Augusto von Dentz
@ 2011-06-21 10:19       ` Li, Nami
  2011-06-21 10:23         ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 7+ messages in thread
From: Li, Nami @ 2011-06-21 10:19 UTC (permalink / raw)
  To: Luiz Augusto von Dentz
  Cc: linux-bluetooth@vger.kernel.org, Liu, Haijun, Fan, Hong

SGksIEx1aXoNCg0KLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS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GZvciBsb2dnaW5nLCBjYW4gd2UgZGVsZXRlIGl0PyANClRoZXJlIGFyZSBv
bmx5IHR3byBmdW5jdGlvbnMgY2FsbGluZyBmaW5kX3NlcnZpY2UsIG9uZSBpbiB5b3VyIGNvbW1p
dCAsIGFub3RoZXIgaW4gcmVnaXN0ZXJfcmVjb3JkIGZ1bmN0aW9uOg0KCXNlcnZpY2UgPSBmaW5k
X3NlcnZpY2UoZHJpdmVyLCAwKTsNClNlZW1zIHRoZSBjaGFubmVsIHBhcmFtZXRlciBpcyB1c2Vs
ZXNzLg0KQW5kIGNvbnNpZGVyaW5nIE9CRVggb3ZlciBMMkNBUCwgc2hvdWxkIHdlIG1vZGlmeSBm
aW5kX3NlcnZpY2UgdG8NCiAgIHN0YXRpYyBzdHJ1Y3QgYmx1ZXRvb3RoX3NlcnZpY2UgKmZpbmRf
c2VydmljZShzdHJ1Y3Qgb2JleF9zZXJ2aWNlX2RyaXZlciAqZHJpdmVyKQ0KanVzdCBkZWxldGUg
dWludDhfdCBjaGFubmVsIHBhcmFtZXRlci4NCklmIG9rLCB5b3Ugb3IgbWUgY2FuIHVwbG9hZCBh
IHBhdGNoIGZvciB0aGlzIGlzc3VlLg0KDQpOYW1pDQoNCg==

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
  2011-06-21 10:19       ` Li, Nami
@ 2011-06-21 10:23         ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2011-06-21 10:23 UTC (permalink / raw)
  To: Li, Nami; +Cc: linux-bluetooth@vger.kernel.org, Liu, Haijun, Fan, Hong

Hi Nami,

2011/6/21 Li, Nami <nami@qca.qualcomm.com>:
> Hi, Luiz
>
> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: 2011年6月21日 17:48
> To: Li, Nami
> Cc: linux-bluetooth@vger.kernel.org
> Subject: Re: [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb
>
> Hi Nami,
>
> 2011/6/21 Li, Nami <nami@qca.qualcomm.com>:
>> Hi,
>>
>> -----Original Message-----
>> From: linux-bluetooth-owner@vger.kernel.org
>> [mailto:linux-bluetooth-owner@vger.kernel.org] On Behalf Of Luiz
>> Augusto von Dentz
>> Sent: 2011年6月21日 16:38
>> To: linux-bluetooth@vger.kernel.org
>> Subject: [PATCH obexd] Fix crash introduced by
>> f5279bfcedd669bc5d4e88cc1c59807c92226dfb
>>
>> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>>
>> The callback function actually needs the bluetooth_service structure not obex_service_driver.
>> ---
>>  plugins/bluetooth.c |   11 +++++++++--
>>  1 files changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c index
>> fe508f4..1037b24 100644
>> --- a/plugins/bluetooth.c
>> +++ b/plugins/bluetooth.c
>> @@ -459,10 +459,11 @@ static int request_service_authorization(struct
>> bluetooth_service *service,
>>
>>  static void confirm_event(GIOChannel *io, void *user_data)  {
>> -       struct bluetooth_service *service = user_data;
>> +       struct bluetooth_service *service;
>>        GError *err = NULL;
>>        char address[18];
>>        uint8_t channel;
>> +       struct obex_service_driver *driver = user_data;
>>
>>        bt_io_get(io, BT_IO_RFCOMM, &err,
>>                        BT_IO_OPT_DEST, address, @@ -477,7 +478,13 @@
>> static void confirm_event(GIOChannel *io, void *user_data)
>>        info("bluetooth: New connection from: %s, channel %u", address,
>>                        channel);
>>
>> -       if (service->driver->service != OBEX_OPP) {
>> +       service = find_service(driver, 0);
>>
>> Will it be better to write as "service = find_service(driver, channel);" ?
>> Or if you choose not to use channel, I think you could omit channel
>> variable and omit bt_io_get(BT_IO_OPT_CHANNEL, &channel);
>
>>I only leave the channel there for logging, as for the find_service it is really useless to use the channel if we are going to support L2CAP in future, so in theory this should work regardless of the transport.
>
>
> Yeah, it`s better when support L2CAP.  If the channel is only use for logging, can we delete it?
> There are only two functions calling find_service, one in your commit , another in register_record function:
>        service = find_service(driver, 0);
> Seems the channel parameter is useless.
> And considering OBEX over L2CAP, should we modify find_service to
>   static struct bluetooth_service *find_service(struct obex_service_driver *driver)
> just delete uint8_t channel parameter.
> If ok, you or me can upload a patch for this issue.

Yep, I gonna send a new version that just remove it since we no longer
need it after this changes

-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH obexd] Add copy and move support for filesystem plugin
  2011-06-21  8:37 [PATCH obexd] Add copy and move support for filesystem plugin Luiz Augusto von Dentz
  2011-06-21  8:37 ` [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb Luiz Augusto von Dentz
@ 2011-06-28  8:01 ` Johan Hedberg
  1 sibling, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2011-06-28  8:01 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Tue, Jun 21, 2011, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> Move is implemented using rename and copy uses sendfile, both part of
> POSIX.
> ---
>  plugins/filesystem.c |   96 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 96 insertions(+), 0 deletions(-)

Applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-28  8:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-21  8:37 [PATCH obexd] Add copy and move support for filesystem plugin Luiz Augusto von Dentz
2011-06-21  8:37 ` [PATCH obexd] Fix crash introduced by f5279bfcedd669bc5d4e88cc1c59807c92226dfb Luiz Augusto von Dentz
2011-06-21  9:37   ` Li, Nami
2011-06-21  9:47     ` Luiz Augusto von Dentz
2011-06-21 10:19       ` Li, Nami
2011-06-21 10:23         ` Luiz Augusto von Dentz
2011-06-28  8:01 ` [PATCH obexd] Add copy and move support for filesystem plugin Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).