[PATCH] switch a bunch of LSM hooks from nameidata to path
[safe/jmp/linux-2.6] / include / linux / security.h
index f4116d6..53a3453 100644 (file)
@@ -230,7 +230,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     loopback/bind mount (@flags & MS_BIND), @dev_name identifies the
  *     pathname of the object being mounted.
  *     @dev_name contains the name for object being mounted.
- *     @nd contains the nameidata structure for mount point object.
+ *     @path contains the path for mount point object.
  *     @type contains the filesystem type.
  *     @flags contains the mount flags.
  *     @data contains the filesystem-specific data.
@@ -249,7 +249,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     Check permission before the device with superblock @mnt->sb is mounted
  *     on the mount point named by @nd.
  *     @mnt contains the vfsmount for device being mounted.
- *     @nd contains the nameidata object for the mount point.
+ *     @path contains the path for the mount point.
  *     Return 0 if permission is granted.
  * @sb_umount:
  *     Check permission before the @mnt file system is unmounted.
@@ -278,16 +278,16 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     This hook is called any time a mount is successfully grafetd to
  *     the tree.
  *     @mnt contains the mounted filesystem.
- *     @mountpoint_nd contains the nameidata structure for the mount point.
+ *     @mountpoint contains the path for the mount point.
  * @sb_pivotroot:
  *     Check permission before pivoting the root filesystem.
- *     @old_nd contains the nameidata structure for the new location of the current root (put_old).
- *      @new_nd contains the nameidata structure for the new root (new_root).
+ *     @old_path contains the path for the new location of the current root (put_old).
+ *      @new_path contains the path for the new root (new_root).
  *     Return 0 if permission is granted.
  * @sb_post_pivotroot:
  *     Update module state after a successful pivot.
- *     @old_nd contains the nameidata structure for the old root.
- *      @new_nd contains the nameidata structure for the new root.
+ *     @old_path contains the path for the old root.
+ *      @new_path contains the path for the new root.
  * @sb_get_mnt_opts:
  *     Get the security relevant mount options used for a superblock
  *     @sb the superblock to get security mount options from
@@ -927,24 +927,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  * Security hooks for XFRM operations.
  *
  * @xfrm_policy_alloc_security:
- *     @xp contains the xfrm_policy being added to Security Policy Database
- *     used by the XFRM system.
+ *     @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy
+ *     Database used by the XFRM system.
  *     @sec_ctx contains the security context information being provided by
  *     the user-level policy update program (e.g., setkey).
  *     Allocate a security structure to the xp->security field; the security
  *     field is initialized to NULL when the xfrm_policy is allocated.
  *     Return 0 if operation was successful (memory to allocate, legal context)
  * @xfrm_policy_clone_security:
- *     @old contains an existing xfrm_policy in the SPD.
- *     @new contains a new xfrm_policy being cloned from old.
- *     Allocate a security structure to the new->security field
- *     that contains the information from the old->security field.
+ *     @old_ctx contains an existing xfrm_sec_ctx.
+ *     @new_ctxp contains a new xfrm_sec_ctx being cloned from old.
+ *     Allocate a security structure in new_ctxp that contains the
+ *     information from the old_ctx structure.
  *     Return 0 if operation was successful (memory to allocate).
  * @xfrm_policy_free_security:
- *     @xp contains the xfrm_policy
+ *     @ctx contains the xfrm_sec_ctx
  *     Deallocate xp->security.
  * @xfrm_policy_delete_security:
- *     @xp contains the xfrm_policy.
+ *     @ctx contains the xfrm_sec_ctx.
  *     Authorize deletion of xp->security.
  * @xfrm_state_alloc_security:
  *     @x contains the xfrm_state being added to the Security Association
@@ -964,7 +964,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
  *     @x contains the xfrm_state.
  *     Authorize deletion of x->security.
  * @xfrm_policy_lookup:
- *     @xp contains the xfrm_policy for which the access control is being
+ *     @ctx contains the xfrm_sec_ctx for which the access control is being
  *     checked.
  *     @fl_secid contains the flow security label that is used to authorize
  *     access to the policy xp.
@@ -1315,20 +1315,20 @@ struct security_operations {
        int (*sb_copy_data)(char *orig, char *copy);
        int (*sb_kern_mount) (struct super_block *sb, void *data);
        int (*sb_statfs) (struct dentry *dentry);
-       int (*sb_mount) (char *dev_name, struct nameidata * nd,
+       int (*sb_mount) (char *dev_name, struct path *path,
                         char *type, unsigned long flags, void *data);
-       int (*sb_check_sb) (struct vfsmount * mnt, struct nameidata * nd);
+       int (*sb_check_sb) (struct vfsmount * mnt, struct path *path);
        int (*sb_umount) (struct vfsmount * mnt, int flags);
        void (*sb_umount_close) (struct vfsmount * mnt);
        void (*sb_umount_busy) (struct vfsmount * mnt);
        void (*sb_post_remount) (struct vfsmount * mnt,
                                 unsigned long flags, void *data);
        void (*sb_post_addmount) (struct vfsmount * mnt,
-                                 struct nameidata * mountpoint_nd);
-       int (*sb_pivotroot) (struct nameidata * old_nd,
-                            struct nameidata * new_nd);
-       void (*sb_post_pivotroot) (struct nameidata * old_nd,
-                                  struct nameidata * new_nd);
+                                 struct path *mountpoint);
+       int (*sb_pivotroot) (struct path *old_path,
+                            struct path *new_path);
+       void (*sb_post_pivotroot) (struct path *old_path,
+                                  struct path *new_path);
        int (*sb_get_mnt_opts) (const struct super_block *sb,
                                struct security_mnt_opts *opts);
        int (*sb_set_mnt_opts) (struct super_block *sb,
@@ -1511,17 +1511,17 @@ struct security_operations {
 #endif /* CONFIG_SECURITY_NETWORK */
 
 #ifdef CONFIG_SECURITY_NETWORK_XFRM
-       int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp,
+       int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp,
                        struct xfrm_user_sec_ctx *sec_ctx);
-       int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new);
-       void (*xfrm_policy_free_security) (struct xfrm_policy *xp);
-       int (*xfrm_policy_delete_security) (struct xfrm_policy *xp);
+       int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
+       void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
+       int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
        int (*xfrm_state_alloc_security) (struct xfrm_state *x,
                struct xfrm_user_sec_ctx *sec_ctx,
                u32 secid);
        void (*xfrm_state_free_security) (struct xfrm_state *x);
        int (*xfrm_state_delete_security) (struct xfrm_state *x);
-       int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
+       int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
        int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
                        struct xfrm_policy *xp, struct flowi *fl);
        int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
