1 diff -Nur ./kernel-headers/asm/boot.h ./kernel-headers/asm/boot.h
2 --- ./kernel-headers/asm/boot.h 1970-01-01 01:00:00.000000000 +0100
3 +++ ./kernel-headers/asm/boot.h 2004-07-10 02:56:48.000000000 +0200
8 +/* Don't touch these, unless you really know what you're doing. */
9 +#define DEF_INITSEG 0x9000
10 +#define DEF_SYSSEG 0x1000
11 +#define DEF_SETUPSEG 0x9020
12 +#define DEF_SYSSIZE 0x7F00
14 +/* Internal svga startup constants */
15 +#define NORMAL_VGA 0xffff /* 80x25 mode */
16 +#define EXTENDED_VGA 0xfffe /* 80x50 mode */
17 +#define ASK_VGA 0xfffd /* ask for it at bootup */
20 diff -Nur ./kernel-headers/asm/ioctl.h ./kernel-headers/asm/ioctl.h
21 --- ./kernel-headers/asm/ioctl.h 1970-01-01 01:00:00.000000000 +0100
22 +++ ./kernel-headers/asm/ioctl.h 2004-07-10 02:56:48.000000000 +0200
24 +/* $Id: kernel_2_6_x.patch,v 1.1 2004-07-21 08:58:08 hackbard Exp $
26 + * linux/ioctl.h for Linux by H.H. Bergman.
29 +#ifndef _ASMI386_IOCTL_H
30 +#define _ASMI386_IOCTL_H
32 +/* ioctl command encoding: 32 bits total, command in lower 16 bits,
33 + * size of the parameter structure in the lower 14 bits of the
35 + * Encoding the size of the parameter structure in the ioctl request
36 + * is useful for catching programs compiled with old versions
37 + * and to avoid overwriting user space outside the user buffer area.
38 + * The highest 2 bits are reserved for indicating the ``access mode''.
39 + * NOTE: This limits the max parameter size to 16kB -1 !
43 + * The following is for compatibility across the various Linux
44 + * platforms. The i386 ioctl numbering scheme doesn't really enforce
45 + * a type field. De facto, however, the top 8 bits of the lower 16
46 + * bits are indeed used as a type field, so we might just as well make
47 + * this explicit here. Please be sure to use the decoding macros
48 + * below from now on.
50 +#define _IOC_NRBITS 8
51 +#define _IOC_TYPEBITS 8
52 +#define _IOC_SIZEBITS 14
53 +#define _IOC_DIRBITS 2
55 +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
56 +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
57 +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
58 +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
60 +#define _IOC_NRSHIFT 0
61 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
62 +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
63 +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
69 +#define _IOC_WRITE 1U
72 +#define _IOC(dir,type,nr,size) \
73 + (((dir) << _IOC_DIRSHIFT) | \
74 + ((type) << _IOC_TYPESHIFT) | \
75 + ((nr) << _IOC_NRSHIFT) | \
76 + ((size) << _IOC_SIZESHIFT))
78 +/* used to create numbers */
79 +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
80 +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
81 +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
82 +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
84 +/* used to decode ioctl numbers.. */
85 +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
86 +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
87 +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
88 +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
90 +/* ...and for the drivers/sound files... */
92 +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
93 +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
94 +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
95 +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
96 +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
98 +#endif /* _ASMI386_IOCTL_H */
99 diff -Nur ./kernel-headers/asm/page.h ./kernel-headers/asm/page.h
100 --- ./kernel-headers/asm/page.h 1970-01-01 01:00:00.000000000 +0100
101 +++ ./kernel-headers/asm/page.h 2004-07-10 02:56:48.000000000 +0200
103 +#ifndef _I386_PAGE_H
104 +#define _I386_PAGE_H
106 +/* PAGE_SHIFT determines the page size */
107 +#define PAGE_SHIFT 12
108 +#define PAGE_SIZE (1UL << PAGE_SHIFT)
109 +#define PAGE_MASK (~(PAGE_SIZE-1))
112 +#ifndef __ASSEMBLY__
114 +#include <linux/config.h>
116 +#ifdef CONFIG_X86_USE_3DNOW
118 +#include <asm/mmx.h>
120 +#define clear_page(page) mmx_clear_page((void *)(page))
121 +#define copy_page(to,from) mmx_copy_page(to,from)
126 + * On older X86 processors its not a win to use MMX here it seems.
127 + * Maybe the K6-III ?
130 +#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
131 +#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
135 +#define clear_user_page(page, vaddr) clear_page(page)
136 +#define copy_user_page(to, from, vaddr) copy_page(to, from)
139 + * These are used to make use of C type-checking..
142 +typedef struct { unsigned long pte_low, pte_high; } pte_t;
143 +typedef struct { unsigned long long pmd; } pmd_t;
144 +typedef struct { unsigned long long pgd; } pgd_t;
145 +#define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
147 +typedef struct { unsigned long pte_low; } pte_t;
148 +typedef struct { unsigned long pmd; } pmd_t;
149 +typedef struct { unsigned long pgd; } pgd_t;
150 +#define pte_val(x) ((x).pte_low)
152 +#define PTE_MASK PAGE_MASK
154 +typedef struct { unsigned long pgprot; } pgprot_t;
156 +#define pmd_val(x) ((x).pmd)
157 +#define pgd_val(x) ((x).pgd)
158 +#define pgprot_val(x) ((x).pgprot)
160 +#define __pte(x) ((pte_t) { (x) } )
161 +#define __pmd(x) ((pmd_t) { (x) } )
162 +#define __pgd(x) ((pgd_t) { (x) } )
163 +#define __pgprot(x) ((pgprot_t) { (x) } )
165 +#endif /* !__ASSEMBLY__ */
167 +/* to align the pointer to the (next) page boundary */
168 +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
171 + * This handles the memory map.. We could make this a config
172 + * option, but too many people screw it up, and too few need
175 + * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
176 + * a virtual address space of one gigabyte, which limits the
177 + * amount of physical memory you can use to about 950MB.
179 + * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
180 + * and CONFIG_HIGHMEM64G options in the kernel configuration.
183 +#define __PAGE_OFFSET (0xC0000000)
186 + * This much address space is reserved for vmalloc() and iomap()
187 + * as well as fixmap mappings.
189 +#define __VMALLOC_RESERVE (128 << 20)
191 +#ifndef __ASSEMBLY__
194 + * Tell the user there is some problem. Beep too, so we can
195 + * see^H^H^Hhear bugs in early bootup as well!
196 + * The offending file and line are encoded after the "officially
197 + * undefined" opcode for parsing in the trap handler.
200 +#if 1 /* Set to zero for a slightly smaller kernel */
202 + __asm__ __volatile__( "ud2\n" \
205 + : : "i" (__LINE__), "i" (__FILE__))
207 +#define BUG() __asm__ __volatile__("ud2\n")
210 +#define PAGE_BUG(page) do { \
214 +/* Pure 2^n version of get_order */
215 +static __inline__ int get_order(unsigned long size)
219 + size = (size-1) >> (PAGE_SHIFT-1);
228 +#endif /* __ASSEMBLY__ */
230 +#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
231 +#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
232 +#define __MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
233 +#define MAXMEM ((unsigned long)(-PAGE_OFFSET-VMALLOC_RESERVE))
234 +#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
235 +#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
236 +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
237 +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
239 +#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
240 + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
242 +#endif /* __KERNEL__ */
244 +#endif /* _I386_PAGE_H */
245 diff -Nur ./kernel-headers/asm/types.h ./kernel-headers/asm/types.h
246 --- ./kernel-headers/asm/types.h 1970-01-01 01:00:00.000000000 +0100
247 +++ ./kernel-headers/asm/types.h 2004-07-10 02:56:48.000000000 +0200
249 +#ifndef _I386_TYPES_H
250 +#define _I386_TYPES_H
252 +typedef unsigned short umode_t;
255 + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
256 + * header files exported to user space
259 +typedef __signed__ char __s8;
260 +typedef unsigned char __u8;
262 +typedef __signed__ short __s16;
263 +typedef unsigned short __u16;
265 +typedef __signed__ int __s32;
266 +typedef unsigned int __u32;
268 +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
269 +typedef __signed__ long long __s64;
270 +typedef unsigned long long __u64;
274 + * These aren't exported outside the kernel to avoid name space clashes
278 +#include <linux/config.h>
280 +typedef signed char s8;
281 +typedef unsigned char u8;
283 +typedef signed short s16;
284 +typedef unsigned short u16;
286 +typedef signed int s32;
287 +typedef unsigned int u32;
289 +typedef signed long long s64;
290 +typedef unsigned long long u64;
292 +#define BITS_PER_LONG 32
294 +/* DMA addresses come in generic and 64-bit flavours. */
296 +#ifdef CONFIG_HIGHMEM64G
297 +typedef u64 dma_addr_t;
299 +typedef u32 dma_addr_t;
301 +typedef u64 dma64_addr_t;
303 +#endif /* __KERNEL__ */
306 diff -Nur ./kernel-headers/asm/unistd.h ./kernel-headers/asm/unistd.h
307 --- ./kernel-headers/asm/unistd.h 1970-01-01 01:00:00.000000000 +0100
308 +++ ./kernel-headers/asm/unistd.h 2004-07-10 02:55:27.000000000 +0200
310 +#ifndef _ASM_I386_UNISTD_H_
311 +#define _ASM_I386_UNISTD_H_
314 + * This file contains the system call numbers.
320 +#define __NR_write 4
322 +#define __NR_close 6
323 +#define __NR_waitpid 7
324 +#define __NR_creat 8
326 +#define __NR_unlink 10
327 +#define __NR_execve 11
328 +#define __NR_chdir 12
329 +#define __NR_time 13
330 +#define __NR_mknod 14
331 +#define __NR_chmod 15
332 +#define __NR_lchown 16
333 +#define __NR_break 17
334 +#define __NR_oldstat 18
335 +#define __NR_lseek 19
336 +#define __NR_getpid 20
337 +#define __NR_mount 21
338 +#define __NR_umount 22
339 +#define __NR_setuid 23
340 +#define __NR_getuid 24
341 +#define __NR_stime 25
342 +#define __NR_ptrace 26
343 +#define __NR_alarm 27
344 +#define __NR_oldfstat 28
345 +#define __NR_pause 29
346 +#define __NR_utime 30
347 +#define __NR_stty 31
348 +#define __NR_gtty 32
349 +#define __NR_access 33
350 +#define __NR_nice 34
351 +#define __NR_ftime 35
352 +#define __NR_sync 36
353 +#define __NR_kill 37
354 +#define __NR_rename 38
355 +#define __NR_mkdir 39
356 +#define __NR_rmdir 40
358 +#define __NR_pipe 42
359 +#define __NR_times 43
360 +#define __NR_prof 44
362 +#define __NR_setgid 46
363 +#define __NR_getgid 47
364 +#define __NR_signal 48
365 +#define __NR_geteuid 49
366 +#define __NR_getegid 50
367 +#define __NR_acct 51
368 +#define __NR_umount2 52
369 +#define __NR_lock 53
370 +#define __NR_ioctl 54
371 +#define __NR_fcntl 55
373 +#define __NR_setpgid 57
374 +#define __NR_ulimit 58
375 +#define __NR_oldolduname 59
376 +#define __NR_umask 60
377 +#define __NR_chroot 61
378 +#define __NR_ustat 62
379 +#define __NR_dup2 63
380 +#define __NR_getppid 64
381 +#define __NR_getpgrp 65
382 +#define __NR_setsid 66
383 +#define __NR_sigaction 67
384 +#define __NR_sgetmask 68
385 +#define __NR_ssetmask 69
386 +#define __NR_setreuid 70
387 +#define __NR_setregid 71
388 +#define __NR_sigsuspend 72
389 +#define __NR_sigpending 73
390 +#define __NR_sethostname 74
391 +#define __NR_setrlimit 75
392 +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
393 +#define __NR_getrusage 77
394 +#define __NR_gettimeofday 78
395 +#define __NR_settimeofday 79
396 +#define __NR_getgroups 80
397 +#define __NR_setgroups 81
398 +#define __NR_select 82
399 +#define __NR_symlink 83
400 +#define __NR_oldlstat 84
401 +#define __NR_readlink 85
402 +#define __NR_uselib 86
403 +#define __NR_swapon 87
404 +#define __NR_reboot 88
405 +#define __NR_readdir 89
406 +#define __NR_mmap 90
407 +#define __NR_munmap 91
408 +#define __NR_truncate 92
409 +#define __NR_ftruncate 93
410 +#define __NR_fchmod 94
411 +#define __NR_fchown 95
412 +#define __NR_getpriority 96
413 +#define __NR_setpriority 97
414 +#define __NR_profil 98
415 +#define __NR_statfs 99
416 +#define __NR_fstatfs 100
417 +#define __NR_ioperm 101
418 +#define __NR_socketcall 102
419 +#define __NR_syslog 103
420 +#define __NR_setitimer 104
421 +#define __NR_getitimer 105
422 +#define __NR_stat 106
423 +#define __NR_lstat 107
424 +#define __NR_fstat 108
425 +#define __NR_olduname 109
426 +#define __NR_iopl 110
427 +#define __NR_vhangup 111
428 +#define __NR_idle 112
429 +#define __NR_vm86old 113
430 +#define __NR_wait4 114
431 +#define __NR_swapoff 115
432 +#define __NR_sysinfo 116
433 +#define __NR_ipc 117
434 +#define __NR_fsync 118
435 +#define __NR_sigreturn 119
436 +#define __NR_clone 120
437 +#define __NR_setdomainname 121
438 +#define __NR_uname 122
439 +#define __NR_modify_ldt 123
440 +#define __NR_adjtimex 124
441 +#define __NR_mprotect 125
442 +#define __NR_sigprocmask 126
443 +#define __NR_create_module 127
444 +#define __NR_init_module 128
445 +#define __NR_delete_module 129
446 +#define __NR_get_kernel_syms 130
447 +#define __NR_quotactl 131
448 +#define __NR_getpgid 132
449 +#define __NR_fchdir 133
450 +#define __NR_bdflush 134
451 +#define __NR_sysfs 135
452 +#define __NR_personality 136
453 +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
454 +#define __NR_setfsuid 138
455 +#define __NR_setfsgid 139
456 +#define __NR__llseek 140
457 +#define __NR_getdents 141
458 +#define __NR__newselect 142
459 +#define __NR_flock 143
460 +#define __NR_msync 144
461 +#define __NR_readv 145
462 +#define __NR_writev 146
463 +#define __NR_getsid 147
464 +#define __NR_fdatasync 148
465 +#define __NR__sysctl 149
466 +#define __NR_mlock 150
467 +#define __NR_munlock 151
468 +#define __NR_mlockall 152
469 +#define __NR_munlockall 153
470 +#define __NR_sched_setparam 154
471 +#define __NR_sched_getparam 155
472 +#define __NR_sched_setscheduler 156
473 +#define __NR_sched_getscheduler 157
474 +#define __NR_sched_yield 158
475 +#define __NR_sched_get_priority_max 159
476 +#define __NR_sched_get_priority_min 160
477 +#define __NR_sched_rr_get_interval 161
478 +#define __NR_nanosleep 162
479 +#define __NR_mremap 163
480 +#define __NR_setresuid 164
481 +#define __NR_getresuid 165
482 +#define __NR_vm86 166
483 +#define __NR_query_module 167
484 +#define __NR_poll 168
485 +#define __NR_nfsservctl 169
486 +#define __NR_setresgid 170
487 +#define __NR_getresgid 171
488 +#define __NR_prctl 172
489 +#define __NR_rt_sigreturn 173
490 +#define __NR_rt_sigaction 174
491 +#define __NR_rt_sigprocmask 175
492 +#define __NR_rt_sigpending 176
493 +#define __NR_rt_sigtimedwait 177
494 +#define __NR_rt_sigqueueinfo 178
495 +#define __NR_rt_sigsuspend 179
496 +#define __NR_pread 180
497 +#define __NR_pwrite 181
498 +#define __NR_chown 182
499 +#define __NR_getcwd 183
500 +#define __NR_capget 184
501 +#define __NR_capset 185
502 +#define __NR_sigaltstack 186
503 +#define __NR_sendfile 187
504 +#define __NR_getpmsg 188 /* some people actually want streams */
505 +#define __NR_putpmsg 189 /* some people actually want streams */
506 +#define __NR_vfork 190
507 +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
508 +#define __NR_mmap2 192
509 +#define __NR_truncate64 193
510 +#define __NR_ftruncate64 194
511 +#define __NR_stat64 195
512 +#define __NR_lstat64 196
513 +#define __NR_fstat64 197
514 +#define __NR_lchown32 198
515 +#define __NR_getuid32 199
516 +#define __NR_getgid32 200
517 +#define __NR_geteuid32 201
518 +#define __NR_getegid32 202
519 +#define __NR_setreuid32 203
520 +#define __NR_setregid32 204
521 +#define __NR_getgroups32 205
522 +#define __NR_setgroups32 206
523 +#define __NR_fchown32 207
524 +#define __NR_setresuid32 208
525 +#define __NR_getresuid32 209
526 +#define __NR_setresgid32 210
527 +#define __NR_getresgid32 211
528 +#define __NR_chown32 212
529 +#define __NR_setuid32 213
530 +#define __NR_setgid32 214
531 +#define __NR_setfsuid32 215
532 +#define __NR_setfsgid32 216
533 +#define __NR_pivot_root 217
534 +#define __NR_mincore 218
535 +#define __NR_madvise 219
536 +#define __NR_madvise1 219 /* delete when C lib stub is removed */
537 +#define __NR_getdents64 220
538 +#define __NR_fcntl64 221
539 +#define __NR_security 223 /* syscall for security modules */
540 +#define __NR_gettid 224
541 +#define __NR_readahead 225
542 +#define __NR_setxattr 226
543 +#define __NR_lsetxattr 227
544 +#define __NR_fsetxattr 228
545 +#define __NR_getxattr 229
546 +#define __NR_lgetxattr 230
547 +#define __NR_fgetxattr 231
548 +#define __NR_listxattr 232
549 +#define __NR_llistxattr 233
550 +#define __NR_flistxattr 234
551 +#define __NR_removexattr 235
552 +#define __NR_lremovexattr 236
553 +#define __NR_fremovexattr 237
554 +#define __NR_tkill 238
555 +#define __NR_sendfile64 239
556 +#define __NR_futex 240
557 +#define __NR_sched_setaffinity 241
558 +#define __NR_sched_getaffinity 242
559 +#define __NR_set_thread_area 243
560 +#define __NR_get_thread_area 244
561 +#define __NR_io_setup 245
562 +#define __NR_io_destroy 246
563 +#define __NR_io_getevents 247
564 +#define __NR_io_submit 248
565 +#define __NR_io_cancel 249
566 +#define __NR_alloc_hugepages 250
567 +#define __NR_free_hugepages 251
568 +#define __NR_exit_group 252
570 +/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
572 +#define __syscall_return(type, res) \
574 + if ((unsigned long)(res) >= (unsigned long)(-125)) { \
578 + return (type) (res); \
581 +/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
582 +#define _syscall0(type,name) \
586 +__asm__ volatile ("int $0x80" \
588 + : "0" (__NR_##name)); \
589 +__syscall_return(type,__res); \
592 +#define _syscall1(type,name,type1,arg1) \
593 +type name(type1 arg1) \
596 +__asm__ volatile ("int $0x80" \
598 + : "0" (__NR_##name),"b" ((long)(arg1))); \
599 +__syscall_return(type,__res); \
602 +#define _syscall2(type,name,type1,arg1,type2,arg2) \
603 +type name(type1 arg1,type2 arg2) \
606 +__asm__ volatile ("int $0x80" \
608 + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
609 +__syscall_return(type,__res); \
612 +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
613 +type name(type1 arg1,type2 arg2,type3 arg3) \
616 +__asm__ volatile ("int $0x80" \
618 + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
619 + "d" ((long)(arg3))); \
620 +__syscall_return(type,__res); \
623 +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
624 +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
627 +__asm__ volatile ("int $0x80" \
629 + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
630 + "d" ((long)(arg3)),"S" ((long)(arg4))); \
631 +__syscall_return(type,__res); \
634 +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
636 +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
639 +__asm__ volatile ("int $0x80" \
641 + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
642 + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
643 +__syscall_return(type,__res); \
646 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
647 + type5,arg5,type6,arg6) \
648 +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
651 +__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \
653 + : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
654 + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
655 + "0" ((long)(arg6))); \
656 +__syscall_return(type,__res); \
659 +#ifdef __KERNEL_SYSCALLS__
662 + * we need this inline - forking from kernel space will result
663 + * in NO COPY ON WRITE (!!!), until an execve is executed. This
664 + * is no problem, but for the stack. This is handled by not letting
665 + * main() use the stack at all after fork(). Thus, no function
666 + * calls - which means inline code for fork too, as otherwise we
667 + * would use the stack upon exit from 'fork()'.
669 + * Actually only pause and fork are needed inline, so that there
670 + * won't be any messing with the stack from main(), but we define
673 +#define __NR__exit __NR_exit
674 +static inline _syscall0(int,pause)
675 +static inline _syscall0(int,sync)
676 +static inline _syscall0(pid_t,setsid)
677 +static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
678 +static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
679 +static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
680 +static inline _syscall1(int,dup,int,fd)
681 +static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
682 +static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
683 +static inline _syscall1(int,close,int,fd)
684 +static inline _syscall1(int,_exit,int,exitcode)
685 +static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
686 +static inline _syscall1(int,delete_module,const char *,name)
688 +static inline pid_t wait(int * wait_stat)
690 + return waitpid(-1,wait_stat,0);
695 +#endif /* _ASM_I386_UNISTD_H_ */
696 diff -Nur ./kernel-headers/linux/config.h ./kernel-headers/linux/config.h
697 --- ./kernel-headers/linux/config.h 1970-01-01 01:00:00.000000000 +0100
698 +++ ./kernel-headers/linux/config.h 2004-07-10 02:59:15.000000000 +0200
700 +#ifndef _LINUX_CONFIG_H
701 +#define _LINUX_CONFIG_H
703 +#include <linux/autoconf.h>
706 diff -Nur ./kernel-headers/linux/fd.h ./kernel-headers/linux/fd.h
707 --- ./kernel-headers/linux/fd.h 1970-01-01 01:00:00.000000000 +0100
708 +++ ./kernel-headers/linux/fd.h 2004-07-10 02:59:14.000000000 +0200
713 +#include <linux/ioctl.h>
715 +/* New file layout: Now the ioctl definitions immediately follow the
716 + * definitions of the structures that they use */
721 +struct floppy_struct {
722 + unsigned int size, /* nr of sectors total */
723 + sect, /* sectors per track */
724 + head, /* nr of heads */
725 + track, /* nr of tracks */
726 + stretch; /* !=0 means double track steps */
727 +#define FD_STRETCH 1
728 +#define FD_SWAPSIDES 2
730 + unsigned char gap, /* gap1 size */
732 + rate, /* data rate. |= 0x40 for perpendicular */
734 +#define FD_SIZECODEMASK 0x38
735 +#define FD_SIZECODE(floppy) (((((floppy)->rate&FD_SIZECODEMASK)>> 3)+ 2) %8)
736 +#define FD_SECTSIZE(floppy) ( (floppy)->rate & FD_2M ? \
737 + 512 : 128 << FD_SIZECODE(floppy) )
738 +#define FD_PERP 0x40
740 + spec1, /* stepping rate, head unload time */
741 + fmt_gap; /* gap2 size */
742 + const char * name; /* used only for predefined formats */
746 +/* commands needing write access have 0x40 set */
747 +/* commands needing super user access have 0x80 set */
749 +#define FDCLRPRM _IO(2, 0x41)
750 +/* clear user-defined parameters */
752 +#define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
753 +#define FDSETMEDIAPRM FDSETPRM
754 +/* set user-defined parameters for current media */
756 +#define FDDEFPRM _IOW(2, 0x43, struct floppy_struct)
757 +#define FDGETPRM _IOR(2, 0x04, struct floppy_struct)
758 +#define FDDEFMEDIAPRM FDDEFPRM
759 +#define FDGETMEDIAPRM FDGETPRM
760 +/* set/get disk parameters */
763 +#define FDMSGON _IO(2,0x45)
764 +#define FDMSGOFF _IO(2,0x46)
765 +/* issue/don't issue kernel messages on media type change */
769 + * Formatting (obsolete)
771 +#define FD_FILL_BYTE 0xF6 /* format fill byte. */
773 +struct format_descr {
774 + unsigned int device,head,track;
777 +#define FDFMTBEG _IO(2,0x47)
778 +/* begin formatting a disk */
779 +#define FDFMTTRK _IOW(2,0x48, struct format_descr)
780 +/* format the specified track */
781 +#define FDFMTEND _IO(2,0x49)
782 +/* end formatting a disk */
788 +struct floppy_max_errors {
790 + abort, /* number of errors to be reached before aborting */
791 + read_track, /* maximal number of errors permitted to read an
792 + * entire track at once */
793 + reset, /* maximal number of errors before a reset is tried */
794 + recal, /* maximal number of errors before a recalibrate is
798 + * Threshold for reporting FDC errors to the console.
799 + * Setting this to zero may flood your screen when using
800 + * ultra cheap floppies ;-)
806 +#define FDSETEMSGTRESH _IO(2,0x4a)
807 +/* set fdc error reporting threshold */
809 +#define FDFLUSH _IO(2,0x4b)
810 +/* flush buffers for media; either for verifying media, or for
811 + * handling a media change without closing the file descriptor */
813 +#define FDSETMAXERRS _IOW(2, 0x4c, struct floppy_max_errors)
814 +#define FDGETMAXERRS _IOR(2, 0x0e, struct floppy_max_errors)
815 +/* set/get abortion and read_track threshold. See also floppy_drive_params
819 +typedef char floppy_drive_name[16];
820 +#define FDGETDRVTYP _IOR(2, 0x0f, floppy_drive_name)
821 +/* get drive type: 5 1/4 or 3 1/2 */
825 + * Drive parameters (user modifiable)
827 +struct floppy_drive_params {
828 + signed char cmos; /* CMOS type */
830 + /* Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms
831 + * etc) and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA).
833 + unsigned long max_dtr; /* Step rate, usec */
834 + unsigned long hlt; /* Head load/settle time, msec */
835 + unsigned long hut; /* Head unload time (remnant of
837 + unsigned long srt; /* Step rate, usec */
839 + unsigned long spinup; /* time needed for spinup (expressed
841 + unsigned long spindown; /* timeout needed for spindown */
842 + unsigned char spindown_offset; /* decides in which position the disk
844 + unsigned char select_delay; /* delay to wait after select */
845 + unsigned char rps; /* rotations per second */
846 + unsigned char tracks; /* maximum number of tracks */
847 + unsigned long timeout; /* timeout for interrupt requests */
849 + unsigned char interleave_sect; /* if there are more sectors, use
852 + struct floppy_max_errors max_errors;
854 + char flags; /* various flags, including ftd_msg */
856 + * Announce successful media type detection and media information loss after
858 + * Also used to enable/disable printing of overrun warnings.
861 +#define FTD_MSG 0x10
862 +#define FD_BROKEN_DCL 0x20
863 +#define FD_DEBUG 0x02
864 +#define FD_SILENT_DCL_CLEAR 0x4
865 +#define FD_INVERTED_DCL 0x80 /* must be 0x80, because of hardware
868 + char read_track; /* use readtrack during probing? */
871 + * Auto-detection. Each drive type has eight formats which are
872 + * used in succession to try to read the disk. If the FDC cannot lock onto
873 + * the disk, the next format is tried. This uses the variable 'probing'.
875 + short autodetect[8]; /* autodetected formats */
877 + int checkfreq; /* how often should the drive be checked for disk
879 + int native_format; /* native format of this drive */
883 + FD_NEED_TWADDLE_BIT, /* more magic */
884 + FD_VERIFY_BIT, /* inquire for write protection */
885 + FD_DISK_NEWCHANGE_BIT, /* change detected, and no action undertaken yet
886 + * to clear media change status */
888 + FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */
889 + FD_DISK_WRITABLE_BIT /* disk is writable */
892 +#define FDSETDRVPRM _IOW(2, 0x90, struct floppy_drive_params)
893 +#define FDGETDRVPRM _IOR(2, 0x11, struct floppy_drive_params)
894 +/* set/get drive parameters */
898 + * Current drive state (not directly modifiable by user, readonly)
900 +struct floppy_drive_struct {
901 + unsigned long flags;
902 +/* values for these flags */
903 +#define FD_NEED_TWADDLE (1 << FD_NEED_TWADDLE_BIT)
904 +#define FD_VERIFY (1 << FD_VERIFY_BIT)
905 +#define FD_DISK_NEWCHANGE (1 << FD_DISK_NEWCHANGE_BIT)
906 +#define FD_DISK_CHANGED (1 << FD_DISK_CHANGED_BIT)
907 +#define FD_DISK_WRITABLE (1 << FD_DISK_WRITABLE_BIT)
909 + unsigned long spinup_date;
910 + unsigned long select_date;
911 + unsigned long first_read_date;
912 + short probed_format;
913 + short track; /* current track */
914 + short maxblock; /* id of highest block read */
915 + short maxtrack; /* id of highest half track read */
916 + int generation; /* how many diskchanges? */
919 + * (User-provided) media information is _not_ discarded after a media change
920 + * if the corresponding keep_data flag is non-zero. Positive values are
921 + * decremented after each probe.
925 + /* Prevent "aliased" accesses. */
928 + unsigned long last_checked; /* when was the drive last checked for a disk
935 +#define FDGETDRVSTAT _IOR(2, 0x12, struct floppy_drive_struct)
936 +#define FDPOLLDRVSTAT _IOR(2, 0x13, struct floppy_drive_struct)
937 +/* get drive state: GET returns the cached state, POLL polls for new state */
944 + FD_RESET_IF_NEEDED, /* reset only if the reset flags is set */
945 + FD_RESET_IF_RAWCMD, /* obsolete */
946 + FD_RESET_ALWAYS /* reset always */
948 +#define FDRESET _IO(2, 0x54)
954 +struct floppy_fdc_state {
955 + int spec1; /* spec1 value last used */
956 + int spec2; /* spec2 value last used */
958 + unsigned char version; /* FDC version code */
960 + unsigned long address; /* io address */
961 + unsigned int rawcmd:2;
962 + unsigned int reset:1;
963 + unsigned int need_configure:1;
964 + unsigned int perp_mode:2;
965 + unsigned int has_fifo:1;
966 + unsigned int driver_version; /* version code for floppy driver */
967 +#define FD_DRIVER_VERSION 0x100
968 +/* user programs using the floppy API should use floppy_fdc_state to
969 + * get the version number of the floppy driver that they are running
970 + * on. If this version number is bigger than the one compiled into the
971 + * user program (the FD_DRIVER_VERSION define), it should be prepared
972 + * to bigger structures
975 + unsigned char track[4];
976 + /* Position of the heads of the 4 units attached to this FDC,
977 + * as stored on the FDC. In the future, the position as stored
978 + * on the FDC might not agree with the actual physical
979 + * position of these drive heads. By allowing such
980 + * disagreement, it will be possible to reset the FDC without
981 + * incurring the expensive cost of repositioning all heads.
982 + * Right now, these positions are hard wired to 0. */
986 +#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
990 + * Asynchronous Write error tracking
992 +struct floppy_write_errors {
993 + /* Write error logging.
995 + * These fields can be cleared with the FDWERRORCLR ioctl.
996 + * Only writes that were attempted but failed due to a physical media
997 + * error are logged. write(2) calls that fail and return an error code
998 + * to the user process are not counted.
1001 + unsigned int write_errors; /* number of physical write errors
1004 + /* position of first and last write errors */
1005 + unsigned long first_error_sector;
1006 + int first_error_generation;
1007 + unsigned long last_error_sector;
1008 + int last_error_generation;
1010 + unsigned int badness; /* highest retry count for a read or write
1014 +#define FDWERRORCLR _IO(2, 0x56)
1015 +/* clear write error and badness information */
1016 +#define FDWERRORGET _IOR(2, 0x17, struct floppy_write_errors)
1017 +/* get write error and badness information */
1023 +/* new interface flag: now we can do them in batches */
1024 +#define FDHAVEBATCHEDRAWCMD
1026 +struct floppy_raw_cmd {
1027 + unsigned int flags;
1028 +#define FD_RAW_READ 1
1029 +#define FD_RAW_WRITE 2
1030 +#define FD_RAW_NO_MOTOR 4
1031 +#define FD_RAW_DISK_CHANGE 4 /* out: disk change flag was set */
1032 +#define FD_RAW_INTR 8 /* wait for an interrupt */
1033 +#define FD_RAW_SPIN 0x10 /* spin up the disk for this command */
1034 +#define FD_RAW_NO_MOTOR_AFTER 0x20 /* switch the motor off after command
1036 +#define FD_RAW_NEED_DISK 0x40 /* this command needs a disk to be present */
1037 +#define FD_RAW_NEED_SEEK 0x80 /* this command uses an implied seek (soft) */
1039 +/* more "in" flags */
1040 +#define FD_RAW_MORE 0x100 /* more records follow */
1041 +#define FD_RAW_STOP_IF_FAILURE 0x200 /* stop if we encounter a failure */
1042 +#define FD_RAW_STOP_IF_SUCCESS 0x400 /* stop if command successful */
1043 +#define FD_RAW_SOFTFAILURE 0x800 /* consider the return value for failure
1044 + * detection too */
1046 +/* more "out" flags */
1047 +#define FD_RAW_FAILURE 0x10000 /* command sent to fdc, fdc returned error */
1048 +#define FD_RAW_HARDFAILURE 0x20000 /* fdc had to be reset, or timed out */
1051 + char *kernel_data; /* location of data buffer in the kernel */
1052 + struct floppy_raw_cmd *next; /* used for chaining of raw cmd's
1053 + * within the kernel */
1054 + long length; /* in: length of dma transfer. out: remaining bytes */
1055 + long phys_length; /* physical length, if different from dma length */
1056 + int buffer_length; /* length of allocated buffer */
1058 + unsigned char rate;
1059 + unsigned char cmd_count;
1060 + unsigned char cmd[16];
1061 + unsigned char reply_count;
1062 + unsigned char reply[16];
1070 +#define FDRAWCMD _IO(2, 0x58)
1071 +/* send a raw command to the fdc. Structure size not included, because of
1074 +#define FDTWADDLE _IO(2, 0x59)
1075 +/* flicker motor-on bit before reading a sector. Experimental */
1078 +#define FDEJECT _IO(2, 0x5a)
1079 +/* eject the disk */
1082 diff -Nur ./kernel-headers/linux/fs.h ./kernel-headers/linux/fs.h
1083 --- ./kernel-headers/linux/fs.h 1970-01-01 01:00:00.000000000 +0100
1084 +++ ./kernel-headers/linux/fs.h 2004-07-10 02:59:14.000000000 +0200
1086 +#ifndef _LINUX_FS_H
1087 +#define _LINUX_FS_H
1090 + * This file has definitions for some important file table
1094 +#include <linux/config.h>
1095 +#include <linux/linkage.h>
1096 +#include <linux/limits.h>
1097 +#include <linux/wait.h>
1098 +#include <linux/types.h>
1099 +#include <linux/vfs.h>
1100 +#include <linux/net.h>
1101 +#include <linux/kdev_t.h>
1102 +#include <linux/ioctl.h>
1103 +#include <linux/list.h>
1104 +#include <linux/dcache.h>
1105 +#include <linux/stat.h>
1106 +#include <linux/cache.h>
1107 +#include <linux/stddef.h>
1108 +#include <linux/string.h>
1110 +#include <asm/atomic.h>
1111 +#include <asm/bitops.h>
1113 +struct poll_table_struct;
1117 + * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
1118 + * the file limit at runtime and only root can increase the per-process
1119 + * nr_file rlimit, so it's safe to set up a ridiculously high absolute
1120 + * upper limit on files-per-process.
1122 + * Some programs (notably those using select()) may have to be
1123 + * recompiled to take full advantage of the new limits..
1126 +/* Fixed constants first: */
1128 +#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */
1129 +#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
1131 +#define BLOCK_SIZE_BITS 10
1132 +#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
1134 +/* And dynamically-tunable limits and defaults: */
1135 +struct files_stat_struct {
1136 + int nr_files; /* read only */
1137 + int nr_free_files; /* read only */
1138 + int max_files; /* tunable */
1140 +extern struct files_stat_struct files_stat;
1142 +struct inodes_stat_t {
1147 +extern struct inodes_stat_t inodes_stat;
1149 +extern int leases_enable, dir_notify_enable, lease_break_time;
1151 +#define NR_FILE 8192 /* this can well be larger on a larger system */
1152 +#define NR_RESERVED_FILES 10 /* reserved for root */
1153 +#define NR_SUPER 256
1156 +#define MAY_WRITE 2
1159 +#define FMODE_READ 1
1160 +#define FMODE_WRITE 2
1164 +#define READA 2 /* read-ahead - don't block if no resources */
1165 +#define SPECIAL 4 /* For non-blockdevice requests in request queue */
1171 +/* public flags for file_system_type */
1172 +#define FS_REQUIRES_DEV 1
1173 +#define FS_NO_DCACHE 2 /* Only dcache the necessary things. */
1174 +#define FS_NO_PRELIM 4 /* prevent preloading of dentries, even if
1175 + * FS_NO_DCACHE is not set.
1177 +#define FS_SINGLE 8 /* Filesystem that can have only one superblock */
1178 +#define FS_NOMOUNT 16 /* Never mount from userland */
1179 +#define FS_LITTER 32 /* Keeps the tree in dcache */
1180 +#define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon
1181 + * as nfs_rename() will be cleaned up
1184 + * These are the fs-independent mount-flags: up to 32 flags are supported
1186 +#define MS_RDONLY 1 /* Mount read-only */
1187 +#define MS_NOSUID 2 /* Ignore suid and sgid bits */
1188 +#define MS_NODEV 4 /* Disallow access to device special files */
1189 +#define MS_NOEXEC 8 /* Disallow program execution */
1190 +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
1191 +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
1192 +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
1193 +#define MS_NOATIME 1024 /* Do not update access times. */
1194 +#define MS_NODIRATIME 2048 /* Do not update directory access times */
1195 +#define MS_BIND 4096
1196 +#define MS_MOVE 8192
1197 +#define MS_REC 16384
1198 +#define MS_VERBOSE 32768
1199 +#define MS_ACTIVE (1<<30)
1200 +#define MS_NOUSER (1<<31)
1203 + * Superblock flags that can be altered by MS_REMOUNT
1205 +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\
1209 + * Old magic mount flag and mask
1211 +#define MS_MGC_VAL 0xC0ED0000
1212 +#define MS_MGC_MSK 0xffff0000
1214 +/* Inode flags - they have nothing to superblock flags now */
1216 +#define S_SYNC 1 /* Writes are synced at once */
1217 +#define S_NOATIME 2 /* Do not update access times */
1218 +#define S_QUOTA 4 /* Quota initialized for file */
1219 +#define S_APPEND 8 /* Append-only file */
1220 +#define S_IMMUTABLE 16 /* Immutable file */
1221 +#define S_DEAD 32 /* removed, but still open directory */
1222 +#define S_NOQUOTA 64 /* Inode is not counted to quota */
1225 + * Note that nosuid etc flags are inode-specific: setting some file-system
1226 + * flags just means all the inodes inherit those flags by default. It might be
1227 + * possible to override it selectively if you really wanted to with some
1228 + * ioctl() that is not currently implemented.
1230 + * Exception: MS_RDONLY is always applied to the entire file system.
1232 + * Unfortunately, it is possible to change a filesystems flags with it mounted
1233 + * with files in use. This means that all of the inodes will not have their
1234 + * i_flags updated. Hence, i_flags no longer inherit the superblock mount
1235 + * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
1237 +#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
1239 +#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
1240 +#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || ((inode)->i_flags & S_SYNC))
1241 +#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
1243 +#define IS_QUOTAINIT(inode) ((inode)->i_flags & S_QUOTA)
1244 +#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
1245 +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
1246 +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
1247 +#define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
1248 +#define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME)
1250 +#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
1252 +/* the read-only stuff doesn't really belong here, but any other place is
1253 + probably as bad and I don't want to create yet another include file. */
1255 +#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */
1256 +#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
1257 +#define BLKRRPART _IO(0x12,95) /* re-read partition table */
1258 +#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
1259 +#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
1260 +#define BLKRASET _IO(0x12,98) /* Set read ahead for block device */
1261 +#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */
1262 +#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
1263 +#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
1264 +#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
1265 +#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
1266 +#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
1268 +#define BLKPG _IO(0x12,105)/* See blkpg.h */
1269 +#define BLKELVGET _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t))/* elevator get */
1270 +#define BLKELVSET _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t))/* elevator set */
1271 +/* This was here just to show that the number is taken -
1272 + probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */
1274 +/* A jump here: 108-111 have been used for various private purposes. */
1275 +#define BLKBSZGET _IOR(0x12,112,sizeof(int))
1276 +#define BLKBSZSET _IOW(0x12,113,sizeof(int))
1277 +#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64)) /* return device size in bytes (u64 *arg) */
1279 +#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
1280 +#define FIBMAP _IO(0x00,1) /* bmap access */
1281 +#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
1285 +#include <asm/semaphore.h>
1286 +#include <asm/byteorder.h>
1288 +extern void update_atime (struct inode *);
1289 +extern void update_mctime (struct inode *);
1290 +#define UPDATE_ATIME(inode) update_atime (inode)
1292 +extern void buffer_init(unsigned long);
1293 +extern void inode_init(unsigned long);
1294 +extern void mnt_init(unsigned long);
1295 +extern void files_init(unsigned long mempages);
1297 +/* bh state bits */
1298 +enum bh_state_bits {
1299 + BH_Uptodate, /* 1 if the buffer contains valid data */
1300 + BH_Dirty, /* 1 if the buffer is dirty */
1301 + BH_Lock, /* 1 if the buffer is locked */
1302 + BH_Req, /* 0 if the buffer has been invalidated */
1303 + BH_Mapped, /* 1 if the buffer has a disk mapping */
1304 + BH_New, /* 1 if the buffer is new and not yet written out */
1305 + BH_Async, /* 1 if the buffer is under end_buffer_io_async I/O */
1306 + BH_Wait_IO, /* 1 if we should write out this buffer */
1307 + BH_Launder, /* 1 if we can throttle on this buffer */
1308 + BH_Attached, /* 1 if b_inode_buffers is linked into a list */
1309 + BH_JBD, /* 1 if it has an attached journal_head */
1310 + BH_Sync, /* 1 if the buffer is a sync read */
1312 + BH_PrivateStart,/* not a state bit, but the first bit available
1313 + * for private allocation by other entities
1317 +#define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512)
1320 + * Try to keep the most commonly used fields in single cache lines (16
1321 + * bytes) to improve performance. This ordering should be
1322 + * particularly beneficial on 32-bit processors.
1324 + * We use the first 16 bytes for the data which is used in searches
1325 + * over the block hash lists (ie. getblk() and friends).
1327 + * The second 16 bytes we use for lru buffer scans, as used by
1328 + * sync_buffers() and refill_freelist(). -- sct
1330 +struct buffer_head {
1331 + /* First cache line: */
1332 + struct buffer_head *b_next; /* Hash queue list */
1333 + unsigned long b_blocknr; /* block number */
1334 + unsigned short b_size; /* block size */
1335 + unsigned short b_list; /* List that this buffer appears */
1336 + kdev_t b_dev; /* device (B_FREE = free) */
1338 + atomic_t b_count; /* users using this block */
1339 + kdev_t b_rdev; /* Real device */
1340 + unsigned long b_state; /* buffer state bitmap (see above) */
1341 + unsigned long b_flushtime; /* Time when (dirty) buffer should be written */
1343 + struct buffer_head *b_next_free;/* lru/free list linkage */
1344 + struct buffer_head *b_prev_free;/* doubly linked list of buffers */
1345 + struct buffer_head *b_this_page;/* circular list of buffers in one page */
1346 + struct buffer_head *b_reqnext; /* request queue */
1348 + struct buffer_head **b_pprev; /* doubly linked list of hash-queue */
1349 + char * b_data; /* pointer to data block */
1350 + struct page *b_page; /* the page this bh is mapped to */
1351 + void (*b_end_io)(struct buffer_head *bh, int uptodate); /* I/O completion */
1352 + void *b_private; /* reserved for b_end_io */
1354 + unsigned long b_rsector; /* Real buffer location on disk */
1355 + wait_queue_head_t b_wait;
1357 + struct list_head b_inode_buffers; /* doubly linked list of inode dirty buffers */
1360 +typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
1361 +void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
1363 +#define __buffer_state(bh, state) (((bh)->b_state & (1UL << BH_##state)) != 0)
1365 +#define buffer_uptodate(bh) __buffer_state(bh,Uptodate)
1366 +#define buffer_dirty(bh) __buffer_state(bh,Dirty)
1367 +#define buffer_locked(bh) __buffer_state(bh,Lock)
1368 +#define buffer_req(bh) __buffer_state(bh,Req)
1369 +#define buffer_mapped(bh) __buffer_state(bh,Mapped)
1370 +#define buffer_new(bh) __buffer_state(bh,New)
1371 +#define buffer_async(bh) __buffer_state(bh,Async)
1372 +#define buffer_launder(bh) __buffer_state(bh,Launder)
1374 +#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
1376 +extern void set_bh_page(struct buffer_head *bh, struct page *page, unsigned long offset);
1378 +#define touch_buffer(bh) mark_page_accessed(bh->b_page)
1381 +#include <linux/pipe_fs_i.h>
1382 +#include <linux/minix_fs_i.h>
1383 +#include <linux/ext2_fs_i.h>
1384 +#include <linux/ext3_fs_i.h>
1385 +#include <linux/hpfs_fs_i.h>
1386 +#include <linux/ntfs_fs_i.h>
1387 +#include <linux/msdos_fs_i.h>
1388 +#include <linux/umsdos_fs_i.h>
1389 +#include <linux/iso_fs_i.h>
1390 +#include <linux/nfs_fs_i.h>
1391 +#include <linux/sysv_fs_i.h>
1392 +#include <linux/affs_fs_i.h>
1393 +#include <linux/ufs_fs_i.h>
1394 +#include <linux/efs_fs_i.h>
1395 +#include <linux/coda_fs_i.h>
1396 +#include <linux/romfs_fs_i.h>
1397 +#include <linux/shmem_fs.h>
1398 +#include <linux/smb_fs_i.h>
1399 +#include <linux/hfs_fs_i.h>
1400 +#include <linux/adfs_fs_i.h>
1401 +#include <linux/qnx4_fs_i.h>
1402 +#include <linux/reiserfs_fs_i.h>
1403 +#include <linux/bfs_fs_i.h>
1404 +#include <linux/udf_fs_i.h>
1405 +#include <linux/ncp_fs_i.h>
1406 +#include <linux/proc_fs_i.h>
1407 +#include <linux/usbdev_fs_i.h>
1408 +#include <linux/jffs2_fs_i.h>
1409 +#include <linux/cramfs_fs_sb.h>
1412 + * Attribute flags. These should be or-ed together to figure out what
1413 + * has been changed!
1415 +#define ATTR_MODE 1
1418 +#define ATTR_SIZE 8
1419 +#define ATTR_ATIME 16
1420 +#define ATTR_MTIME 32
1421 +#define ATTR_CTIME 64
1422 +#define ATTR_ATIME_SET 128
1423 +#define ATTR_MTIME_SET 256
1424 +#define ATTR_FORCE 512 /* Not a change, but a change it */
1425 +#define ATTR_ATTR_FLAG 1024
1428 + * This is the Inode Attributes structure, used for notify_change(). It
1429 + * uses the above definitions as flags, to know which values have changed.
1430 + * Also, in this manner, a Filesystem can look at only the values it cares
1431 + * about. Basically, these are the attributes that the VFS layer can
1432 + * request to change from the FS layer.
1434 + * Derek Atkins <warlord@MIT.EDU> 94-10-20
1437 + unsigned int ia_valid;
1445 + unsigned int ia_attr_flags;
1449 + * This is the inode attributes flag definitions
1451 +#define ATTR_FLAG_SYNCRONOUS 1 /* Syncronous write */
1452 +#define ATTR_FLAG_NOATIME 2 /* Don't update atime */
1453 +#define ATTR_FLAG_APPEND 4 /* Append-only file */
1454 +#define ATTR_FLAG_IMMUTABLE 8 /* Immutable file */
1455 +#define ATTR_FLAG_NODIRATIME 16 /* Don't update atime for directory */
1458 + * Includes for diskquotas and mount structures.
1460 +#include <linux/quota.h>
1461 +#include <linux/mount.h>
1464 + * oh the beauties of C type declarations.
1467 +struct address_space;
1470 +struct address_space_operations {
1471 + int (*writepage)(struct page *);
1472 + int (*readpage)(struct file *, struct page *);
1473 + int (*sync_page)(struct page *);
1475 + * ext3 requires that a successful prepare_write() call be followed
1476 + * by a commit_write() call - they must be balanced
1478 + int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
1479 + int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
1480 + /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
1481 + int (*bmap)(struct address_space *, long);
1482 + int (*flushpage) (struct page *, unsigned long);
1483 + int (*releasepage) (struct page *, int);
1484 +#define KERNEL_HAS_O_DIRECT /* this is for modules out of the kernel */
1485 + int (*direct_IO)(int, struct inode *, struct kiobuf *, unsigned long, int);
1486 +#define KERNEL_HAS_DIRECT_FILEIO /* Unfortunate kludge due to lack of foresight */
1487 + int (*direct_fileIO)(int, struct file *, struct kiobuf *, unsigned long, int);
1488 + void (*removepage)(struct page *); /* called when page gets removed from the inode */
1491 +struct address_space {
1492 + struct list_head clean_pages; /* list of clean pages */
1493 + struct list_head dirty_pages; /* list of dirty pages */
1494 + struct list_head locked_pages; /* list of locked pages */
1495 + unsigned long nrpages; /* number of total pages */
1496 + struct address_space_operations *a_ops; /* methods */
1497 + struct inode *host; /* owner: inode, block_device */
1498 + struct vm_area_struct *i_mmap; /* list of private mappings */
1499 + struct vm_area_struct *i_mmap_shared; /* list of shared mappings */
1500 + spinlock_t i_shared_lock; /* and spinlock protecting it */
1501 + int gfp_mask; /* how to allocate the pages */
1504 +struct char_device {
1505 + struct list_head hash;
1509 + struct semaphore sem;
1512 +struct block_device {
1513 + struct list_head bd_hash;
1514 + atomic_t bd_count;
1515 + struct inode * bd_inode;
1516 + dev_t bd_dev; /* not a kdev_t - it's a search key */
1518 + const struct block_device_operations *bd_op;
1519 + struct semaphore bd_sem; /* open/close mutex */
1520 + struct list_head bd_inodes;
1524 + struct list_head i_hash;
1525 + struct list_head i_list;
1526 + struct list_head i_dentry;
1528 + struct list_head i_dirty_buffers;
1529 + struct list_head i_dirty_data_buffers;
1531 + unsigned long i_ino;
1543 + unsigned int i_blkbits;
1544 + unsigned long i_blksize;
1545 + unsigned long i_blocks;
1546 + unsigned long i_version;
1547 + unsigned short i_bytes;
1548 + struct semaphore i_sem;
1549 + struct rw_semaphore i_alloc_sem;
1550 + struct semaphore i_zombie;
1551 + struct inode_operations *i_op;
1552 + struct file_operations *i_fop; /* former ->i_op->default_file_ops */
1553 + struct super_block *i_sb;
1554 + wait_queue_head_t i_wait;
1555 + struct file_lock *i_flock;
1556 + struct address_space *i_mapping;
1557 + struct address_space i_data;
1558 + struct dquot *i_dquot[MAXQUOTAS];
1559 + /* These three should probably be a union */
1560 + struct list_head i_devices;
1561 + struct pipe_inode_info *i_pipe;
1562 + struct block_device *i_bdev;
1563 + struct char_device *i_cdev;
1565 + unsigned long i_dnotify_mask; /* Directory notify events */
1566 + struct dnotify_struct *i_dnotify; /* for directory notifications */
1568 + unsigned long i_state;
1570 + unsigned int i_flags;
1571 + unsigned char i_sock;
1573 + atomic_t i_writecount;
1574 + unsigned int i_attr_flags;
1575 + __u32 i_generation;
1577 + struct minix_inode_info minix_i;
1578 + struct ext2_inode_info ext2_i;
1579 + struct ext3_inode_info ext3_i;
1580 + struct hpfs_inode_info hpfs_i;
1581 + struct ntfs_inode_info ntfs_i;
1582 + struct msdos_inode_info msdos_i;
1583 + struct umsdos_inode_info umsdos_i;
1584 + struct iso_inode_info isofs_i;
1585 + struct nfs_inode_info nfs_i;
1586 + struct sysv_inode_info sysv_i;
1587 + struct affs_inode_info affs_i;
1588 + struct ufs_inode_info ufs_i;
1589 + struct efs_inode_info efs_i;
1590 + struct romfs_inode_info romfs_i;
1591 + struct shmem_inode_info shmem_i;
1592 + struct coda_inode_info coda_i;
1593 + struct smb_inode_info smbfs_i;
1594 + struct hfs_inode_info hfs_i;
1595 + struct adfs_inode_info adfs_i;
1596 + struct qnx4_inode_info qnx4_i;
1597 + struct reiserfs_inode_info reiserfs_i;
1598 + struct bfs_inode_info bfs_i;
1599 + struct udf_inode_info udf_i;
1600 + struct ncp_inode_info ncpfs_i;
1601 + struct proc_inode_info proc_i;
1602 + struct socket socket_i;
1603 + struct usbdev_inode_info usbdev_i;
1604 + struct jffs2_inode_info jffs2_i;
1609 +static inline void inode_add_bytes(struct inode *inode, loff_t bytes)
1611 + inode->i_blocks += bytes >> 9;
1613 + inode->i_bytes += bytes;
1614 + if (inode->i_bytes >= 512) {
1615 + inode->i_blocks++;
1616 + inode->i_bytes -= 512;
1620 +static inline void inode_sub_bytes(struct inode *inode, loff_t bytes)
1622 + inode->i_blocks -= bytes >> 9;
1624 + if (inode->i_bytes < bytes) {
1625 + inode->i_blocks--;
1626 + inode->i_bytes += 512;
1628 + inode->i_bytes -= bytes;
1631 +static inline loff_t inode_get_bytes(struct inode *inode)
1633 + return (((loff_t)inode->i_blocks) << 9) + inode->i_bytes;
1636 +static inline void inode_set_bytes(struct inode *inode, loff_t bytes)
1638 + inode->i_blocks = bytes >> 9;
1639 + inode->i_bytes = bytes & 511;
1642 +struct fown_struct {
1643 + int pid; /* pid or -pgrp where SIGIO should be sent */
1644 + uid_t uid, euid; /* uid/euid of process setting the owner */
1645 + int signum; /* posix.1b rt signal to be delivered on IO */
1649 + struct list_head f_list;
1650 + struct dentry *f_dentry;
1651 + struct vfsmount *f_vfsmnt;
1652 + struct file_operations *f_op;
1654 + unsigned int f_flags;
1657 + unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
1658 + struct fown_struct f_owner;
1659 + unsigned int f_uid, f_gid;
1662 + unsigned long f_version;
1664 + /* needed for tty driver, and maybe others */
1665 + void *private_data;
1667 + /* preallocated helper kiobuf to speedup O_DIRECT */
1668 + struct kiobuf *f_iobuf;
1669 + long f_iobuf_lock;
1671 +extern spinlock_t files_lock;
1672 +#define file_list_lock() spin_lock(&files_lock);
1673 +#define file_list_unlock() spin_unlock(&files_lock);
1675 +#define get_file(x) atomic_inc(&(x)->f_count)
1676 +#define file_count(x) atomic_read(&(x)->f_count)
1678 +extern int init_private_file(struct file *, struct dentry *, int);
1680 +#define MAX_NON_LFS ((1UL<<31) - 1)
1682 +/* Page cache limit. The filesystems should put that into their s_maxbytes
1683 + limits, otherwise bad things can happen in VM. */
1684 +#if BITS_PER_LONG==32
1685 +#define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
1686 +#elif BITS_PER_LONG==64
1687 +#define MAX_LFS_FILESIZE 0x7fffffffffffffff
1692 +#define FL_BROKEN 4 /* broken flock() emulation */
1693 +#define FL_ACCESS 8 /* for processes suspended by mandatory locking */
1694 +#define FL_LOCKD 16 /* lock held by rpc.lockd */
1695 +#define FL_LEASE 32 /* lease held on this file */
1698 + * The POSIX file lock owner is determined by
1699 + * the "struct files_struct" in the thread group
1700 + * (or NULL for no owner - BSD locks).
1702 + * Lockd stuffs a "host" pointer into this.
1704 +typedef struct files_struct *fl_owner_t;
1707 + struct file_lock *fl_next; /* singly linked list for this inode */
1708 + struct list_head fl_link; /* doubly linked list of all locks */
1709 + struct list_head fl_block; /* circular list of blocked processes */
1710 + fl_owner_t fl_owner;
1711 + unsigned int fl_pid;
1712 + wait_queue_head_t fl_wait;
1713 + struct file *fl_file;
1714 + unsigned char fl_flags;
1715 + unsigned char fl_type;
1719 + void (*fl_notify)(struct file_lock *); /* unblock callback */
1720 + void (*fl_insert)(struct file_lock *); /* lock insertion callback */
1721 + void (*fl_remove)(struct file_lock *); /* lock removal callback */
1723 + struct fasync_struct * fl_fasync; /* for lease break notifications */
1724 + unsigned long fl_break_time; /* for nonblocking lease breaks */
1727 + struct nfs_lock_info nfs_fl;
1731 +/* The following constant reflects the upper bound of the file/locking space */
1733 +#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1)))
1734 +#define OFFSET_MAX INT_LIMIT(loff_t)
1735 +#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
1738 +extern struct list_head file_lock_list;
1740 +#include <linux/fcntl.h>
1742 +extern int fcntl_getlk(unsigned int, struct flock *);
1743 +extern int fcntl_setlk(unsigned int, unsigned int, struct flock *);
1745 +extern int fcntl_getlk64(unsigned int, struct flock64 *);
1746 +extern int fcntl_setlk64(unsigned int, unsigned int, struct flock64 *);
1749 +extern void locks_init_lock(struct file_lock *);
1750 +extern void locks_copy_lock(struct file_lock *, struct file_lock *);
1751 +extern void locks_remove_posix(struct file *, fl_owner_t);
1752 +extern void locks_remove_flock(struct file *);
1753 +extern struct file_lock *posix_test_lock(struct file *, struct file_lock *);
1754 +extern int posix_lock_file(struct file *, struct file_lock *, unsigned int);
1755 +extern void posix_block_lock(struct file_lock *, struct file_lock *);
1756 +extern void posix_unblock_lock(struct file_lock *);
1757 +extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
1758 +extern int __get_lease(struct inode *inode, unsigned int flags);
1759 +extern time_t lease_get_mtime(struct inode *);
1760 +extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
1761 +extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
1762 +extern void steal_locks(fl_owner_t from);
1764 +struct fasync_struct {
1767 + struct fasync_struct *fa_next; /* singly linked list */
1768 + struct file *fa_file;
1771 +#define FASYNC_MAGIC 0x4601
1773 +/* SMP safe fasync helpers: */
1774 +extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
1775 +/* can be called from interrupts */
1776 +extern void kill_fasync(struct fasync_struct **, int, int);
1777 +/* only for net: no internal synchronization */
1778 +extern void __kill_fasync(struct fasync_struct *, int, int);
1781 + struct dentry *dentry;
1782 + struct vfsmount *mnt;
1784 + unsigned int flags;
1792 +#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
1793 +#define MNT_DETACH 0x00000002 /* Just detach from the tree */
1795 +#include <linux/minix_fs_sb.h>
1796 +#include <linux/ext2_fs_sb.h>
1797 +#include <linux/ext3_fs_sb.h>
1798 +#include <linux/hpfs_fs_sb.h>
1799 +#include <linux/ntfs_fs_sb.h>
1800 +#include <linux/msdos_fs_sb.h>
1801 +#include <linux/iso_fs_sb.h>
1802 +#include <linux/nfs_fs_sb.h>
1803 +#include <linux/sysv_fs_sb.h>
1804 +#include <linux/affs_fs_sb.h>
1805 +#include <linux/ufs_fs_sb.h>
1806 +#include <linux/efs_fs_sb.h>
1807 +#include <linux/romfs_fs_sb.h>
1808 +#include <linux/smb_fs_sb.h>
1809 +#include <linux/hfs_fs_sb.h>
1810 +#include <linux/adfs_fs_sb.h>
1811 +#include <linux/qnx4_fs_sb.h>
1812 +#include <linux/reiserfs_fs_sb.h>
1813 +#include <linux/bfs_fs_sb.h>
1814 +#include <linux/udf_fs_sb.h>
1815 +#include <linux/ncp_fs_sb.h>
1816 +#include <linux/usbdev_fs_sb.h>
1817 +#include <linux/cramfs_fs_sb.h>
1818 +#include <linux/jffs2_fs_sb.h>
1820 +extern struct list_head super_blocks;
1821 +extern spinlock_t sb_lock;
1823 +#define sb_entry(list) list_entry((list), struct super_block, s_list)
1824 +#define S_BIAS (1<<30)
1825 +struct super_block {
1826 + struct list_head s_list; /* Keep this first */
1828 + unsigned long s_blocksize;
1829 + unsigned char s_blocksize_bits;
1830 + unsigned char s_dirt;
1831 + unsigned long long s_maxbytes; /* Max file size */
1832 + struct file_system_type *s_type;
1833 + struct super_operations *s_op;
1834 + struct dquot_operations *dq_op;
1835 + struct quotactl_ops *s_qcop;
1836 + unsigned long s_flags;
1837 + unsigned long s_magic;
1838 + struct dentry *s_root;
1839 + struct rw_semaphore s_umount;
1840 + struct semaphore s_lock;
1842 + atomic_t s_active;
1844 + struct list_head s_dirty; /* dirty inodes */
1845 + struct list_head s_locked_inodes;/* inodes being synced */
1846 + struct list_head s_files;
1848 + struct block_device *s_bdev;
1849 + struct list_head s_instances;
1850 + struct quota_info s_dquot; /* Diskquota specific options */
1853 + struct minix_sb_info minix_sb;
1854 + struct ext2_sb_info ext2_sb;
1855 + struct ext3_sb_info ext3_sb;
1856 + struct hpfs_sb_info hpfs_sb;
1857 + struct ntfs_sb_info ntfs_sb;
1858 + struct msdos_sb_info msdos_sb;
1859 + struct isofs_sb_info isofs_sb;
1860 + struct nfs_sb_info nfs_sb;
1861 + struct sysv_sb_info sysv_sb;
1862 + struct affs_sb_info affs_sb;
1863 + struct ufs_sb_info ufs_sb;
1864 + struct efs_sb_info efs_sb;
1865 + struct shmem_sb_info shmem_sb;
1866 + struct romfs_sb_info romfs_sb;
1867 + struct smb_sb_info smbfs_sb;
1868 + struct hfs_sb_info hfs_sb;
1869 + struct adfs_sb_info adfs_sb;
1870 + struct qnx4_sb_info qnx4_sb;
1871 + struct reiserfs_sb_info reiserfs_sb;
1872 + struct bfs_sb_info bfs_sb;
1873 + struct udf_sb_info udf_sb;
1874 + struct ncp_sb_info ncpfs_sb;
1875 + struct usbdev_sb_info usbdevfs_sb;
1876 + struct jffs2_sb_info jffs2_sb;
1877 + struct cramfs_sb_info cramfs_sb;
1878 + void *generic_sbp;
1881 + * The next field is for VFS *only*. No filesystems have any business
1882 + * even looking at it. You had been warned.
1884 + struct semaphore s_vfs_rename_sem; /* Kludge */
1886 + /* The next field is used by knfsd when converting a (inode number based)
1887 + * file handle into a dentry. As it builds a path in the dcache tree from
1888 + * the bottom up, there may for a time be a subpath of dentrys which is not
1889 + * connected to the main tree. This semaphore ensure that there is only ever
1890 + * one such free path per filesystem. Note that unconnected files (or other
1891 + * non-directories) are allowed, but not unconnected diretories.
1893 + struct semaphore s_nfsd_free_path_sem;
1897 + * VFS helper functions..
1899 +extern int vfs_create(struct inode *, struct dentry *, int);
1900 +extern int vfs_mkdir(struct inode *, struct dentry *, int);
1901 +extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
1902 +extern int vfs_symlink(struct inode *, struct dentry *, const char *);
1903 +extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
1904 +extern int vfs_rmdir(struct inode *, struct dentry *);
1905 +extern int vfs_unlink(struct inode *, struct dentry *);
1906 +extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
1911 +#define DT_UNKNOWN 0
1922 + * This is the "filldir" function type, used by readdir() to let
1923 + * the kernel specify what kind of dirent layout it wants to have.
1924 + * This allows the kernel to read directories into kernel space or
1925 + * to have different dirent layouts depending on the binary type.
1927 +typedef int (*filldir_t)(void *, const char *, int, loff_t, ino_t, unsigned);
1929 +struct block_device_operations {
1930 + int (*open) (struct inode *, struct file *);
1931 + int (*release) (struct inode *, struct file *);
1932 + int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
1933 + int (*check_media_change) (kdev_t);
1934 + int (*revalidate) (kdev_t);
1935 + struct module *owner;
1940 + * read, write, poll, fsync, readv, writev can be called
1941 + * without the big kernel lock held in all filesystems.
1943 +struct file_operations {
1944 + struct module *owner;
1945 + loff_t (*llseek) (struct file *, loff_t, int);
1946 + ssize_t (*read) (struct file *, char *, size_t, loff_t *);
1947 + ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
1948 + int (*readdir) (struct file *, void *, filldir_t);
1949 + unsigned int (*poll) (struct file *, struct poll_table_struct *);
1950 + int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
1951 + int (*mmap) (struct file *, struct vm_area_struct *);
1952 + int (*open) (struct inode *, struct file *);
1953 + int (*flush) (struct file *);
1954 + int (*release) (struct inode *, struct file *);
1955 + int (*fsync) (struct file *, struct dentry *, int datasync);
1956 + int (*fasync) (int, struct file *, int);
1957 + int (*lock) (struct file *, int, struct file_lock *);
1958 + ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
1959 + ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
1960 + ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
1961 + unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
1964 +struct inode_operations {
1965 + int (*create) (struct inode *,struct dentry *,int);
1966 + struct dentry * (*lookup) (struct inode *,struct dentry *);
1967 + int (*link) (struct dentry *,struct inode *,struct dentry *);
1968 + int (*unlink) (struct inode *,struct dentry *);
1969 + int (*symlink) (struct inode *,struct dentry *,const char *);
1970 + int (*mkdir) (struct inode *,struct dentry *,int);
1971 + int (*rmdir) (struct inode *,struct dentry *);
1972 + int (*mknod) (struct inode *,struct dentry *,int,int);
1973 + int (*rename) (struct inode *, struct dentry *,
1974 + struct inode *, struct dentry *);
1975 + int (*readlink) (struct dentry *, char *,int);
1976 + int (*follow_link) (struct dentry *, struct nameidata *);
1977 + void (*truncate) (struct inode *);
1978 + int (*permission) (struct inode *, int);
1979 + int (*revalidate) (struct dentry *);
1980 + int (*setattr) (struct dentry *, struct iattr *);
1981 + int (*getattr) (struct dentry *, struct iattr *);
1982 + int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
1983 + ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
1984 + ssize_t (*listxattr) (struct dentry *, char *, size_t);
1985 + int (*removexattr) (struct dentry *, const char *);
1991 + * NOTE: write_inode, delete_inode, clear_inode, put_inode can be called
1992 + * without the big kernel lock held in all filesystems.
1994 +struct super_operations {
1995 + struct inode *(*alloc_inode)(struct super_block *sb);
1996 + void (*destroy_inode)(struct inode *);
1998 + void (*read_inode) (struct inode *);
2000 + /* reiserfs kludge. reiserfs needs 64 bits of information to
2001 + ** find an inode. We are using the read_inode2 call to get
2002 + ** that information. We don't like this, and are waiting on some
2003 + ** VFS changes for the real solution.
2004 + ** iget4 calls read_inode2, iff it is defined
2006 + void (*read_inode2) (struct inode *, void *) ;
2007 + void (*dirty_inode) (struct inode *);
2008 + void (*write_inode) (struct inode *, int);
2009 + void (*put_inode) (struct inode *);
2010 + void (*delete_inode) (struct inode *);
2011 + void (*put_super) (struct super_block *);
2012 + void (*write_super) (struct super_block *);
2013 + int (*sync_fs) (struct super_block *);
2014 + void (*write_super_lockfs) (struct super_block *);
2015 + void (*unlockfs) (struct super_block *);
2016 + int (*statfs) (struct super_block *, struct statfs *);
2017 + int (*remount_fs) (struct super_block *, int *, char *);
2018 + void (*clear_inode) (struct inode *);
2019 + void (*umount_begin) (struct super_block *);
2021 + /* Following are for knfsd to interact with "interesting" filesystems
2022 + * Currently just reiserfs, but possibly FAT and others later
2024 + * fh_to_dentry is given a filehandle fragement with length, and a type flag
2025 + * and must return a dentry for the referenced object or, if "parent" is
2026 + * set, a dentry for the parent of the object.
2027 + * If a dentry cannot be found, a "root" dentry should be created and
2028 + * flaged as DCACHE_NFSD_DISCONNECTED. nfsd_iget is an example implementation.
2030 + * dentry_to_fh is given a dentry and must generate the filesys specific
2031 + * part of the file handle. Available length is passed in *lenp and used
2032 + * length should be returned therein.
2033 + * If need_parent is set, then dentry_to_fh should encode sufficient information
2034 + * to find the (current) parent.
2035 + * dentry_to_fh should return a 1byte "type" which will be passed back in
2036 + * the fhtype arguement to fh_to_dentry. Type of 0 is reserved.
2037 + * If filesystem was exportable before the introduction of fh_to_dentry,
2038 + * types 1 and 2 should be used is that same way as the generic code.
2039 + * Type 255 means error.
2041 + * Lengths are in units of 4bytes, not bytes.
2043 + struct dentry * (*fh_to_dentry)(struct super_block *sb, __u32 *fh, int len, int fhtype, int parent);
2044 + int (*dentry_to_fh)(struct dentry *, __u32 *fh, int *lenp, int need_parent);
2045 + int (*show_options)(struct seq_file *, struct vfsmount *);
2048 +/* Inode state bits.. */
2049 +#define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */
2050 +#define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */
2051 +#define I_DIRTY_PAGES 4 /* Data-related inode changes pending */
2053 +#define I_FREEING 16
2056 +#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
2058 +extern void __mark_inode_dirty(struct inode *, int);
2059 +static inline void mark_inode_dirty(struct inode *inode)
2061 + __mark_inode_dirty(inode, I_DIRTY);
2064 +static inline void mark_inode_dirty_sync(struct inode *inode)
2066 + __mark_inode_dirty(inode, I_DIRTY_SYNC);
2069 +static inline void mark_inode_dirty_pages(struct inode *inode)
2071 + __mark_inode_dirty(inode, I_DIRTY_PAGES);
2074 +struct file_system_type {
2077 + struct super_block *(*read_super) (struct super_block *, void *, int);
2078 + struct module *owner;
2079 + struct file_system_type * next;
2080 + struct list_head fs_supers;
2083 +#define DECLARE_FSTYPE(var,type,read,flags) \
2084 +struct file_system_type var = { \
2086 + read_super: read, \
2087 + fs_flags: flags, \
2088 + owner: THIS_MODULE, \
2091 +#define DECLARE_FSTYPE_DEV(var,type,read) \
2092 + DECLARE_FSTYPE(var,type,read,FS_REQUIRES_DEV)
2094 +/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
2095 +#define fops_get(fops) \
2096 + (((fops) && (fops)->owner) \
2097 + ? ( try_inc_mod_count((fops)->owner) ? (fops) : NULL ) \
2100 +#define fops_put(fops) \
2102 + if ((fops) && (fops)->owner) \
2103 + __MOD_DEC_USE_COUNT((fops)->owner); \
2106 +extern int register_filesystem(struct file_system_type *);
2107 +extern int unregister_filesystem(struct file_system_type *);
2108 +extern struct vfsmount *kern_mount(struct file_system_type *);
2109 +extern int may_umount(struct vfsmount *);
2110 +extern long do_mount(char *, char *, char *, unsigned long, void *);
2112 +#define kern_umount mntput
2114 +extern int vfs_statfs(struct super_block *, struct statfs *);
2116 +/* Return value for VFS lock functions - tells locks.c to lock conventionally
2117 + * REALLY kosha for root NFS and nfs_lock
2119 +#define LOCK_USE_CLNT 1
2121 +#define FLOCK_VERIFY_READ 1
2122 +#define FLOCK_VERIFY_WRITE 2
2124 +extern int locks_mandatory_locked(struct inode *);
2125 +extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
2128 + * Candidates for mandatory locking have the setgid bit set
2129 + * but no group execute bit - an otherwise meaningless combination.
2131 +#define MANDATORY_LOCK(inode) \
2132 + (IS_MANDLOCK(inode) && ((inode)->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
2134 +static inline int locks_verify_locked(struct inode *inode)
2136 + if (MANDATORY_LOCK(inode))
2137 + return locks_mandatory_locked(inode);
2141 +static inline int locks_verify_area(int read_write, struct inode *inode,
2142 + struct file *filp, loff_t offset,
2145 + if (inode->i_flock && MANDATORY_LOCK(inode))
2146 + return locks_mandatory_area(read_write, inode, filp, offset, count);
2150 +static inline int locks_verify_truncate(struct inode *inode,
2151 + struct file *filp,
2154 + if (inode->i_flock && MANDATORY_LOCK(inode))
2155 + return locks_mandatory_area(
2156 + FLOCK_VERIFY_WRITE, inode, filp,
2157 + size < inode->i_size ? size : inode->i_size,
2158 + (size < inode->i_size ? inode->i_size - size
2159 + : size - inode->i_size)
2164 +static inline int get_lease(struct inode *inode, unsigned int mode)
2166 + if (inode->i_flock)
2167 + return __get_lease(inode, mode);
2173 +asmlinkage long sys_open(const char *, int, int);
2174 +asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
2175 +extern int do_truncate(struct dentry *, loff_t start);
2177 +extern struct file *filp_open(const char *, int, int);
2178 +extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
2179 +extern int filp_close(struct file *, fl_owner_t id);
2180 +extern char * getname(const char *);
2183 +extern void vfs_caches_init(unsigned long);
2185 +#define __getname() kmem_cache_alloc(names_cachep, SLAB_KERNEL)
2186 +#define putname(name) kmem_cache_free(names_cachep, (void *)(name))
2188 +enum {BDEV_FILE, BDEV_SWAP, BDEV_FS, BDEV_RAW};
2189 +extern int register_blkdev(unsigned int, const char *, struct block_device_operations *);
2190 +extern int unregister_blkdev(unsigned int, const char *);
2191 +extern struct block_device *bdget(dev_t);
2192 +extern int bd_acquire(struct inode *inode);
2193 +extern void bd_forget(struct inode *inode);
2194 +extern void bdput(struct block_device *);
2195 +extern struct char_device *cdget(dev_t);
2196 +extern void cdput(struct char_device *);
2197 +extern int blkdev_open(struct inode *, struct file *);
2198 +extern int blkdev_close(struct inode *, struct file *);
2199 +extern struct file_operations def_blk_fops;
2200 +extern struct address_space_operations def_blk_aops;
2201 +extern struct file_operations def_fifo_fops;
2202 +extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
2203 +extern int blkdev_get(struct block_device *, mode_t, unsigned, int);
2204 +extern int blkdev_put(struct block_device *, int);
2207 +extern const struct block_device_operations *get_blkfops(unsigned int);
2208 +extern int register_chrdev(unsigned int, const char *, struct file_operations *);
2209 +extern int unregister_chrdev(unsigned int, const char *);
2210 +extern int chrdev_open(struct inode *, struct file *);
2211 +extern const char * bdevname(kdev_t);
2212 +extern const char * cdevname(kdev_t);
2213 +extern const char * kdevname(kdev_t);
2214 +extern void init_special_inode(struct inode *, umode_t, int);
2216 +/* Invalid inode operations -- fs/bad_inode.c */
2217 +extern void make_bad_inode(struct inode *);
2218 +extern int is_bad_inode(struct inode *);
2220 +extern struct file_operations read_fifo_fops;
2221 +extern struct file_operations write_fifo_fops;
2222 +extern struct file_operations rdwr_fifo_fops;
2223 +extern struct file_operations read_pipe_fops;
2224 +extern struct file_operations write_pipe_fops;
2225 +extern struct file_operations rdwr_pipe_fops;
2227 +extern int fs_may_remount_ro(struct super_block *);
2229 +extern int FASTCALL(try_to_free_buffers(struct page *, unsigned int));
2230 +extern void refile_buffer(struct buffer_head * buf);
2231 +extern void create_empty_buffers(struct page *, kdev_t, unsigned long);
2232 +extern void end_buffer_io_sync(struct buffer_head *bh, int uptodate);
2234 +/* reiserfs_writepage needs this */
2235 +extern void set_buffer_async_io(struct buffer_head *bh) ;
2237 +#define BUF_CLEAN 0
2238 +#define BUF_LOCKED 1 /* Buffers scheduled for write */
2239 +#define BUF_DIRTY 2 /* Dirty buffers, not yet scheduled for write */
2242 +static inline void get_bh(struct buffer_head * bh)
2244 + atomic_inc(&(bh)->b_count);
2247 +static inline void put_bh(struct buffer_head *bh)
2249 + smp_mb__before_atomic_dec();
2250 + atomic_dec(&bh->b_count);
2254 + * This is called by bh->b_end_io() handlers when I/O has completed.
2256 +static inline void mark_buffer_uptodate(struct buffer_head * bh, int on)
2259 + set_bit(BH_Uptodate, &bh->b_state);
2261 + clear_bit(BH_Uptodate, &bh->b_state);
2264 +#define atomic_set_buffer_clean(bh) test_and_clear_bit(BH_Dirty, &(bh)->b_state)
2266 +static inline void __mark_buffer_clean(struct buffer_head *bh)
2268 + refile_buffer(bh);
2271 +static inline void mark_buffer_clean(struct buffer_head * bh)
2273 + if (atomic_set_buffer_clean(bh))
2274 + __mark_buffer_clean(bh);
2277 +extern void FASTCALL(__mark_dirty(struct buffer_head *bh));
2278 +extern void FASTCALL(__mark_buffer_dirty(struct buffer_head *bh));
2279 +extern void FASTCALL(mark_buffer_dirty(struct buffer_head *bh));
2281 +extern void FASTCALL(buffer_insert_list(struct buffer_head *, struct list_head *));
2283 +static inline void buffer_insert_inode_queue(struct buffer_head *bh, struct inode *inode)
2285 + buffer_insert_list(bh, &inode->i_dirty_buffers);
2288 +static inline void buffer_insert_inode_data_queue(struct buffer_head *bh, struct inode *inode)
2290 + buffer_insert_list(bh, &inode->i_dirty_data_buffers);
2293 +static inline int atomic_set_buffer_dirty(struct buffer_head *bh)
2295 + return test_and_set_bit(BH_Dirty, &bh->b_state);
2298 +static inline void mark_buffer_async(struct buffer_head * bh, int on)
2301 + set_bit(BH_Async, &bh->b_state);
2303 + clear_bit(BH_Async, &bh->b_state);
2306 +static inline void set_buffer_attached(struct buffer_head *bh)
2308 + set_bit(BH_Attached, &bh->b_state);
2311 +static inline void clear_buffer_attached(struct buffer_head *bh)
2313 + clear_bit(BH_Attached, &bh->b_state);
2316 +static inline int buffer_attached(struct buffer_head *bh)
2318 + return test_bit(BH_Attached, &bh->b_state);
2322 + * If an error happens during the make_request, this function
2323 + * has to be recalled. It marks the buffer as clean and not
2324 + * uptodate, and it notifys the upper layer about the end
2327 +static inline void buffer_IO_error(struct buffer_head * bh)
2329 + mark_buffer_clean(bh);
2331 + * b_end_io has to clear the BH_Uptodate bitflag in the error case!
2333 + bh->b_end_io(bh, 0);
2336 +static inline void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
2338 + mark_buffer_dirty(bh);
2339 + buffer_insert_inode_queue(bh, inode);
2342 +extern void set_buffer_flushtime(struct buffer_head *);
2343 +extern void balance_dirty(void);
2344 +extern int check_disk_change(kdev_t);
2345 +extern int invalidate_inodes(struct super_block *);
2346 +extern int invalidate_device(kdev_t, int);
2347 +extern void invalidate_inode_pages(struct inode *);
2348 +extern void invalidate_inode_pages2(struct address_space *);
2349 +extern void invalidate_inode_buffers(struct inode *);
2350 +#define invalidate_buffers(dev) __invalidate_buffers((dev), 0)
2351 +#define destroy_buffers(dev) __invalidate_buffers((dev), 1)
2352 +extern void invalidate_bdev(struct block_device *, int);
2353 +extern void __invalidate_buffers(kdev_t dev, int);
2354 +extern void sync_inodes(kdev_t);
2355 +extern void sync_unlocked_inodes(void);
2356 +extern void write_inode_now(struct inode *, int);
2357 +extern int sync_buffers(kdev_t, int);
2358 +extern void sync_dev(kdev_t);
2359 +extern int fsync_dev(kdev_t);
2360 +extern int fsync_super(struct super_block *);
2361 +extern int fsync_no_super(kdev_t);
2362 +extern void sync_inodes_sb(struct super_block *);
2363 +extern int fsync_buffers_list(struct list_head *);
2364 +static inline int fsync_inode_buffers(struct inode *inode)
2366 + return fsync_buffers_list(&inode->i_dirty_buffers);
2368 +static inline int fsync_inode_data_buffers(struct inode *inode)
2370 + return fsync_buffers_list(&inode->i_dirty_data_buffers);
2372 +extern int inode_has_buffers(struct inode *);
2373 +extern int do_fdatasync(struct file *);
2374 +extern int filemap_fdatasync(struct address_space *);
2375 +extern int filemap_fdatawait(struct address_space *);
2376 +extern void sync_supers(kdev_t dev, int wait);
2377 +extern int bmap(struct inode *, int);
2378 +extern int notify_change(struct dentry *, struct iattr *);
2379 +extern int permission(struct inode *, int);
2380 +extern int vfs_permission(struct inode *, int);
2381 +extern int get_write_access(struct inode *);
2382 +extern int deny_write_access(struct file *);
2383 +static inline void put_write_access(struct inode * inode)
2385 + atomic_dec(&inode->i_writecount);
2387 +static inline void allow_write_access(struct file *file)
2390 + atomic_inc(&file->f_dentry->d_inode->i_writecount);
2392 +extern int do_pipe(int *);
2394 +extern int open_namei(const char *, int, int, struct nameidata *);
2396 +extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
2397 +extern struct file * open_exec(const char *);
2399 +/* fs/dcache.c -- generic fs support functions */
2400 +extern int is_subdir(struct dentry *, struct dentry *);
2401 +extern ino_t find_inode_number(struct dentry *, struct qstr *);
2404 + * Kernel pointers have redundant information, so we can use a
2405 + * scheme where we can return either an error code or a dentry
2406 + * pointer with the same return value.
2408 + * This should be a per-architecture thing, to allow different
2409 + * error and pointer decisions.
2411 +static inline void *ERR_PTR(long error)
2413 + return (void *) error;
2416 +static inline long PTR_ERR(const void *ptr)
2418 + return (long) ptr;
2421 +static inline long IS_ERR(const void *ptr)
2423 + return (unsigned long)ptr > (unsigned long)-1000L;
2427 + * The bitmask for a lookup event:
2428 + * - follow links at the end
2429 + * - require a directory
2430 + * - ending slashes ok even for nonexistent files
2431 + * - internal "there are more path compnents" flag
2433 +#define LOOKUP_FOLLOW (1)
2434 +#define LOOKUP_DIRECTORY (2)
2435 +#define LOOKUP_CONTINUE (4)
2436 +#define LOOKUP_POSITIVE (8)
2437 +#define LOOKUP_PARENT (16)
2438 +#define LOOKUP_NOALT (32)
2440 + * Type of the last component on LOOKUP_PARENT
2442 +enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
2445 + * "descriptor" for what we're up to with a read for sendfile().
2446 + * This allows us to use the same read code yet
2447 + * have multiple different users of the data that
2448 + * we read from a file.
2450 + * The simplest case just copies the data to user
2458 +} read_descriptor_t;
2460 +typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long);
2462 +/* needed for stackable file system support */
2463 +extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
2465 +extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
2466 +extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
2467 +extern int FASTCALL(path_walk(const char *, struct nameidata *));
2468 +extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
2469 +extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
2470 +extern void path_release(struct nameidata *);
2471 +extern int follow_down(struct vfsmount **, struct dentry **);
2472 +extern int follow_up(struct vfsmount **, struct dentry **);
2473 +extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
2474 +extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
2475 +#define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
2476 +#define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
2478 +extern void inode_init_once(struct inode *);
2479 +extern void iput(struct inode *);
2480 +extern void force_delete(struct inode *);
2481 +extern struct inode * igrab(struct inode *);
2482 +extern ino_t iunique(struct super_block *, ino_t);
2484 +typedef int (*find_inode_t)(struct inode *, unsigned long, void *);
2485 +extern struct inode * iget4(struct super_block *, unsigned long, find_inode_t, void *);
2486 +static inline struct inode *iget(struct super_block *sb, unsigned long ino)
2488 + return iget4(sb, ino, NULL, NULL);
2491 +extern void clear_inode(struct inode *);
2492 +extern struct inode *new_inode(struct super_block *sb);
2493 +extern void remove_suid(struct inode *inode);
2495 +extern void insert_inode_hash(struct inode *);
2496 +extern void remove_inode_hash(struct inode *);
2497 +extern struct file * get_empty_filp(void);
2498 +extern void file_move(struct file *f, struct list_head *list);
2499 +extern struct buffer_head * get_hash_table(kdev_t, int, int);
2500 +extern struct buffer_head * getblk(kdev_t, int, int);
2501 +extern void ll_rw_block(int, int, struct buffer_head * bh[]);
2502 +extern void submit_bh(int, struct buffer_head *);
2503 +extern int is_read_only(kdev_t);
2504 +extern void __brelse(struct buffer_head *);
2505 +static inline void brelse(struct buffer_head *buf)
2510 +extern void __bforget(struct buffer_head *);
2511 +static inline void bforget(struct buffer_head *buf)
2516 +extern int set_blocksize(kdev_t, int);
2517 +extern int sb_set_blocksize(struct super_block *, int);
2518 +extern int sb_min_blocksize(struct super_block *, int);
2519 +extern struct buffer_head * bread(kdev_t, int, int);
2520 +static inline struct buffer_head * sb_bread(struct super_block *sb, int block)
2522 + return bread(sb->s_dev, block, sb->s_blocksize);
2524 +static inline struct buffer_head * sb_getblk(struct super_block *sb, int block)
2526 + return getblk(sb->s_dev, block, sb->s_blocksize);
2528 +static inline struct buffer_head * sb_get_hash_table(struct super_block *sb, int block)
2530 + return get_hash_table(sb->s_dev, block, sb->s_blocksize);
2532 +extern void wakeup_bdflush(void);
2533 +extern void put_unused_buffer_head(struct buffer_head * bh);
2534 +extern struct buffer_head * get_unused_buffer_head(int async);
2536 +extern int brw_page(int, struct page *, kdev_t, int [], int);
2538 +typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int);
2540 +/* Generic buffer handling for block filesystems.. */
2541 +extern int try_to_release_page(struct page * page, int gfp_mask);
2542 +extern int discard_bh_page(struct page *, unsigned long, int);
2543 +#define block_flushpage(page, offset) discard_bh_page(page, offset, 1)
2544 +#define block_invalidate_page(page) discard_bh_page(page, 0, 0)
2545 +extern int block_symlink(struct inode *, const char *, int);
2546 +extern int block_write_full_page(struct page*, get_block_t*);
2547 +extern int block_read_full_page(struct page*, get_block_t*);
2548 +extern int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
2549 +extern int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
2551 +extern int generic_cont_expand(struct inode *inode, loff_t size) ;
2552 +extern int block_commit_write(struct page *page, unsigned from, unsigned to);
2553 +extern int block_sync_page(struct page *);
2555 +int generic_block_bmap(struct address_space *, long, get_block_t *);
2556 +int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
2557 +int block_truncate_page(struct address_space *, loff_t, get_block_t *);
2558 +extern int generic_direct_IO(int, struct inode *, struct kiobuf *, unsigned long, int, get_block_t *);
2559 +extern int waitfor_one_page(struct page *);
2560 +extern int writeout_one_page(struct page *);
2562 +extern int generic_file_mmap(struct file *, struct vm_area_struct *);
2563 +extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
2564 +extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
2565 +extern int precheck_file_write(struct file *, struct inode *, size_t *, loff_t *);
2566 +extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *);
2567 +extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t);
2568 +extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
2569 +extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
2570 +extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *);
2571 +extern int generic_file_open(struct inode * inode, struct file * filp);
2573 +extern struct file_operations generic_ro_fops;
2575 +extern int vfs_readlink(struct dentry *, char *, int, const char *);
2576 +extern int vfs_follow_link(struct nameidata *, const char *);
2577 +extern int page_readlink(struct dentry *, char *, int);
2578 +extern int page_follow_link(struct dentry *, struct nameidata *);
2579 +extern struct inode_operations page_symlink_inode_operations;
2581 +extern int vfs_readdir(struct file *, filldir_t, void *);
2582 +extern int dcache_dir_open(struct inode *, struct file *);
2583 +extern int dcache_dir_close(struct inode *, struct file *);
2584 +extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2585 +extern int dcache_dir_fsync(struct file *, struct dentry *, int);
2586 +extern int dcache_readdir(struct file *, void *, filldir_t);
2587 +extern struct file_operations dcache_dir_ops;
2589 +extern struct file_system_type *get_fs_type(const char *name);
2590 +extern struct super_block *get_super(kdev_t);
2591 +extern void drop_super(struct super_block *sb);
2592 +static inline int is_mounted(kdev_t dev)
2594 + struct super_block *sb = get_super(dev);
2601 +unsigned long generate_cluster(kdev_t, int b[], int);
2602 +unsigned long generate_cluster_swab32(kdev_t, int b[], int);
2603 +extern kdev_t ROOT_DEV;
2604 +extern char root_device_name[];
2607 +extern void show_buffers(void);
2609 +#ifdef CONFIG_BLK_DEV_INITRD
2610 +extern unsigned int real_root_dev;
2613 +extern ssize_t char_read(struct file *, char *, size_t, loff_t *);
2614 +extern ssize_t block_read(struct file *, char *, size_t, loff_t *);
2615 +extern int read_ahead[];
2617 +extern ssize_t char_write(struct file *, const char *, size_t, loff_t *);
2618 +extern ssize_t block_write(struct file *, const char *, size_t, loff_t *);
2620 +extern int file_fsync(struct file *, struct dentry *, int);
2621 +extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start_idx, unsigned long end_idx);
2622 +extern int generic_osync_inode(struct inode *, int);
2623 +#define OSYNC_METADATA (1<<0)
2624 +#define OSYNC_DATA (1<<1)
2625 +#define OSYNC_INODE (1<<2)
2627 +extern int inode_change_ok(struct inode *, struct iattr *);
2628 +extern int inode_setattr(struct inode *, struct iattr *);
2630 +/* kernel/fork.c */
2631 +extern int unshare_files(void);
2634 + * Common dentry functions for inclusion in the VFS
2635 + * or in other stackable file systems. Some of these
2636 + * functions were in linux/fs/ C (VFS) files.
2641 + * Locking the parent is needed to:
2642 + * - serialize directory operations
2643 + * - make sure the parent doesn't change from
2644 + * under us in the middle of an operation.
2646 + * NOTE! Right now we'd rather use a "struct inode"
2647 + * for this, but as I expect things to move toward
2648 + * using dentries instead for most things it is
2649 + * probably better to start with the conceptually
2650 + * better interface of relying on a path of dentries.
2652 +static inline struct dentry *lock_parent(struct dentry *dentry)
2654 + struct dentry *dir = dget(dentry->d_parent);
2656 + down(&dir->d_inode->i_sem);
2660 +static inline struct dentry *get_parent(struct dentry *dentry)
2662 + return dget(dentry->d_parent);
2665 +static inline void unlock_dir(struct dentry *dir)
2667 + up(&dir->d_inode->i_sem);
2672 + * Whee.. Deadlock country. Happily there are only two VFS
2673 + * operations that does this..
2675 +static inline void double_down(struct semaphore *s1, struct semaphore *s2)
2678 + if ((unsigned long) s1 < (unsigned long) s2) {
2679 + struct semaphore *tmp = s2;
2680 + s2 = s1; s1 = tmp;
2688 + * Ewwwwwwww... _triple_ lock. We are guaranteed that the 3rd argument is
2689 + * not equal to 1st and not equal to 2nd - the first case (target is parent of
2690 + * source) would be already caught, the second is plain impossible (target is
2691 + * its own parent and that case would be caught even earlier). Very messy.
2692 + * I _think_ that it works, but no warranties - please, look it through.
2693 + * Pox on bloody lusers who mandated overwriting rename() for directories...
2696 +static inline void triple_down(struct semaphore *s1,
2697 + struct semaphore *s2,
2698 + struct semaphore *s3)
2701 + if ((unsigned long) s1 < (unsigned long) s2) {
2702 + if ((unsigned long) s1 < (unsigned long) s3) {
2703 + struct semaphore *tmp = s3;
2704 + s3 = s1; s1 = tmp;
2706 + if ((unsigned long) s1 < (unsigned long) s2) {
2707 + struct semaphore *tmp = s2;
2708 + s2 = s1; s1 = tmp;
2711 + if ((unsigned long) s1 < (unsigned long) s3) {
2712 + struct semaphore *tmp = s3;
2713 + s3 = s1; s1 = tmp;
2715 + if ((unsigned long) s2 < (unsigned long) s3) {
2716 + struct semaphore *tmp = s3;
2717 + s3 = s2; s2 = tmp;
2721 + } else if ((unsigned long) s2 < (unsigned long) s3) {
2722 + struct semaphore *tmp = s3;
2723 + s3 = s2; s2 = tmp;
2729 +static inline void double_up(struct semaphore *s1, struct semaphore *s2)
2736 +static inline void triple_up(struct semaphore *s1,
2737 + struct semaphore *s2,
2738 + struct semaphore *s3)
2746 +static inline void double_lock(struct dentry *d1, struct dentry *d2)
2748 + double_down(&d1->d_inode->i_sem, &d2->d_inode->i_sem);
2751 +static inline void double_unlock(struct dentry *d1, struct dentry *d2)
2753 + double_up(&d1->d_inode->i_sem,&d2->d_inode->i_sem);
2758 +#endif /* __KERNEL__ */
2760 +#endif /* _LINUX_FS_H */
2761 diff -Nur ./kernel-headers/linux/genhd.h ./kernel-headers/linux/genhd.h
2762 --- ./kernel-headers/linux/genhd.h 1970-01-01 01:00:00.000000000 +0100
2763 +++ ./kernel-headers/linux/genhd.h 2004-07-10 02:59:15.000000000 +0200
2765 +#ifndef _LINUX_GENHD_H
2766 +#define _LINUX_GENHD_H
2769 + * genhd.h Copyright (C) 1992 Drew Eckhardt
2770 + * Generic hard disk header file by
2773 + * <drew@colorado.edu>
2776 +#include <linux/config.h>
2777 +#include <linux/types.h>
2778 +#include <linux/major.h>
2781 +/* These three have identical behaviour; use the second one if DOS fdisk gets
2782 + confused about extended/logical partitions starting past cylinder 1023. */
2783 + DOS_EXTENDED_PARTITION = 5,
2784 + LINUX_EXTENDED_PARTITION = 0x85,
2785 + WIN98_EXTENDED_PARTITION = 0x0f,
2787 + LINUX_SWAP_PARTITION = 0x82,
2788 + LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
2790 + SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION,
2792 + DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */
2793 + EZD_PARTITION = 0x55, /* EZ-DRIVE */
2794 + DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */
2795 + DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */
2797 + FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */
2798 + OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */
2799 + NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */
2800 + BSDI_PARTITION = 0xb7, /* BSDI Partition ID */
2801 +/* Ours is not to wonder why.. */
2802 + BSD_PARTITION = FREEBSD_PARTITION,
2803 + MINIX_PARTITION = 0x81, /* Minix Partition ID */
2804 + PLAN9_PARTITION = 0x39, /* Plan 9 Partition ID */
2805 + UNIXWARE_PARTITION = 0x63, /* Partition ID, same as */
2806 + /* GNU_HURD and SCO Unix */
2810 + unsigned char boot_ind; /* 0x80 - active */
2811 + unsigned char head; /* starting head */
2812 + unsigned char sector; /* starting sector */
2813 + unsigned char cyl; /* starting cylinder */
2814 + unsigned char sys_ind; /* What partition type */
2815 + unsigned char end_head; /* end head */
2816 + unsigned char end_sector; /* end sector */
2817 + unsigned char end_cyl; /* end cylinder */
2818 + unsigned int start_sect; /* starting sector counting from 0 */
2819 + unsigned int nr_sects; /* nr of sectors in partition */
2820 +} __attribute__((packed));
2823 +# include <linux/devfs_fs_kernel.h>
2826 + unsigned long start_sect;
2827 + unsigned long nr_sects;
2828 + devfs_handle_t de; /* primary (master) devfs entry */
2829 +#ifdef CONFIG_DEVFS_FS
2831 +#endif /* CONFIG_DEVFS_FS */
2832 +#ifdef CONFIG_BLK_STATS
2833 + /* Performance stats: */
2834 + unsigned int ios_in_flight;
2835 + unsigned int io_ticks;
2836 + unsigned int last_idle_time;
2837 + unsigned int last_queue_change;
2838 + unsigned int aveq;
2840 + unsigned int rd_ios;
2841 + unsigned int rd_merges;
2842 + unsigned int rd_ticks;
2843 + unsigned int rd_sectors;
2844 + unsigned int wr_ios;
2845 + unsigned int wr_merges;
2846 + unsigned int wr_ticks;
2847 + unsigned int wr_sectors;
2848 +#endif /* CONFIG_BLK_STATS */
2851 +#define GENHD_FL_REMOVABLE 1
2854 + int major; /* major number of driver */
2855 + const char *major_name; /* name of major driver */
2856 + int minor_shift; /* number of times minor is shifted to
2858 + int max_p; /* maximum partitions per device */
2860 + struct hd_struct *part; /* [indexed by minor] */
2861 + int *sizes; /* [idem], device size in blocks */
2862 + int nr_real; /* number of real devices */
2864 + void *real_devices; /* internal use */
2865 + struct gendisk *next;
2866 + struct block_device_operations *fops;
2868 + devfs_handle_t *de_arr; /* one per physical disc */
2869 + char *flags; /* one per physical disc */
2872 +/* drivers/block/genhd.c */
2873 +extern struct gendisk *gendisk_head;
2875 +extern void add_gendisk(struct gendisk *gp);
2876 +extern void del_gendisk(struct gendisk *gp);
2877 +extern struct gendisk *get_gendisk(kdev_t dev);
2878 +extern int walk_gendisk(int (*walk)(struct gendisk *, void *), void *);
2880 +#endif /* __KERNEL__ */
2882 +#ifdef CONFIG_SOLARIS_X86_PARTITION
2884 +#define SOLARIS_X86_NUMSLICE 8
2885 +#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
2887 +struct solaris_x86_slice {
2888 + ushort s_tag; /* ID tag of partition */
2889 + ushort s_flag; /* permission flags */
2890 + unsigned int s_start; /* start sector no of partition */
2891 + unsigned int s_size; /* # of blocks in partition */
2894 +struct solaris_x86_vtoc {
2895 + unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */
2896 + unsigned int v_sanity; /* to verify vtoc sanity */
2897 + unsigned int v_version; /* layout version */
2898 + char v_volume[8]; /* volume name */
2899 + ushort v_sectorsz; /* sector size in bytes */
2900 + ushort v_nparts; /* number of partitions */
2901 + unsigned int v_reserved[10]; /* free space */
2902 + struct solaris_x86_slice
2903 + v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */
2904 + unsigned int timestamp[SOLARIS_X86_NUMSLICE]; /* timestamp (unsupported) */
2905 + char v_asciilabel[128]; /* for compatibility */
2908 +#endif /* CONFIG_SOLARIS_X86_PARTITION */
2910 +#ifdef CONFIG_BSD_DISKLABEL
2912 + * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il>
2913 + * updated by Marc Espie <Marc.Espie@openbsd.org>
2916 +/* check against BSD src/sys/sys/disklabel.h for consistency */
2918 +#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
2919 +#define BSD_MAXPARTITIONS 8
2920 +#define OPENBSD_MAXPARTITIONS 16
2921 +#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
2922 +struct bsd_disklabel {
2923 + __u32 d_magic; /* the magic number */
2924 + __s16 d_type; /* drive type */
2925 + __s16 d_subtype; /* controller/d_type specific */
2926 + char d_typename[16]; /* type name, e.g. "eagle" */
2927 + char d_packname[16]; /* pack identifier */
2928 + __u32 d_secsize; /* # of bytes per sector */
2929 + __u32 d_nsectors; /* # of data sectors per track */
2930 + __u32 d_ntracks; /* # of tracks per cylinder */
2931 + __u32 d_ncylinders; /* # of data cylinders per unit */
2932 + __u32 d_secpercyl; /* # of data sectors per cylinder */
2933 + __u32 d_secperunit; /* # of data sectors per unit */
2934 + __u16 d_sparespertrack; /* # of spare sectors per track */
2935 + __u16 d_sparespercyl; /* # of spare sectors per cylinder */
2936 + __u32 d_acylinders; /* # of alt. cylinders per unit */
2937 + __u16 d_rpm; /* rotational speed */
2938 + __u16 d_interleave; /* hardware sector interleave */
2939 + __u16 d_trackskew; /* sector 0 skew, per track */
2940 + __u16 d_cylskew; /* sector 0 skew, per cylinder */
2941 + __u32 d_headswitch; /* head switch time, usec */
2942 + __u32 d_trkseek; /* track-to-track seek, usec */
2943 + __u32 d_flags; /* generic flags */
2945 + __u32 d_drivedata[NDDATA]; /* drive-type specific information */
2947 + __u32 d_spare[NSPARE]; /* reserved for future use */
2948 + __u32 d_magic2; /* the magic number (again) */
2949 + __u16 d_checksum; /* xor of data incl. partitions */
2951 + /* filesystem and partition information: */
2952 + __u16 d_npartitions; /* number of partitions in following */
2953 + __u32 d_bbsize; /* size of boot area at sn0, bytes */
2954 + __u32 d_sbsize; /* max size of fs superblock, bytes */
2955 + struct bsd_partition { /* the partition table */
2956 + __u32 p_size; /* number of sectors in partition */
2957 + __u32 p_offset; /* starting sector */
2958 + __u32 p_fsize; /* filesystem basic fragment size */
2959 + __u8 p_fstype; /* filesystem type, see below */
2960 + __u8 p_frag; /* filesystem fragments per block */
2961 + __u16 p_cpg; /* filesystem cylinders per group */
2962 + } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
2965 +#endif /* CONFIG_BSD_DISKLABEL */
2967 +#ifdef CONFIG_UNIXWARE_DISKLABEL
2969 + * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl>
2970 + * and Krzysztof G. Baranowski <kgb@knm.org.pl>
2973 +#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */
2974 +#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */
2975 +#define UNIXWARE_NUMSLICE 16
2976 +#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */
2978 +struct unixware_slice {
2979 + __u16 s_label; /* label */
2980 + __u16 s_flags; /* permission flags */
2981 + __u32 start_sect; /* starting sector */
2982 + __u32 nr_sects; /* number of sectors in slice */
2985 +struct unixware_disklabel {
2986 + __u32 d_type; /* drive type */
2987 + __u32 d_magic; /* the magic number */
2988 + __u32 d_version; /* version number */
2989 + char d_serial[12]; /* serial number of the device */
2990 + __u32 d_ncylinders; /* # of data cylinders per device */
2991 + __u32 d_ntracks; /* # of tracks per cylinder */
2992 + __u32 d_nsectors; /* # of data sectors per track */
2993 + __u32 d_secsize; /* # of bytes per sector */
2994 + __u32 d_part_start; /* # of first sector of this partition */
2995 + __u32 d_unknown1[12]; /* ? */
2996 + __u32 d_alt_tbl; /* byte offset of alternate table */
2997 + __u32 d_alt_len; /* byte length of alternate table */
2998 + __u32 d_phys_cyl; /* # of physical cylinders per device */
2999 + __u32 d_phys_trk; /* # of physical tracks per cylinder */
3000 + __u32 d_phys_sec; /* # of physical sectors per track */
3001 + __u32 d_phys_bytes; /* # of physical bytes per sector */
3002 + __u32 d_unknown2; /* ? */
3003 + __u32 d_unknown3; /* ? */
3004 + __u32 d_pad[8]; /* pad */
3006 + struct unixware_vtoc {
3007 + __u32 v_magic; /* the magic number */
3008 + __u32 v_version; /* version number */
3009 + char v_name[8]; /* volume name */
3010 + __u16 v_nslices; /* # of slices */
3011 + __u16 v_unknown1; /* ? */
3012 + __u32 v_reserved[10]; /* reserved */
3013 + struct unixware_slice
3014 + v_slice[UNIXWARE_NUMSLICE]; /* slice headers */
3019 +#endif /* CONFIG_UNIXWARE_DISKLABEL */
3021 +#ifdef CONFIG_MINIX_SUBPARTITION
3022 +# define MINIX_NR_SUBPARTITIONS 4
3023 +#endif /* CONFIG_MINIX_SUBPARTITION */
3027 +char *disk_name (struct gendisk *hd, int minor, char *buf);
3030 + * Account for the completion of an IO request (used by drivers which
3031 + * bypass the normal end_request processing)
3035 +#ifdef CONFIG_BLK_STATS
3036 +extern void disk_round_stats(struct hd_struct *hd);
3037 +extern void req_new_io(struct request *req, int merge, int sectors);
3038 +extern void req_merged_io(struct request *req);
3039 +extern void req_finished_io(struct request *req);
3041 +static inline void req_new_io(struct request *req, int merge, int sectors) { }
3042 +static inline void req_merged_io(struct request *req) { }
3043 +static inline void req_finished_io(struct request *req) { }
3044 +#endif /* CONFIG_BLK_STATS */
3046 +extern void devfs_register_partitions (struct gendisk *dev, int minor,
3052 + * FIXME: this should use genhd->minor_shift, but that is slow to look up.
3054 +static inline unsigned int disk_index (kdev_t dev)
3056 + int major = MAJOR(dev);
3057 + int minor = MINOR(dev);
3058 + unsigned int index;
3061 + case DAC960_MAJOR+0:
3062 + index = (minor & 0x00f8) >> 3;
3064 + case SCSI_DISK0_MAJOR:
3065 + index = (minor & 0x00f0) >> 4;
3067 + case IDE0_MAJOR: /* same as HD_MAJOR */
3068 + case XT_DISK_MAJOR:
3069 + index = (minor & 0x0040) >> 6;
3072 + index = ((minor & 0x0040) >> 6) + 2;
3083 diff -Nur ./kernel-headers/linux/hdreg.h ./kernel-headers/linux/hdreg.h
3084 --- ./kernel-headers/linux/hdreg.h 1970-01-01 01:00:00.000000000 +0100
3085 +++ ./kernel-headers/linux/hdreg.h 2004-07-10 02:59:15.000000000 +0200
3087 +#ifndef _LINUX_HDREG_H
3088 +#define _LINUX_HDREG_H
3091 + * This file contains some defines for the AT-hd-controller.
3092 + * Various sources.
3095 +#define HD_IRQ 14 /* the standard disk interrupt */
3097 +/* ide.c has its own port definitions in "ide.h" */
3099 +/* Hd controller regs. Ref: IBM AT Bios-listing */
3100 +#define HD_DATA 0x1f0 /* _CTL when writing */
3101 +#define HD_ERROR 0x1f1 /* see err-bits */
3102 +#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
3103 +#define HD_SECTOR 0x1f3 /* starting sector */
3104 +#define HD_LCYL 0x1f4 /* starting cylinder */
3105 +#define HD_HCYL 0x1f5 /* high byte of starting cyl */
3106 +#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
3107 +#define HD_STATUS 0x1f7 /* see status-bits */
3108 +#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
3109 +#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
3110 +#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
3112 +#define HD_CMD 0x3f6 /* used for resets */
3113 +#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
3115 +/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
3117 +/* Bits of HD_STATUS */
3118 +#define ERR_STAT 0x01
3119 +#define INDEX_STAT 0x02
3120 +#define ECC_STAT 0x04 /* Corrected error */
3121 +#define DRQ_STAT 0x08
3122 +#define SEEK_STAT 0x10
3123 +#define SRV_STAT 0x10
3124 +#define WRERR_STAT 0x20
3125 +#define READY_STAT 0x40
3126 +#define BUSY_STAT 0x80
3128 +/* Bits for HD_ERROR */
3129 +#define MARK_ERR 0x01 /* Bad address mark */
3130 +#define TRK0_ERR 0x02 /* couldn't find track 0 */
3131 +#define ABRT_ERR 0x04 /* Command aborted */
3132 +#define MCR_ERR 0x08 /* media change request */
3133 +#define ID_ERR 0x10 /* ID field not found */
3134 +#define MC_ERR 0x20 /* media changed */
3135 +#define ECC_ERR 0x40 /* Uncorrectable ECC error */
3136 +#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
3137 +#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
3139 +/* Bits of HD_NSECTOR */
3143 +#define TAG_MASK 0xf8
3147 + * Command Header sizes for IOCTL commands
3148 + * HDIO_DRIVE_CMD, HDIO_DRIVE_TASK, and HDIO_DRIVE_TASKFILE
3152 +#include <asm/hdreg.h>
3153 +typedef ide_ioreg_t task_ioreg_t;
3155 +typedef unsigned char task_ioreg_t;
3158 +typedef unsigned long sata_ioreg_t;
3160 +#define HDIO_DRIVE_CMD_HDR_SIZE 4*sizeof(task_ioreg_t)
3161 +#define HDIO_DRIVE_TASK_HDR_SIZE 8*sizeof(task_ioreg_t)
3162 +#define HDIO_DRIVE_HOB_HDR_SIZE 8*sizeof(task_ioreg_t)
3164 +#define IDE_DRIVE_TASK_INVALID -1
3165 +#define IDE_DRIVE_TASK_NO_DATA 0
3166 +#define IDE_DRIVE_TASK_SET_XFER 1
3168 +#define IDE_DRIVE_TASK_IN 2
3170 +#define IDE_DRIVE_TASK_OUT 3
3171 +#define IDE_DRIVE_TASK_RAW_WRITE 4
3173 +struct hd_drive_cmd_hdr {
3174 + task_ioreg_t command;
3175 + task_ioreg_t sector_number;
3176 + task_ioreg_t feature;
3177 + task_ioreg_t sector_count;
3180 +typedef struct hd_drive_task_hdr {
3181 + task_ioreg_t data;
3182 + task_ioreg_t feature;
3183 + task_ioreg_t sector_count;
3184 + task_ioreg_t sector_number;
3185 + task_ioreg_t low_cylinder;
3186 + task_ioreg_t high_cylinder;
3187 + task_ioreg_t device_head;
3188 + task_ioreg_t command;
3191 +typedef struct hd_drive_hob_hdr {
3192 + task_ioreg_t data;
3193 + task_ioreg_t feature;
3194 + task_ioreg_t sector_count;
3195 + task_ioreg_t sector_number;
3196 + task_ioreg_t low_cylinder;
3197 + task_ioreg_t high_cylinder;
3198 + task_ioreg_t device_head;
3199 + task_ioreg_t control;
3202 +typedef union ide_reg_valid_s {
3203 + unsigned all : 16;
3205 + unsigned data : 1;
3206 + unsigned error_feature : 1;
3207 + unsigned sector : 1;
3208 + unsigned nsector : 1;
3209 + unsigned lcyl : 1;
3210 + unsigned hcyl : 1;
3211 + unsigned select : 1;
3212 + unsigned status_command : 1;
3214 + unsigned data_hob : 1;
3215 + unsigned error_feature_hob : 1;
3216 + unsigned sector_hob : 1;
3217 + unsigned nsector_hob : 1;
3218 + unsigned lcyl_hob : 1;
3219 + unsigned hcyl_hob : 1;
3220 + unsigned select_hob : 1;
3221 + unsigned control_hob : 1;
3226 + * Define standard taskfile in/out register
3228 +#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
3229 +#define IDE_TASKFILE_STD_IN_FLAGS 0xFE
3230 +#define IDE_HOB_STD_OUT_FLAGS 0x3C
3231 +#define IDE_HOB_STD_IN_FLAGS 0x3C
3233 +typedef struct ide_task_request_s {
3234 + task_ioreg_t io_ports[8];
3235 + task_ioreg_t hob_ports[8];
3236 + ide_reg_valid_t out_flags;
3237 + ide_reg_valid_t in_flags;
3240 + unsigned long out_size;
3241 + unsigned long in_size;
3242 +} ide_task_request_t;
3244 +typedef struct ide_ioctl_request_s {
3245 + ide_task_request_t *task_request;
3246 + unsigned char *out_buffer;
3247 + unsigned char *in_buffer;
3248 +} ide_ioctl_request_t;
3250 +#define TASKFILE_INVALID 0x7fff
3251 +#define TASKFILE_48 0x8000
3253 +#define TASKFILE_NO_DATA 0x0000
3255 +#define TASKFILE_IN 0x0001
3256 +#define TASKFILE_MULTI_IN 0x0002
3258 +#define TASKFILE_OUT 0x0004
3259 +#define TASKFILE_MULTI_OUT 0x0008
3260 +#define TASKFILE_IN_OUT 0x0010
3262 +#define TASKFILE_IN_DMA 0x0020
3263 +#define TASKFILE_OUT_DMA 0x0040
3264 +#define TASKFILE_IN_DMAQ 0x0080
3265 +#define TASKFILE_OUT_DMAQ 0x0100
3267 +#define TASKFILE_P_IN 0x0200
3268 +#define TASKFILE_P_OUT 0x0400
3269 +#define TASKFILE_P_IN_DMA 0x0800
3270 +#define TASKFILE_P_OUT_DMA 0x1000
3271 +#define TASKFILE_P_IN_DMAQ 0x2000
3272 +#define TASKFILE_P_OUT_DMAQ 0x4000
3274 +/* ATA/ATAPI Commands pre T13 Spec */
3275 +#define WIN_NOP 0x00
3277 + * 0x01->0x02 Reserved
3279 +#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */
3281 + * 0x04->0x07 Reserved
3283 +#define WIN_SRST 0x08 /* ATAPI soft reset command */
3284 +#define WIN_DEVICE_RESET 0x08
3286 + * 0x09->0x0F Reserved
3288 +#define WIN_RECAL 0x10
3289 +#define WIN_RESTORE WIN_RECAL
3291 + * 0x10->0x1F Reserved
3293 +#define WIN_READ 0x20 /* 28-Bit */
3294 +#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */
3295 +#define WIN_READ_LONG 0x22 /* 28-Bit */
3296 +#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */
3297 +#define WIN_READ_EXT 0x24 /* 48-Bit */
3298 +#define WIN_READDMA_EXT 0x25 /* 48-Bit */
3299 +#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */
3300 +#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */
3304 +#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */
3306 + * 0x2A->0x2F Reserved
3308 +#define WIN_WRITE 0x30 /* 28-Bit */
3309 +#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */
3310 +#define WIN_WRITE_LONG 0x32 /* 28-Bit */
3311 +#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */
3312 +#define WIN_WRITE_EXT 0x34 /* 48-Bit */
3313 +#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */
3314 +#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */
3315 +#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */
3316 +#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */
3317 +#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */
3319 + * 0x3A->0x3B Reserved
3321 +#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */
3323 + * 0x3D->0x3F Reserved
3325 +#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */
3326 +#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */
3327 +#define WIN_VERIFY_EXT 0x42 /* 48-Bit */
3329 + * 0x43->0x4F Reserved
3331 +#define WIN_FORMAT 0x50
3333 + * 0x51->0x5F Reserved
3335 +#define WIN_INIT 0x60
3337 + * 0x61->0x5F Reserved
3339 +#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */
3340 +#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */
3341 +#define WIN_DIAGNOSE 0x90
3342 +#define WIN_SPECIFY 0x91 /* set drive geometry translation */
3343 +#define WIN_DOWNLOAD_MICROCODE 0x92
3344 +#define WIN_STANDBYNOW2 0x94
3345 +#define WIN_STANDBY2 0x96
3346 +#define WIN_SETIDLE2 0x97
3347 +#define WIN_CHECKPOWERMODE2 0x98
3348 +#define WIN_SLEEPNOW2 0x99
3352 +#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
3353 +#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
3354 +#define WIN_QUEUED_SERVICE 0xA2
3355 +#define WIN_SMART 0xB0 /* self-monitoring and reporting */
3356 +#define CFA_ERASE_SECTORS 0xC0
3357 +#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/
3358 +#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
3359 +#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
3360 +#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
3361 +#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
3362 +#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */
3363 +#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
3364 +#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */
3365 +#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
3366 +#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */
3367 +#define WIN_GETMEDIASTATUS 0xDA
3368 +#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */
3369 +#define WIN_POSTBOOT 0xDC
3370 +#define WIN_PREBOOT 0xDD
3371 +#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
3372 +#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
3373 +#define WIN_STANDBYNOW1 0xE0
3374 +#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
3375 +#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */
3376 +#define WIN_SETIDLE1 0xE3
3377 +#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
3378 +#define WIN_CHECKPOWERMODE1 0xE5
3379 +#define WIN_SLEEPNOW1 0xE6
3380 +#define WIN_FLUSH_CACHE 0xE7
3381 +#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
3382 +#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */
3383 + /* SET_FEATURES 0x22 or 0xDD */
3384 +#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */
3385 +#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
3386 +#define WIN_MEDIAEJECT 0xED
3387 +#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
3388 +#define WIN_SETFEATURES 0xEF /* set special drive features */
3389 +#define EXABYTE_ENABLE_NEST 0xF0
3390 +#define WIN_SECURITY_SET_PASS 0xF1
3391 +#define WIN_SECURITY_UNLOCK 0xF2
3392 +#define WIN_SECURITY_ERASE_PREPARE 0xF3
3393 +#define WIN_SECURITY_ERASE_UNIT 0xF4
3394 +#define WIN_SECURITY_FREEZE_LOCK 0xF5
3395 +#define WIN_SECURITY_DISABLE 0xF6
3396 +#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */
3397 +#define WIN_SET_MAX 0xF9
3398 +#define DISABLE_SEAGATE 0xFB
3400 +/* WIN_SMART sub-commands */
3402 +#define SMART_READ_VALUES 0xD0
3403 +#define SMART_READ_THRESHOLDS 0xD1
3404 +#define SMART_AUTOSAVE 0xD2
3405 +#define SMART_SAVE 0xD3
3406 +#define SMART_IMMEDIATE_OFFLINE 0xD4
3407 +#define SMART_READ_LOG_SECTOR 0xD5
3408 +#define SMART_WRITE_LOG_SECTOR 0xD6
3409 +#define SMART_WRITE_THRESHOLDS 0xD7
3410 +#define SMART_ENABLE 0xD8
3411 +#define SMART_DISABLE 0xD9
3412 +#define SMART_STATUS 0xDA
3413 +#define SMART_AUTO_OFFLINE 0xDB
3415 +/* Password used in TF4 & TF5 executing SMART commands */
3417 +#define SMART_LCYL_PASS 0x4F
3418 +#define SMART_HCYL_PASS 0xC2
3420 +/* WIN_SETFEATURES sub-commands */
3421 +#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */
3422 +#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
3423 +#define SETFEATURES_XFER 0x03 /* Set transfer mode */
3424 +# define XFER_UDMA_7 0x47 /* 0100|0111 */
3425 +# define XFER_UDMA_6 0x46 /* 0100|0110 */
3426 +# define XFER_UDMA_5 0x45 /* 0100|0101 */
3427 +# define XFER_UDMA_4 0x44 /* 0100|0100 */
3428 +# define XFER_UDMA_3 0x43 /* 0100|0011 */
3429 +# define XFER_UDMA_2 0x42 /* 0100|0010 */
3430 +# define XFER_UDMA_1 0x41 /* 0100|0001 */
3431 +# define XFER_UDMA_0 0x40 /* 0100|0000 */
3432 +# define XFER_MW_DMA_2 0x22 /* 0010|0010 */
3433 +# define XFER_MW_DMA_1 0x21 /* 0010|0001 */
3434 +# define XFER_MW_DMA_0 0x20 /* 0010|0000 */
3435 +# define XFER_SW_DMA_2 0x12 /* 0001|0010 */
3436 +# define XFER_SW_DMA_1 0x11 /* 0001|0001 */
3437 +# define XFER_SW_DMA_0 0x10 /* 0001|0000 */
3438 +# define XFER_PIO_4 0x0C /* 0000|1100 */
3439 +# define XFER_PIO_3 0x0B /* 0000|1011 */
3440 +# define XFER_PIO_2 0x0A /* 0000|1010 */
3441 +# define XFER_PIO_1 0x09 /* 0000|1001 */
3442 +# define XFER_PIO_0 0x08 /* 0000|1000 */
3443 +# define XFER_PIO_SLOW 0x00 /* 0000|0000 */
3444 +#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
3445 +#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */
3446 +#define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */
3447 +#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */
3448 +#define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */
3449 +#define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */
3450 +#define SETFEATURES_RW_LONG 0x44 /* Set Lenght of VS bytes */
3451 +#define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */
3452 +#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */
3453 +#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */
3454 +#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */
3455 +#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */
3456 +#define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */
3457 +#define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */
3458 +#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */
3459 +#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */
3460 +#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */
3461 +#define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */
3462 +#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */
3463 +#define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */
3464 +#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
3465 +#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
3466 +#define SETFEATURES_EN_REST 0xAC /* ATA-1 */
3467 +#define SETFEATURES_4B_RW_LONG 0xBB /* Set Lenght of 4 bytes */
3468 +#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */
3469 +#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
3470 +#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
3471 +#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */
3472 +#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */
3474 +/* WIN_SECURITY sub-commands */
3476 +#define SECURITY_SET_PASSWORD 0xBA
3477 +#define SECURITY_UNLOCK 0xBB
3478 +#define SECURITY_ERASE_PREPARE 0xBC
3479 +#define SECURITY_ERASE_UNIT 0xBD
3480 +#define SECURITY_FREEZE_LOCK 0xBE
3481 +#define SECURITY_DISABLE_PASSWORD 0xBF
3483 +struct hd_geometry {
3484 + unsigned char heads;
3485 + unsigned char sectors;
3486 + unsigned short cylinders;
3487 + unsigned long start;
3491 +struct hd_big_geometry {
3492 + unsigned char heads;
3493 + unsigned char sectors;
3494 + unsigned int cylinders;
3495 + unsigned long start;
3498 +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
3499 +#define HDIO_GETGEO 0x0301 /* get device geometry */
3500 +#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
3501 +#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
3502 +#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */
3504 +#define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */
3506 +#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
3507 +#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
3508 +#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
3509 +#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
3510 +#define HDIO_GET_DMA 0x030b /* get use-dma flag */
3511 +#define HDIO_GET_NICE 0x030c /* get nice flags */
3512 +#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
3513 +#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */
3514 +#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */
3515 +#define HDIO_GET_ADDRESS 0x0310 /* */
3517 +#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */
3518 +#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */
3519 +#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */
3520 +#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */
3521 +#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
3522 +#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
3524 +#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
3526 +/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
3527 +#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
3528 +#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
3529 +#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
3530 +#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
3531 +#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
3532 +#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
3533 +#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
3534 +#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
3535 +#define HDIO_SET_NICE 0x0329 /* set nice flags */
3536 +#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
3537 +#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
3538 +#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
3539 +#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
3540 +#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */
3541 +#define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */
3550 +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
3551 +#define HDIO_GETGEO_BIG 0x0330 /* */
3552 +#define HDIO_GETGEO_BIG_RAW 0x0331 /* */
3554 +#define HDIO_SET_IDE_SCSI 0x0338
3555 +#define HDIO_SET_SCSI_IDE 0x0339
3557 +#define __NEW_HD_DRIVE_ID
3558 +/* structure returned by HDIO_GET_IDENTITY,
3559 + * as per ANSI NCITS ATA6 rev.1b spec
3561 +struct hd_driveid {
3562 + unsigned short config; /* lots of obsolete bit flags */
3563 + unsigned short cyls; /* Obsolete, "physical" cyls */
3564 + unsigned short reserved2; /* reserved (word 2) */
3565 + unsigned short heads; /* Obsolete, "physical" heads */
3566 + unsigned short track_bytes; /* unformatted bytes per track */
3567 + unsigned short sector_bytes; /* unformatted bytes per sector */
3568 + unsigned short sectors; /* Obsolete, "physical" sectors per track */
3569 + unsigned short vendor0; /* vendor unique */
3570 + unsigned short vendor1; /* vendor unique */
3571 + unsigned short vendor2; /* Retired vendor unique */
3572 + unsigned char serial_no[20]; /* 0 = not_specified */
3573 + unsigned short buf_type; /* Retired */
3574 + unsigned short buf_size; /* Retired, 512 byte increments
3575 + * 0 = not_specified
3577 + unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */
3578 + unsigned char fw_rev[8]; /* 0 = not_specified */
3579 + unsigned char model[40]; /* 0 = not_specified */
3580 + unsigned char max_multsect; /* 0=not_implemented */
3581 + unsigned char vendor3; /* vendor unique */
3582 + unsigned short dword_io; /* 0=not_implemented; 1=implemented */
3583 + unsigned char vendor4; /* vendor unique */
3584 + unsigned char capability; /* (upper byte of word 49)
3590 + unsigned short reserved50; /* reserved (word 50) */
3591 + unsigned char vendor5; /* Obsolete, vendor unique */
3592 + unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */
3593 + unsigned char vendor6; /* Obsolete, vendor unique */
3594 + unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */
3595 + unsigned short field_valid; /* (word 53)
3596 + * 2: ultra_ok word 88
3597 + * 1: eide_ok words 64-70
3598 + * 0: cur_ok words 54-58
3600 + unsigned short cur_cyls; /* Obsolete, logical cylinders */
3601 + unsigned short cur_heads; /* Obsolete, l heads */
3602 + unsigned short cur_sectors; /* Obsolete, l sectors per track */
3603 + unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */
3604 + unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */
3605 + unsigned char multsect; /* current multiple sector count */
3606 + unsigned char multsect_valid; /* when (bit0==1) multsect is ok */
3607 + unsigned int lba_capacity; /* Obsolete, total number of sectors */
3608 + unsigned short dma_1word; /* Obsolete, single-word dma info */
3609 + unsigned short dma_mword; /* multiple-word dma info */
3610 + unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */
3611 + unsigned short eide_dma_min; /* min mword dma cycle time (ns) */
3612 + unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
3613 + unsigned short eide_pio; /* min cycle time (ns), no IORDY */
3614 + unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
3615 + unsigned short words69_70[2]; /* reserved words 69-70
3616 + * future command overlap and queuing
3618 + /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
3619 + unsigned short words71_74[4]; /* reserved words 71-74
3620 + * for IDENTIFY PACKET DEVICE command
3622 + unsigned short queue_depth; /* (word 75)
3624 + * 4:0 Maximum queue depth -1
3626 + unsigned short words76_79[4]; /* reserved words 76-79 */
3627 + unsigned short major_rev_num; /* (word 80) */
3628 + unsigned short minor_rev_num; /* (word 81) */
3629 + unsigned short command_set_1; /* (word 82) supported
3633 + * 12: WRITE_BUFFER
3635 + * 10: Host Protected Area
3637 + * 8: SERVICE Interrupt
3638 + * 7: Release Interrupt
3641 + * 4: PACKET Command
3642 + * 3: Power Management Feature Set
3643 + * 2: Removable Feature Set
3644 + * 1: Security Feature Set
3645 + * 0: SMART Feature Set
3647 + unsigned short command_set_2; /* (word 83)
3648 + * 15: Shall be ZERO
3649 + * 14: Shall be ONE
3650 + * 13: FLUSH CACHE EXT
3652 + * 11: Device Configuration Overlay
3653 + * 10: 48-bit Address Feature Set
3654 + * 9: Automatic Acoustic Management
3655 + * 8: SET MAX security
3656 + * 7: reserved 1407DT PARTIES
3657 + * 6: SetF sub-command Power-Up
3658 + * 5: Power-Up in Standby Feature Set
3659 + * 4: Removable Media Notification
3660 + * 3: APM Feature Set
3661 + * 2: CFA Feature Set
3662 + * 1: READ/WRITE DMA QUEUED
3663 + * 0: Download MicroCode
3665 + unsigned short cfsse; /* (word 84)
3666 + * cmd set-feature supported extensions
3667 + * 15: Shall be ZERO
3668 + * 14: Shall be ONE
3670 + * 5: General Purpose Logging
3671 + * 4: Streaming Feature Set
3672 + * 3: Media Card Pass Through
3673 + * 2: Media Serial Number Valid
3674 + * 1: SMART selt-test supported
3675 + * 0: SMART error logging
3677 + unsigned short cfs_enable_1; /* (word 85)
3678 + * command set-feature enabled
3682 + * 12: WRITE_BUFFER
3684 + * 10: Host Protected Area
3686 + * 8: SERVICE Interrupt
3687 + * 7: Release Interrupt
3690 + * 4: PACKET Command
3691 + * 3: Power Management Feature Set
3692 + * 2: Removable Feature Set
3693 + * 1: Security Feature Set
3694 + * 0: SMART Feature Set
3696 + unsigned short cfs_enable_2; /* (word 86)
3697 + * command set-feature enabled
3698 + * 15: Shall be ZERO
3699 + * 14: Shall be ONE
3700 + * 13: FLUSH CACHE EXT
3702 + * 11: Device Configuration Overlay
3703 + * 10: 48-bit Address Feature Set
3704 + * 9: Automatic Acoustic Management
3705 + * 8: SET MAX security
3706 + * 7: reserved 1407DT PARTIES
3707 + * 6: SetF sub-command Power-Up
3708 + * 5: Power-Up in Standby Feature Set
3709 + * 4: Removable Media Notification
3710 + * 3: APM Feature Set
3711 + * 2: CFA Feature Set
3712 + * 1: READ/WRITE DMA QUEUED
3713 + * 0: Download MicroCode
3715 + unsigned short csf_default; /* (word 87)
3716 + * command set-feature default
3717 + * 15: Shall be ZERO
3718 + * 14: Shall be ONE
3720 + * 5: General Purpose Logging enabled
3721 + * 4: Valid CONFIGURE STREAM executed
3722 + * 3: Media Card Pass Through enabled
3723 + * 2: Media Serial Number Valid
3724 + * 1: SMART selt-test supported
3725 + * 0: SMART error logging
3727 + unsigned short dma_ultra; /* (word 88) */
3728 + unsigned short trseuc; /* time required for security erase */
3729 + unsigned short trsEuc; /* time required for enhanced erase */
3730 + unsigned short CurAPMvalues; /* current APM values */
3731 + unsigned short mprc; /* master password revision code */
3732 + unsigned short hw_config; /* hardware config (word 93)
3733 + * 15: Shall be ZERO
3734 + * 14: Shall be ONE
3750 + unsigned short acoustic; /* (word 94)
3751 + * 15:8 Vendor's recommended value
3752 + * 7:0 current value
3754 + unsigned short msrqs; /* min stream request size */
3755 + unsigned short sxfert; /* stream transfer time */
3756 + unsigned short sal; /* stream access latency */
3757 + unsigned int spg; /* stream performance granularity */
3758 + unsigned long long lba_capacity_2;/* 48-bit total number of sectors */
3759 + unsigned short words104_125[22];/* reserved words 104-125 */
3760 + unsigned short last_lun; /* (word 126) */
3761 + unsigned short word127; /* (word 127) Feature Set
3762 + * Removable Media Notification
3764 + * 1:0 00 = not supported
3769 + unsigned short dlf; /* (word 128)
3770 + * device lock function
3772 + * 8 security level 1:max 0:high
3774 + * 5 enhanced erase
3781 + unsigned short csfo; /* (word 129)
3782 + * current set features options
3784 + * 3: auto reassign
3786 + * 1: read-look-ahead
3789 + unsigned short words130_155[26];/* reserved vendor words 130-155 */
3790 + unsigned short word156; /* reserved vendor word 156 */
3791 + unsigned short words157_159[3];/* reserved vendor words 157-159 */
3792 + unsigned short cfa_power; /* (word 160) CFA Power Mode
3793 + * 15 word 160 supported
3799 + unsigned short words161_175[15];/* Reserved for CFA */
3800 + unsigned short words176_205[30];/* Current Media Serial Number */
3801 + unsigned short words206_254[49];/* reserved words 206-254 */
3802 + unsigned short integrity_word; /* (word 255)
3809 + * IDE "nice" flags. These are used on a per drive basis to determine
3810 + * when to be nice and give more bandwidth to the other devices which
3811 + * share the same IDE bus.
3813 +#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
3814 +#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
3815 +#define IDE_NICE_0 (2) /* when sure that it won't affect us */
3816 +#define IDE_NICE_1 (3) /* when probably won't affect us much */
3817 +#define IDE_NICE_2 (4) /* when we know it's on our expense */
3821 + * These routines are used for kernel command line parameters from main.c:
3823 +#include <linux/config.h>
3825 +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
3826 +int ide_register(int io_port, int ctl_port, int irq);
3827 +int ide_unregister(unsigned int);
3828 +#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
3830 +#endif /* __KERNEL__ */
3832 +#endif /* _LINUX_HDREG_H */
3833 diff -Nur ./kernel-headers/linux/ioctl.h ./kernel-headers/linux/ioctl.h
3834 --- ./kernel-headers/linux/ioctl.h 1970-01-01 01:00:00.000000000 +0100
3835 +++ ./kernel-headers/linux/ioctl.h 2004-07-10 02:59:15.000000000 +0200
3837 +#ifndef _LINUX_IOCTL_H
3838 +#define _LINUX_IOCTL_H
3840 +#include <asm/ioctl.h>
3842 +#endif /* _LINUX_IOCTL_H */
3844 diff -Nur ./kernel-headers/linux/lvm.h ./kernel-headers/linux/lvm.h
3845 --- ./kernel-headers/linux/lvm.h 1970-01-01 01:00:00.000000000 +0100
3846 +++ ./kernel-headers/linux/lvm.h 2004-07-10 02:59:15.000000000 +0200
3849 + * include/linux/lvm.h
3853 + * Copyright (C) 1997 - 2002 Heinz Mauelshagen, Sistina Software
3855 + * February-November 1997
3857 + * January-March,July,September,October,Dezember 1999
3858 + * January,February,July,November 2000
3859 + * January-March,June,July 2001
3862 + * lvm is free software; you can redistribute it and/or modify
3863 + * it under the terms of the GNU General Public License as published by
3864 + * the Free Software Foundation; either version 2, or (at your option)
3865 + * any later version.
3867 + * lvm is distributed in the hope that it will be useful,
3868 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3869 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3870 + * GNU General Public License for more details.
3872 + * You should have received a copy of the GNU General Public License
3873 + * along with GNU CC; see the file COPYING. If not, write to
3874 + * the Free Software Foundation, 59 Temple Place - Suite 330,
3875 + * Boston, MA 02111-1307, USA.
3882 + * 10/10/1997 - beginning of new structure creation
3883 + * 12/05/1998 - incorporated structures from lvm_v1.h and deleted lvm_v1.h
3884 + * 07/06/1998 - avoided LVM_KMALLOC_MAX define by using vmalloc/vfree
3885 + * instead of kmalloc/kfree
3886 + * 01/07/1998 - fixed wrong LVM_MAX_SIZE
3887 + * 07/07/1998 - extended pe_t structure by ios member (for statistic)
3888 + * 02/08/1998 - changes for official char/block major numbers
3889 + * 07/08/1998 - avoided init_module() and cleanup_module() to be static
3890 + * 29/08/1998 - seprated core and disk structure type definitions
3891 + * 01/09/1998 - merged kernel integration version (mike)
3892 + * 20/01/1999 - added LVM_PE_DISK_OFFSET macro for use in
3893 + * vg_read_with_pv_and_lv(), pv_move_pe(), pv_show_pe_text()...
3894 + * 18/02/1999 - added definition of time_disk_t structure for;
3895 + * keeps time stamps on disk for nonatomic writes (future)
3896 + * 15/03/1999 - corrected LV() and VG() macro definition to use argument
3897 + * instead of minor
3898 + * 03/07/1999 - define for genhd.c name handling
3899 + * 23/07/1999 - implemented snapshot part
3900 + * 08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit
3901 + * 01/01/2000 - extended lv_v2 core structure by wait_queue member
3902 + * 12/02/2000 - integrated Andrea Arcagnelli's snapshot work
3903 + * 18/02/2000 - seperated user and kernel space parts by
3904 + * #ifdef them with __KERNEL__
3905 + * 08/03/2000 - implemented cluster/shared bits for vg_access
3906 + * 26/06/2000 - implemented snapshot persistency and resizing support
3907 + * 02/11/2000 - added hash table size member to lv structure
3908 + * 12/11/2000 - removed unneeded timestamp definitions
3909 + * 24/12/2000 - removed LVM_TO_{CORE,DISK}*, use cpu_{from, to}_le*
3910 + * instead - Christoph Hellwig
3911 + * 22/01/2001 - Change ulong to uint32_t
3912 + * 14/02/2001 - changed LVM_SNAPSHOT_MIN_CHUNK to 1 page
3913 + * 20/02/2001 - incremented IOP version to 11 because of incompatible
3914 + * change in VG activation (in order to support devfs better)
3915 + * 01/03/2001 - Revert to IOP10 and add VG_CREATE_OLD call for compatibility
3916 + * 08/03/2001 - new lv_t (in core) version number 5: changed page member
3917 + * to (struct kiobuf *) to use for COW exception table io
3918 + * 26/03/2001 - changed lv_v4 to lv_v5 in structure definition (HM)
3919 + * 21/06/2001 - changed BLOCK_SIZE back to 1024 for non S/390
3920 + * 22/06/2001 - added Andreas Dilger's PE on 4k boundary alignment enhancements
3921 + * 19/07/2001 - added rwsem compatibility macros for 2.2 kernels
3922 + * 13/11/2001 - reduced userspace inclusion of kernel headers to a minimum
3927 +#ifndef _LVM_H_INCLUDE
3928 +#define _LVM_H_INCLUDE
3930 +#define LVM_RELEASE_NAME "1.0.5+"
3931 +#define LVM_RELEASE_DATE "22/07/2002"
3933 +#define _LVM_KERNEL_H_VERSION "LVM "LVM_RELEASE_NAME" ("LVM_RELEASE_DATE")"
3935 +#include <linux/version.h>
3938 + * preprocessor definitions
3940 +/* if you like emergency reset code in the driver */
3941 +#define LVM_TOTAL_RESET
3944 +#undef LVM_HD_NAME /* display nice names in /proc/partitions */
3946 +/* lots of debugging output (see driver source)
3947 + #define DEBUG_LVM_GET_INFO
3950 + #define DEBUG_MAP_SIZE
3951 + #define DEBUG_IOCTL
3952 + #define DEBUG_READ
3953 + #define DEBUG_GENDISK
3954 + #define DEBUG_VG_CREATE
3955 + #define DEBUG_DEVICE
3956 + #define DEBUG_KFREE
3959 +#include <linux/kdev_t.h>
3960 +#include <linux/list.h>
3961 +#include <asm/types.h>
3962 +#include <linux/major.h>
3964 +/* This prevents the need to include <linux/list.h> which
3965 + causes problems on some platforms. It's not nice but then
3966 + neither is the alternative. */
3968 + struct list_head *next, *prev;
3971 +#include <linux/kdev_t.h>
3973 +#endif /* #ifndef __KERNEL__ */
3977 +#include <linux/spinlock.h>
3979 +#include <asm/semaphore.h>
3980 +#endif /* #ifdef __KERNEL__ */
3983 +#include <asm/page.h>
3985 +#if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR)
3986 +#error Bad include/linux/major.h - LVM MAJOR undefined
3993 +#ifdef CONFIG_ARCH_S390
3994 +#define BLOCK_SIZE 4096
3996 +#define BLOCK_SIZE 1024
3999 +#ifndef SECTOR_SIZE
4000 +#define SECTOR_SIZE 512
4003 +/* structure version */
4004 +#define LVM_STRUCT_VERSION 1
4006 +#define LVM_DIR_PREFIX "/dev/"
4009 + * i/o protocol version
4011 + * defined here for the driver and defined seperate in the
4012 + * user land tools/lib/liblvm.h
4015 +#define LVM_DRIVER_IOP_VERSION 10
4017 +#define LVM_NAME "lvm"
4018 +#define LVM_GLOBAL "global"
4019 +#define LVM_DIR "lvm"
4020 +#define LVM_VG_SUBDIR "VGs"
4021 +#define LVM_LV_SUBDIR "LVs"
4022 +#define LVM_PV_SUBDIR "PVs"
4025 + * VG/LV indexing macros
4027 +/* character minor maps directly to volume group */
4028 +#define VG_CHR(a) ( a)
4030 +/* block minor indexes into a volume group/logical volume indirection table */
4031 +#define VG_BLK(a) ( vg_lv_map[a].vg_number)
4032 +#define LV_BLK(a) ( vg_lv_map[a].lv_number)
4035 + * absolute limits for VGs, PVs per VG and LVs per VG
4037 +#define ABS_MAX_VG 99
4038 +#define ABS_MAX_PV 256
4039 +#define ABS_MAX_LV 256 /* caused by 8 bit minor */
4041 +#define MAX_VG ABS_MAX_VG
4042 +#define MAX_LV ABS_MAX_LV
4043 +#define MAX_PV ABS_MAX_PV
4045 +#if ( MAX_VG > ABS_MAX_VG)
4047 +#define MAX_VG ABS_MAX_VG
4050 +#if ( MAX_LV > ABS_MAX_LV)
4052 +#define MAX_LV ABS_MAX_LV
4057 + * VGDA: default disk spaces and offsets
4059 + * there's space after the structures for later extensions.
4061 + * offset what size
4062 + * --------------- ---------------------------------- ------------
4063 + * 0 physical volume structure ~500 byte
4065 + * 1K volume group structure ~200 byte
4067 + * 6K namelist of physical volumes 128 byte each
4069 + * 6k + n * ~300byte n logical volume structures ~300 byte each
4071 + * + m * 4byte m physical extent alloc. structs 4 byte each
4073 + * End of disk - first physical extent typically 4 megabyte
4080 +/* DONT TOUCH THESE !!! */
4089 + * LVM_PE_T_MAX corresponds to:
4091 + * 8KB PE size can map a ~512 MB logical volume at the cost of 1MB memory,
4093 + * 128MB PE size can map a 8TB logical volume at the same cost of memory.
4095 + * Default PE size of 4 MB gives a maximum logical volume size of 256 GB.
4097 + * Maximum PE size of 16GB gives a maximum logical volume size of 1024 TB.
4099 + * AFAIK, the actual kernels limit this to 1 TB.
4101 + * Should be a sufficient spectrum ;*)
4104 +/* This is the usable size of pe_disk_t.le_num !!! v v */
4105 +#define LVM_PE_T_MAX ( ( 1 << ( sizeof ( uint16_t) * 8)) - 2)
4107 +#define LVM_LV_SIZE_MAX(a) ( ( long long) LVM_PE_T_MAX * (a)->pe_size > ( long long) 1024*1024/SECTOR_SIZE*1024*1024 ? ( long long) 1024*1024/SECTOR_SIZE*1024*1024 : ( long long) LVM_PE_T_MAX * (a)->pe_size)
4108 +#define LVM_MIN_PE_SIZE ( 8192L / SECTOR_SIZE) /* 8 KB in sectors */
4109 +#define LVM_MAX_PE_SIZE ( 16L * 1024L * 1024L / SECTOR_SIZE * 1024) /* 16GB in sectors */
4110 +#define LVM_DEFAULT_PE_SIZE ( 4096L * 1024 / SECTOR_SIZE) /* 4 MB in sectors */
4111 +#define LVM_DEFAULT_STRIPE_SIZE 16L /* 16 KB */
4112 +#define LVM_MIN_STRIPE_SIZE ( PAGE_SIZE/SECTOR_SIZE) /* PAGESIZE in sectors */
4113 +#define LVM_MAX_STRIPE_SIZE ( 512L * 1024 / SECTOR_SIZE) /* 512 KB in sectors */
4114 +#define LVM_MAX_STRIPES 128 /* max # of stripes */
4115 +#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024) /* 1TB[sectors] */
4116 +#define LVM_MAX_MIRRORS 2 /* future use */
4117 +#define LVM_MIN_READ_AHEAD 0 /* minimum read ahead sectors */
4118 +#define LVM_DEFAULT_READ_AHEAD 1024 /* sectors for 512k scsi segments */
4119 +#define LVM_MAX_READ_AHEAD 1024 /* maximum read ahead sectors */
4120 +#define LVM_MAX_LV_IO_TIMEOUT 60 /* seconds I/O timeout (future use) */
4121 +#define LVM_PARTITION 0xfe /* LVM partition id */
4122 +#define LVM_NEW_PARTITION 0x8e /* new LVM partition id (10/09/1999) */
4123 +#define LVM_PE_SIZE_PV_SIZE_REL 5 /* max relation PV size and PE size */
4125 +#define LVM_SNAPSHOT_MAX_CHUNK 1024 /* 1024 KB */
4126 +#define LVM_SNAPSHOT_DEF_CHUNK 64 /* 64 KB */
4127 +#define LVM_SNAPSHOT_MIN_CHUNK (PAGE_SIZE/1024) /* 4 or 8 KB */
4133 + * FIXME: the last parameter to _IO{W,R,WR} is a data type. The macro will
4134 + * expand this using sizeof(), so putting "1" there is misleading
4135 + * because sizeof(1) = sizeof(int) = sizeof(2) = 4 on a 32-bit machine!
4138 +#define VG_CREATE_OLD _IOW ( 0xfe, 0x00, 1)
4139 +#define VG_REMOVE _IOW ( 0xfe, 0x01, 1)
4141 +#define VG_EXTEND _IOW ( 0xfe, 0x03, 1)
4142 +#define VG_REDUCE _IOW ( 0xfe, 0x04, 1)
4144 +#define VG_STATUS _IOWR ( 0xfe, 0x05, 1)
4145 +#define VG_STATUS_GET_COUNT _IOWR ( 0xfe, 0x06, 1)
4146 +#define VG_STATUS_GET_NAMELIST _IOWR ( 0xfe, 0x07, 1)
4148 +#define VG_SET_EXTENDABLE _IOW ( 0xfe, 0x08, 1)
4149 +#define VG_RENAME _IOW ( 0xfe, 0x09, 1)
4151 +/* Since 0.9beta6 */
4152 +#define VG_CREATE _IOW ( 0xfe, 0x0a, 1)
4154 +/* logical volume */
4155 +#define LV_CREATE _IOW ( 0xfe, 0x20, 1)
4156 +#define LV_REMOVE _IOW ( 0xfe, 0x21, 1)
4158 +#define LV_ACTIVATE _IO ( 0xfe, 0x22)
4159 +#define LV_DEACTIVATE _IO ( 0xfe, 0x23)
4161 +#define LV_EXTEND _IOW ( 0xfe, 0x24, 1)
4162 +#define LV_REDUCE _IOW ( 0xfe, 0x25, 1)
4164 +#define LV_STATUS_BYNAME _IOWR ( 0xfe, 0x26, 1)
4165 +#define LV_STATUS_BYINDEX _IOWR ( 0xfe, 0x27, 1)
4167 +#define LV_SET_ACCESS _IOW ( 0xfe, 0x28, 1)
4168 +#define LV_SET_ALLOCATION _IOW ( 0xfe, 0x29, 1)
4169 +#define LV_SET_STATUS _IOW ( 0xfe, 0x2a, 1)
4171 +#define LE_REMAP _IOW ( 0xfe, 0x2b, 1)
4173 +#define LV_SNAPSHOT_USE_RATE _IOWR ( 0xfe, 0x2c, 1)
4175 +#define LV_STATUS_BYDEV _IOWR ( 0xfe, 0x2e, 1)
4177 +#define LV_RENAME _IOW ( 0xfe, 0x2f, 1)
4179 +#define LV_BMAP _IOWR ( 0xfe, 0x30, 1)
4182 +/* physical volume */
4183 +#define PV_STATUS _IOWR ( 0xfe, 0x40, 1)
4184 +#define PV_CHANGE _IOWR ( 0xfe, 0x41, 1)
4185 +#define PV_FLUSH _IOW ( 0xfe, 0x42, 1)
4187 +/* physical extent */
4188 +#define PE_LOCK_UNLOCK _IOW ( 0xfe, 0x50, 1)
4190 +/* i/o protocol version */
4191 +#define LVM_GET_IOP_VERSION _IOR ( 0xfe, 0x98, 1)
4193 +#ifdef LVM_TOTAL_RESET
4194 +/* special reset function for testing purposes */
4195 +#define LVM_RESET _IO ( 0xfe, 0x99)
4198 +/* lock the logical volume manager */
4199 +#if LVM_DRIVER_IOP_VERSION > 11
4200 +#define LVM_LOCK_LVM _IO ( 0xfe, 0x9A)
4202 +/* This is actually the same as _IO ( 0xff, 0x00), oops. Remove for IOP 12+ */
4203 +#define LVM_LOCK_LVM _IO ( 0xfe, 0x100)
4212 +#define VG_ACTIVE 0x01 /* vg_status */
4213 +#define VG_EXPORTED 0x02 /* " */
4214 +#define VG_EXTENDABLE 0x04 /* " */
4216 +#define VG_READ 0x01 /* vg_access */
4217 +#define VG_WRITE 0x02 /* " */
4218 +#define VG_CLUSTERED 0x04 /* " */
4219 +#define VG_SHARED 0x08 /* " */
4221 +/* logical volume */
4222 +#define LV_ACTIVE 0x01 /* lv_status */
4223 +#define LV_SPINDOWN 0x02 /* " */
4225 +#define LV_READ 0x01 /* lv_access */
4226 +#define LV_WRITE 0x02 /* " */
4227 +#define LV_SNAPSHOT 0x04 /* " */
4228 +#define LV_SNAPSHOT_ORG 0x08 /* " */
4230 +#define LV_BADBLOCK_ON 0x01 /* lv_badblock */
4232 +#define LV_STRICT 0x01 /* lv_allocation */
4233 +#define LV_CONTIGUOUS 0x02 /* " */
4235 +/* physical volume */
4236 +#define PV_ACTIVE 0x01 /* pv_status */
4237 +#define PV_ALLOCATABLE 0x02 /* pv_allocatable */
4241 +#define LVM_SNAPSHOT_DROPPED_SECTOR 1
4244 + * Structure definitions core/disk follow
4246 + * conditional conversion takes place on big endian architectures
4247 + * in functions * pv_copy_*(), vg_copy_*() and lv_copy_*()
4251 +#define NAME_LEN 128 /* don't change!!! */
4252 +#define UUID_LEN 32 /* don't change!!! */
4254 +/* copy on write tables in disk format */
4255 +typedef struct lv_COW_table_disk_v1 {
4256 + uint64_t pv_org_number;
4257 + uint64_t pv_org_rsector;
4258 + uint64_t pv_snap_number;
4259 + uint64_t pv_snap_rsector;
4260 +} lv_COW_table_disk_t;
4262 +/* remap physical sector/rdev pairs including hash */
4263 +typedef struct lv_block_exception_v1 {
4264 + struct list_head hash;
4265 + uint32_t rsector_org;
4267 + uint32_t rsector_new;
4269 +} lv_block_exception_t;
4271 +/* disk stored pe information */
4277 +/* disk stored PV, VG, LV and PE size and offset information */
4285 + * physical volume structures
4289 +typedef struct pv_v2 {
4290 + char id[2]; /* Identifier */
4291 + unsigned short version; /* HM lvm version */
4292 + lvm_disk_data_t pv_on_disk;
4293 + lvm_disk_data_t vg_on_disk;
4294 + lvm_disk_data_t pv_uuidlist_on_disk;
4295 + lvm_disk_data_t lv_on_disk;
4296 + lvm_disk_data_t pe_on_disk;
4297 + char pv_name[NAME_LEN];
4298 + char vg_name[NAME_LEN];
4299 + char system_id[NAME_LEN]; /* for vgexport/vgimport */
4303 + uint pv_allocatable;
4304 + uint pv_size; /* HM */
4308 + uint pe_allocated;
4309 + uint pe_stale; /* for future use */
4310 + pe_disk_t *pe; /* HM */
4311 + struct block_device *bd;
4312 + char pv_uuid[UUID_LEN+1];
4315 + uint32_t pe_start; /* in sectors */
4321 +typedef struct pv_disk_v2 {
4322 + uint8_t id[2]; /* Identifier */
4323 + uint16_t version; /* HM lvm version */
4324 + lvm_disk_data_t pv_on_disk;
4325 + lvm_disk_data_t vg_on_disk;
4326 + lvm_disk_data_t pv_uuidlist_on_disk;
4327 + lvm_disk_data_t lv_on_disk;
4328 + lvm_disk_data_t pe_on_disk;
4329 + uint8_t pv_uuid[NAME_LEN];
4330 + uint8_t vg_name[NAME_LEN];
4331 + uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */
4332 + uint32_t pv_major;
4333 + uint32_t pv_number;
4334 + uint32_t pv_status;
4335 + uint32_t pv_allocatable;
4336 + uint32_t pv_size; /* HM */
4339 + uint32_t pe_total;
4340 + uint32_t pe_allocated;
4342 + /* new in struct version 2 */
4343 + uint32_t pe_start; /* in sectors */
4349 + * Structures for Logical Volume (LV)
4352 +/* core PE information */
4355 + uint32_t pe; /* to be changed if > 2TB */
4361 + char lv_name[NAME_LEN];
4368 +typedef struct lv_bmap {
4369 + uint32_t lv_block;
4374 + * Structure Logical Volume (LV) Version 3
4378 +typedef struct lv_v5 {
4379 + char lv_name[NAME_LEN];
4380 + char vg_name[NAME_LEN];
4383 + uint lv_open; /* HM */
4384 + kdev_t lv_dev; /* HM */
4385 + uint lv_number; /* HM */
4386 + uint lv_mirror_copies; /* for future use */
4387 + uint lv_recovery; /* " */
4388 + uint lv_schedule; /* " */
4390 + pe_t *lv_current_pe; /* HM */
4391 + uint lv_current_le; /* for future use */
4392 + uint lv_allocated_le;
4394 + uint lv_stripesize;
4395 + uint lv_badblock; /* for future use */
4396 + uint lv_allocation;
4397 + uint lv_io_timeout; /* for future use */
4398 + uint lv_read_ahead;
4400 + /* delta to version 1 starts here */
4401 + struct lv_v5 *lv_snapshot_org;
4402 + struct lv_v5 *lv_snapshot_prev;
4403 + struct lv_v5 *lv_snapshot_next;
4404 + lv_block_exception_t *lv_block_exception;
4405 + uint lv_remap_ptr;
4406 + uint lv_remap_end;
4407 + uint lv_chunk_size;
4408 + uint lv_snapshot_minor;
4410 + struct kiobuf *lv_iobuf;
4411 + struct kiobuf *lv_COW_table_iobuf;
4412 + struct rw_semaphore lv_lock;
4413 + struct list_head *lv_snapshot_hash_table;
4414 + uint32_t lv_snapshot_hash_table_size;
4415 + uint32_t lv_snapshot_hash_mask;
4416 + wait_queue_head_t lv_snapshot_wait;
4417 + int lv_snapshot_use_rate;
4420 + uint lv_allocated_snapshot_le;
4427 +typedef struct lv_disk_v3 {
4428 + uint8_t lv_name[NAME_LEN];
4429 + uint8_t vg_name[NAME_LEN];
4430 + uint32_t lv_access;
4431 + uint32_t lv_status;
4432 + uint32_t lv_open; /* HM */
4433 + uint32_t lv_dev; /* HM */
4434 + uint32_t lv_number; /* HM */
4435 + uint32_t lv_mirror_copies; /* for future use */
4436 + uint32_t lv_recovery; /* " */
4437 + uint32_t lv_schedule; /* " */
4439 + uint32_t lv_snapshot_minor;/* minor number of original */
4440 + uint16_t lv_chunk_size; /* chunk size of snapshot */
4442 + uint32_t lv_allocated_le;
4443 + uint32_t lv_stripes;
4444 + uint32_t lv_stripesize;
4445 + uint32_t lv_badblock; /* for future use */
4446 + uint32_t lv_allocation;
4447 + uint32_t lv_io_timeout; /* for future use */
4448 + uint32_t lv_read_ahead; /* HM */
4452 + * Structure Volume Group (VG) Version 1
4456 +typedef struct vg_v3 {
4457 + char vg_name[NAME_LEN]; /* volume group name */
4458 + uint vg_number; /* volume group number */
4459 + uint vg_access; /* read/write */
4460 + uint vg_status; /* active or not */
4461 + uint lv_max; /* maximum logical volumes */
4462 + uint lv_cur; /* current logical volumes */
4463 + uint lv_open; /* open logical volumes */
4464 + uint pv_max; /* maximum physical volumes */
4465 + uint pv_cur; /* current physical volumes FU */
4466 + uint pv_act; /* active physical volumes */
4467 + uint dummy; /* was obsolete max_pe_per_pv */
4468 + uint vgda; /* volume group descriptor arrays FU */
4469 + uint pe_size; /* physical extent size in sectors */
4470 + uint pe_total; /* total of physical extents */
4471 + uint pe_allocated; /* allocated physical extents */
4472 + uint pvg_total; /* physical volume groups FU */
4473 + struct proc_dir_entry *proc;
4474 + pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */
4475 + lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */
4476 + char vg_uuid[UUID_LEN+1]; /* volume group UUID */
4478 + struct proc_dir_entry *vg_dir_pde;
4479 + struct proc_dir_entry *lv_subdir_pde;
4480 + struct proc_dir_entry *pv_subdir_pde;
4488 +typedef struct vg_disk_v2 {
4489 + uint8_t vg_uuid[UUID_LEN]; /* volume group UUID */
4490 + uint8_t vg_name_dummy[NAME_LEN-UUID_LEN]; /* rest of v1 VG name */
4491 + uint32_t vg_number; /* volume group number */
4492 + uint32_t vg_access; /* read/write */
4493 + uint32_t vg_status; /* active or not */
4494 + uint32_t lv_max; /* maximum logical volumes */
4495 + uint32_t lv_cur; /* current logical volumes */
4496 + uint32_t lv_open; /* open logical volumes */
4497 + uint32_t pv_max; /* maximum physical volumes */
4498 + uint32_t pv_cur; /* current physical volumes FU */
4499 + uint32_t pv_act; /* active physical volumes */
4501 + uint32_t vgda; /* volume group descriptor arrays FU */
4502 + uint32_t pe_size; /* physical extent size in sectors */
4503 + uint32_t pe_total; /* total of physical extents */
4504 + uint32_t pe_allocated; /* allocated physical extents */
4505 + uint32_t pvg_total; /* physical volume groups FU */
4510 + * Request structures for ioctls
4513 +/* Request structure PV_STATUS_BY_NAME... */
4515 + char pv_name[NAME_LEN];
4517 +} pv_status_req_t, pv_change_req_t;
4519 +/* Request structure PV_FLUSH */
4521 + char pv_name[NAME_LEN];
4526 +/* Request structure PE_MOVE */
4529 + LOCK_PE, UNLOCK_PE
4534 + uint32_t pv_offset;
4539 +/* Request structure LV_STATUS_BYNAME */
4541 + char lv_name[NAME_LEN];
4543 +} lv_status_byname_req_t, lv_req_t;
4545 +/* Request structure LV_STATUS_BYINDEX */
4547 + uint32_t lv_index;
4549 + /* Transfer size because user space and kernel space differ */
4551 +} lv_status_byindex_req_t;
4553 +/* Request structure LV_STATUS_BYDEV... */
4557 +} lv_status_bydev_req_t;
4560 +/* Request structure LV_SNAPSHOT_USE_RATE */
4564 +} lv_snapshot_use_rate_req_t;
4568 +/* useful inlines */
4569 +static inline ulong round_up(ulong n, ulong size) {
4571 + return (n + size) & ~size;
4574 +static inline ulong div_up(ulong n, ulong size) {
4575 + return round_up(n, size) / size;
4578 +/* FIXME: nasty capital letters */
4579 +static int inline LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg_t *vg, lv_t *lv) {
4580 + return vg->pe_size / lv->lv_chunk_size;
4583 +static int inline LVM_GET_COW_TABLE_ENTRIES_PER_PE(vg_t *vg, lv_t *lv) {
4584 + ulong chunks = vg->pe_size / lv->lv_chunk_size;
4585 + ulong entry_size = sizeof(lv_COW_table_disk_t);
4586 + ulong chunk_size = lv->lv_chunk_size * SECTOR_SIZE;
4587 + ulong entries = (vg->pe_size * SECTOR_SIZE) /
4588 + (entry_size + chunk_size);
4593 + for(; entries; entries--)
4594 + if((div_up(entries * entry_size, chunk_size) + entries) <=
4602 +#endif /* #ifndef _LVM_H_INCLUDE */
4604 diff -Nur ./kernel-headers/linux/major.h ./kernel-headers/linux/major.h
4605 --- ./kernel-headers/linux/major.h 1970-01-01 01:00:00.000000000 +0100
4606 +++ ./kernel-headers/linux/major.h 2004-07-10 02:59:15.000000000 +0200
4608 +#ifndef _LINUX_MAJOR_H
4609 +#define _LINUX_MAJOR_H
4612 + * This file has definitions for major device numbers.
4613 + * For the device number assignments, see Documentation/devices.txt.
4619 + * Important: Don't change this to 256. Major number 255 is and must be
4620 + * reserved for future expansion into a larger dev_t space.
4622 +#define MAX_CHRDEV 255
4623 +#define MAX_BLKDEV 255
4625 +#define UNNAMED_MAJOR 0
4626 +#define MEM_MAJOR 1
4627 +#define RAMDISK_MAJOR 1
4628 +#define FLOPPY_MAJOR 2
4629 +#define PTY_MASTER_MAJOR 2
4630 +#define IDE0_MAJOR 3
4631 +#define PTY_SLAVE_MAJOR 3
4632 +#define HD_MAJOR IDE0_MAJOR
4633 +#define TTY_MAJOR 4
4634 +#define TTYAUX_MAJOR 5
4636 +#define VCS_MAJOR 7
4637 +#define LOOP_MAJOR 7
4638 +#define SCSI_DISK0_MAJOR 8
4639 +#define SCSI_TAPE_MAJOR 9
4641 +#define MISC_MAJOR 10
4642 +#define SCSI_CDROM_MAJOR 11
4643 +#define MUX_MAJOR 11 /* PA-RISC only */
4644 +#define QIC02_TAPE_MAJOR 12
4645 +#define XT_DISK_MAJOR 13
4646 +#define SOUND_MAJOR 14
4647 +#define CDU31A_CDROM_MAJOR 15
4648 +#define JOYSTICK_MAJOR 15
4649 +#define GOLDSTAR_CDROM_MAJOR 16
4650 +#define OPTICS_CDROM_MAJOR 17
4651 +#define SANYO_CDROM_MAJOR 18
4652 +#define CYCLADES_MAJOR 19
4653 +#define CYCLADESAUX_MAJOR 20
4654 +#define MITSUMI_X_CDROM_MAJOR 20
4655 +#define MFM_ACORN_MAJOR 21 /* ARM Linux /dev/mfm */
4656 +#define SCSI_GENERIC_MAJOR 21
4657 +#define Z8530_MAJOR 34
4658 +#define DIGI_MAJOR 23
4659 +#define IDE1_MAJOR 22
4660 +#define DIGICU_MAJOR 22
4661 +#define MITSUMI_CDROM_MAJOR 23
4662 +#define CDU535_CDROM_MAJOR 24
4663 +#define STL_SERIALMAJOR 24
4664 +#define MATSUSHITA_CDROM_MAJOR 25
4665 +#define STL_CALLOUTMAJOR 25
4666 +#define MATSUSHITA_CDROM2_MAJOR 26
4667 +#define QIC117_TAPE_MAJOR 27
4668 +#define MATSUSHITA_CDROM3_MAJOR 27
4669 +#define MATSUSHITA_CDROM4_MAJOR 28
4670 +#define STL_SIOMEMMAJOR 28
4671 +#define ACSI_MAJOR 28
4672 +#define AZTECH_CDROM_MAJOR 29
4673 +#define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */
4674 +#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */
4675 +#define CM206_CDROM_MAJOR 32
4676 +#define IDE2_MAJOR 33
4677 +#define IDE3_MAJOR 34
4678 +#define XPRAM_MAJOR 35 /* expanded storage on S/390 = "slow ram" */
4679 + /* proposed by Peter */
4680 +#define NETLINK_MAJOR 36
4681 +#define PS2ESDI_MAJOR 36
4682 +#define IDETAPE_MAJOR 37
4683 +#define Z2RAM_MAJOR 37
4684 +#define APBLOCK_MAJOR 38 /* AP1000 Block device */
4685 +#define DDV_MAJOR 39 /* AP1000 DDV block device */
4686 +#define NBD_MAJOR 43 /* Network block device */
4687 +#define RISCOM8_NORMAL_MAJOR 48
4688 +#define DAC960_MAJOR 48 /* 48..55 */
4689 +#define RISCOM8_CALLOUT_MAJOR 49
4690 +#define MKISS_MAJOR 55
4691 +#define DSP56K_MAJOR 55 /* DSP56001 processor device */
4693 +#define IDE4_MAJOR 56
4694 +#define IDE5_MAJOR 57
4696 +#define LVM_BLK_MAJOR 58 /* Logical Volume Manager */
4698 +#define SCSI_DISK1_MAJOR 65
4699 +#define SCSI_DISK2_MAJOR 66
4700 +#define SCSI_DISK3_MAJOR 67
4701 +#define SCSI_DISK4_MAJOR 68
4702 +#define SCSI_DISK5_MAJOR 69
4703 +#define SCSI_DISK6_MAJOR 70
4704 +#define SCSI_DISK7_MAJOR 71
4707 +#define COMPAQ_SMART2_MAJOR 72
4708 +#define COMPAQ_SMART2_MAJOR1 73
4709 +#define COMPAQ_SMART2_MAJOR2 74
4710 +#define COMPAQ_SMART2_MAJOR3 75
4711 +#define COMPAQ_SMART2_MAJOR4 76
4712 +#define COMPAQ_SMART2_MAJOR5 77
4713 +#define COMPAQ_SMART2_MAJOR6 78
4714 +#define COMPAQ_SMART2_MAJOR7 79
4716 +#define SPECIALIX_NORMAL_MAJOR 75
4717 +#define SPECIALIX_CALLOUT_MAJOR 76
4719 +#define COMPAQ_CISS_MAJOR 104
4720 +#define COMPAQ_CISS_MAJOR1 105
4721 +#define COMPAQ_CISS_MAJOR2 106
4722 +#define COMPAQ_CISS_MAJOR3 107
4723 +#define COMPAQ_CISS_MAJOR4 108
4724 +#define COMPAQ_CISS_MAJOR5 109
4725 +#define COMPAQ_CISS_MAJOR6 110
4726 +#define COMPAQ_CISS_MAJOR7 111
4728 +#define ATARAID_MAJOR 114
4730 +#define DASD_MAJOR 94 /* Official assignations from Peter */
4732 +#define MDISK_MAJOR 95 /* Official assignations from Peter */
4734 +#define I2O_MAJOR 80 /* 80->87 */
4736 +#define IDE6_MAJOR 88
4737 +#define IDE7_MAJOR 89
4738 +#define IDE8_MAJOR 90
4739 +#define IDE9_MAJOR 91
4741 +#define UBD_MAJOR 98
4743 +#define AURORA_MAJOR 79
4745 +#define JSFD_MAJOR 99
4747 +#define PHONE_MAJOR 100
4749 +#define LVM_CHAR_MAJOR 109 /* Logical Volume Manager */
4751 +#define UMEM_MAJOR 116 /* http://www.umem.com/ Battery Backed RAM */
4753 +#define RTF_MAJOR 150
4754 +#define RAW_MAJOR 162
4756 +#define USB_ACM_MAJOR 166
4757 +#define USB_ACM_AUX_MAJOR 167
4758 +#define USB_CHAR_MAJOR 180
4760 +#define UNIX98_PTY_MASTER_MAJOR 128
4761 +#define UNIX98_PTY_MAJOR_COUNT 8
4762 +#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
4764 +#define VXVM_MAJOR 199 /* VERITAS volume i/o driver */
4765 +#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */
4766 +#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */
4768 +#define MSR_MAJOR 202
4769 +#define CPUID_MAJOR 203
4771 +#define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */
4773 +#define IBM_TTY3270_MAJOR 227 /* Official allocations now */
4774 +#define IBM_FS3270_MAJOR 228
4777 + * Tests for SCSI devices.
4780 +#define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \
4781 + ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR))
4783 +#define SCSI_BLK_MAJOR(M) \
4784 + (SCSI_DISK_MAJOR(M) \
4785 + || (M) == SCSI_CDROM_MAJOR)
4787 +static __inline__ int scsi_blk_major(int m) {
4788 + return SCSI_BLK_MAJOR(m);
4792 + * Tests for IDE devices
4794 +#define IDE_DISK_MAJOR(M) ((M) == IDE0_MAJOR || (M) == IDE1_MAJOR || \
4795 + (M) == IDE2_MAJOR || (M) == IDE3_MAJOR || \
4796 + (M) == IDE4_MAJOR || (M) == IDE5_MAJOR || \
4797 + (M) == IDE6_MAJOR || (M) == IDE7_MAJOR || \
4798 + (M) == IDE8_MAJOR || (M) == IDE9_MAJOR)
4800 +static __inline__ int ide_blk_major(int m)
4802 + return IDE_DISK_MAJOR(m);
4806 diff -Nur ./kernel-headers/linux/unistd.h ./kernel-headers/linux/unistd.h
4807 --- ./kernel-headers/linux/unistd.h 1970-01-01 01:00:00.000000000 +0100
4808 +++ ./kernel-headers/linux/unistd.h 2004-07-10 02:59:14.000000000 +0200
4810 +#ifndef _LINUX_UNISTD_H_
4811 +#define _LINUX_UNISTD_H_
4816 + * Include machine specific syscallX macros
4818 +#include <asm/unistd.h>
4820 +#endif /* _LINUX_UNISTD_H_ */