From: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: linux-bluetooth <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v4 2/4] Bluetooth: bnep: Add support for get bnep features via ioctl
Date: Thu, 2 Apr 2015 10:09:19 +0200 [thread overview]
Message-ID: <CAMv5GbcFDUJhJ=1QA_3XZUg8j1-m0d0u9-aWS+Be7KLzWMnwOw@mail.gmail.com> (raw)
In-Reply-To: <71A9BC4E-A1AC-46F7-887A-1050664A6587@holtmann.org>
Hi Marcel,
On 1 April 2015 at 22:26, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Grzegorz,
>
>> This is needed if user space wants to know supported bnep features
>> by kernel, e.g. if kernel supports sending response to bnep setup
>> control message. By now there is no possibility to know supported
>> features by kernel in case of bnep. Ioctls allows only to add connection,
>> delete connection, get connection list, get connection info. Adding
>> connection if it's possible (establishing network device connection) is
>> equivalent to starting bnep session. Bnep session handles data queue of
>> transmit, receive messages over bnep channel. It means that if we add
>> connection the received/transmitted data will be parsed immediately. In
>> case of get bnep features we want to know before session start, if we
>> should leave setup data on socket queue and let kernel to handle with it,
>> or in case of no setup handling support, if we should pull this message
>> and handle setup response within user space.
>>
>> Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
>> ---
>> fs/compat_ioctl.c | 1 +
>> net/bluetooth/bnep/bnep.h | 1 +
>> net/bluetooth/bnep/sock.c | 8 ++++++++
>> 3 files changed, 10 insertions(+)
>>
>> diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
>> index afec645..19fb0c8 100644
>> --- a/fs/compat_ioctl.c
>> +++ b/fs/compat_ioctl.c
>> @@ -570,6 +570,7 @@ static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, void __user *argp)
>> #define BNEPCONNDEL _IOW('B', 201, int)
>> #define BNEPGETCONNLIST _IOR('B', 210, int)
>> #define BNEPGETCONNINFO _IOR('B', 211, int)
>> +#define BNEPGETSUPPFEAT _IOR('B', 212, int)
>>
>> #define CMTPCONNADD _IOW('C', 200, int)
>> #define CMTPCONNDEL _IOW('C', 201, int)
>> diff --git a/net/bluetooth/bnep/bnep.h b/net/bluetooth/bnep/bnep.h
>> index 5a5b16f..8709733 100644
>> --- a/net/bluetooth/bnep/bnep.h
>> +++ b/net/bluetooth/bnep/bnep.h
>> @@ -111,6 +111,7 @@ struct bnep_ext_hdr {
>> #define BNEPCONNDEL _IOW('B', 201, int)
>> #define BNEPGETCONNLIST _IOR('B', 210, int)
>> #define BNEPGETCONNINFO _IOR('B', 211, int)
>> +#define BNEPGETSUPPFEAT _IOR('B', 212, int)
>>
>> struct bnep_connadd_req {
>> int sock; /* Connected socket */
>> diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c
>> index 5f05129..f18b6bd 100644
>> --- a/net/bluetooth/bnep/sock.c
>> +++ b/net/bluetooth/bnep/sock.c
>> @@ -58,6 +58,8 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
>> struct socket *nsock;
>> void __user *argp = (void __user *)arg;
>> int err;
>> + const __u32 supp_feat = 0;
>
> I doubt that const is needed here. It is on the stack anyway. And personally I prefer it before the int err.
>
Ok.
>> +
>
> This extra empty line is against any coding style. Please be careful with these.
>
I've missed it, thanks.
>> BT_DBG("cmd %x arg %lx", cmd, arg);
>>
>> @@ -120,6 +122,12 @@ static int bnep_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long
>>
>> return err;
>>
>> + case BNEPGETSUPPFEAT:
>> + if (copy_to_user(argp, &supp_feat, sizeof(supp_feat)))
>> + return -EFAULT;
>> +
>> + return 0;
>> +
>> default:
>> return -EINVAL;
>> }
>
> Regards
>
> Marcel
>
Regards,
Grzegorz
next prev parent reply other threads:[~2015-04-02 8:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 14:24 [PATCH v4 0/4] Handling extended headers of bnep control frames Grzegorz Kolodziejczyk
2015-04-01 14:24 ` [PATCH v4 1/4] Bluetooth: bnep: Return err value while sending cmd is not understood Grzegorz Kolodziejczyk
2015-04-01 14:24 ` [PATCH v4 2/4] Bluetooth: bnep: Add support for get bnep features via ioctl Grzegorz Kolodziejczyk
2015-04-01 20:26 ` Marcel Holtmann
2015-04-02 8:09 ` Grzegorz Kolodziejczyk [this message]
2015-04-01 14:24 ` [PATCH v4 3/4] Bluetooth: bnep: Add support to extended headers of control frames Grzegorz Kolodziejczyk
2015-04-01 14:24 ` [PATCH v4 4/4] Bluetooth: bnep: Handle BNEP connection setup request Grzegorz Kolodziejczyk
2015-04-01 20:28 ` Marcel Holtmann
2015-04-02 8:40 ` Grzegorz Kolodziejczyk
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='CAMv5GbcFDUJhJ=1QA_3XZUg8j1-m0d0u9-aWS+Be7KLzWMnwOw@mail.gmail.com' \
--to=grzegorz.kolodziejczyk@tieto.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.