License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2005-04-17 06:20:36 +08:00
|
|
|
/* atmdev.h - ATM device driver declarations and various related items */
|
|
|
|
#ifndef LINUX_ATMDEV_H
|
|
|
|
#define LINUX_ATMDEV_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <linux/wait.h> /* wait_queue_head_t */
|
|
|
|
#include <linux/time.h> /* struct timeval */
|
|
|
|
#include <linux/net.h>
|
2011-11-24 09:12:59 +08:00
|
|
|
#include <linux/bug.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <linux/skbuff.h> /* struct sk_buff */
|
|
|
|
#include <linux/uio.h>
|
|
|
|
#include <net/sock.h>
|
2011-07-27 07:09:06 +08:00
|
|
|
#include <linux/atomic.h>
|
2017-07-04 20:53:01 +08:00
|
|
|
#include <linux/refcount.h>
|
2012-10-13 17:46:48 +08:00
|
|
|
#include <uapi/linux/atmdev.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
|
|
|
|
extern struct proc_dir_entry *atm_proc_root;
|
|
|
|
#endif
|
|
|
|
|
atm: 32-bit ioctl compatibility
We lack compat ioctl support through most of the ATM code. This patch
deals with most of it, and I can now at least use BR2684 and PPPoATM
with 32-bit userspace.
I haven't added a .compat_ioctl method to struct atm_ioctl, because
AFAICT none of the current users need any conversion -- so we can just
call the ->ioctl() method in every case. I looked at br2684, clip, lec,
mpc, pppoatm and atmtcp.
In svc_compat_ioctl() the only mangling which is needed is to change
COMPAT_ATM_ADDPARTY to ATM_ADDPARTY. Although it's defined as
_IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
it doesn't actually _take_ a struct atm_iobuf as an argument -- it takes
a struct sockaddr_atmsvc, which _is_ the same between 32-bit and 64-bit
code, so doesn't need conversion.
Almost all of vcc_ioctl() would have been identical, so I converted that
into a core do_vcc_ioctl() function with an 'int compat' argument.
I've done the same with atm_dev_ioctl(), where there _are_ a few
differences, but still it's relatively contained and there would
otherwise have been a lot of duplication.
I haven't done any of the actual device-specific ioctls, although I've
added a compat_ioctl method to struct atmdev_ops.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-04 14:12:38 +08:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
#include <linux/compat.h>
|
|
|
|
struct compat_atm_iobuf {
|
|
|
|
int length;
|
|
|
|
compat_uptr_t buffer;
|
|
|
|
};
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
struct k_atm_aal_stats {
|
|
|
|
#define __HANDLE_ITEM(i) atomic_t i
|
|
|
|
__AAL_STAT_ITEMS
|
|
|
|
#undef __HANDLE_ITEM
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct k_atm_dev_stats {
|
|
|
|
struct k_atm_aal_stats aal0;
|
|
|
|
struct k_atm_aal_stats aal34;
|
|
|
|
struct k_atm_aal_stats aal5;
|
|
|
|
};
|
|
|
|
|
2012-01-31 00:46:54 +08:00
|
|
|
struct device;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
enum {
|
|
|
|
ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
|
|
|
|
by device driver. */
|
|
|
|
ATM_VF_READY, /* VC is ready to transfer data. Set by device
|
|
|
|
driver, cleared by anybody. */
|
|
|
|
ATM_VF_PARTIAL, /* resources are bound to PVC (partial PVC
|
|
|
|
setup), controlled by socket layer */
|
|
|
|
ATM_VF_REGIS, /* registered with demon, controlled by SVC
|
|
|
|
socket layer */
|
|
|
|
ATM_VF_BOUND, /* local SAP is set, controlled by SVC socket
|
|
|
|
layer */
|
|
|
|
ATM_VF_RELEASED, /* demon has indicated/requested release,
|
|
|
|
controlled by SVC socket layer */
|
|
|
|
ATM_VF_HASQOS, /* QOS parameters have been set */
|
|
|
|
ATM_VF_LISTEN, /* socket is used for listening */
|
|
|
|
ATM_VF_META, /* SVC socket isn't used for normal data
|
|
|
|
traffic and doesn't depend on signaling
|
|
|
|
to be available */
|
|
|
|
ATM_VF_SESSION, /* VCC is p2mp session control descriptor */
|
|
|
|
ATM_VF_HASSAP, /* SAP has been set */
|
|
|
|
ATM_VF_CLOSE, /* asynchronous close - treat like VF_RELEASED*/
|
|
|
|
ATM_VF_WAITING, /* waiting for reply from sigd */
|
|
|
|
ATM_VF_IS_CLIP, /* in use by CLIP protocol */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define ATM_VF2VS(flags) \
|
|
|
|
(test_bit(ATM_VF_READY,&(flags)) ? ATM_VS_CONNECTED : \
|
|
|
|
test_bit(ATM_VF_RELEASED,&(flags)) ? ATM_VS_CLOSING : \
|
|
|
|
test_bit(ATM_VF_LISTEN,&(flags)) ? ATM_VS_LISTEN : \
|
|
|
|
test_bit(ATM_VF_REGIS,&(flags)) ? ATM_VS_INUSE : \
|
|
|
|
test_bit(ATM_VF_BOUND,&(flags)) ? ATM_VS_BOUND : ATM_VS_IDLE)
|
|
|
|
|
|
|
|
|
|
|
|
enum {
|
2005-11-30 08:16:41 +08:00
|
|
|
ATM_DF_REMOVED, /* device was removed from atm_devs list */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define ATM_PHY_SIG_LOST 0 /* no carrier/light */
|
|
|
|
#define ATM_PHY_SIG_UNKNOWN 1 /* carrier/light status is unknown */
|
|
|
|
#define ATM_PHY_SIG_FOUND 2 /* carrier/light okay */
|
|
|
|
|
|
|
|
#define ATM_ATMOPT_CLP 1 /* set CLP bit */
|
|
|
|
|
|
|
|
struct atm_vcc {
|
|
|
|
/* struct sock has to be the first member of atm_vcc */
|
|
|
|
struct sock sk;
|
|
|
|
unsigned long flags; /* VCC flags (ATM_VF_*) */
|
|
|
|
short vpi; /* VPI and VCI (types must be equal */
|
|
|
|
/* with sockaddr) */
|
|
|
|
int vci;
|
|
|
|
unsigned long aal_options; /* AAL layer options */
|
|
|
|
unsigned long atm_options; /* ATM layer options */
|
|
|
|
struct atm_dev *dev; /* device back pointer */
|
|
|
|
struct atm_qos qos; /* QOS */
|
|
|
|
struct atm_sap sap; /* SAP */
|
2012-11-28 08:03:11 +08:00
|
|
|
void (*release_cb)(struct atm_vcc *vcc); /* release_sock callback */
|
2005-04-17 06:20:36 +08:00
|
|
|
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
|
|
|
|
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
|
|
|
|
int (*push_oam)(struct atm_vcc *vcc,void *cell);
|
|
|
|
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
|
|
|
|
void *dev_data; /* per-device data */
|
|
|
|
void *proto_data; /* per-protocol data */
|
|
|
|
struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
|
2012-11-07 06:16:57 +08:00
|
|
|
struct module *owner; /* owner of ->push function */
|
2005-04-17 06:20:36 +08:00
|
|
|
/* SVC part --- may move later ------------------------------------- */
|
|
|
|
short itf; /* interface number */
|
|
|
|
struct sockaddr_atmsvc local;
|
|
|
|
struct sockaddr_atmsvc remote;
|
|
|
|
/* Multipoint part ------------------------------------------------- */
|
|
|
|
struct atm_vcc *session; /* session VCC descriptor */
|
|
|
|
/* Other stuff ----------------------------------------------------- */
|
|
|
|
void *user_back; /* user backlink - not touched by */
|
|
|
|
/* native ATM stack. Currently used */
|
|
|
|
/* by CLIP and sch_atm. */
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline struct atm_vcc *atm_sk(struct sock *sk)
|
|
|
|
{
|
|
|
|
return (struct atm_vcc *)sk;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct atm_vcc *ATM_SD(struct socket *sock)
|
|
|
|
{
|
|
|
|
return atm_sk(sock->sk);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct sock *sk_atm(struct atm_vcc *vcc)
|
|
|
|
{
|
|
|
|
return (struct sock *)vcc;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct atm_dev_addr {
|
|
|
|
struct sockaddr_atmsvc addr; /* ATM address */
|
|
|
|
struct list_head entry; /* next address */
|
|
|
|
};
|
|
|
|
|
2005-10-07 13:19:28 +08:00
|
|
|
enum atm_addr_type_t { ATM_ADDR_LOCAL, ATM_ADDR_LECS };
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct atm_dev {
|
|
|
|
const struct atmdev_ops *ops; /* device operations; NULL if unused */
|
|
|
|
const struct atmphy_ops *phy; /* PHY operations, may be undefined */
|
|
|
|
/* (NULL) */
|
|
|
|
const char *type; /* device type name */
|
|
|
|
int number; /* device index */
|
|
|
|
void *dev_data; /* per-device data */
|
|
|
|
void *phy_data; /* private PHY date */
|
|
|
|
unsigned long flags; /* device flags (ATM_DF_*) */
|
|
|
|
struct list_head local; /* local ATM addresses */
|
2005-10-07 13:19:28 +08:00
|
|
|
struct list_head lecs; /* LECS ATM addresses learned via ILMI */
|
2005-04-17 06:20:36 +08:00
|
|
|
unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */
|
|
|
|
struct atm_cirange ci_range; /* VPI/VCI range */
|
|
|
|
struct k_atm_dev_stats stats; /* statistics */
|
|
|
|
char signal; /* signal status (ATM_PHY_SIG_*) */
|
|
|
|
int link_rate; /* link rate (default: OC3) */
|
2017-07-04 20:53:01 +08:00
|
|
|
refcount_t refcnt; /* reference count */
|
2005-04-17 06:20:36 +08:00
|
|
|
spinlock_t lock; /* protect internal members */
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
|
struct proc_dir_entry *proc_entry; /* proc entry */
|
|
|
|
char *proc_name; /* proc entry name */
|
|
|
|
#endif
|
2007-12-31 15:16:06 +08:00
|
|
|
struct device class_dev; /* sysfs device */
|
2005-04-17 06:20:36 +08:00
|
|
|
struct list_head dev_list; /* linkage */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* OF: send_Oam Flags */
|
|
|
|
|
|
|
|
#define ATM_OF_IMMED 1 /* Attempt immediate delivery */
|
|
|
|
#define ATM_OF_INRATE 2 /* Attempt in-rate delivery */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ioctl, getsockopt, and setsockopt are optional and can be set to NULL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct atmdev_ops { /* only send is required */
|
|
|
|
void (*dev_close)(struct atm_dev *dev);
|
|
|
|
int (*open)(struct atm_vcc *vcc);
|
|
|
|
void (*close)(struct atm_vcc *vcc);
|
|
|
|
int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
|
atm: 32-bit ioctl compatibility
We lack compat ioctl support through most of the ATM code. This patch
deals with most of it, and I can now at least use BR2684 and PPPoATM
with 32-bit userspace.
I haven't added a .compat_ioctl method to struct atm_ioctl, because
AFAICT none of the current users need any conversion -- so we can just
call the ->ioctl() method in every case. I looked at br2684, clip, lec,
mpc, pppoatm and atmtcp.
In svc_compat_ioctl() the only mangling which is needed is to change
COMPAT_ATM_ADDPARTY to ATM_ADDPARTY. Although it's defined as
_IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
it doesn't actually _take_ a struct atm_iobuf as an argument -- it takes
a struct sockaddr_atmsvc, which _is_ the same between 32-bit and 64-bit
code, so doesn't need conversion.
Almost all of vcc_ioctl() would have been identical, so I converted that
into a core do_vcc_ioctl() function with an 'int compat' argument.
I've done the same with atm_dev_ioctl(), where there _are_ a few
differences, but still it's relatively contained and there would
otherwise have been a lot of duplication.
I haven't done any of the actual device-specific ioctls, although I've
added a compat_ioctl method to struct atmdev_ops.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-04 14:12:38 +08:00
|
|
|
#ifdef CONFIG_COMPAT
|
|
|
|
int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
|
|
|
|
void __user *arg);
|
|
|
|
#endif
|
2005-04-17 06:20:36 +08:00
|
|
|
int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
|
|
|
|
void __user *optval,int optlen);
|
|
|
|
int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
|
2009-10-01 07:12:20 +08:00
|
|
|
void __user *optval,unsigned int optlen);
|
2005-04-17 06:20:36 +08:00
|
|
|
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
|
|
|
|
int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
|
|
|
|
void (*phy_put)(struct atm_dev *dev,unsigned char value,
|
|
|
|
unsigned long addr);
|
|
|
|
unsigned char (*phy_get)(struct atm_dev *dev,unsigned long addr);
|
|
|
|
int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags);
|
|
|
|
int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page);
|
|
|
|
struct module *owner;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct atmphy_ops {
|
|
|
|
int (*start)(struct atm_dev *dev);
|
|
|
|
int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
|
|
|
|
void (*interrupt)(struct atm_dev *dev);
|
|
|
|
int (*stop)(struct atm_dev *dev);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct atm_skb_data {
|
|
|
|
struct atm_vcc *vcc; /* ATM VCC */
|
|
|
|
unsigned long atm_options; /* ATM layer options */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VCC_HTABLE_SIZE 32
|
|
|
|
|
|
|
|
extern struct hlist_head vcc_hash[VCC_HTABLE_SIZE];
|
|
|
|
extern rwlock_t vcc_sklist_lock;
|
|
|
|
|
|
|
|
#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))
|
|
|
|
|
2010-12-09 03:40:47 +08:00
|
|
|
struct atm_dev *atm_dev_register(const char *type, struct device *parent,
|
|
|
|
const struct atmdev_ops *ops,
|
|
|
|
int number, /* -1 == pick first available */
|
|
|
|
unsigned long *flags);
|
2005-04-17 06:20:36 +08:00
|
|
|
struct atm_dev *atm_dev_lookup(int number);
|
|
|
|
void atm_dev_deregister(struct atm_dev *dev);
|
2010-07-09 04:55:30 +08:00
|
|
|
|
|
|
|
/* atm_dev_signal_change
|
|
|
|
*
|
|
|
|
* Propagate lower layer signal change in atm_dev->signal to netdevice.
|
|
|
|
* The event will be sent via a notifier call chain.
|
|
|
|
*/
|
|
|
|
void atm_dev_signal_change(struct atm_dev *dev, char signal);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
void vcc_insert_socket(struct sock *sk);
|
|
|
|
|
2011-03-30 21:17:04 +08:00
|
|
|
void atm_dev_release_vccs(struct atm_dev *dev);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
|
|
|
|
{
|
|
|
|
atomic_add(truesize, &sk_atm(vcc)->sk_rmem_alloc);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void atm_return(struct atm_vcc *vcc,int truesize)
|
|
|
|
{
|
|
|
|
atomic_sub(truesize, &sk_atm(vcc)->sk_rmem_alloc);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size)
|
|
|
|
{
|
2017-06-30 18:08:00 +08:00
|
|
|
return (size + refcount_read(&sk_atm(vcc)->sk_wmem_alloc)) <
|
2005-04-17 06:20:36 +08:00
|
|
|
sk_atm(vcc)->sk_sndbuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void atm_dev_hold(struct atm_dev *dev)
|
|
|
|
{
|
2017-07-04 20:53:01 +08:00
|
|
|
refcount_inc(&dev->refcnt);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void atm_dev_put(struct atm_dev *dev)
|
|
|
|
{
|
2017-07-04 20:53:01 +08:00
|
|
|
if (refcount_dec_and_test(&dev->refcnt)) {
|
2005-11-30 08:16:41 +08:00
|
|
|
BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
|
|
|
|
if (dev->ops->dev_close)
|
|
|
|
dev->ops->dev_close(dev);
|
2007-12-31 15:16:06 +08:00
|
|
|
put_device(&dev->class_dev);
|
2005-11-30 08:16:41 +08:00
|
|
|
}
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int atm_charge(struct atm_vcc *vcc,int truesize);
|
|
|
|
struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
|
2005-10-07 14:46:04 +08:00
|
|
|
gfp_t gfp_flags);
|
2005-11-30 08:13:55 +08:00
|
|
|
int atm_pcr_goal(const struct atm_trafprm *tp);
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
void vcc_release_async(struct atm_vcc *vcc, int reply);
|
|
|
|
|
|
|
|
struct atm_ioctl {
|
|
|
|
struct module *owner;
|
|
|
|
/* A module reference is kept if appropriate over this call.
|
|
|
|
* Return -ENOIOCTLCMD if you don't handle it. */
|
|
|
|
int (*ioctl)(struct socket *, unsigned int cmd, unsigned long arg);
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* register_atm_ioctl - register handler for ioctl operations
|
|
|
|
*
|
|
|
|
* Special (non-device) handlers of ioctl's should
|
|
|
|
* register here. If you're a normal device, you should
|
|
|
|
* set .ioctl in your atmdev_ops instead.
|
|
|
|
*/
|
|
|
|
void register_atm_ioctl(struct atm_ioctl *);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* deregister_atm_ioctl - remove the ioctl handler
|
|
|
|
*/
|
|
|
|
void deregister_atm_ioctl(struct atm_ioctl *);
|
|
|
|
|
2010-07-09 04:55:30 +08:00
|
|
|
|
|
|
|
/* register_atmdevice_notifier - register atm_dev notify events
|
|
|
|
*
|
|
|
|
* Clients like br2684 will register notify events
|
|
|
|
* Currently we notify of signal found/lost
|
|
|
|
*/
|
|
|
|
int register_atmdevice_notifier(struct notifier_block *nb);
|
|
|
|
void unregister_atmdevice_notifier(struct notifier_block *nb);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif
|