@@ -1593,16 +1593,16 @@ void security_sb_free(struct super_block *sb);
 int security_sb_copy_data(char *orig, char *copy);
 int security_sb_kern_mount(struct super_block *sb, void *data);
 int security_sb_statfs(struct dentry *dentry);
-int security_sb_mount(char *dev_name, struct nameidata *nd,
+int security_sb_mount(char *dev_name, struct path *path,
                        char *type, unsigned long flags, void *data);
-int security_sb_check_sb(struct vfsmount *mnt, struct nameidata *nd);
+int security_sb_check_sb(struct vfsmount *mnt, struct path *path);
 int security_sb_umount(struct vfsmount *mnt, int flags);
 void security_sb_umount_close(struct vfsmount *mnt);
 void security_sb_umount_busy(struct vfsmount *mnt);
 void security_sb_post_remount(struct vfsmount *mnt, unsigned long flags, void *data);
-void security_sb_post_addmount(struct vfsmount *mnt, struct nameidata *mountpoint_nd);
-int security_sb_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
-void security_sb_post_pivotroot(struct nameidata *old_nd, struct nameidata *new_nd);
+void security_sb_post_addmount(struct vfsmount *mnt, struct path *mountpoint);
+int security_sb_pivotroot(struct path *old_path, struct path *new_path);
+void security_sb_post_pivotroot(struct path *old_path, struct path *new_path);
 int security_sb_get_mnt_opts(const struct super_block *sb,
                                struct security_mnt_opts *opts);
 int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts);
@@ -1872,7 +1872,7 @@ static inline int security_sb_statfs (struct dentry *dentry)
        return 0;
 }
 
-static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
+static inline int security_sb_mount (char *dev_name, struct path *path,
                                    char *type, unsigned long flags,
                                    void *data)
 {
@@ -1880,7 +1880,7 @@ static inline int security_sb_mount (char *dev_name, struct nameidata *nd,
 }
 
 static inline int security_sb_check_sb (struct vfsmount *mnt,
-                                       struct nameidata *nd)
+                                       struct path *path)
 {
        return 0;
 }
@@ -1901,17 +1901,17 @@ static inline void security_sb_post_remount (struct vfsmount *mnt,
 { }
 
 static inline void security_sb_post_addmount (struct vfsmount *mnt,
-                                             struct nameidata *mountpoint_nd)
+                                             struct path *mountpoint)
 { }
 
-static inline int security_sb_pivotroot (struct nameidata *old_nd,
-                                        struct nameidata *new_nd)
+static inline int security_sb_pivotroot (struct path *old_path,
+                                        struct path *new_path)
 {
        return 0;
 }
 
-static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
-                                              struct nameidata *new_nd)
+static inline void security_sb_post_pivotroot (struct path *old_path,
+                                              struct path *new_path)
 { }
 static inline int security_sb_get_mnt_opts(const struct super_block *sb,
                                           struct security_mnt_opts *opts)
@@ -2641,16 +2641,16 @@ static inline void security_inet_conn_established(struct sock *sk,
 
 #ifdef CONFIG_SECURITY_NETWORK_XFRM
 
-int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx);
-int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new);
-void security_xfrm_policy_free(struct xfrm_policy *xp);
-int security_xfrm_policy_delete(struct xfrm_policy *xp);
+int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx);
+int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp);
+void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
+int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
 int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
 int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
                                      struct xfrm_sec_ctx *polsec, u32 secid);
 int security_xfrm_state_delete(struct xfrm_state *x);
 void security_xfrm_state_free(struct xfrm_state *x);
-int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir);
+int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
 int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
                                       struct xfrm_policy *xp, struct flowi *fl);
 int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
@@ -2658,21 +2658,21 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
 
 #else  /* CONFIG_SECURITY_NETWORK_XFRM */
 
-static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx)
+static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx)
 {
        return 0;
 }
 
-static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new)
+static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp)
 {
        return 0;
 }
 
-static inline void security_xfrm_policy_free(struct xfrm_policy *xp)
+static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
 {
 }
 
-static inline int security_xfrm_policy_delete(struct xfrm_policy *xp)
+static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
 {
        return 0;
 }
@@ -2698,7 +2698,7 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x)
        return 0;
 }
 
-static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir)
+static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
 {
        return 0;
 }