diff options
Diffstat (limited to 'libc/kernel/common/linux/raid')
-rw-r--r-- | libc/kernel/common/linux/raid/md.h | 49 | ||||
-rw-r--r-- | libc/kernel/common/linux/raid/md_k.h | 184 | ||||
-rw-r--r-- | libc/kernel/common/linux/raid/md_p.h | 135 | ||||
-rw-r--r-- | libc/kernel/common/linux/raid/md_u.h | 104 | ||||
-rw-r--r-- | libc/kernel/common/linux/raid/xor.h | 32 |
5 files changed, 504 insertions, 0 deletions
diff --git a/libc/kernel/common/linux/raid/md.h b/libc/kernel/common/linux/raid/md.h new file mode 100644 index 0000000..d609c06 --- /dev/null +++ b/libc/kernel/common/linux/raid/md.h @@ -0,0 +1,49 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _MD_H +#define _MD_H + +#include <linux/blkdev.h> +#include <asm/semaphore.h> +#include <linux/major.h> +#include <linux/ioctl.h> +#include <linux/types.h> +#include <linux/bitops.h> +#include <linux/module.h> +#include <linux/hdreg.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> +#include <linux/smp_lock.h> +#include <linux/delay.h> +#include <net/checksum.h> +#include <linux/random.h> +#include <linux/kernel_stat.h> +#include <asm/io.h> +#include <linux/completion.h> +#include <linux/mempool.h> +#include <linux/list.h> +#include <linux/reboot.h> +#include <linux/vmalloc.h> +#include <linux/blkpg.h> +#include <linux/bio.h> + +#include <linux/raid/md_p.h> +#include <linux/raid/md_u.h> +#include <linux/raid/md_k.h> + +#define MD_MAJOR_VERSION 0 +#define MD_MINOR_VERSION 90 + +#define MD_PATCHLEVEL_VERSION 3 + +#endif + diff --git a/libc/kernel/common/linux/raid/md_k.h b/libc/kernel/common/linux/raid/md_k.h new file mode 100644 index 0000000..c8b858c --- /dev/null +++ b/libc/kernel/common/linux/raid/md_k.h @@ -0,0 +1,184 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _MD_K_H +#define _MD_K_H + +#include "../../../drivers/md/dm-bio-list.h" + +#define LEVEL_MULTIPATH (-4) +#define LEVEL_LINEAR (-1) +#define LEVEL_FAULTY (-5) + +#define LEVEL_NONE (-1000000) + +#define MaxSector (~(sector_t)0) +#define MD_THREAD_NAME_MAX 14 + +typedef struct mddev_s mddev_t; +typedef struct mdk_rdev_s mdk_rdev_t; + +#define MAX_MD_DEVS 256 + +#define MAX_CHUNK_SIZE (1<<30) + +struct mdk_rdev_s +{ + struct list_head same_set; + + sector_t size; + mddev_t *mddev; + unsigned long last_events; + + struct block_device *bdev; + + struct page *sb_page; + int sb_loaded; + __u64 sb_events; + sector_t data_offset; + sector_t sb_offset; + int sb_size; + int preferred_minor; + + struct kobject kobj; + + unsigned long flags; +#define Faulty 1 +#define In_sync 2 +#define WriteMostly 4 +#define BarriersNotsupp 5 + + int desc_nr; + int raid_disk; + int saved_raid_disk; + sector_t recovery_offset; + + atomic_t nr_pending; + atomic_t read_errors; + atomic_t corrected_errors; +}; + +struct mddev_s +{ + void *private; + struct mdk_personality *pers; + dev_t unit; + int md_minor; + struct list_head disks; + int sb_dirty; + int ro; + + struct gendisk *gendisk; + + struct kobject kobj; + + int major_version, + minor_version, + patch_version; + int persistent; + int chunk_size; + time_t ctime, utime; + int level, layout; + char clevel[16]; + int raid_disks; + int max_disks; + sector_t size; + sector_t array_size; + __u64 events; + + char uuid[16]; + + sector_t reshape_position; + int delta_disks, new_level, new_layout, new_chunk; + + struct mdk_thread_s *thread; + struct mdk_thread_s *sync_thread; + sector_t curr_resync; + unsigned long resync_mark; + sector_t resync_mark_cnt; + sector_t curr_mark_cnt; + + sector_t resync_max_sectors; + + sector_t resync_mismatches; + + sector_t suspend_lo; + sector_t suspend_hi; + + int sync_speed_min; + int sync_speed_max; + + int ok_start_degraded; + +#define MD_RECOVERY_RUNNING 0 +#define MD_RECOVERY_SYNC 1 +#define MD_RECOVERY_ERR 2 +#define MD_RECOVERY_INTR 3 +#define MD_RECOVERY_DONE 4 +#define MD_RECOVERY_NEEDED 5 +#define MD_RECOVERY_REQUESTED 6 +#define MD_RECOVERY_CHECK 7 +#define MD_RECOVERY_RESHAPE 8 +#define MD_RECOVERY_FROZEN 9 + + unsigned long recovery; + + int in_sync; + struct mutex reconfig_mutex; + atomic_t active; + + int changed; + int degraded; + int barriers_work; + struct bio *biolist; + + atomic_t recovery_active; + wait_queue_head_t recovery_wait; + sector_t recovery_cp; + + spinlock_t write_lock; + wait_queue_head_t sb_wait; + atomic_t pending_writes; + + unsigned int safemode; + unsigned int safemode_delay; + struct timer_list safemode_timer; + atomic_t writes_pending; + request_queue_t *queue; + + atomic_t write_behind; + unsigned int max_write_behind; + + struct bitmap *bitmap; + struct file *bitmap_file; + long bitmap_offset; + long default_bitmap_offset; + + struct list_head all_mddevs; +}; + +struct md_sysfs_entry { + struct attribute attr; + ssize_t (*show)(mddev_t *, char *); + ssize_t (*store)(mddev_t *, const char *, size_t); +}; + +#define ITERATE_RDEV_GENERIC(head,rdev,tmp) for ((tmp) = (head).next; (rdev) = (list_entry((tmp), mdk_rdev_t, same_set)), (tmp) = (tmp)->next, (tmp)->prev != &(head) ; ) +#define ITERATE_RDEV(mddev,rdev,tmp) ITERATE_RDEV_GENERIC((mddev)->disks,rdev,tmp) +#define ITERATE_RDEV_PENDING(rdev,tmp) ITERATE_RDEV_GENERIC(pending_raid_disks,rdev,tmp) + +#define THREAD_WAKEUP 0 + +#define __wait_event_lock_irq(wq, condition, lock, cmd) do { wait_queue_t __wait; init_waitqueue_entry(&__wait, current); add_wait_queue(&wq, &__wait); for (;;) { set_current_state(TASK_UNINTERRUPTIBLE); if (condition) break; spin_unlock_irq(&lock); cmd; schedule(); spin_lock_irq(&lock); } current->state = TASK_RUNNING; remove_wait_queue(&wq, &__wait); } while (0) + +#define wait_event_lock_irq(wq, condition, lock, cmd) do { if (condition) break; __wait_event_lock_irq(wq, condition, lock, cmd); } while (0) + +#endif diff --git a/libc/kernel/common/linux/raid/md_p.h b/libc/kernel/common/linux/raid/md_p.h new file mode 100644 index 0000000..ab856a7 --- /dev/null +++ b/libc/kernel/common/linux/raid/md_p.h @@ -0,0 +1,135 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _MD_P_H +#define _MD_P_H + +#define MD_RESERVED_BYTES (64 * 1024) +#define MD_RESERVED_SECTORS (MD_RESERVED_BYTES / 512) +#define MD_RESERVED_BLOCKS (MD_RESERVED_BYTES / BLOCK_SIZE) + +#define MD_NEW_SIZE_SECTORS(x) ((x & ~(MD_RESERVED_SECTORS - 1)) - MD_RESERVED_SECTORS) +#define MD_NEW_SIZE_BLOCKS(x) ((x & ~(MD_RESERVED_BLOCKS - 1)) - MD_RESERVED_BLOCKS) + +#define MD_SB_BYTES 4096 +#define MD_SB_WORDS (MD_SB_BYTES / 4) +#define MD_SB_BLOCKS (MD_SB_BYTES / BLOCK_SIZE) +#define MD_SB_SECTORS (MD_SB_BYTES / 512) + +#define MD_SB_GENERIC_OFFSET 0 +#define MD_SB_PERSONALITY_OFFSET 64 +#define MD_SB_DISKS_OFFSET 128 +#define MD_SB_DESCRIPTOR_OFFSET 992 + +#define MD_SB_GENERIC_CONSTANT_WORDS 32 +#define MD_SB_GENERIC_STATE_WORDS 32 +#define MD_SB_GENERIC_WORDS (MD_SB_GENERIC_CONSTANT_WORDS + MD_SB_GENERIC_STATE_WORDS) +#define MD_SB_PERSONALITY_WORDS 64 +#define MD_SB_DESCRIPTOR_WORDS 32 +#define MD_SB_DISKS 27 +#define MD_SB_DISKS_WORDS (MD_SB_DISKS*MD_SB_DESCRIPTOR_WORDS) +#define MD_SB_RESERVED_WORDS (1024 - MD_SB_GENERIC_WORDS - MD_SB_PERSONALITY_WORDS - MD_SB_DISKS_WORDS - MD_SB_DESCRIPTOR_WORDS) +#define MD_SB_EQUAL_WORDS (MD_SB_GENERIC_WORDS + MD_SB_PERSONALITY_WORDS + MD_SB_DISKS_WORDS) + +#define MD_DISK_FAULTY 0 +#define MD_DISK_ACTIVE 1 +#define MD_DISK_SYNC 2 +#define MD_DISK_REMOVED 3 + +#define MD_DISK_WRITEMOSTLY 9 + +typedef struct mdp_device_descriptor_s { + __u32 number; + __u32 major; + __u32 minor; + __u32 raid_disk; + __u32 state; + __u32 reserved[MD_SB_DESCRIPTOR_WORDS - 5]; +} mdp_disk_t; + +#define MD_SB_MAGIC 0xa92b4efc + +#define MD_SB_CLEAN 0 +#define MD_SB_ERRORS 1 + +#define MD_SB_BITMAP_PRESENT 8 + +typedef struct mdp_superblock_s { + + __u32 md_magic; + __u32 major_version; + __u32 minor_version; + __u32 patch_version; + __u32 gvalid_words; + __u32 set_uuid0; + __u32 ctime; + __u32 level; + __u32 size; + __u32 nr_disks; + __u32 raid_disks; + __u32 md_minor; + __u32 not_persistent; + __u32 set_uuid1; + __u32 set_uuid2; + __u32 set_uuid3; + __u32 gstate_creserved[MD_SB_GENERIC_CONSTANT_WORDS - 16]; + + __u32 utime; + __u32 state; + __u32 active_disks; + __u32 working_disks; + __u32 failed_disks; + __u32 spare_disks; + __u32 sb_csum; +#ifdef __BIG_ENDIAN + __u32 events_hi; + __u32 events_lo; + __u32 cp_events_hi; + __u32 cp_events_lo; +#else + __u32 events_lo; + __u32 events_hi; + __u32 cp_events_lo; + __u32 cp_events_hi; +#endif + __u32 recovery_cp; + + __u64 reshape_position; + __u32 new_level; + __u32 delta_disks; + __u32 new_layout; + __u32 new_chunk; + __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 18]; + + __u32 layout; + __u32 chunk_size; + __u32 root_pv; + __u32 root_block; + __u32 pstate_reserved[MD_SB_PERSONALITY_WORDS - 4]; + + mdp_disk_t disks[MD_SB_DISKS]; + + __u32 reserved[MD_SB_RESERVED_WORDS]; + + mdp_disk_t this_disk; + +} mdp_super_t; + +#define WriteMostly1 1 + +#define MD_FEATURE_BITMAP_OFFSET 1 +#define MD_FEATURE_RECOVERY_OFFSET 2 +#define MD_FEATURE_RESHAPE_ACTIVE 4 + +#define MD_FEATURE_ALL (1|2|4) + +#endif + diff --git a/libc/kernel/common/linux/raid/md_u.h b/libc/kernel/common/linux/raid/md_u.h new file mode 100644 index 0000000..3671187 --- /dev/null +++ b/libc/kernel/common/linux/raid/md_u.h @@ -0,0 +1,104 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _MD_U_H +#define _MD_U_H + +#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) +#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) +#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) +#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) +#define RAID_AUTORUN _IO (MD_MAJOR, 0x14) +#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) + +#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) +#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) +#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) +#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) +#define SET_DISK_INFO _IO (MD_MAJOR, 0x24) +#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) +#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) +#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) +#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) +#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) +#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) +#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) + +#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) +#define START_ARRAY _IO (MD_MAJOR, 0x31) +#define STOP_ARRAY _IO (MD_MAJOR, 0x32) +#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) +#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) + +typedef struct mdu_version_s { + int major; + int minor; + int patchlevel; +} mdu_version_t; + +typedef struct mdu_array_info_s { + + int major_version; + int minor_version; + int patch_version; + int ctime; + int level; + int size; + int nr_disks; + int raid_disks; + int md_minor; + int not_persistent; + + int utime; + int state; + int active_disks; + int working_disks; + int failed_disks; + int spare_disks; + + int layout; + int chunk_size; + +} mdu_array_info_t; + +typedef struct mdu_disk_info_s { + + int number; + int major; + int minor; + int raid_disk; + int state; + +} mdu_disk_info_t; + +typedef struct mdu_start_info_s { + + int major; + int minor; + int raid_disk; + int state; + +} mdu_start_info_t; + +typedef struct mdu_bitmap_file_s +{ + char pathname[4096]; +} mdu_bitmap_file_t; + +typedef struct mdu_param_s +{ + int personality; + int chunk_size; + int max_fault; +} mdu_param_t; + +#endif + diff --git a/libc/kernel/common/linux/raid/xor.h b/libc/kernel/common/linux/raid/xor.h new file mode 100644 index 0000000..01e9f45 --- /dev/null +++ b/libc/kernel/common/linux/raid/xor.h @@ -0,0 +1,32 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + **************************************************************************** + ****************************************************************************/ +#ifndef _XOR_H +#define _XOR_H + +#include <linux/raid/md.h> + +#define MAX_XOR_BLOCKS 5 + +struct xor_block_template { + struct xor_block_template *next; + const char *name; + int speed; + void (*do_2)(unsigned long, unsigned long *, unsigned long *); + void (*do_3)(unsigned long, unsigned long *, unsigned long *, + unsigned long *); + void (*do_4)(unsigned long, unsigned long *, unsigned long *, + unsigned long *, unsigned long *); + void (*do_5)(unsigned long, unsigned long *, unsigned long *, + unsigned long *, unsigned long *, unsigned long *); +}; + +#endif |