Re: [PATCH 6/8] security: smack: Use a more current logging style
On Tue, 2014-02-25 at 18:53 -0600, Kodiak Furr wrote: > Chghf11 Sorry, I can't read this. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/8] security: smack: Use a more current logging style
On Tue, 2014-02-25 at 18:53 -0600, Kodiak Furr wrote: Chghf11 Sorry, I can't read this. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/8] security: smack: Use a more current logging style
On Mon, 24 Feb 2014, Casey Schaufler wrote: > On 2/24/2014 2:35 PM, Casey Schaufler wrote: > > On 2/24/2014 1:59 PM, Joe Perches wrote: > >> Convert printks to pr_ > >> Add pr_fmt. > >> > >> Signed-off-by: Joe Perches > > Acked-by: Casey Schaufler > > > > I will take this into the smack-next tree. > > Unless James would rather take the whole set, that is. Yep, I'll take the whole set. > > > > >> --- > >> security/smack/smack_lsm.c | 7 --- > >> security/smack/smackfs.c | 25 +++-- > >> 2 files changed, 15 insertions(+), 17 deletions(-) > >> > >> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c > >> index 14f52be..a273aad 100644 > >> --- a/security/smack/smack_lsm.c > >> +++ b/security/smack/smack_lsm.c > >> @@ -18,6 +18,8 @@ > >> * as published by the Free Software Foundation. > >> */ > >> > >> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > >> + > >> #include > >> #include > >> #include > >> @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode > >> *inode, const char *name, > >>if (sock->sk->sk_family == PF_INET) { > >>rc = smack_netlabel(sock->sk, SMACK_CIPSO_SOCKET); > >>if (rc != 0) > >> - printk(KERN_WARNING > >> - "Smack: \"%s\" netlbl error %d.\n", > >> + pr_warn("\"%s\" netlbl error %d\n", > >>__func__, -rc); > >>} > >>} else > >> @@ -3916,7 +3917,7 @@ static __init int smack_init(void) > >>if (tsp == NULL) > >>return -ENOMEM; > >> > >> - printk(KERN_INFO "Smack: Initializing.\n"); > >> + pr_info("Initializing\n"); > >> > >>/* > >> * Set the security state for the initial task. > >> diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c > >> index 3198cfe..2e25220 100644 > >> --- a/security/smack/smackfs.c > >> +++ b/security/smack/smackfs.c > >> @@ -16,6 +16,8 @@ > >> * > >> */ > >> > >> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > >> + > >> #include > >> #include > >> #include > >> @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) > >> > >>rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, ); > >>if (rc != 0) > >> - printk(KERN_WARNING "%s:%d remove rc = %d\n", > >> - __func__, __LINE__, rc); > >> + pr_warn("%s:%d remove rc = %d\n", __func__, __LINE__, rc); > >> > >>doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); > >>if (doip == NULL) > >> @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) > >> > >>rc = netlbl_cfg_cipsov4_add(doip, ); > >>if (rc != 0) { > >> - printk(KERN_WARNING "%s:%d cipso add rc = %d\n", > >> - __func__, __LINE__, rc); > >> + pr_warn("%s:%d cipso add rc = %d\n", __func__, __LINE__, rc); > >>kfree(doip); > >>return; > >>} > >>rc = netlbl_cfg_cipsov4_map_add(doip->doi, NULL, NULL, NULL, ); > >>if (rc != 0) { > >> - printk(KERN_WARNING "%s:%d map add rc = %d\n", > >> - __func__, __LINE__, rc); > >> + pr_warn("%s:%d map add rc = %d\n", __func__, __LINE__, rc); > >>kfree(doip); > >>return; > >>} > >> @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) > >>if (oldambient != NULL) { > >>rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, ); > >>if (rc != 0) > >> - printk(KERN_WARNING "%s:%d remove rc = %d\n", > >> - __func__, __LINE__, rc); > >> + pr_warn("%s:%d remove rc = %d\n", > >> + __func__, __LINE__, rc); > >>} > >>if (smack_net_ambient == NULL) > >>smack_net_ambient = _known_floor; > >> @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) > >>rc = netlbl_cfg_unlbl_map_add(smack_net_ambient->smk_known, PF_INET, > >> NULL, NULL, ); > >>if (rc != 0) > >> - printk(KERN_WARNING "%s:%d add rc = %d\n", > >> - __func__, __LINE__, rc); > >> + pr_warn("%s:%d add rc = %d\n", __func__, __LINE__, rc); > >> } > >> > >> /* > >> @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, > >> void *data, int silent) > >> > >>rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); > >>if (rc != 0) { > >> - printk(KERN_ERR "%s failed %d while creating inodes\n", > >> - __func__, rc); > >> + pr_err("%s failed %d while creating inodes\n", __func__, rc); > >>return rc; > >>} > >> > >> @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) > >> > >>err = smk_init_sysfs(); > >>if (err) > >> - printk(KERN_ERR "smackfs: sysfs mountpoint problem.\n"); > >> + pr_err("smackfs: sysfs mountpoint problem\n"); > >> > >>
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 2:35 PM, Casey Schaufler wrote: > On 2/24/2014 1:59 PM, Joe Perches wrote: >> Convert printks to pr_ >> Add pr_fmt. >> >> Signed-off-by: Joe Perches > Acked-by: Casey Schaufler > > I will take this into the smack-next tree. Unless James would rather take the whole set, that is. > >> --- >> security/smack/smack_lsm.c | 7 --- >> security/smack/smackfs.c | 25 +++-- >> 2 files changed, 15 insertions(+), 17 deletions(-) >> >> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c >> index 14f52be..a273aad 100644 >> --- a/security/smack/smack_lsm.c >> +++ b/security/smack/smack_lsm.c >> @@ -18,6 +18,8 @@ >> * as published by the Free Software Foundation. >> */ >> >> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt >> + >> #include >> #include >> #include >> @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode >> *inode, const char *name, >> if (sock->sk->sk_family == PF_INET) { >> rc = smack_netlabel(sock->sk, SMACK_CIPSO_SOCKET); >> if (rc != 0) >> -printk(KERN_WARNING >> -"Smack: \"%s\" netlbl error %d.\n", >> +pr_warn("\"%s\" netlbl error %d\n", >> __func__, -rc); >> } >> } else >> @@ -3916,7 +3917,7 @@ static __init int smack_init(void) >> if (tsp == NULL) >> return -ENOMEM; >> >> -printk(KERN_INFO "Smack: Initializing.\n"); >> +pr_info("Initializing\n"); >> >> /* >> * Set the security state for the initial task. >> diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c >> index 3198cfe..2e25220 100644 >> --- a/security/smack/smackfs.c >> +++ b/security/smack/smackfs.c >> @@ -16,6 +16,8 @@ >> * >> */ >> >> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt >> + >> #include >> #include >> #include >> @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) >> >> rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, ); >> if (rc != 0) >> -printk(KERN_WARNING "%s:%d remove rc = %d\n", >> - __func__, __LINE__, rc); >> +pr_warn("%s:%d remove rc = %d\n", __func__, __LINE__, rc); >> >> doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); >> if (doip == NULL) >> @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) >> >> rc = netlbl_cfg_cipsov4_add(doip, ); >> if (rc != 0) { >> -printk(KERN_WARNING "%s:%d cipso add rc = %d\n", >> - __func__, __LINE__, rc); >> +pr_warn("%s:%d cipso add rc = %d\n", __func__, __LINE__, rc); >> kfree(doip); >> return; >> } >> rc = netlbl_cfg_cipsov4_map_add(doip->doi, NULL, NULL, NULL, ); >> if (rc != 0) { >> -printk(KERN_WARNING "%s:%d map add rc = %d\n", >> - __func__, __LINE__, rc); >> +pr_warn("%s:%d map add rc = %d\n", __func__, __LINE__, rc); >> kfree(doip); >> return; >> } >> @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) >> if (oldambient != NULL) { >> rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, ); >> if (rc != 0) >> -printk(KERN_WARNING "%s:%d remove rc = %d\n", >> - __func__, __LINE__, rc); >> +pr_warn("%s:%d remove rc = %d\n", >> +__func__, __LINE__, rc); >> } >> if (smack_net_ambient == NULL) >> smack_net_ambient = _known_floor; >> @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) >> rc = netlbl_cfg_unlbl_map_add(smack_net_ambient->smk_known, PF_INET, >>NULL, NULL, ); >> if (rc != 0) >> -printk(KERN_WARNING "%s:%d add rc = %d\n", >> - __func__, __LINE__, rc); >> +pr_warn("%s:%d add rc = %d\n", __func__, __LINE__, rc); >> } >> >> /* >> @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, void >> *data, int silent) >> >> rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); >> if (rc != 0) { >> -printk(KERN_ERR "%s failed %d while creating inodes\n", >> -__func__, rc); >> +pr_err("%s failed %d while creating inodes\n", __func__, rc); >> return rc; >> } >> >> @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) >> >> err = smk_init_sysfs(); >> if (err) >> -printk(KERN_ERR "smackfs: sysfs mountpoint problem.\n"); >> +pr_err("smackfs: sysfs mountpoint problem\n"); >> >> err = register_filesystem(_fs_type); >> if (!err) { >> smackfs_mount = kern_mount(_fs_type); >> if (IS_ERR(smackfs_mount)) { >> -printk(KERN_ERR "smackfs: could
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 1:59 PM, Joe Perches wrote: > Convert printks to pr_ > Add pr_fmt. > > Signed-off-by: Joe Perches Acked-by: Casey Schaufler I will take this into the smack-next tree. > --- > security/smack/smack_lsm.c | 7 --- > security/smack/smackfs.c | 25 +++-- > 2 files changed, 15 insertions(+), 17 deletions(-) > > diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c > index 14f52be..a273aad 100644 > --- a/security/smack/smack_lsm.c > +++ b/security/smack/smack_lsm.c > @@ -18,6 +18,8 @@ > * as published by the Free Software Foundation. > */ > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + > #include > #include > #include > @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, > const char *name, > if (sock->sk->sk_family == PF_INET) { > rc = smack_netlabel(sock->sk, SMACK_CIPSO_SOCKET); > if (rc != 0) > - printk(KERN_WARNING > - "Smack: \"%s\" netlbl error %d.\n", > + pr_warn("\"%s\" netlbl error %d\n", > __func__, -rc); > } > } else > @@ -3916,7 +3917,7 @@ static __init int smack_init(void) > if (tsp == NULL) > return -ENOMEM; > > - printk(KERN_INFO "Smack: Initializing.\n"); > + pr_info("Initializing\n"); > > /* >* Set the security state for the initial task. > diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c > index 3198cfe..2e25220 100644 > --- a/security/smack/smackfs.c > +++ b/security/smack/smackfs.c > @@ -16,6 +16,8 @@ > * > */ > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + > #include > #include > #include > @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) > > rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, ); > if (rc != 0) > - printk(KERN_WARNING "%s:%d remove rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d remove rc = %d\n", __func__, __LINE__, rc); > > doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); > if (doip == NULL) > @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) > > rc = netlbl_cfg_cipsov4_add(doip, ); > if (rc != 0) { > - printk(KERN_WARNING "%s:%d cipso add rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d cipso add rc = %d\n", __func__, __LINE__, rc); > kfree(doip); > return; > } > rc = netlbl_cfg_cipsov4_map_add(doip->doi, NULL, NULL, NULL, ); > if (rc != 0) { > - printk(KERN_WARNING "%s:%d map add rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d map add rc = %d\n", __func__, __LINE__, rc); > kfree(doip); > return; > } > @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) > if (oldambient != NULL) { > rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, ); > if (rc != 0) > - printk(KERN_WARNING "%s:%d remove rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d remove rc = %d\n", > + __func__, __LINE__, rc); > } > if (smack_net_ambient == NULL) > smack_net_ambient = _known_floor; > @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) > rc = netlbl_cfg_unlbl_map_add(smack_net_ambient->smk_known, PF_INET, > NULL, NULL, ); > if (rc != 0) > - printk(KERN_WARNING "%s:%d add rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d add rc = %d\n", __func__, __LINE__, rc); > } > > /* > @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, void > *data, int silent) > > rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); > if (rc != 0) { > - printk(KERN_ERR "%s failed %d while creating inodes\n", > - __func__, rc); > + pr_err("%s failed %d while creating inodes\n", __func__, rc); > return rc; > } > > @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) > > err = smk_init_sysfs(); > if (err) > - printk(KERN_ERR "smackfs: sysfs mountpoint problem.\n"); > + pr_err("smackfs: sysfs mountpoint problem\n"); > > err = register_filesystem(_fs_type); > if (!err) { > smackfs_mount = kern_mount(_fs_type); > if (IS_ERR(smackfs_mount)) { > - printk(KERN_ERR "smackfs: could not mount!\n"); > + pr_err("smackfs: could not mount!\n"); > err = PTR_ERR(smackfs_mount); >
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 2:23 PM, Joe Perches wrote: > On Mon, 2014-02-24 at 14:16 -0800, Casey Schaufler wrote: >> On 2/24/2014 1:59 PM, Joe Perches wrote: >>> Convert printks to pr_ >>> Add pr_fmt. >>> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c > [] >>> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt >>> + >> What is pr_fmt() for? > Prefixing "smack: " to the pr_ uses. OK. I didn't see where it was used. I understand now. I'll go back and ACK the changes. > >>> @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode >>> *inode, const char *name, >>> if (sock->sk->sk_family == PF_INET) { >>> rc = smack_netlabel(sock->sk, SMACK_CIPSO_SOCKET); >>> if (rc != 0) >>> - printk(KERN_WARNING >>> - "Smack: \"%s\" netlbl error %d.\n", >>> + pr_warn("\"%s\" netlbl error %d\n", >>> __func__, -rc); > This will be now be emitted as > > <4>smack: "smack_inode_setsecurity" netlbl error - > > instead of > > <4>Smack: "smack_inode_setsecurity" netlbl error - > > Though it'd be a lot more common to use: > > pr_warn("%s: netlbl error: %d\n", > __func__, -rc); > > so the output would be: > > <4>smack: smack_inode_setsecurity: netlbl error: - > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 1:59 PM, Joe Perches wrote: > Convert printks to pr_ > Add pr_fmt. > > Signed-off-by: Joe Perches > --- > security/smack/smack_lsm.c | 7 --- > security/smack/smackfs.c | 25 +++-- > 2 files changed, 15 insertions(+), 17 deletions(-) > > diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c > index 14f52be..a273aad 100644 > --- a/security/smack/smack_lsm.c > +++ b/security/smack/smack_lsm.c > @@ -18,6 +18,8 @@ > * as published by the Free Software Foundation. > */ > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + What is pr_fmt() for? > #include > #include > #include > @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, > const char *name, > if (sock->sk->sk_family == PF_INET) { > rc = smack_netlabel(sock->sk, SMACK_CIPSO_SOCKET); > if (rc != 0) > - printk(KERN_WARNING > - "Smack: \"%s\" netlbl error %d.\n", > + pr_warn("\"%s\" netlbl error %d\n", > __func__, -rc); > } > } else > @@ -3916,7 +3917,7 @@ static __init int smack_init(void) > if (tsp == NULL) > return -ENOMEM; > > - printk(KERN_INFO "Smack: Initializing.\n"); > + pr_info("Initializing\n"); > > /* >* Set the security state for the initial task. > diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c > index 3198cfe..2e25220 100644 > --- a/security/smack/smackfs.c > +++ b/security/smack/smackfs.c > @@ -16,6 +16,8 @@ > * > */ > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > + > #include > #include > #include > @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) > > rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, ); > if (rc != 0) > - printk(KERN_WARNING "%s:%d remove rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d remove rc = %d\n", __func__, __LINE__, rc); > > doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); > if (doip == NULL) > @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) > > rc = netlbl_cfg_cipsov4_add(doip, ); > if (rc != 0) { > - printk(KERN_WARNING "%s:%d cipso add rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d cipso add rc = %d\n", __func__, __LINE__, rc); > kfree(doip); > return; > } > rc = netlbl_cfg_cipsov4_map_add(doip->doi, NULL, NULL, NULL, ); > if (rc != 0) { > - printk(KERN_WARNING "%s:%d map add rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d map add rc = %d\n", __func__, __LINE__, rc); > kfree(doip); > return; > } > @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) > if (oldambient != NULL) { > rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, ); > if (rc != 0) > - printk(KERN_WARNING "%s:%d remove rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d remove rc = %d\n", > + __func__, __LINE__, rc); > } > if (smack_net_ambient == NULL) > smack_net_ambient = _known_floor; > @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) > rc = netlbl_cfg_unlbl_map_add(smack_net_ambient->smk_known, PF_INET, > NULL, NULL, ); > if (rc != 0) > - printk(KERN_WARNING "%s:%d add rc = %d\n", > -__func__, __LINE__, rc); > + pr_warn("%s:%d add rc = %d\n", __func__, __LINE__, rc); > } > > /* > @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, void > *data, int silent) > > rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); > if (rc != 0) { > - printk(KERN_ERR "%s failed %d while creating inodes\n", > - __func__, rc); > + pr_err("%s failed %d while creating inodes\n", __func__, rc); > return rc; > } > > @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) > > err = smk_init_sysfs(); > if (err) > - printk(KERN_ERR "smackfs: sysfs mountpoint problem.\n"); > + pr_err("smackfs: sysfs mountpoint problem\n"); > > err = register_filesystem(_fs_type); > if (!err) { > smackfs_mount = kern_mount(_fs_type); > if (IS_ERR(smackfs_mount)) { > - printk(KERN_ERR "smackfs: could not mount!\n"); > + pr_err("smackfs: could not mount!\n"); > err = PTR_ERR(smackfs_mount); > smackfs_mount = NULL; > } -- To
Re: [PATCH 6/8] security: smack: Use a more current logging style
On Mon, 2014-02-24 at 14:16 -0800, Casey Schaufler wrote: > On 2/24/2014 1:59 PM, Joe Perches wrote: > > Convert printks to pr_ > > Add pr_fmt. > > diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c [] > > +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > + > > What is pr_fmt() for? Prefixing "smack: " to the pr_ uses. > > @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode > > *inode, const char *name, > > if (sock->sk->sk_family == PF_INET) { > > rc = smack_netlabel(sock->sk, SMACK_CIPSO_SOCKET); > > if (rc != 0) > > - printk(KERN_WARNING > > - "Smack: \"%s\" netlbl error %d.\n", > > + pr_warn("\"%s\" netlbl error %d\n", > > __func__, -rc); This will be now be emitted as <4>smack: "smack_inode_setsecurity" netlbl error - instead of <4>Smack: "smack_inode_setsecurity" netlbl error - Though it'd be a lot more common to use: pr_warn("%s: netlbl error: %d\n", __func__, -rc); so the output would be: <4>smack: smack_inode_setsecurity: netlbl error: - -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 1:59 PM, Joe Perches wrote: Convert printks to pr_level Add pr_fmt. Signed-off-by: Joe Perches j...@perches.com --- security/smack/smack_lsm.c | 7 --- security/smack/smackfs.c | 25 +++-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 14f52be..a273aad 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -18,6 +18,8 @@ * as published by the Free Software Foundation. */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + What is pr_fmt() for? #include linux/xattr.h #include linux/pagemap.h #include linux/mount.h @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, if (sock-sk-sk_family == PF_INET) { rc = smack_netlabel(sock-sk, SMACK_CIPSO_SOCKET); if (rc != 0) - printk(KERN_WARNING - Smack: \%s\ netlbl error %d.\n, + pr_warn(\%s\ netlbl error %d\n, __func__, -rc); } } else @@ -3916,7 +3917,7 @@ static __init int smack_init(void) if (tsp == NULL) return -ENOMEM; - printk(KERN_INFO Smack: Initializing.\n); + pr_info(Initializing\n); /* * Set the security state for the initial task. diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 3198cfe..2e25220 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -16,6 +16,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/kernel.h #include linux/vmalloc.h #include linux/security.h @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d remove rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d remove rc = %d\n, __func__, __LINE__, rc); doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); if (doip == NULL) @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_cipsov4_add(doip, nai); if (rc != 0) { - printk(KERN_WARNING %s:%d cipso add rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d cipso add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } rc = netlbl_cfg_cipsov4_map_add(doip-doi, NULL, NULL, NULL, nai); if (rc != 0) { - printk(KERN_WARNING %s:%d map add rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d map add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) if (oldambient != NULL) { rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d remove rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d remove rc = %d\n, + __func__, __LINE__, rc); } if (smack_net_ambient == NULL) smack_net_ambient = smack_known_floor; @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) rc = netlbl_cfg_unlbl_map_add(smack_net_ambient-smk_known, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d add rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d add rc = %d\n, __func__, __LINE__, rc); } /* @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent) rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); if (rc != 0) { - printk(KERN_ERR %s failed %d while creating inodes\n, - __func__, rc); + pr_err(%s failed %d while creating inodes\n, __func__, rc); return rc; } @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) err = smk_init_sysfs(); if (err) - printk(KERN_ERR smackfs: sysfs mountpoint problem.\n); + pr_err(smackfs: sysfs mountpoint problem\n); err = register_filesystem(smk_fs_type); if (!err) { smackfs_mount = kern_mount(smk_fs_type); if (IS_ERR(smackfs_mount)) { - printk(KERN_ERR smackfs: could not mount!\n); + pr_err(smackfs: could not mount!\n); err = PTR_ERR(smackfs_mount); smackfs_mount = NULL; } -- To unsubscribe from this list: send the line unsubscribe
Re: [PATCH 6/8] security: smack: Use a more current logging style
On Mon, 2014-02-24 at 14:16 -0800, Casey Schaufler wrote: On 2/24/2014 1:59 PM, Joe Perches wrote: Convert printks to pr_level Add pr_fmt. diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c [] +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + What is pr_fmt() for? Prefixing smack: to the pr_level uses. @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, if (sock-sk-sk_family == PF_INET) { rc = smack_netlabel(sock-sk, SMACK_CIPSO_SOCKET); if (rc != 0) - printk(KERN_WARNING - Smack: \%s\ netlbl error %d.\n, + pr_warn(\%s\ netlbl error %d\n, __func__, -rc); This will be now be emitted as 4smack: smack_inode_setsecurity netlbl error -d instead of 4Smack: smack_inode_setsecurity netlbl error -d Though it'd be a lot more common to use: pr_warn(%s: netlbl error: %d\n, __func__, -rc); so the output would be: 4smack: smack_inode_setsecurity: netlbl error: -d -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 2:23 PM, Joe Perches wrote: On Mon, 2014-02-24 at 14:16 -0800, Casey Schaufler wrote: On 2/24/2014 1:59 PM, Joe Perches wrote: Convert printks to pr_level Add pr_fmt. diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c [] +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + What is pr_fmt() for? Prefixing smack: to the pr_level uses. OK. I didn't see where it was used. I understand now. I'll go back and ACK the changes. @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, if (sock-sk-sk_family == PF_INET) { rc = smack_netlabel(sock-sk, SMACK_CIPSO_SOCKET); if (rc != 0) - printk(KERN_WARNING - Smack: \%s\ netlbl error %d.\n, + pr_warn(\%s\ netlbl error %d\n, __func__, -rc); This will be now be emitted as 4smack: smack_inode_setsecurity netlbl error -d instead of 4Smack: smack_inode_setsecurity netlbl error -d Though it'd be a lot more common to use: pr_warn(%s: netlbl error: %d\n, __func__, -rc); so the output would be: 4smack: smack_inode_setsecurity: netlbl error: -d -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 1:59 PM, Joe Perches wrote: Convert printks to pr_level Add pr_fmt. Signed-off-by: Joe Perches j...@perches.com Acked-by: Casey Schaufler ca...@schaufler-ca.com I will take this into the smack-next tree. --- security/smack/smack_lsm.c | 7 --- security/smack/smackfs.c | 25 +++-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 14f52be..a273aad 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -18,6 +18,8 @@ * as published by the Free Software Foundation. */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/xattr.h #include linux/pagemap.h #include linux/mount.h @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, if (sock-sk-sk_family == PF_INET) { rc = smack_netlabel(sock-sk, SMACK_CIPSO_SOCKET); if (rc != 0) - printk(KERN_WARNING - Smack: \%s\ netlbl error %d.\n, + pr_warn(\%s\ netlbl error %d\n, __func__, -rc); } } else @@ -3916,7 +3917,7 @@ static __init int smack_init(void) if (tsp == NULL) return -ENOMEM; - printk(KERN_INFO Smack: Initializing.\n); + pr_info(Initializing\n); /* * Set the security state for the initial task. diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 3198cfe..2e25220 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -16,6 +16,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/kernel.h #include linux/vmalloc.h #include linux/security.h @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d remove rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d remove rc = %d\n, __func__, __LINE__, rc); doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); if (doip == NULL) @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_cipsov4_add(doip, nai); if (rc != 0) { - printk(KERN_WARNING %s:%d cipso add rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d cipso add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } rc = netlbl_cfg_cipsov4_map_add(doip-doi, NULL, NULL, NULL, nai); if (rc != 0) { - printk(KERN_WARNING %s:%d map add rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d map add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) if (oldambient != NULL) { rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d remove rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d remove rc = %d\n, + __func__, __LINE__, rc); } if (smack_net_ambient == NULL) smack_net_ambient = smack_known_floor; @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) rc = netlbl_cfg_unlbl_map_add(smack_net_ambient-smk_known, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d add rc = %d\n, -__func__, __LINE__, rc); + pr_warn(%s:%d add rc = %d\n, __func__, __LINE__, rc); } /* @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent) rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); if (rc != 0) { - printk(KERN_ERR %s failed %d while creating inodes\n, - __func__, rc); + pr_err(%s failed %d while creating inodes\n, __func__, rc); return rc; } @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) err = smk_init_sysfs(); if (err) - printk(KERN_ERR smackfs: sysfs mountpoint problem.\n); + pr_err(smackfs: sysfs mountpoint problem\n); err = register_filesystem(smk_fs_type); if (!err) { smackfs_mount = kern_mount(smk_fs_type); if (IS_ERR(smackfs_mount)) { - printk(KERN_ERR smackfs: could not mount!\n); + pr_err(smackfs: could not mount!\n); err = PTR_ERR(smackfs_mount); smackfs_mount = NULL;
Re: [PATCH 6/8] security: smack: Use a more current logging style
On 2/24/2014 2:35 PM, Casey Schaufler wrote: On 2/24/2014 1:59 PM, Joe Perches wrote: Convert printks to pr_level Add pr_fmt. Signed-off-by: Joe Perches j...@perches.com Acked-by: Casey Schaufler ca...@schaufler-ca.com I will take this into the smack-next tree. Unless James would rather take the whole set, that is. --- security/smack/smack_lsm.c | 7 --- security/smack/smackfs.c | 25 +++-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 14f52be..a273aad 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -18,6 +18,8 @@ * as published by the Free Software Foundation. */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/xattr.h #include linux/pagemap.h #include linux/mount.h @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, if (sock-sk-sk_family == PF_INET) { rc = smack_netlabel(sock-sk, SMACK_CIPSO_SOCKET); if (rc != 0) -printk(KERN_WARNING -Smack: \%s\ netlbl error %d.\n, +pr_warn(\%s\ netlbl error %d\n, __func__, -rc); } } else @@ -3916,7 +3917,7 @@ static __init int smack_init(void) if (tsp == NULL) return -ENOMEM; -printk(KERN_INFO Smack: Initializing.\n); +pr_info(Initializing\n); /* * Set the security state for the initial task. diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 3198cfe..2e25220 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -16,6 +16,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/kernel.h #include linux/vmalloc.h #include linux/security.h @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, nai); if (rc != 0) -printk(KERN_WARNING %s:%d remove rc = %d\n, - __func__, __LINE__, rc); +pr_warn(%s:%d remove rc = %d\n, __func__, __LINE__, rc); doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); if (doip == NULL) @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_cipsov4_add(doip, nai); if (rc != 0) { -printk(KERN_WARNING %s:%d cipso add rc = %d\n, - __func__, __LINE__, rc); +pr_warn(%s:%d cipso add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } rc = netlbl_cfg_cipsov4_map_add(doip-doi, NULL, NULL, NULL, nai); if (rc != 0) { -printk(KERN_WARNING %s:%d map add rc = %d\n, - __func__, __LINE__, rc); +pr_warn(%s:%d map add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) if (oldambient != NULL) { rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, nai); if (rc != 0) -printk(KERN_WARNING %s:%d remove rc = %d\n, - __func__, __LINE__, rc); +pr_warn(%s:%d remove rc = %d\n, +__func__, __LINE__, rc); } if (smack_net_ambient == NULL) smack_net_ambient = smack_known_floor; @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) rc = netlbl_cfg_unlbl_map_add(smack_net_ambient-smk_known, PF_INET, NULL, NULL, nai); if (rc != 0) -printk(KERN_WARNING %s:%d add rc = %d\n, - __func__, __LINE__, rc); +pr_warn(%s:%d add rc = %d\n, __func__, __LINE__, rc); } /* @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent) rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); if (rc != 0) { -printk(KERN_ERR %s failed %d while creating inodes\n, -__func__, rc); +pr_err(%s failed %d while creating inodes\n, __func__, rc); return rc; } @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) err = smk_init_sysfs(); if (err) -printk(KERN_ERR smackfs: sysfs mountpoint problem.\n); +pr_err(smackfs: sysfs mountpoint problem\n); err = register_filesystem(smk_fs_type); if (!err) { smackfs_mount = kern_mount(smk_fs_type); if (IS_ERR(smackfs_mount)) { -printk(KERN_ERR smackfs: could not mount!\n); +pr_err(smackfs: could not mount!\n); err = PTR_ERR(smackfs_mount);
Re: [PATCH 6/8] security: smack: Use a more current logging style
On Mon, 24 Feb 2014, Casey Schaufler wrote: On 2/24/2014 2:35 PM, Casey Schaufler wrote: On 2/24/2014 1:59 PM, Joe Perches wrote: Convert printks to pr_level Add pr_fmt. Signed-off-by: Joe Perches j...@perches.com Acked-by: Casey Schaufler ca...@schaufler-ca.com I will take this into the smack-next tree. Unless James would rather take the whole set, that is. Yep, I'll take the whole set. --- security/smack/smack_lsm.c | 7 --- security/smack/smackfs.c | 25 +++-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index 14f52be..a273aad 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -18,6 +18,8 @@ * as published by the Free Software Foundation. */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/xattr.h #include linux/pagemap.h #include linux/mount.h @@ -2106,8 +2108,7 @@ static int smack_inode_setsecurity(struct inode *inode, const char *name, if (sock-sk-sk_family == PF_INET) { rc = smack_netlabel(sock-sk, SMACK_CIPSO_SOCKET); if (rc != 0) - printk(KERN_WARNING - Smack: \%s\ netlbl error %d.\n, + pr_warn(\%s\ netlbl error %d\n, __func__, -rc); } } else @@ -3916,7 +3917,7 @@ static __init int smack_init(void) if (tsp == NULL) return -ENOMEM; - printk(KERN_INFO Smack: Initializing.\n); + pr_info(Initializing\n); /* * Set the security state for the initial task. diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c index 3198cfe..2e25220 100644 --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -16,6 +16,8 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME : fmt + #include linux/kernel.h #include linux/vmalloc.h #include linux/security.h @@ -698,8 +700,7 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_map_del(NULL, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d remove rc = %d\n, - __func__, __LINE__, rc); + pr_warn(%s:%d remove rc = %d\n, __func__, __LINE__, rc); doip = kmalloc(sizeof(struct cipso_v4_doi), GFP_KERNEL); if (doip == NULL) @@ -713,15 +714,13 @@ static void smk_cipso_doi(void) rc = netlbl_cfg_cipsov4_add(doip, nai); if (rc != 0) { - printk(KERN_WARNING %s:%d cipso add rc = %d\n, - __func__, __LINE__, rc); + pr_warn(%s:%d cipso add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } rc = netlbl_cfg_cipsov4_map_add(doip-doi, NULL, NULL, NULL, nai); if (rc != 0) { - printk(KERN_WARNING %s:%d map add rc = %d\n, - __func__, __LINE__, rc); + pr_warn(%s:%d map add rc = %d\n, __func__, __LINE__, rc); kfree(doip); return; } @@ -741,8 +740,8 @@ static void smk_unlbl_ambient(char *oldambient) if (oldambient != NULL) { rc = netlbl_cfg_map_del(oldambient, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d remove rc = %d\n, - __func__, __LINE__, rc); + pr_warn(%s:%d remove rc = %d\n, + __func__, __LINE__, rc); } if (smack_net_ambient == NULL) smack_net_ambient = smack_known_floor; @@ -750,8 +749,7 @@ static void smk_unlbl_ambient(char *oldambient) rc = netlbl_cfg_unlbl_map_add(smack_net_ambient-smk_known, PF_INET, NULL, NULL, nai); if (rc != 0) - printk(KERN_WARNING %s:%d add rc = %d\n, - __func__, __LINE__, rc); + pr_warn(%s:%d add rc = %d\n, __func__, __LINE__, rc); } /* @@ -2302,8 +2300,7 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent) rc = simple_fill_super(sb, SMACK_MAGIC, smack_files); if (rc != 0) { - printk(KERN_ERR %s failed %d while creating inodes\n, - __func__, rc); + pr_err(%s failed %d while creating inodes\n, __func__, rc); return rc; } @@ -2369,13 +2366,13 @@ static int __init init_smk_fs(void) err = smk_init_sysfs(); if (err) - printk(KERN_ERR smackfs: sysfs mountpoint problem.\n); + pr_err(smackfs: sysfs mountpoint problem\n); err = register_filesystem(smk_fs_type); if (!err) { smackfs_mount = kern_mount(smk_fs_type); if (IS_ERR(smackfs_mount)) { - printk(KERN_ERR smackfs: could not mount!\n); + pr_err(smackfs: could not mount!\n);