Re: [PATCH] linux/hdsmart.h: fix goofups

From: Bartlomiej Zolnierkiewicz
Date: Sun Feb 17 2008 - 12:27:12 EST


On Sunday 17 February 2008, Robert P. J. Day wrote:
> On Sun, 17 Feb 2008, Bartlomiej Zolnierkiewicz wrote:
>
> > Fix goofups of commit 76166952bbc81dda1c8a8c14e75a2aa06f6c052c
> > ("<linux/hdsmart.h> is not used by kernel code").
> >
> > Reported-by: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
> > ---
> > include/linux/hdsmart.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > Index: b/include/linux/hdsmart.h
> > ===================================================================
> > --- a/include/linux/hdsmart.h
> > +++ b/include/linux/hdsmart.h
> > @@ -17,7 +17,7 @@
> > #ifndef _LINUX_HDSMART_H
> > #define _LINUX_HDSMART_H
> >
> > -#ifndef __KERNEL
> > +#ifndef __KERNEL__
> > #define OFFLINE_FULL_SCAN 0
> > #define SHORT_SELF_TEST 1
> > #define EXTEND_SELF_TEST 2
> > @@ -121,6 +121,6 @@ typedef struct ata_smart_selftestlog_s {
> > unsigned char resevered[2];
> > unsigned char chksum;
> > } __attribute__ ((packed)) ata_smart_selftestlog_t;
> > -#endif /* __KERNEL__ *
> > +#endif /* __KERNEL__ */
> >
> > #endif /* _LINUX_HDSMART_H */
>
> if that header file isn't used by any kernel code, why bother having a
> check for __KERNEL__ in the first place? it's being exported to
> userspace unchecked:
>
> include/linux/Kbuild:header-y += hdsmart.h
>
> so why not just toss that check entirely? otherwise, you're going to
> get a header file exported to userspace that has a superfluous
> __KERNEL__ test in it.

We don't want new (accidental etc.) kernel users of this header.

How's about this version?

From: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
Subject: [PATCH] linux/hdsmart.h: fix goofups (take 2)

Fix goofups of commit 76166952bbc81dda1c8a8c14e75a2aa06f6c052c
("<linux/hdsmart.h> is not used by kernel code").

Also update include/linux/Kbuild to reflect the fact that hdsmart.h
uses __KERNEL__ ifdefs now.

Reported-by: "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
---
include/linux/Kbuild | 2 +-
include/linux/hdsmart.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

Index: b/include/linux/Kbuild
===================================================================
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -70,7 +70,6 @@ header-y += fuse.h
header-y += genetlink.h
header-y += gen_stats.h
header-y += gigaset_dev.h
-header-y += hdsmart.h
header-y += hysdn_if.h
header-y += i2o-dev.h
header-y += i8k.h
@@ -211,6 +210,7 @@ unifdef-y += hayesesp.h
unifdef-y += hdlcdrv.h
unifdef-y += hdlc.h
unifdef-y += hdreg.h
+unifdef-y += hdsmart.h
unifdef-y += hiddev.h
unifdef-y += hpet.h
unifdef-y += i2c.h
Index: b/include/linux/hdsmart.h
===================================================================
--- a/include/linux/hdsmart.h
+++ b/include/linux/hdsmart.h
@@ -17,7 +17,7 @@
#ifndef _LINUX_HDSMART_H
#define _LINUX_HDSMART_H

-#ifndef __KERNEL
+#ifndef __KERNEL__
#define OFFLINE_FULL_SCAN 0
#define SHORT_SELF_TEST 1
#define EXTEND_SELF_TEST 2
@@ -121,6 +121,6 @@ typedef struct ata_smart_selftestlog_s {
unsigned char resevered[2];
unsigned char chksum;
} __attribute__ ((packed)) ata_smart_selftestlog_t;
-#endif /* __KERNEL__ *
+#endif /* __KERNEL__ */

#endif /* _LINUX_HDSMART_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/