Merge branch 'linus' into cont_syslog
[safe/jmp/linux-2.6] / include / linux / atmdev.h
index aca9b34..817b237 100644 (file)
@@ -7,7 +7,6 @@
 #define LINUX_ATMDEV_H
 
 
-#include <linux/config.h>
 #include <linux/atmapi.h>
 #include <linux/atm.h>
 #include <linux/atmioc.h>
@@ -101,6 +100,10 @@ struct atm_dev_stats {
                                        /* use backend to make new if */
 #define ATM_ADDPARTY   _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
                                        /* add party to p2mp call */
+#ifdef CONFIG_COMPAT
+/* It actually takes struct sockaddr_atmsvc, not struct atm_iobuf */
+#define COMPAT_ATM_ADDPARTY    _IOW('a', ATMIOC_SPECIAL+4,struct compat_atm_iobuf)
+#endif
 #define ATM_DROPPARTY  _IOW('a', ATMIOC_SPECIAL+5,int)
                                        /* drop party from p2mp call */
 
@@ -210,6 +213,7 @@ struct atm_cirange {
 
 #ifdef __KERNEL__
 
+#include <linux/device.h>
 #include <linux/wait.h> /* wait_queue_head_t */
 #include <linux/time.h> /* struct timeval */
 #include <linux/net.h>
@@ -224,6 +228,13 @@ struct atm_cirange {
 extern struct proc_dir_entry *atm_proc_root;
 #endif
 
+#ifdef CONFIG_COMPAT
+#include <linux/compat.h>
+struct compat_atm_iobuf {
+       int length;
+       compat_uptr_t buffer;
+};
+#endif
 
 struct k_atm_aal_stats {
 #define __HANDLE_ITEM(i) atomic_t i
@@ -274,7 +285,7 @@ enum {
 
 
 enum {
-       ATM_DF_CLOSE,           /* close device when last VCC is closed */
+       ATM_DF_REMOVED,         /* device was removed from atm_devs list */
 };
 
 
@@ -359,6 +370,7 @@ struct atm_dev {
        struct proc_dir_entry *proc_entry; /* proc entry */
        char *proc_name;                /* proc entry name */
 #endif
+       struct device class_dev;        /* sysfs device */
        struct list_head dev_list;      /* linkage */
 };
 
@@ -378,10 +390,14 @@ struct atmdev_ops { /* only send is required */
        int (*open)(struct atm_vcc *vcc);
        void (*close)(struct atm_vcc *vcc);
        int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
+#ifdef CONFIG_COMPAT
+       int (*compat_ioctl)(struct atm_dev *dev,unsigned int cmd,
+                           void __user *arg);
+#endif
        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,
-           void __user *optval,int optlen);
+           void __user *optval,unsigned int optlen);
        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,
@@ -415,7 +431,6 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
     int number,unsigned long *flags); /* number == -1: pick first available */
 struct atm_dev *atm_dev_lookup(int number);
 void atm_dev_deregister(struct atm_dev *dev);
-void shutdown_atm_dev(struct atm_dev *dev);
 void vcc_insert_socket(struct sock *sk);
 
 
@@ -457,18 +472,19 @@ static inline void atm_dev_hold(struct atm_dev *dev)
 
 static inline void atm_dev_put(struct atm_dev *dev)
 {
-       atomic_dec(&dev->refcnt);
-
-       if ((atomic_read(&dev->refcnt) == 1) &&
-           test_bit(ATM_DF_CLOSE,&dev->flags))
-               shutdown_atm_dev(dev);
+       if (atomic_dec_and_test(&dev->refcnt)) {
+               BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
+               if (dev->ops->dev_close)
+                       dev->ops->dev_close(dev);
+               put_device(&dev->class_dev);
+       }
 }
 
 
 int atm_charge(struct atm_vcc *vcc,int truesize);
 struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
-    unsigned int __nocast gfp_flags);
-int atm_pcr_goal(struct atm_trafprm *tp);
+    gfp_t gfp_flags);
+int atm_pcr_goal(const struct atm_trafprm *tp);
 
 void vcc_release_async(struct atm_vcc *vcc, int reply);