NFS: Stop sillyname renames and unmounts from racing
[safe/jmp/linux-2.6] / include / linux / ipc.h
index 36027b1..408696e 100644 (file)
@@ -2,7 +2,6 @@
 #define _LINUX_IPC_H
 
 #include <linux/types.h>
-#include <linux/kref.h>
 
 #define IPC_PRIVATE ((__kernel_key_t) 0)  
 
@@ -50,8 +49,39 @@ struct ipc_perm
 #define IPC_64  0x0100  /* New version (support 32-bit UIDs, bigger
                           message sizes, etc. */
 
+/*
+ * These are used to wrap system calls.
+ *
+ * See architecture code for ugly details..
+ */
+struct ipc_kludge {
+       struct msgbuf __user *msgp;
+       long msgtyp;
+};
+
+#define SEMOP           1
+#define SEMGET          2
+#define SEMCTL          3
+#define SEMTIMEDOP      4
+#define MSGSND         11
+#define MSGRCV         12
+#define MSGGET         13
+#define MSGCTL         14
+#define SHMAT          21
+#define SHMDT          22
+#define SHMGET         23
+#define SHMCTL         24
+
+/* Used by the DIPC package, try and avoid reusing it */
+#define DIPC            25
+
+#define IPCCALL(version,op)    ((version)<<16 | (op))
+
 #ifdef __KERNEL__
 
+#include <linux/kref.h>
+#include <linux/spinlock.h>
+
 #define IPCMNI 32768  /* <= MAX_INT limit for ipc arrays (including sysctl changes) */
 
 /* used by in-kernel data structures */
@@ -59,6 +89,7 @@ struct kern_ipc_perm
 {
        spinlock_t      lock;
        int             deleted;
+       int             id;
        key_t           key;
        uid_t           uid;
        gid_t           gid;
@@ -80,6 +111,8 @@ struct ipc_namespace {
        int             msg_ctlmax;
        int             msg_ctlmnb;
        int             msg_ctlmni;
+       atomic_t        msg_bytes;
+       atomic_t        msg_hdrs;
 
        size_t          shm_ctlmax;
        size_t          shm_ctlall;
@@ -88,24 +121,37 @@ struct ipc_namespace {
 };
 
 extern struct ipc_namespace init_ipc_ns;
+
+#ifdef CONFIG_SYSVIPC
+#define INIT_IPC_NS(ns)                .ns             = &init_ipc_ns,
 extern void free_ipc_ns(struct kref *kref);
-extern int copy_ipcs(unsigned long flags, struct task_struct *tsk);
-extern int unshare_ipcs(unsigned long flags, struct ipc_namespace **ns);
+extern struct ipc_namespace *copy_ipcs(unsigned long flags,
+                                               struct ipc_namespace *ns);
+#else
+#define INIT_IPC_NS(ns)
+static inline struct ipc_namespace *copy_ipcs(unsigned long flags,
+                                               struct ipc_namespace *ns)
+{
+       return ns;
+}
+#endif
 
 static inline struct ipc_namespace *get_ipc_ns(struct ipc_namespace *ns)
 {
+#ifdef CONFIG_SYSVIPC
        if (ns)
                kref_get(&ns->kref);
+#endif
        return ns;
 }
 
 static inline void put_ipc_ns(struct ipc_namespace *ns)
 {
+#ifdef CONFIG_SYSVIPC
        kref_put(&ns->kref, free_ipc_ns);
+#endif
 }
 
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_IPC_H */
-
-