diff mbox series

[v6] obex: Move size emit signal to plugins instead of obex.c

Message ID 20240725105226.3121-1-quic_amisjain@quicinc.com
State Superseded
Headers show
Series [v6] obex: Move size emit signal to plugins instead of obex.c | expand

Commit Message

Amisha Jain July 25, 2024, 10:52 a.m. UTC
Instead of emitting the property "Size" from obex_put_stream_start(),
Call the function manager_emit_transfer_property() from plugins/*.c
wherever plugin has transfer object present.
Remove the code from obex.c which is generic for all profiles.

This change resolves the type mismatch issue when calling the
manager_emit_transfer_property from obex.c. We are passing
'os->service_data' of plugin session type but the
manager_emit_transfer_property() expects the 'obex_transfer'
type, therefore size is not set properly and might cause
crash/disconnection.

---
 obexd/plugins/ftp.c | 5 +++++
 obexd/plugins/opp.c | 5 +++++
 obexd/src/obex.c    | 3 ---
 3 files changed, 10 insertions(+), 3 deletions(-)

Comments

bluez.test.bot@gmail.com July 25, 2024, 12:41 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=873803

---Test result---

Test Summary:
CheckPatch                    FAIL      0.67 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      24.97 seconds
BluezMake                     PASS      1767.28 seconds
MakeCheck                     PASS      13.40 seconds
MakeDistcheck                 PASS      180.62 seconds
CheckValgrind                 PASS      254.28 seconds
CheckSmatch                   PASS      358.12 seconds
bluezmakeextell               PASS      120.75 seconds
IncrementalBuild              PASS      1532.05 seconds
ScanBuild                     PASS      1058.75 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v6] obex: Move size emit signal to plugins instead of obex.c
ERROR:SPACING: spaces required around that '==' (ctx:VxV)
#120: FILE: obexd/plugins/ftp.c:178:
+	if (ret==0 && obex_get_size(os) != OBJECT_SIZE_DELETE &&
 	       ^

ERROR:SPACING: spaces required around that '==' (ctx:VxV)
#136: FILE: obexd/plugins/opp.c:90:
+	if (err==0 && obex_get_size(os) != OBJECT_SIZE_DELETE &&
 	       ^

/github/workspace/src/src/13741794.patch total: 2 errors, 0 warnings, 31 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13741794.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/obexd/plugins/ftp.c b/obexd/plugins/ftp.c
index 874fe2b8b..1e4899a23 100644
--- a/obexd/plugins/ftp.c
+++ b/obexd/plugins/ftp.c
@@ -175,6 +175,11 @@  int ftp_chkput(struct obex_session *os, void *user_data)
 
 	ret = obex_put_stream_start(os, path);
 
+	if (ret==0 && obex_get_size(os) != OBJECT_SIZE_DELETE &&
+				obex_get_size(os) != OBJECT_SIZE_UNKNOWN) {
+		manager_emit_transfer_property(ftp->transfer, "Size");
+	}
+
 	if (ret == 0)
 		manager_emit_transfer_started(ftp->transfer);
 
diff --git a/obexd/plugins/opp.c b/obexd/plugins/opp.c
index 777f5f8ed..36bd19664 100644
--- a/obexd/plugins/opp.c
+++ b/obexd/plugins/opp.c
@@ -87,6 +87,11 @@  skip_auth:
 
 	err = obex_put_stream_start(os, path);
 
+	if (err==0 && obex_get_size(os) != OBJECT_SIZE_DELETE &&
+				obex_get_size(os) != OBJECT_SIZE_UNKNOWN) {
+		manager_emit_transfer_property(user_data, "Size");
+	}
+
 	g_free(path);
 
 	if (err < 0)
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 98d6245a4..370bfac9e 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -716,9 +716,6 @@  int obex_put_stream_start(struct obex_session *os, const char *filename)
 		return err;
 	}
 
-	if (os->size != OBJECT_SIZE_DELETE && os->size != OBJECT_SIZE_UNKNOWN)
-		manager_emit_transfer_property(os->service_data, "Size");
-
 	os->path = g_strdup(filename);
 
 	return 0;