linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikel Astiz <mikel.astiz.oss@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Mikel Astiz <mikel.astiz@bmw-carit.de>
Subject: [PATCH obexd 2/3] client: refactor naming convention in session api
Date: Fri,  2 Mar 2012 13:41:26 +0100	[thread overview]
Message-ID: <1330692087-13021-3-git-send-email-mikel.astiz.oss@gmail.com> (raw)
In-Reply-To: <1330692087-13021-1-git-send-email-mikel.astiz.oss@gmail.com>

From: Mikel Astiz <mikel.astiz@bmw-carit.de>

The terms "name", "filename" and "targetname" are used in session.h that
can be confusing. This patch proposes to follow the terminology in the
D-Bus api:
	- Name: the remote name of the object being transferred
	- Filename: the local filesystem name of a file being sent
	- Targetfile: the local filesystem name of a file being
		received
---
 client/session.c |   30 +++++++++++++++---------------
 client/session.h |   12 ++++++------
 2 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/client/session.c b/client/session.c
index 06022b5..6497d70 100644
--- a/client/session.c
+++ b/client/session.c
@@ -931,7 +931,7 @@ static void session_prepare_get(gpointer data, gpointer user_data)
 }
 
 int obc_session_get(struct obc_session *session, const char *type,
-		const char *filename, const char *targetname,
+		const char *name, const char *targetfile,
 		const guint8 *apparam, gint apparam_size,
 		session_callback_t func, void *user_data)
 {
@@ -955,9 +955,8 @@ int obc_session_get(struct obc_session *session, const char *type,
 		agent = NULL;
 
 	transfer = obc_transfer_register(session->conn, session->obex,
-							agent, targetname,
-							filename, type,
-							params);
+							agent, targetfile,
+							name, type, params);
 	if (transfer == NULL) {
 		if (params != NULL) {
 			g_free(params->data);
@@ -971,7 +970,7 @@ int obc_session_get(struct obc_session *session, const char *type,
 }
 
 int obc_session_send(struct obc_session *session, const char *filename,
-				const char *targetname)
+				const char *name)
 {
 	struct obc_transfer *transfer;
 	const char *agent;
@@ -984,8 +983,7 @@ int obc_session_send(struct obc_session *session, const char *filename,
 
 	transfer = obc_transfer_register(session->conn, session->obex,
 							agent, filename,
-							targetname, NULL,
-							NULL);
+							name, NULL, NULL);
 	if (transfer == NULL)
 		return -EINVAL;
 
@@ -1000,7 +998,7 @@ int obc_session_send(struct obc_session *session, const char *filename,
 }
 
 int obc_session_pull(struct obc_session *session,
-				const char *type, const char *filename,
+				const char *type, const char *targetfile,
 				session_callback_t function, void *user_data)
 {
 	struct obc_transfer *transfer;
@@ -1015,7 +1013,8 @@ int obc_session_pull(struct obc_session *session,
 		agent = NULL;
 
 	transfer = obc_transfer_register(session->conn, session->obex,
-								agent, filename,
+								agent,
+								targetfile,
 								NULL, type,
 								NULL);
 	if (transfer == NULL) {
@@ -1076,7 +1075,7 @@ static void session_prepare_put(gpointer data, gpointer user_data)
 	DBG("Transfer(%p) started", transfer);
 }
 
-int obc_session_put(struct obc_session *session, char *buf, const char *targetname)
+int obc_session_put(struct obc_session *session, char *buf, const char *name)
 {
 	struct obc_transfer *transfer;
 	const char *agent;
@@ -1090,7 +1089,8 @@ int obc_session_put(struct obc_session *session, char *buf, const char *targetna
 
 	transfer = obc_transfer_register(session->conn, session->obex,
 							agent, NULL,
-							targetname, NULL, NULL);
+							name, NULL,
+							NULL);
 	if (transfer == NULL) {
 		g_free(buf);
 		return -EIO;
@@ -1382,7 +1382,7 @@ guint obc_session_mkdir(struct obc_session *session, const char *folder,
 	return p->id;
 }
 
-guint obc_session_copy(struct obc_session *session, const char *filename,
+guint obc_session_copy(struct obc_session *session, const char *srcname,
 				const char *destname, session_callback_t func,
 				void *user_data, GError **err)
 {
@@ -1401,7 +1401,7 @@ guint obc_session_copy(struct obc_session *session, const char *filename,
 
 	p = pending_request_new(session, NULL, NULL, func, user_data);
 
-	p->req_id = g_obex_copy(session->obex, filename, destname, async_cb, p,
+	p->req_id = g_obex_copy(session->obex, srcname, destname, async_cb, p,
 									err);
 	if (*err != NULL) {
 		pending_request_free(p);
@@ -1412,7 +1412,7 @@ guint obc_session_copy(struct obc_session *session, const char *filename,
 	return p->id;
 }
 
-guint obc_session_move(struct obc_session *session, const char *filename,
+guint obc_session_move(struct obc_session *session, const char *srcname,
 				const char *destname, session_callback_t func,
 				void *user_data, GError **err)
 {
@@ -1431,7 +1431,7 @@ guint obc_session_move(struct obc_session *session, const char *filename,
 
 	p = pending_request_new(session, NULL, NULL, func, user_data);
 
-	p->req_id = g_obex_move(session->obex, filename, destname, async_cb, p,
+	p->req_id = g_obex_move(session->obex, srcname, destname, async_cb, p,
 									err);
 	if (*err != NULL) {
 		pending_request_free(p);
diff --git a/client/session.h b/client/session.h
index a19b31f..4bfb41d 100644
--- a/client/session.h
+++ b/client/session.h
@@ -56,18 +56,18 @@ const char *obc_session_get_buffer(struct obc_session *session, size_t *size);
 void *obc_session_get_params(struct obc_session *session, size_t *size);
 
 int obc_session_send(struct obc_session *session, const char *filename,
-				const char *remotename);
+				const char *name);
 int obc_session_get(struct obc_session *session, const char *type,
-		const char *filename, const char *targetname,
+		const char *name, const char *targetfile,
 		const guint8  *apparam, gint apparam_size,
 		session_callback_t func, void *user_data);
 int obc_session_pull(struct obc_session *session,
-				const char *type, const char *filename,
+				const char *type, const char *targetfile,
 				session_callback_t function, void *user_data);
 const char *obc_session_register(struct obc_session *session,
 						GDBusDestroyFunction destroy);
 int obc_session_put(struct obc_session *session, char *buf,
-				const char *targetname);
+				const char *name);
 
 guint obc_session_setpath(struct obc_session *session, const char *path,
 				session_callback_t func, void *user_data,
@@ -75,10 +75,10 @@ guint obc_session_setpath(struct obc_session *session, const char *path,
 guint obc_session_mkdir(struct obc_session *session, const char *folder,
 				session_callback_t func, void *user_data,
 				GError **err);
-guint obc_session_copy(struct obc_session *session, const char *filename,
+guint obc_session_copy(struct obc_session *session, const char *srcname,
 				const char *destname, session_callback_t func,
 				void *user_data, GError **err);
-guint obc_session_move(struct obc_session *session, const char *filename,
+guint obc_session_move(struct obc_session *session, const char *srcname,
 				const char *destname, session_callback_t func,
 				void *user_data, GError **err);
 guint obc_session_delete(struct obc_session *session, const char *file,
-- 
1.7.6.5


  parent reply	other threads:[~2012-03-02 12:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-02 12:41 [PATCH obexd 0/3] client: parameter naming convention Mikel Astiz
2012-03-02 12:41 ` [PATCH obexd 1/3] client: fix naming convention in transfer api Mikel Astiz
2012-03-05 10:14   ` Luiz Augusto von Dentz
2012-03-02 12:41 ` Mikel Astiz [this message]
2012-03-05 10:17   ` [PATCH obexd 2/3] client: refactor naming convention in session api Luiz Augusto von Dentz
2012-03-02 12:41 ` [PATCH obexd 3/3] client: simplify obc_session_pull Mikel Astiz
2012-03-05 10:18   ` Luiz Augusto von Dentz

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=1330692087-13021-3-git-send-email-mikel.astiz.oss@gmail.com \
    --to=mikel.astiz.oss@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=mikel.astiz@bmw-carit.de \
    /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;
as well as URLs for NNTP newsgroup(s).