* [PATCH] Remove <linux/genhd.h> from user-visible headers.
@ 2008-03-12 16:52 David Woodhouse
2008-03-12 17:18 ` Al Viro
0 siblings, 1 reply; 2+ messages in thread
From: David Woodhouse @ 2008-03-12 16:52 UTC (permalink / raw)
To: torvalds; +Cc: viro, linux-kernel, matthew, dhowells
It was all wrapped in '#ifdef CONFIG_BLOCK' anyway, so userspace was
getting nothing useful out of it. And the special #ifndef __KERNEL__
version of 'struct partition' makes me inclined to promote an attitude
of violence...
Stick some comments on some of the #endifs too, while we're at it.
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 994df37..0fac822 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -205,7 +205,6 @@ unifdef-y += futex.h
unifdef-y += fs.h
unifdef-y += gameport.h
unifdef-y += generic_serial.h
-unifdef-y += genhd.h
unifdef-y += gfs2_ondisk.h
unifdef-y += hayesesp.h
unifdef-y += hdlcdrv.h
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 32c2ac4..ecd2bf6 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -55,24 +55,6 @@ enum {
UNIXWARE_PARTITION = 0x63, /* Same as GNU_HURD and SCO Unix */
};
-#ifndef __KERNEL__
-
-struct partition {
- unsigned char boot_ind; /* 0x80 - active */
- unsigned char head; /* starting head */
- unsigned char sector; /* starting sector */
- unsigned char cyl; /* starting cylinder */
- unsigned char sys_ind; /* What partition type */
- unsigned char end_head; /* end head */
- unsigned char end_sector; /* end sector */
- unsigned char end_cyl; /* end cylinder */
- unsigned int start_sect; /* starting sector counting from 0 */
- unsigned int nr_sects; /* nr of sectors in partition */
-} __attribute__((packed));
-
-#endif
-
-#ifdef __KERNEL__
#include <linux/major.h>
#include <linux/device.h>
#include <linux/smp.h>
@@ -228,7 +210,7 @@ static inline void part_stat_set_all(struct hd_struct *part, int value) {
sizeof(struct disk_stats));
}
-#else
+#else /* !CONFIG_SMP */
#define __disk_stat_add(gendiskp, field, addnd) \
(gendiskp->dkstats.field += addnd)
#define disk_stat_read(gendiskp, field) (gendiskp->dkstats.field)
@@ -256,7 +238,7 @@ static inline void part_stat_set_all(struct hd_struct *part, int value)
memset(&part->dkstats, value, sizeof(struct disk_stats));
}
-#endif
+#endif /* CONFIG_SMP */
#define disk_stat_add(gendiskp, field, addnd) \
do { \
@@ -395,8 +377,6 @@ static inline void set_capacity(struct gendisk *disk, sector_t size)
disk->capacity = size;
}
-#endif /* __KERNEL__ */
-
#ifdef CONFIG_SOLARIS_X86_PARTITION
#define SOLARIS_X86_NUMSLICE 16
@@ -540,8 +520,6 @@ struct unixware_disklabel {
# define MINIX_NR_SUBPARTITIONS 4
#endif /* CONFIG_MINIX_SUBPARTITION */
-#ifdef __KERNEL__
-
#define ADDPART_FLAG_NONE 0
#define ADDPART_FLAG_RAID 1
#define ADDPART_FLAG_WHOLEDISK 2
@@ -570,8 +548,6 @@ static inline struct block_device *bdget_disk(struct gendisk *disk, int index)
return bdget(MKDEV(disk->major, disk->first_minor) + index);
}
-#endif
-
#else /* CONFIG_BLOCK */
static inline void printk_all_partitions(void) { }
@@ -584,4 +560,4 @@ static inline dev_t blk_lookup_devt(const char *name)
#endif /* CONFIG_BLOCK */
-#endif
+#endif /* _LINUX_GENHD_H */
--
dwmw2
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Remove <linux/genhd.h> from user-visible headers.
2008-03-12 16:52 [PATCH] Remove <linux/genhd.h> from user-visible headers David Woodhouse
@ 2008-03-12 17:18 ` Al Viro
0 siblings, 0 replies; 2+ messages in thread
From: Al Viro @ 2008-03-12 17:18 UTC (permalink / raw)
To: David Woodhouse; +Cc: torvalds, linux-kernel, matthew, dhowells
On Wed, Mar 12, 2008 at 05:52:56PM +0100, David Woodhouse wrote:
> It was all wrapped in '#ifdef CONFIG_BLOCK' anyway, so userspace was
> getting nothing useful out of it. And the special #ifndef __KERNEL__
> version of 'struct partition' makes me inclined to promote an attitude
> of violence...
>
> Stick some comments on some of the #endifs too, while we're at it.
Right... Actually, if that goes in... the next step is to take fs/partitions
to block and evict more than a half of genhd.h to block/blk.h and relevant
partition handlers. I have a long-rotten patch for that, will resurrect...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-12 17:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-12 16:52 [PATCH] Remove <linux/genhd.h> from user-visible headers David Woodhouse
2008-03-12 17:18 ` Al Viro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox