From 305759909e4d09b2016bcc57f650a09cee23955d Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Mon, 23 Apr 2007 13:36:54 +0000 Subject: [PATCH] Rename mac*devfsdirent*() to mac*devfs*() to synchronize with SEDarwin, where similar data structures exist to support devfs and the MAC Framework, but are named differently. Obtained from: TrustedBSD Project Sponsored by: SPARTA, Inc. --- sys/fs/devfs/devfs_devs.c | 4 ++-- sys/fs/devfs/devfs_vnops.c | 2 +- sys/security/mac/mac_framework.h | 6 +++--- sys/security/mac/mac_policy.h | 12 ++++++------ sys/security/mac/mac_vfs.c | 22 ++++++++++------------ sys/security/mac_biba/mac_biba.c | 8 ++++---- sys/security/mac_lomac/mac_lomac.c | 8 ++++---- sys/security/mac_mls/mac_mls.c | 9 +++++---- sys/security/mac_stub/mac_stub.c | 8 ++++---- sys/security/mac_test/mac_test.c | 27 +++++++++++++-------------- 10 files changed, 52 insertions(+), 54 deletions(-) diff --git a/sys/fs/devfs/devfs_devs.c b/sys/fs/devfs/devfs_devs.c index 8e155b8d5968..ca5c2dead80d 100644 --- a/sys/fs/devfs/devfs_devs.c +++ b/sys/fs/devfs/devfs_devs.c @@ -182,7 +182,7 @@ devfs_newdirent(char *name, int namelen) de->de_links = 1; de->de_holdcnt = 1; #ifdef MAC - mac_init_devfsdirent(de); + mac_init_devfs(de); #endif return (de); } @@ -274,7 +274,7 @@ devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int vp_locked) de->de_symlink = NULL; } #ifdef MAC - mac_destroy_devfsdirent(de); + mac_destroy_devfs(de); #endif if (de->de_inode > DEVFS_ROOTINO) { free_unr(devfs_inos, de->de_inode); diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 61ddb54a4da9..4f7cda26a4b9 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -1229,7 +1229,7 @@ devfs_setlabel(struct vop_setlabel_args *ap) de = vp->v_data; mac_relabel_vnode(ap->a_cred, vp, ap->a_label); - mac_update_devfsdirent(vp->v_mount, de, vp); + mac_update_devfs(vp->v_mount, de, vp); return (0); } diff --git a/sys/security/mac/mac_framework.h b/sys/security/mac/mac_framework.h index 64b4b90c98bc..772fe3783da0 100644 --- a/sys/security/mac/mac_framework.h +++ b/sys/security/mac/mac_framework.h @@ -91,7 +91,7 @@ struct vop_setlabel_args; */ void mac_init_bpfdesc(struct bpf_d *); void mac_init_cred(struct ucred *); -void mac_init_devfsdirent(struct devfs_dirent *); +void mac_init_devfs(struct devfs_dirent *); void mac_init_ifnet(struct ifnet *); int mac_init_inpcb(struct inpcb *, int); void mac_init_sysv_msgmsg(struct msg *); @@ -112,7 +112,7 @@ void mac_copy_mbuf_tag(struct m_tag *, struct m_tag *); void mac_copy_vnode_label(struct label *, struct label *); void mac_destroy_bpfdesc(struct bpf_d *); void mac_destroy_cred(struct ucred *); -void mac_destroy_devfsdirent(struct devfs_dirent *); +void mac_destroy_devfs(struct devfs_dirent *); void mac_destroy_ifnet(struct ifnet *); void mac_destroy_inpcb(struct inpcb *); void mac_destroy_sysv_msgmsg(struct msg *); @@ -152,7 +152,7 @@ int mac_create_vnode_extattr(struct ucred *cred, struct mount *mp, void mac_create_mount(struct ucred *cred, struct mount *mp); void mac_relabel_vnode(struct ucred *cred, struct vnode *vp, struct label *newlabel); -void mac_update_devfsdirent(struct mount *mp, struct devfs_dirent *de, +void mac_update_devfs(struct mount *mp, struct devfs_dirent *de, struct vnode *vp); /* diff --git a/sys/security/mac/mac_policy.h b/sys/security/mac/mac_policy.h index 75a55bd06053..efe0118a7b67 100644 --- a/sys/security/mac/mac_policy.h +++ b/sys/security/mac/mac_policy.h @@ -117,7 +117,7 @@ typedef void (*mpo_placeholder_t)(void); */ typedef void (*mpo_init_bpfdesc_label_t)(struct label *label); typedef void (*mpo_init_cred_label_t)(struct label *label); -typedef void (*mpo_init_devfsdirent_label_t)(struct label *label); +typedef void (*mpo_init_devfs_label_t)(struct label *label); typedef void (*mpo_init_ifnet_label_t)(struct label *label); typedef int (*mpo_init_inpcb_label_t)(struct label *label, int flag); typedef void (*mpo_init_sysv_msgmsg_label_t)(struct label *label); @@ -136,7 +136,7 @@ typedef void (*mpo_init_proc_label_t)(struct label *label); typedef void (*mpo_init_vnode_label_t)(struct label *label); typedef void (*mpo_destroy_bpfdesc_label_t)(struct label *label); typedef void (*mpo_destroy_cred_label_t)(struct label *label); -typedef void (*mpo_destroy_devfsdirent_label_t)(struct label *label); +typedef void (*mpo_destroy_devfs_label_t)(struct label *label); typedef void (*mpo_destroy_ifnet_label_t)(struct label *label); typedef void (*mpo_destroy_inpcb_label_t)(struct label *label); typedef void (*mpo_destroy_sysv_msgmsg_label_t)(struct label *label); @@ -227,7 +227,7 @@ typedef void (*mpo_relabel_vnode_t)(struct ucred *cred, struct vnode *vp, typedef int (*mpo_setlabel_vnode_extattr_t)(struct ucred *cred, struct vnode *vp, struct label *vplabel, struct label *intlabel); -typedef void (*mpo_update_devfsdirent_t)(struct mount *mp, +typedef void (*mpo_update_devfs_t)(struct mount *mp, struct devfs_dirent *de, struct label *delabel, struct vnode *vp, struct label *vplabel); @@ -630,7 +630,7 @@ struct mac_policy_ops { */ mpo_init_bpfdesc_label_t mpo_init_bpfdesc_label; mpo_init_cred_label_t mpo_init_cred_label; - mpo_init_devfsdirent_label_t mpo_init_devfsdirent_label; + mpo_init_devfs_label_t mpo_init_devfs_label; mpo_placeholder_t _mpo_placeholder0; mpo_init_ifnet_label_t mpo_init_ifnet_label; mpo_init_inpcb_label_t mpo_init_inpcb_label; @@ -649,7 +649,7 @@ struct mac_policy_ops { mpo_init_vnode_label_t mpo_init_vnode_label; mpo_destroy_bpfdesc_label_t mpo_destroy_bpfdesc_label; mpo_destroy_cred_label_t mpo_destroy_cred_label; - mpo_destroy_devfsdirent_label_t mpo_destroy_devfsdirent_label; + mpo_destroy_devfs_label_t mpo_destroy_devfs_label; mpo_placeholder_t _mpo_placeholder1; mpo_destroy_ifnet_label_t mpo_destroy_ifnet_label; mpo_destroy_inpcb_label_t mpo_destroy_inpcb_label; @@ -706,7 +706,7 @@ struct mac_policy_ops { mpo_create_mount_t mpo_create_mount; mpo_relabel_vnode_t mpo_relabel_vnode; mpo_setlabel_vnode_extattr_t mpo_setlabel_vnode_extattr; - mpo_update_devfsdirent_t mpo_update_devfsdirent; + mpo_update_devfs_t mpo_update_devfs; /* * Labeling event operations: IPC objects. diff --git a/sys/security/mac/mac_vfs.c b/sys/security/mac/mac_vfs.c index c6726d2fdbbc..ed716dbbb9b7 100644 --- a/sys/security/mac/mac_vfs.c +++ b/sys/security/mac/mac_vfs.c @@ -81,20 +81,20 @@ static int mac_setlabel_vnode_extattr(struct ucred *cred, struct vnode *vp, struct label *intlabel); static struct label * -mac_devfsdirent_label_alloc(void) +mac_devfs_label_alloc(void) { struct label *label; label = mac_labelzone_alloc(M_WAITOK); - MAC_PERFORM(init_devfsdirent_label, label); + MAC_PERFORM(init_devfs_label, label); return (label); } void -mac_init_devfsdirent(struct devfs_dirent *de) +mac_init_devfs(struct devfs_dirent *de) { - de->de_label = mac_devfsdirent_label_alloc(); + de->de_label = mac_devfs_label_alloc(); } static struct label * @@ -132,18 +132,18 @@ mac_init_vnode(struct vnode *vp) } static void -mac_devfsdirent_label_free(struct label *label) +mac_devfs_label_free(struct label *label) { - MAC_PERFORM(destroy_devfsdirent_label, label); + MAC_PERFORM(destroy_devfs_label, label); mac_labelzone_free(label); } void -mac_destroy_devfsdirent(struct devfs_dirent *de) +mac_destroy_devfs(struct devfs_dirent *de) { - mac_devfsdirent_label_free(de->de_label); + mac_devfs_label_free(de->de_label); de->de_label = NULL; } @@ -208,12 +208,10 @@ mac_internalize_vnode_label(struct label *label, char *string) } void -mac_update_devfsdirent(struct mount *mp, struct devfs_dirent *de, - struct vnode *vp) +mac_update_devfs(struct mount *mp, struct devfs_dirent *de, struct vnode *vp) { - MAC_PERFORM(update_devfsdirent, mp, de, de->de_label, vp, - vp->v_label); + MAC_PERFORM(update_devfs, mp, de, de->de_label, vp, vp->v_label); } void diff --git a/sys/security/mac_biba/mac_biba.c b/sys/security/mac_biba/mac_biba.c index f2d973aaa0ee..9396b38308a1 100644 --- a/sys/security/mac_biba/mac_biba.c +++ b/sys/security/mac_biba/mac_biba.c @@ -851,7 +851,7 @@ mac_biba_relabel_vnode(struct ucred *cred, struct vnode *vp, } static void -mac_biba_update_devfsdirent(struct mount *mp, struct devfs_dirent *de, +mac_biba_update_devfs(struct mount *mp, struct devfs_dirent *de, struct label *delabel, struct vnode *vp, struct label *vplabel) { struct mac_biba *source, *dest; @@ -3241,7 +3241,7 @@ static struct mac_policy_ops mac_biba_ops = .mpo_init = mac_biba_init, .mpo_init_bpfdesc_label = mac_biba_init_label, .mpo_init_cred_label = mac_biba_init_label, - .mpo_init_devfsdirent_label = mac_biba_init_label, + .mpo_init_devfs_label = mac_biba_init_label, .mpo_init_ifnet_label = mac_biba_init_label, .mpo_init_inpcb_label = mac_biba_init_label_waitcheck, .mpo_init_syncache_label = mac_biba_init_label_waitcheck, @@ -3260,7 +3260,7 @@ static struct mac_policy_ops mac_biba_ops = .mpo_init_vnode_label = mac_biba_init_label, .mpo_destroy_bpfdesc_label = mac_biba_destroy_label, .mpo_destroy_cred_label = mac_biba_destroy_label, - .mpo_destroy_devfsdirent_label = mac_biba_destroy_label, + .mpo_destroy_devfs_label = mac_biba_destroy_label, .mpo_destroy_ifnet_label = mac_biba_destroy_label, .mpo_destroy_inpcb_label = mac_biba_destroy_label, .mpo_destroy_syncache_label = mac_biba_destroy_label, @@ -3298,7 +3298,7 @@ static struct mac_policy_ops mac_biba_ops = .mpo_create_devfs_symlink = mac_biba_create_devfs_symlink, .mpo_create_mount = mac_biba_create_mount, .mpo_relabel_vnode = mac_biba_relabel_vnode, - .mpo_update_devfsdirent = mac_biba_update_devfsdirent, + .mpo_update_devfs = mac_biba_update_devfs, .mpo_associate_vnode_devfs = mac_biba_associate_vnode_devfs, .mpo_associate_vnode_extattr = mac_biba_associate_vnode_extattr, .mpo_associate_vnode_singlelabel = mac_biba_associate_vnode_singlelabel, diff --git a/sys/security/mac_lomac/mac_lomac.c b/sys/security/mac_lomac/mac_lomac.c index f41581651790..ae575317501f 100644 --- a/sys/security/mac_lomac/mac_lomac.c +++ b/sys/security/mac_lomac/mac_lomac.c @@ -971,7 +971,7 @@ mac_lomac_relabel_vnode(struct ucred *cred, struct vnode *vp, } static void -mac_lomac_update_devfsdirent(struct mount *mp, struct devfs_dirent *de, +mac_lomac_update_devfs(struct mount *mp, struct devfs_dirent *de, struct label *delabel, struct vnode *vp, struct label *vplabel) { struct mac_lomac *source, *dest; @@ -2821,7 +2821,7 @@ static struct mac_policy_ops mac_lomac_ops = .mpo_init = mac_lomac_init, .mpo_init_bpfdesc_label = mac_lomac_init_label, .mpo_init_cred_label = mac_lomac_init_label, - .mpo_init_devfsdirent_label = mac_lomac_init_label, + .mpo_init_devfs_label = mac_lomac_init_label, .mpo_init_ifnet_label = mac_lomac_init_label, .mpo_init_syncache_label = mac_lomac_init_label_waitcheck, .mpo_init_inpcb_label = mac_lomac_init_label_waitcheck, @@ -2836,7 +2836,7 @@ static struct mac_policy_ops mac_lomac_ops = .mpo_init_syncache_from_inpcb = mac_lomac_init_syncache_from_inpcb, .mpo_destroy_bpfdesc_label = mac_lomac_destroy_label, .mpo_destroy_cred_label = mac_lomac_destroy_label, - .mpo_destroy_devfsdirent_label = mac_lomac_destroy_label, + .mpo_destroy_devfs_label = mac_lomac_destroy_label, .mpo_destroy_ifnet_label = mac_lomac_destroy_label, .mpo_destroy_inpcb_label = mac_lomac_destroy_label, .mpo_destroy_ipq_label = mac_lomac_destroy_label, @@ -2870,7 +2870,7 @@ static struct mac_policy_ops mac_lomac_ops = .mpo_create_devfs_symlink = mac_lomac_create_devfs_symlink, .mpo_create_mount = mac_lomac_create_mount, .mpo_relabel_vnode = mac_lomac_relabel_vnode, - .mpo_update_devfsdirent = mac_lomac_update_devfsdirent, + .mpo_update_devfs = mac_lomac_update_devfs, .mpo_associate_vnode_devfs = mac_lomac_associate_vnode_devfs, .mpo_associate_vnode_extattr = mac_lomac_associate_vnode_extattr, .mpo_associate_vnode_singlelabel = diff --git a/sys/security/mac_mls/mac_mls.c b/sys/security/mac_mls/mac_mls.c index 506f03197f9d..b0f2a61fb90c 100644 --- a/sys/security/mac_mls/mac_mls.c +++ b/sys/security/mac_mls/mac_mls.c @@ -36,6 +36,7 @@ /* * Developed by the TrustedBSD Project. + * * MLS fixed label mandatory confidentiality policy. */ @@ -815,7 +816,7 @@ mac_mls_relabel_vnode(struct ucred *cred, struct vnode *vp, } static void -mac_mls_update_devfsdirent(struct mount *mp, struct devfs_dirent *de, +mac_mls_update_devfs(struct mount *mp, struct devfs_dirent *de, struct label *delabel, struct vnode *vp, struct label *vplabel) { struct mac_mls *source, *dest; @@ -2866,7 +2867,7 @@ static struct mac_policy_ops mac_mls_ops = .mpo_init = mac_mls_init, .mpo_init_bpfdesc_label = mac_mls_init_label, .mpo_init_cred_label = mac_mls_init_label, - .mpo_init_devfsdirent_label = mac_mls_init_label, + .mpo_init_devfs_label = mac_mls_init_label, .mpo_init_ifnet_label = mac_mls_init_label, .mpo_init_inpcb_label = mac_mls_init_label_waitcheck, .mpo_init_syncache_label = mac_mls_init_label_waitcheck, @@ -2884,7 +2885,7 @@ static struct mac_policy_ops mac_mls_ops = .mpo_init_vnode_label = mac_mls_init_label, .mpo_destroy_bpfdesc_label = mac_mls_destroy_label, .mpo_destroy_cred_label = mac_mls_destroy_label, - .mpo_destroy_devfsdirent_label = mac_mls_destroy_label, + .mpo_destroy_devfs_label = mac_mls_destroy_label, .mpo_destroy_ifnet_label = mac_mls_destroy_label, .mpo_destroy_inpcb_label = mac_mls_destroy_label, .mpo_destroy_syncache_label = mac_mls_destroy_label, @@ -2922,7 +2923,7 @@ static struct mac_policy_ops mac_mls_ops = .mpo_create_devfs_symlink = mac_mls_create_devfs_symlink, .mpo_create_mount = mac_mls_create_mount, .mpo_relabel_vnode = mac_mls_relabel_vnode, - .mpo_update_devfsdirent = mac_mls_update_devfsdirent, + .mpo_update_devfs = mac_mls_update_devfs, .mpo_associate_vnode_devfs = mac_mls_associate_vnode_devfs, .mpo_associate_vnode_extattr = mac_mls_associate_vnode_extattr, .mpo_associate_vnode_singlelabel = mac_mls_associate_vnode_singlelabel, diff --git a/sys/security/mac_stub/mac_stub.c b/sys/security/mac_stub/mac_stub.c index d92439539efe..1934d6abf357 100644 --- a/sys/security/mac_stub/mac_stub.c +++ b/sys/security/mac_stub/mac_stub.c @@ -245,7 +245,7 @@ stub_setlabel_vnode_extattr(struct ucred *cred, struct vnode *vp, } static void -stub_update_devfsdirent(struct mount *mp, struct devfs_dirent *de, +stub_update_devfs(struct mount *mp, struct devfs_dirent *de, struct label *delabel, struct vnode *vp, struct label *vplabel) { @@ -1434,7 +1434,7 @@ static struct mac_policy_ops mac_stub_ops = .mpo_syscall = stub_syscall, .mpo_init_bpfdesc_label = stub_init_label, .mpo_init_cred_label = stub_init_label, - .mpo_init_devfsdirent_label = stub_init_label, + .mpo_init_devfs_label = stub_init_label, .mpo_init_ifnet_label = stub_init_label, .mpo_init_inpcb_label = stub_init_label_waitcheck, .mpo_init_sysv_msgmsg_label = stub_init_label, @@ -1451,7 +1451,7 @@ static struct mac_policy_ops mac_stub_ops = .mpo_init_vnode_label = stub_init_label, .mpo_destroy_bpfdesc_label = stub_destroy_label, .mpo_destroy_cred_label = stub_destroy_label, - .mpo_destroy_devfsdirent_label = stub_destroy_label, + .mpo_destroy_devfs_label = stub_destroy_label, .mpo_destroy_ifnet_label = stub_destroy_label, .mpo_destroy_inpcb_label = stub_destroy_label, .mpo_destroy_sysv_msgmsg_label = stub_destroy_label, @@ -1498,7 +1498,7 @@ static struct mac_policy_ops mac_stub_ops = .mpo_create_mount = stub_create_mount, .mpo_relabel_vnode = stub_relabel_vnode, .mpo_setlabel_vnode_extattr = stub_setlabel_vnode_extattr, - .mpo_update_devfsdirent = stub_update_devfsdirent, + .mpo_update_devfs = stub_update_devfs, .mpo_create_mbuf_from_socket = stub_create_mbuf_from_socket, .mpo_create_pipe = stub_create_pipe, .mpo_create_posix_sem = stub_create_posix_sem, diff --git a/sys/security/mac_test/mac_test.c b/sys/security/mac_test/mac_test.c index 54f76d1ce3d6..ad49d145d5d3 100644 --- a/sys/security/mac_test/mac_test.c +++ b/sys/security/mac_test/mac_test.c @@ -164,13 +164,13 @@ mac_test_init_cred_label(struct label *label) COUNTER_INC(init_cred_label); } -COUNTER_DECL(init_devfsdirent_label); +COUNTER_DECL(init_devfs_label); static void -mac_test_init_devfsdirent_label(struct label *label) +mac_test_init_devfs_label(struct label *label) { LABEL_INIT(label, MAGIC_DEVFS); - COUNTER_INC(init_devfsdirent_label); + COUNTER_INC(init_devfs_label); } COUNTER_DECL(init_ifnet_label); @@ -352,13 +352,13 @@ mac_test_destroy_cred_label(struct label *label) COUNTER_INC(destroy_cred_label); } -COUNTER_DECL(destroy_devfsdirent_label); +COUNTER_DECL(destroy_devfs_label); static void -mac_test_destroy_devfsdirent_label(struct label *label) +mac_test_destroy_devfs_label(struct label *label) { LABEL_DESTROY(label, MAGIC_DEVFS); - COUNTER_INC(destroy_devfsdirent_label); + COUNTER_INC(destroy_devfs_label); } COUNTER_DECL(destroy_ifnet_label); @@ -716,16 +716,15 @@ mac_test_setlabel_vnode_extattr(struct ucred *cred, struct vnode *vp, return (0); } -COUNTER_DECL(update_devfsdirent); +COUNTER_DECL(update_devfs); static void -mac_test_update_devfsdirent(struct mount *mp, - struct devfs_dirent *devfs_dirent, struct label *direntlabel, - struct vnode *vp, struct label *vplabel) +mac_test_update_devfs(struct mount *mp, struct devfs_dirent *devfs_dirent, + struct label *direntlabel, struct vnode *vp, struct label *vplabel) { LABEL_CHECK(direntlabel, MAGIC_DEVFS); LABEL_CHECK(vplabel, MAGIC_VNODE); - COUNTER_INC(update_devfsdirent); + COUNTER_INC(update_devfs); } /* @@ -2463,7 +2462,7 @@ static struct mac_policy_ops mac_test_ops = { .mpo_init_bpfdesc_label = mac_test_init_bpfdesc_label, .mpo_init_cred_label = mac_test_init_cred_label, - .mpo_init_devfsdirent_label = mac_test_init_devfsdirent_label, + .mpo_init_devfs_label = mac_test_init_devfs_label, .mpo_init_ifnet_label = mac_test_init_ifnet_label, .mpo_init_sysv_msgmsg_label = mac_test_init_sysv_msgmsg_label, .mpo_init_sysv_msgqueue_label = mac_test_init_sysv_msgqueue_label, @@ -2481,7 +2480,7 @@ static struct mac_policy_ops mac_test_ops = .mpo_init_vnode_label = mac_test_init_vnode_label, .mpo_destroy_bpfdesc_label = mac_test_destroy_bpfdesc_label, .mpo_destroy_cred_label = mac_test_destroy_cred_label, - .mpo_destroy_devfsdirent_label = mac_test_destroy_devfsdirent_label, + .mpo_destroy_devfs_label = mac_test_destroy_devfs_label, .mpo_destroy_ifnet_label = mac_test_destroy_ifnet_label, .mpo_destroy_sysv_msgmsg_label = mac_test_destroy_sysv_msgmsg_label, .mpo_destroy_sysv_msgqueue_label = @@ -2525,7 +2524,7 @@ static struct mac_policy_ops mac_test_ops = .mpo_create_mount = mac_test_create_mount, .mpo_relabel_vnode = mac_test_relabel_vnode, .mpo_setlabel_vnode_extattr = mac_test_setlabel_vnode_extattr, - .mpo_update_devfsdirent = mac_test_update_devfsdirent, + .mpo_update_devfs = mac_test_update_devfs, .mpo_create_mbuf_from_socket = mac_test_create_mbuf_from_socket, .mpo_create_pipe = mac_test_create_pipe, .mpo_create_posix_sem = mac_test_create_posix_sem,