tty.c (960603a54aa0d5f4f1c4f1037bcaee571d03cb1e) | tty.c (1c64834e0624c61735308138e67cc3b527f41621) |
---|---|
1/* 2 RFCOMM implementation for Linux Bluetooth stack (BlueZ). 3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License version 2 as 8 published by the Free Software Foundation; --- 37 unchanged lines hidden (view full) --- 46 struct tty_port port; 47 struct list_head list; 48 49 char name[12]; 50 int id; 51 unsigned long flags; 52 int err; 53 | 1/* 2 RFCOMM implementation for Linux Bluetooth stack (BlueZ). 3 Copyright (C) 2002 Maxim Krasnyansky <maxk@qualcomm.com> 4 Copyright (C) 2002 Marcel Holtmann <marcel@holtmann.org> 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License version 2 as 8 published by the Free Software Foundation; --- 37 unchanged lines hidden (view full) --- 46 struct tty_port port; 47 struct list_head list; 48 49 char name[12]; 50 int id; 51 unsigned long flags; 52 int err; 53 |
54 unsigned long status; /* don't export to userspace */ 55 |
|
54 bdaddr_t src; 55 bdaddr_t dst; 56 u8 channel; 57 58 uint modem_status; 59 60 struct rfcomm_dlc *dlc; 61 --- 356 unchanged lines hidden (view full) --- 418 if (!dev) 419 return -ENODEV; 420 421 if (dev->flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN)) { 422 tty_port_put(&dev->port); 423 return -EPERM; 424 } 425 | 56 bdaddr_t src; 57 bdaddr_t dst; 58 u8 channel; 59 60 uint modem_status; 61 62 struct rfcomm_dlc *dlc; 63 --- 356 unchanged lines hidden (view full) --- 420 if (!dev) 421 return -ENODEV; 422 423 if (dev->flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN)) { 424 tty_port_put(&dev->port); 425 return -EPERM; 426 } 427 |
428 /* only release once */ 429 if (test_and_set_bit(RFCOMM_DEV_RELEASED, &dev->status)) { 430 tty_port_put(&dev->port); 431 return -EALREADY; 432 } 433 |
|
426 if (req.flags & (1 << RFCOMM_HANGUP_NOW)) 427 rfcomm_dlc_close(dev->dlc, 0); 428 429 /* Shut down TTY synchronously before freeing rfcomm_dev */ 430 tty = tty_port_tty_get(&dev->port); 431 if (tty) { 432 tty_vhangup(tty); 433 tty_kref_put(tty); 434 } 435 | 434 if (req.flags & (1 << RFCOMM_HANGUP_NOW)) 435 rfcomm_dlc_close(dev->dlc, 0); 436 437 /* Shut down TTY synchronously before freeing rfcomm_dev */ 438 tty = tty_port_tty_get(&dev->port); 439 if (tty) { 440 tty_vhangup(tty); 441 tty_kref_put(tty); 442 } 443 |
436 if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags) && 437 !test_and_set_bit(RFCOMM_TTY_RELEASED, &dev->flags)) | 444 if (!test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) |
438 tty_port_put(&dev->port); 439 440 tty_port_put(&dev->port); 441 return 0; 442} 443 444static int rfcomm_get_dev_list(void __user *arg) 445{ --- 678 unchanged lines hidden --- | 445 tty_port_put(&dev->port); 446 447 tty_port_put(&dev->port); 448 return 0; 449} 450 451static int rfcomm_get_dev_list(void __user *arg) 452{ --- 678 unchanged lines hidden --- |