OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

4835 lines
154 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../lilo/local_kernel_headers.patch
  5. # Copyright (C) 2006 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This patch file is dual-licensed. It is available under the license the
  11. # patched project is licensed under, as long as it is an OpenSource license
  12. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  13. # of the GNU General Public License as published by the Free Software
  14. # Foundation; either version 2 of the License, or (at your option) any later
  15. # version.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. --- lilo-22.5.8.orig/kernel-headers/asm/unistd.h
  18. +++ lilo-22.5.8/kernel-headers/asm/unistd.h
  19. @@ -0,0 +1,386 @@
  20. +#ifndef _ASM_I386_UNISTD_H_
  21. +#define _ASM_I386_UNISTD_H_
  22. +
  23. +/*
  24. + * This file contains the system call numbers.
  25. + */
  26. +
  27. +#define __NR_exit 1
  28. +#define __NR_fork 2
  29. +#define __NR_read 3
  30. +#define __NR_write 4
  31. +#define __NR_open 5
  32. +#define __NR_close 6
  33. +#define __NR_waitpid 7
  34. +#define __NR_creat 8
  35. +#define __NR_link 9
  36. +#define __NR_unlink 10
  37. +#define __NR_execve 11
  38. +#define __NR_chdir 12
  39. +#define __NR_time 13
  40. +#define __NR_mknod 14
  41. +#define __NR_chmod 15
  42. +#define __NR_lchown 16
  43. +#define __NR_break 17
  44. +#define __NR_oldstat 18
  45. +#define __NR_lseek 19
  46. +#define __NR_getpid 20
  47. +#define __NR_mount 21
  48. +#define __NR_umount 22
  49. +#define __NR_setuid 23
  50. +#define __NR_getuid 24
  51. +#define __NR_stime 25
  52. +#define __NR_ptrace 26
  53. +#define __NR_alarm 27
  54. +#define __NR_oldfstat 28
  55. +#define __NR_pause 29
  56. +#define __NR_utime 30
  57. +#define __NR_stty 31
  58. +#define __NR_gtty 32
  59. +#define __NR_access 33
  60. +#define __NR_nice 34
  61. +#define __NR_ftime 35
  62. +#define __NR_sync 36
  63. +#define __NR_kill 37
  64. +#define __NR_rename 38
  65. +#define __NR_mkdir 39
  66. +#define __NR_rmdir 40
  67. +#define __NR_dup 41
  68. +#define __NR_pipe 42
  69. +#define __NR_times 43
  70. +#define __NR_prof 44
  71. +#define __NR_brk 45
  72. +#define __NR_setgid 46
  73. +#define __NR_getgid 47
  74. +#define __NR_signal 48
  75. +#define __NR_geteuid 49
  76. +#define __NR_getegid 50
  77. +#define __NR_acct 51
  78. +#define __NR_umount2 52
  79. +#define __NR_lock 53
  80. +#define __NR_ioctl 54
  81. +#define __NR_fcntl 55
  82. +#define __NR_mpx 56
  83. +#define __NR_setpgid 57
  84. +#define __NR_ulimit 58
  85. +#define __NR_oldolduname 59
  86. +#define __NR_umask 60
  87. +#define __NR_chroot 61
  88. +#define __NR_ustat 62
  89. +#define __NR_dup2 63
  90. +#define __NR_getppid 64
  91. +#define __NR_getpgrp 65
  92. +#define __NR_setsid 66
  93. +#define __NR_sigaction 67
  94. +#define __NR_sgetmask 68
  95. +#define __NR_ssetmask 69
  96. +#define __NR_setreuid 70
  97. +#define __NR_setregid 71
  98. +#define __NR_sigsuspend 72
  99. +#define __NR_sigpending 73
  100. +#define __NR_sethostname 74
  101. +#define __NR_setrlimit 75
  102. +#define __NR_getrlimit 76 /* Back compatible 2Gig limited rlimit */
  103. +#define __NR_getrusage 77
  104. +#define __NR_gettimeofday 78
  105. +#define __NR_settimeofday 79
  106. +#define __NR_getgroups 80
  107. +#define __NR_setgroups 81
  108. +#define __NR_select 82
  109. +#define __NR_symlink 83
  110. +#define __NR_oldlstat 84
  111. +#define __NR_readlink 85
  112. +#define __NR_uselib 86
  113. +#define __NR_swapon 87
  114. +#define __NR_reboot 88
  115. +#define __NR_readdir 89
  116. +#define __NR_mmap 90
  117. +#define __NR_munmap 91
  118. +#define __NR_truncate 92
  119. +#define __NR_ftruncate 93
  120. +#define __NR_fchmod 94
  121. +#define __NR_fchown 95
  122. +#define __NR_getpriority 96
  123. +#define __NR_setpriority 97
  124. +#define __NR_profil 98
  125. +#define __NR_statfs 99
  126. +#define __NR_fstatfs 100
  127. +#define __NR_ioperm 101
  128. +#define __NR_socketcall 102
  129. +#define __NR_syslog 103
  130. +#define __NR_setitimer 104
  131. +#define __NR_getitimer 105
  132. +#define __NR_stat 106
  133. +#define __NR_lstat 107
  134. +#define __NR_fstat 108
  135. +#define __NR_olduname 109
  136. +#define __NR_iopl 110
  137. +#define __NR_vhangup 111
  138. +#define __NR_idle 112
  139. +#define __NR_vm86old 113
  140. +#define __NR_wait4 114
  141. +#define __NR_swapoff 115
  142. +#define __NR_sysinfo 116
  143. +#define __NR_ipc 117
  144. +#define __NR_fsync 118
  145. +#define __NR_sigreturn 119
  146. +#define __NR_clone 120
  147. +#define __NR_setdomainname 121
  148. +#define __NR_uname 122
  149. +#define __NR_modify_ldt 123
  150. +#define __NR_adjtimex 124
  151. +#define __NR_mprotect 125
  152. +#define __NR_sigprocmask 126
  153. +#define __NR_create_module 127
  154. +#define __NR_init_module 128
  155. +#define __NR_delete_module 129
  156. +#define __NR_get_kernel_syms 130
  157. +#define __NR_quotactl 131
  158. +#define __NR_getpgid 132
  159. +#define __NR_fchdir 133
  160. +#define __NR_bdflush 134
  161. +#define __NR_sysfs 135
  162. +#define __NR_personality 136
  163. +#define __NR_afs_syscall 137 /* Syscall for Andrew File System */
  164. +#define __NR_setfsuid 138
  165. +#define __NR_setfsgid 139
  166. +#define __NR__llseek 140
  167. +#define __NR_getdents 141
  168. +#define __NR__newselect 142
  169. +#define __NR_flock 143
  170. +#define __NR_msync 144
  171. +#define __NR_readv 145
  172. +#define __NR_writev 146
  173. +#define __NR_getsid 147
  174. +#define __NR_fdatasync 148
  175. +#define __NR__sysctl 149
  176. +#define __NR_mlock 150
  177. +#define __NR_munlock 151
  178. +#define __NR_mlockall 152
  179. +#define __NR_munlockall 153
  180. +#define __NR_sched_setparam 154
  181. +#define __NR_sched_getparam 155
  182. +#define __NR_sched_setscheduler 156
  183. +#define __NR_sched_getscheduler 157
  184. +#define __NR_sched_yield 158
  185. +#define __NR_sched_get_priority_max 159
  186. +#define __NR_sched_get_priority_min 160
  187. +#define __NR_sched_rr_get_interval 161
  188. +#define __NR_nanosleep 162
  189. +#define __NR_mremap 163
  190. +#define __NR_setresuid 164
  191. +#define __NR_getresuid 165
  192. +#define __NR_vm86 166
  193. +#define __NR_query_module 167
  194. +#define __NR_poll 168
  195. +#define __NR_nfsservctl 169
  196. +#define __NR_setresgid 170
  197. +#define __NR_getresgid 171
  198. +#define __NR_prctl 172
  199. +#define __NR_rt_sigreturn 173
  200. +#define __NR_rt_sigaction 174
  201. +#define __NR_rt_sigprocmask 175
  202. +#define __NR_rt_sigpending 176
  203. +#define __NR_rt_sigtimedwait 177
  204. +#define __NR_rt_sigqueueinfo 178
  205. +#define __NR_rt_sigsuspend 179
  206. +#define __NR_pread 180
  207. +#define __NR_pwrite 181
  208. +#define __NR_chown 182
  209. +#define __NR_getcwd 183
  210. +#define __NR_capget 184
  211. +#define __NR_capset 185
  212. +#define __NR_sigaltstack 186
  213. +#define __NR_sendfile 187
  214. +#define __NR_getpmsg 188 /* some people actually want streams */
  215. +#define __NR_putpmsg 189 /* some people actually want streams */
  216. +#define __NR_vfork 190
  217. +#define __NR_ugetrlimit 191 /* SuS compliant getrlimit */
  218. +#define __NR_mmap2 192
  219. +#define __NR_truncate64 193
  220. +#define __NR_ftruncate64 194
  221. +#define __NR_stat64 195
  222. +#define __NR_lstat64 196
  223. +#define __NR_fstat64 197
  224. +#define __NR_lchown32 198
  225. +#define __NR_getuid32 199
  226. +#define __NR_getgid32 200
  227. +#define __NR_geteuid32 201
  228. +#define __NR_getegid32 202
  229. +#define __NR_setreuid32 203
  230. +#define __NR_setregid32 204
  231. +#define __NR_getgroups32 205
  232. +#define __NR_setgroups32 206
  233. +#define __NR_fchown32 207
  234. +#define __NR_setresuid32 208
  235. +#define __NR_getresuid32 209
  236. +#define __NR_setresgid32 210
  237. +#define __NR_getresgid32 211
  238. +#define __NR_chown32 212
  239. +#define __NR_setuid32 213
  240. +#define __NR_setgid32 214
  241. +#define __NR_setfsuid32 215
  242. +#define __NR_setfsgid32 216
  243. +#define __NR_pivot_root 217
  244. +#define __NR_mincore 218
  245. +#define __NR_madvise 219
  246. +#define __NR_madvise1 219 /* delete when C lib stub is removed */
  247. +#define __NR_getdents64 220
  248. +#define __NR_fcntl64 221
  249. +#define __NR_security 223 /* syscall for security modules */
  250. +#define __NR_gettid 224
  251. +#define __NR_readahead 225
  252. +#define __NR_setxattr 226
  253. +#define __NR_lsetxattr 227
  254. +#define __NR_fsetxattr 228
  255. +#define __NR_getxattr 229
  256. +#define __NR_lgetxattr 230
  257. +#define __NR_fgetxattr 231
  258. +#define __NR_listxattr 232
  259. +#define __NR_llistxattr 233
  260. +#define __NR_flistxattr 234
  261. +#define __NR_removexattr 235
  262. +#define __NR_lremovexattr 236
  263. +#define __NR_fremovexattr 237
  264. +#define __NR_tkill 238
  265. +#define __NR_sendfile64 239
  266. +#define __NR_futex 240
  267. +#define __NR_sched_setaffinity 241
  268. +#define __NR_sched_getaffinity 242
  269. +#define __NR_set_thread_area 243
  270. +#define __NR_get_thread_area 244
  271. +#define __NR_io_setup 245
  272. +#define __NR_io_destroy 246
  273. +#define __NR_io_getevents 247
  274. +#define __NR_io_submit 248
  275. +#define __NR_io_cancel 249
  276. +#define __NR_alloc_hugepages 250
  277. +#define __NR_free_hugepages 251
  278. +#define __NR_exit_group 252
  279. +
  280. +/* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
  281. +
  282. +#define __syscall_return(type, res) \
  283. +do { \
  284. + if ((unsigned long)(res) >= (unsigned long)(-125)) { \
  285. + errno = -(res); \
  286. + res = -1; \
  287. + } \
  288. + return (type) (res); \
  289. +} while (0)
  290. +
  291. +/* XXX - _foo needs to be __foo, while __NR_bar could be _NR_bar. */
  292. +#define _syscall0(type,name) \
  293. +type name(void) \
  294. +{ \
  295. +long __res; \
  296. +__asm__ volatile ("int $0x80" \
  297. + : "=a" (__res) \
  298. + : "0" (__NR_##name)); \
  299. +__syscall_return(type,__res); \
  300. +}
  301. +
  302. +#define _syscall1(type,name,type1,arg1) \
  303. +type name(type1 arg1) \
  304. +{ \
  305. +long __res; \
  306. +__asm__ volatile ("int $0x80" \
  307. + : "=a" (__res) \
  308. + : "0" (__NR_##name),"b" ((long)(arg1))); \
  309. +__syscall_return(type,__res); \
  310. +}
  311. +
  312. +#define _syscall2(type,name,type1,arg1,type2,arg2) \
  313. +type name(type1 arg1,type2 arg2) \
  314. +{ \
  315. +long __res; \
  316. +__asm__ volatile ("int $0x80" \
  317. + : "=a" (__res) \
  318. + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2))); \
  319. +__syscall_return(type,__res); \
  320. +}
  321. +
  322. +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
  323. +type name(type1 arg1,type2 arg2,type3 arg3) \
  324. +{ \
  325. +long __res; \
  326. +__asm__ volatile ("int $0x80" \
  327. + : "=a" (__res) \
  328. + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
  329. + "d" ((long)(arg3))); \
  330. +__syscall_return(type,__res); \
  331. +}
  332. +
  333. +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \
  334. +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
  335. +{ \
  336. +long __res; \
  337. +__asm__ volatile ("int $0x80" \
  338. + : "=a" (__res) \
  339. + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
  340. + "d" ((long)(arg3)),"S" ((long)(arg4))); \
  341. +__syscall_return(type,__res); \
  342. +}
  343. +
  344. +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
  345. + type5,arg5) \
  346. +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \
  347. +{ \
  348. +long __res; \
  349. +__asm__ volatile ("int $0x80" \
  350. + : "=a" (__res) \
  351. + : "0" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
  352. + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \
  353. +__syscall_return(type,__res); \
  354. +}
  355. +
  356. +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \
  357. + type5,arg5,type6,arg6) \
  358. +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \
  359. +{ \
  360. +long __res; \
  361. +__asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; int $0x80 ; pop %%ebp" \
  362. + : "=a" (__res) \
  363. + : "i" (__NR_##name),"b" ((long)(arg1)),"c" ((long)(arg2)), \
  364. + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \
  365. + "0" ((long)(arg6))); \
  366. +__syscall_return(type,__res); \
  367. +}
  368. +
  369. +#ifdef __KERNEL_SYSCALLS__
  370. +
  371. +/*
  372. + * we need this inline - forking from kernel space will result
  373. + * in NO COPY ON WRITE (!!!), until an execve is executed. This
  374. + * is no problem, but for the stack. This is handled by not letting
  375. + * main() use the stack at all after fork(). Thus, no function
  376. + * calls - which means inline code for fork too, as otherwise we
  377. + * would use the stack upon exit from 'fork()'.
  378. + *
  379. + * Actually only pause and fork are needed inline, so that there
  380. + * won't be any messing with the stack from main(), but we define
  381. + * some others too.
  382. + */
  383. +#define __NR__exit __NR_exit
  384. +static inline _syscall0(int,pause)
  385. +static inline _syscall0(int,sync)
  386. +static inline _syscall0(pid_t,setsid)
  387. +static inline _syscall3(int,write,int,fd,const char *,buf,off_t,count)
  388. +static inline _syscall3(int,read,int,fd,char *,buf,off_t,count)
  389. +static inline _syscall3(off_t,lseek,int,fd,off_t,offset,int,count)
  390. +static inline _syscall1(int,dup,int,fd)
  391. +static inline _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
  392. +static inline _syscall3(int,open,const char *,file,int,flag,int,mode)
  393. +static inline _syscall1(int,close,int,fd)
  394. +static inline _syscall1(int,_exit,int,exitcode)
  395. +static inline _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
  396. +static inline _syscall1(int,delete_module,const char *,name)
  397. +
  398. +static inline pid_t wait(int * wait_stat)
  399. +{
  400. + return waitpid(-1,wait_stat,0);
  401. +}
  402. +
  403. +#endif
  404. +
  405. +#endif /* _ASM_I386_UNISTD_H_ */
  406. --- lilo-22.5.8.orig/kernel-headers/asm/boot.h
  407. +++ lilo-22.5.8/kernel-headers/asm/boot.h
  408. @@ -0,0 +1,15 @@
  409. +#ifndef _LINUX_BOOT_H
  410. +#define _LINUX_BOOT_H
  411. +
  412. +/* Don't touch these, unless you really know what you're doing. */
  413. +#define DEF_INITSEG 0x9000
  414. +#define DEF_SYSSEG 0x1000
  415. +#define DEF_SETUPSEG 0x9020
  416. +#define DEF_SYSSIZE 0x7F00
  417. +
  418. +/* Internal svga startup constants */
  419. +#define NORMAL_VGA 0xffff /* 80x25 mode */
  420. +#define EXTENDED_VGA 0xfffe /* 80x50 mode */
  421. +#define ASK_VGA 0xfffd /* ask for it at bootup */
  422. +
  423. +#endif
  424. --- lilo-22.5.8.orig/kernel-headers/asm/page.h
  425. +++ lilo-22.5.8/kernel-headers/asm/page.h
  426. @@ -0,0 +1,142 @@
  427. +#ifndef _I386_PAGE_H
  428. +#define _I386_PAGE_H
  429. +
  430. +/* PAGE_SHIFT determines the page size */
  431. +#define PAGE_SHIFT 12
  432. +#define PAGE_SIZE (1UL << PAGE_SHIFT)
  433. +#define PAGE_MASK (~(PAGE_SIZE-1))
  434. +
  435. +#ifdef __KERNEL__
  436. +#ifndef __ASSEMBLY__
  437. +
  438. +#include <linux/config.h>
  439. +
  440. +#ifdef CONFIG_X86_USE_3DNOW
  441. +
  442. +#include <asm/mmx.h>
  443. +
  444. +#define clear_page(page) mmx_clear_page((void *)(page))
  445. +#define copy_page(to,from) mmx_copy_page(to,from)
  446. +
  447. +#else
  448. +
  449. +/*
  450. + * On older X86 processors its not a win to use MMX here it seems.
  451. + * Maybe the K6-III ?
  452. + */
  453. +
  454. +#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
  455. +#define copy_page(to,from) memcpy((void *)(to), (void *)(from), PAGE_SIZE)
  456. +
  457. +#endif
  458. +
  459. +#define clear_user_page(page, vaddr) clear_page(page)
  460. +#define copy_user_page(to, from, vaddr) copy_page(to, from)
  461. +
  462. +/*
  463. + * These are used to make use of C type-checking..
  464. + */
  465. +#if CONFIG_X86_PAE
  466. +typedef struct { unsigned long pte_low, pte_high; } pte_t;
  467. +typedef struct { unsigned long long pmd; } pmd_t;
  468. +typedef struct { unsigned long long pgd; } pgd_t;
  469. +#define pte_val(x) ((x).pte_low | ((unsigned long long)(x).pte_high << 32))
  470. +#else
  471. +typedef struct { unsigned long pte_low; } pte_t;
  472. +typedef struct { unsigned long pmd; } pmd_t;
  473. +typedef struct { unsigned long pgd; } pgd_t;
  474. +#define pte_val(x) ((x).pte_low)
  475. +#endif
  476. +#define PTE_MASK PAGE_MASK
  477. +
  478. +typedef struct { unsigned long pgprot; } pgprot_t;
  479. +
  480. +#define pmd_val(x) ((x).pmd)
  481. +#define pgd_val(x) ((x).pgd)
  482. +#define pgprot_val(x) ((x).pgprot)
  483. +
  484. +#define __pte(x) ((pte_t) { (x) } )
  485. +#define __pmd(x) ((pmd_t) { (x) } )
  486. +#define __pgd(x) ((pgd_t) { (x) } )
  487. +#define __pgprot(x) ((pgprot_t) { (x) } )
  488. +
  489. +#endif /* !__ASSEMBLY__ */
  490. +
  491. +/* to align the pointer to the (next) page boundary */
  492. +#define PAGE_ALIGN(addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  493. +
  494. +/*
  495. + * This handles the memory map.. We could make this a config
  496. + * option, but too many people screw it up, and too few need
  497. + * it.
  498. + *
  499. + * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
  500. + * a virtual address space of one gigabyte, which limits the
  501. + * amount of physical memory you can use to about 950MB.
  502. + *
  503. + * If you want more physical memory than this then see the CONFIG_HIGHMEM4G
  504. + * and CONFIG_HIGHMEM64G options in the kernel configuration.
  505. + */
  506. +
  507. +#define __PAGE_OFFSET (0xC0000000)
  508. +
  509. +/*
  510. + * This much address space is reserved for vmalloc() and iomap()
  511. + * as well as fixmap mappings.
  512. + */
  513. +#define __VMALLOC_RESERVE (128 << 20)
  514. +
  515. +#ifndef __ASSEMBLY__
  516. +
  517. +/*
  518. + * Tell the user there is some problem. Beep too, so we can
  519. + * see^H^H^Hhear bugs in early bootup as well!
  520. + * The offending file and line are encoded after the "officially
  521. + * undefined" opcode for parsing in the trap handler.
  522. + */
  523. +
  524. +#if 1 /* Set to zero for a slightly smaller kernel */
  525. +#define BUG() \
  526. + __asm__ __volatile__( "ud2\n" \
  527. + "\t.word %c0\n" \
  528. + "\t.long %c1\n" \
  529. + : : "i" (__LINE__), "i" (__FILE__))
  530. +#else
  531. +#define BUG() __asm__ __volatile__("ud2\n")
  532. +#endif
  533. +
  534. +#define PAGE_BUG(page) do { \
  535. + BUG(); \
  536. +} while (0)
  537. +
  538. +/* Pure 2^n version of get_order */
  539. +static __inline__ int get_order(unsigned long size)
  540. +{
  541. + int order;
  542. +
  543. + size = (size-1) >> (PAGE_SHIFT-1);
  544. + order = -1;
  545. + do {
  546. + size >>= 1;
  547. + order++;
  548. + } while (size);
  549. + return order;
  550. +}
  551. +
  552. +#endif /* __ASSEMBLY__ */
  553. +
  554. +#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET)
  555. +#define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE)
  556. +#define __MAXMEM (-__PAGE_OFFSET-__VMALLOC_RESERVE)
  557. +#define MAXMEM ((unsigned long)(-PAGE_OFFSET-VMALLOC_RESERVE))
  558. +#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
  559. +#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
  560. +#define virt_to_page(kaddr) (mem_map + (__pa(kaddr) >> PAGE_SHIFT))
  561. +#define VALID_PAGE(page) ((page - mem_map) < max_mapnr)
  562. +
  563. +#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
  564. + VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
  565. +
  566. +#endif /* __KERNEL__ */
  567. +
  568. +#endif /* _I386_PAGE_H */
  569. --- lilo-22.5.8.orig/kernel-headers/asm/types.h
  570. +++ lilo-22.5.8/kernel-headers/asm/types.h
  571. @@ -0,0 +1,57 @@
  572. +#ifndef _I386_TYPES_H
  573. +#define _I386_TYPES_H
  574. +
  575. +typedef unsigned short umode_t;
  576. +
  577. +/*
  578. + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
  579. + * header files exported to user space
  580. + */
  581. +
  582. +typedef __signed__ char __s8;
  583. +typedef unsigned char __u8;
  584. +
  585. +typedef __signed__ short __s16;
  586. +typedef unsigned short __u16;
  587. +
  588. +typedef __signed__ int __s32;
  589. +typedef unsigned int __u32;
  590. +
  591. +#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
  592. +typedef __signed__ long long __s64;
  593. +typedef unsigned long long __u64;
  594. +#endif
  595. +
  596. +/*
  597. + * These aren't exported outside the kernel to avoid name space clashes
  598. + */
  599. +#ifdef __KERNEL__
  600. +
  601. +#include <linux/config.h>
  602. +
  603. +typedef signed char s8;
  604. +typedef unsigned char u8;
  605. +
  606. +typedef signed short s16;
  607. +typedef unsigned short u16;
  608. +
  609. +typedef signed int s32;
  610. +typedef unsigned int u32;
  611. +
  612. +typedef signed long long s64;
  613. +typedef unsigned long long u64;
  614. +
  615. +#define BITS_PER_LONG 32
  616. +
  617. +/* DMA addresses come in generic and 64-bit flavours. */
  618. +
  619. +#ifdef CONFIG_HIGHMEM64G
  620. +typedef u64 dma_addr_t;
  621. +#else
  622. +typedef u32 dma_addr_t;
  623. +#endif
  624. +typedef u64 dma64_addr_t;
  625. +
  626. +#endif /* __KERNEL__ */
  627. +
  628. +#endif
  629. --- lilo-22.5.8.orig/kernel-headers/asm/ioctl.h
  630. +++ lilo-22.5.8/kernel-headers/asm/ioctl.h
  631. @@ -0,0 +1,75 @@
  632. +/* $Id: ioctl.h,v 1.5 1993/07/19 21:53:50 root Exp root $
  633. + *
  634. + * linux/ioctl.h for Linux by H.H. Bergman.
  635. + */
  636. +
  637. +#ifndef _ASMI386_IOCTL_H
  638. +#define _ASMI386_IOCTL_H
  639. +
  640. +/* ioctl command encoding: 32 bits total, command in lower 16 bits,
  641. + * size of the parameter structure in the lower 14 bits of the
  642. + * upper 16 bits.
  643. + * Encoding the size of the parameter structure in the ioctl request
  644. + * is useful for catching programs compiled with old versions
  645. + * and to avoid overwriting user space outside the user buffer area.
  646. + * The highest 2 bits are reserved for indicating the ``access mode''.
  647. + * NOTE: This limits the max parameter size to 16kB -1 !
  648. + */
  649. +
  650. +/*
  651. + * The following is for compatibility across the various Linux
  652. + * platforms. The i386 ioctl numbering scheme doesn't really enforce
  653. + * a type field. De facto, however, the top 8 bits of the lower 16
  654. + * bits are indeed used as a type field, so we might just as well make
  655. + * this explicit here. Please be sure to use the decoding macros
  656. + * below from now on.
  657. + */
  658. +#define _IOC_NRBITS 8
  659. +#define _IOC_TYPEBITS 8
  660. +#define _IOC_SIZEBITS 14
  661. +#define _IOC_DIRBITS 2
  662. +
  663. +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1)
  664. +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1)
  665. +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1)
  666. +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1)
  667. +
  668. +#define _IOC_NRSHIFT 0
  669. +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS)
  670. +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS)
  671. +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS)
  672. +
  673. +/*
  674. + * Direction bits.
  675. + */
  676. +#define _IOC_NONE 0U
  677. +#define _IOC_WRITE 1U
  678. +#define _IOC_READ 2U
  679. +
  680. +#define _IOC(dir,type,nr,size) \
  681. + (((dir) << _IOC_DIRSHIFT) | \
  682. + ((type) << _IOC_TYPESHIFT) | \
  683. + ((nr) << _IOC_NRSHIFT) | \
  684. + ((size) << _IOC_SIZESHIFT))
  685. +
  686. +/* used to create numbers */
  687. +#define _IO(type,nr) _IOC(_IOC_NONE,(type),(nr),0)
  688. +#define _IOR(type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size))
  689. +#define _IOW(type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size))
  690. +#define _IOWR(type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))
  691. +
  692. +/* used to decode ioctl numbers.. */
  693. +#define _IOC_DIR(nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
  694. +#define _IOC_TYPE(nr) (((nr) >> _IOC_TYPESHIFT) & _IOC_TYPEMASK)
  695. +#define _IOC_NR(nr) (((nr) >> _IOC_NRSHIFT) & _IOC_NRMASK)
  696. +#define _IOC_SIZE(nr) (((nr) >> _IOC_SIZESHIFT) & _IOC_SIZEMASK)
  697. +
  698. +/* ...and for the drivers/sound files... */
  699. +
  700. +#define IOC_IN (_IOC_WRITE << _IOC_DIRSHIFT)
  701. +#define IOC_OUT (_IOC_READ << _IOC_DIRSHIFT)
  702. +#define IOC_INOUT ((_IOC_WRITE|_IOC_READ) << _IOC_DIRSHIFT)
  703. +#define IOCSIZE_MASK (_IOC_SIZEMASK << _IOC_SIZESHIFT)
  704. +#define IOCSIZE_SHIFT (_IOC_SIZESHIFT)
  705. +
  706. +#endif /* _ASMI386_IOCTL_H */
  707. --- lilo-22.5.8.orig/kernel-headers/linux/fd.h
  708. +++ lilo-22.5.8/kernel-headers/linux/fd.h
  709. @@ -0,0 +1,372 @@
  710. +#ifndef _LINUX_FD_H
  711. +#define _LINUX_FD_H
  712. +
  713. +#include <linux/ioctl.h>
  714. +
  715. +/* New file layout: Now the ioctl definitions immediately follow the
  716. + * definitions of the structures that they use */
  717. +
  718. +/*
  719. + * Geometry
  720. + */
  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
  729. +
  730. + unsigned char gap, /* gap1 size */
  731. +
  732. + rate, /* data rate. |= 0x40 for perpendicular */
  733. +#define FD_2M 0x4
  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
  739. +
  740. + spec1, /* stepping rate, head unload time */
  741. + fmt_gap; /* gap2 size */
  742. + const char * name; /* used only for predefined formats */
  743. +};
  744. +
  745. +
  746. +/* commands needing write access have 0x40 set */
  747. +/* commands needing super user access have 0x80 set */
  748. +
  749. +#define FDCLRPRM _IO(2, 0x41)
  750. +/* clear user-defined parameters */
  751. +
  752. +#define FDSETPRM _IOW(2, 0x42, struct floppy_struct)
  753. +#define FDSETMEDIAPRM FDSETPRM
  754. +/* set user-defined parameters for current media */
  755. +
  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 */
  761. +
  762. +
  763. +#define FDMSGON _IO(2,0x45)
  764. +#define FDMSGOFF _IO(2,0x46)
  765. +/* issue/don't issue kernel messages on media type change */
  766. +
  767. +
  768. +/*
  769. + * Formatting (obsolete)
  770. + */
  771. +#define FD_FILL_BYTE 0xF6 /* format fill byte. */
  772. +
  773. +struct format_descr {
  774. + unsigned int device,head,track;
  775. +};
  776. +
  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 */
  783. +
  784. +
  785. +/*
  786. + * Error thresholds
  787. + */
  788. +struct floppy_max_errors {
  789. + unsigned int
  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
  795. + * tried */
  796. +
  797. + /*
  798. + * Threshold for reporting FDC errors to the console.
  799. + * Setting this to zero may flood your screen when using
  800. + * ultra cheap floppies ;-)
  801. + */
  802. + reporting;
  803. +
  804. +};
  805. +
  806. +#define FDSETEMSGTRESH _IO(2,0x4a)
  807. +/* set fdc error reporting threshold */
  808. +
  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 */
  812. +
  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
  816. + * structure */
  817. +
  818. +
  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 */
  822. +
  823. +
  824. +/*
  825. + * Drive parameters (user modifiable)
  826. + */
  827. +struct floppy_drive_params {
  828. + signed char cmos; /* CMOS type */
  829. +
  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).
  832. + */
  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
  836. + * 8" drives) */
  837. + unsigned long srt; /* Step rate, usec */
  838. +
  839. + unsigned long spinup; /* time needed for spinup (expressed
  840. + * in jiffies) */
  841. + unsigned long spindown; /* timeout needed for spindown */
  842. + unsigned char spindown_offset; /* decides in which position the disk
  843. + * will stop */
  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 */
  848. +
  849. + unsigned char interleave_sect; /* if there are more sectors, use
  850. + * interleave */
  851. +
  852. + struct floppy_max_errors max_errors;
  853. +
  854. + char flags; /* various flags, including ftd_msg */
  855. +/*
  856. + * Announce successful media type detection and media information loss after
  857. + * disk changes.
  858. + * Also used to enable/disable printing of overrun warnings.
  859. + */
  860. +
  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
  866. + considerations */
  867. +
  868. + char read_track; /* use readtrack during probing? */
  869. +
  870. +/*
  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'.
  874. + */
  875. + short autodetect[8]; /* autodetected formats */
  876. +
  877. + int checkfreq; /* how often should the drive be checked for disk
  878. + * changes */
  879. + int native_format; /* native format of this drive */
  880. +};
  881. +
  882. +enum {
  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 */
  887. + FD_UNUSED_BIT,
  888. + FD_DISK_CHANGED_BIT, /* disk has been changed since last i/o */
  889. + FD_DISK_WRITABLE_BIT /* disk is writable */
  890. +};
  891. +
  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 */
  895. +
  896. +
  897. +/*
  898. + * Current drive state (not directly modifiable by user, readonly)
  899. + */
  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)
  908. +
  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? */
  917. +
  918. +/*
  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.
  922. + */
  923. + int keep_data;
  924. +
  925. + /* Prevent "aliased" accesses. */
  926. + int fd_ref;
  927. + int fd_device;
  928. + unsigned long last_checked; /* when was the drive last checked for a disk
  929. + * change? */
  930. +
  931. + char *dmabuf;
  932. + int bufblocks;
  933. +};
  934. +
  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 */
  938. +
  939. +
  940. +/*
  941. + * reset FDC
  942. + */
  943. +enum reset_mode {
  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 */
  947. +};
  948. +#define FDRESET _IO(2, 0x54)
  949. +
  950. +
  951. +/*
  952. + * FDC state
  953. + */
  954. +struct floppy_fdc_state {
  955. + int spec1; /* spec1 value last used */
  956. + int spec2; /* spec2 value last used */
  957. + int dtr;
  958. + unsigned char version; /* FDC version code */
  959. + unsigned char dor;
  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
  973. + */
  974. +
  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. */
  983. +
  984. +};
  985. +
  986. +#define FDGETFDCSTAT _IOR(2, 0x15, struct floppy_fdc_state)
  987. +
  988. +
  989. +/*
  990. + * Asynchronous Write error tracking
  991. + */
  992. +struct floppy_write_errors {
  993. + /* Write error logging.
  994. + *
  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.
  999. + */
  1000. +
  1001. + unsigned int write_errors; /* number of physical write errors
  1002. + * encountered */
  1003. +
  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;
  1009. +
  1010. + unsigned int badness; /* highest retry count for a read or write
  1011. + * operation */
  1012. +};
  1013. +
  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 */
  1018. +
  1019. +
  1020. +/*
  1021. + * Raw commands
  1022. + */
  1023. +/* new interface flag: now we can do them in batches */
  1024. +#define FDHAVEBATCHEDRAWCMD
  1025. +
  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
  1035. + * completion */
  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) */
  1038. +
  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 */
  1045. +
  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 */
  1049. +
  1050. + void *data;
  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 */
  1057. +
  1058. + unsigned char rate;
  1059. + unsigned char cmd_count;
  1060. + unsigned char cmd[16];
  1061. + unsigned char reply_count;
  1062. + unsigned char reply[16];
  1063. + int track;
  1064. + int resultcode;
  1065. +
  1066. + int reserved1;
  1067. + int reserved2;
  1068. +};
  1069. +
  1070. +#define FDRAWCMD _IO(2, 0x58)
  1071. +/* send a raw command to the fdc. Structure size not included, because of
  1072. + * batches */
  1073. +
  1074. +#define FDTWADDLE _IO(2, 0x59)
  1075. +/* flicker motor-on bit before reading a sector. Experimental */
  1076. +
  1077. +
  1078. +#define FDEJECT _IO(2, 0x5a)
  1079. +/* eject the disk */
  1080. +
  1081. +#endif
  1082. --- lilo-22.5.8.orig/kernel-headers/linux/fs.h
  1083. +++ lilo-22.5.8/kernel-headers/linux/fs.h
  1084. @@ -0,0 +1,1675 @@
  1085. +#ifndef _LINUX_FS_H
  1086. +#define _LINUX_FS_H
  1087. +
  1088. +/*
  1089. + * This file has definitions for some important file table
  1090. + * structures etc.
  1091. + */
  1092. +
  1093. +#include <linux/config.h>
  1094. +#include <linux/linkage.h>
  1095. +#include <linux/limits.h>
  1096. +#include <linux/wait.h>
  1097. +#include <linux/types.h>
  1098. +#include <linux/vfs.h>
  1099. +#include <linux/net.h>
  1100. +#include <linux/kdev_t.h>
  1101. +#include <linux/ioctl.h>
  1102. +#include <linux/list.h>
  1103. +#include <linux/dcache.h>
  1104. +#include <linux/stat.h>
  1105. +#include <linux/cache.h>
  1106. +#include <linux/stddef.h>
  1107. +#include <linux/string.h>
  1108. +
  1109. +#include <asm/atomic.h>
  1110. +#include <asm/bitops.h>
  1111. +
  1112. +struct poll_table_struct;
  1113. +
  1114. +
  1115. +/*
  1116. + * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
  1117. + * the file limit at runtime and only root can increase the per-process
  1118. + * nr_file rlimit, so it's safe to set up a ridiculously high absolute
  1119. + * upper limit on files-per-process.
  1120. + *
  1121. + * Some programs (notably those using select()) may have to be
  1122. + * recompiled to take full advantage of the new limits..
  1123. + */
  1124. +
  1125. +/* Fixed constants first: */
  1126. +#undef NR_OPEN
  1127. +#define NR_OPEN (1024*1024) /* Absolute upper limit on fd num */
  1128. +#define INR_OPEN 1024 /* Initial setting for nfile rlimits */
  1129. +
  1130. +#define BLOCK_SIZE_BITS 10
  1131. +#define BLOCK_SIZE (1<<BLOCK_SIZE_BITS)
  1132. +
  1133. +/* And dynamically-tunable limits and defaults: */
  1134. +struct files_stat_struct {
  1135. + int nr_files; /* read only */
  1136. + int nr_free_files; /* read only */
  1137. + int max_files; /* tunable */
  1138. +};
  1139. +extern struct files_stat_struct files_stat;
  1140. +
  1141. +struct inodes_stat_t {
  1142. + int nr_inodes;
  1143. + int nr_unused;
  1144. + int dummy[5];
  1145. +};
  1146. +extern struct inodes_stat_t inodes_stat;
  1147. +
  1148. +extern int leases_enable, dir_notify_enable, lease_break_time;
  1149. +
  1150. +#define NR_FILE 8192 /* this can well be larger on a larger system */
  1151. +#define NR_RESERVED_FILES 10 /* reserved for root */
  1152. +#define NR_SUPER 256
  1153. +
  1154. +#define MAY_EXEC 1
  1155. +#define MAY_WRITE 2
  1156. +#define MAY_READ 4
  1157. +
  1158. +#define FMODE_READ 1
  1159. +#define FMODE_WRITE 2
  1160. +
  1161. +#define READ 0
  1162. +#define WRITE 1
  1163. +#define READA 2 /* read-ahead - don't block if no resources */
  1164. +#define SPECIAL 4 /* For non-blockdevice requests in request queue */
  1165. +
  1166. +#define SEL_IN 1
  1167. +#define SEL_OUT 2
  1168. +#define SEL_EX 4
  1169. +
  1170. +/* public flags for file_system_type */
  1171. +#define FS_REQUIRES_DEV 1
  1172. +#define FS_NO_DCACHE 2 /* Only dcache the necessary things. */
  1173. +#define FS_NO_PRELIM 4 /* prevent preloading of dentries, even if
  1174. + * FS_NO_DCACHE is not set.
  1175. + */
  1176. +#define FS_SINGLE 8 /* Filesystem that can have only one superblock */
  1177. +#define FS_NOMOUNT 16 /* Never mount from userland */
  1178. +#define FS_LITTER 32 /* Keeps the tree in dcache */
  1179. +#define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon
  1180. + * as nfs_rename() will be cleaned up
  1181. + */
  1182. +/*
  1183. + * These are the fs-independent mount-flags: up to 32 flags are supported
  1184. + */
  1185. +#define MS_RDONLY 1 /* Mount read-only */
  1186. +#define MS_NOSUID 2 /* Ignore suid and sgid bits */
  1187. +#define MS_NODEV 4 /* Disallow access to device special files */
  1188. +#define MS_NOEXEC 8 /* Disallow program execution */
  1189. +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */
  1190. +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */
  1191. +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
  1192. +#define MS_NOATIME 1024 /* Do not update access times. */
  1193. +#define MS_NODIRATIME 2048 /* Do not update directory access times */
  1194. +#define MS_BIND 4096
  1195. +#define MS_MOVE 8192
  1196. +#define MS_REC 16384
  1197. +#define MS_VERBOSE 32768
  1198. +#define MS_ACTIVE (1<<30)
  1199. +#define MS_NOUSER (1<<31)
  1200. +
  1201. +/*
  1202. + * Superblock flags that can be altered by MS_REMOUNT
  1203. + */
  1204. +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|\
  1205. + MS_NODIRATIME)
  1206. +
  1207. +/*
  1208. + * Old magic mount flag and mask
  1209. + */
  1210. +#define MS_MGC_VAL 0xC0ED0000
  1211. +#define MS_MGC_MSK 0xffff0000
  1212. +
  1213. +/* Inode flags - they have nothing to superblock flags now */
  1214. +
  1215. +#define S_SYNC 1 /* Writes are synced at once */
  1216. +#define S_NOATIME 2 /* Do not update access times */
  1217. +#define S_QUOTA 4 /* Quota initialized for file */
  1218. +#define S_APPEND 8 /* Append-only file */
  1219. +#define S_IMMUTABLE 16 /* Immutable file */
  1220. +#define S_DEAD 32 /* removed, but still open directory */
  1221. +#define S_NOQUOTA 64 /* Inode is not counted to quota */
  1222. +
  1223. +/*
  1224. + * Note that nosuid etc flags are inode-specific: setting some file-system
  1225. + * flags just means all the inodes inherit those flags by default. It might be
  1226. + * possible to override it selectively if you really wanted to with some
  1227. + * ioctl() that is not currently implemented.
  1228. + *
  1229. + * Exception: MS_RDONLY is always applied to the entire file system.
  1230. + *
  1231. + * Unfortunately, it is possible to change a filesystems flags with it mounted
  1232. + * with files in use. This means that all of the inodes will not have their
  1233. + * i_flags updated. Hence, i_flags no longer inherit the superblock mount
  1234. + * flags, so these have to be checked separately. -- rmk@arm.uk.linux.org
  1235. + */
  1236. +#define __IS_FLG(inode,flg) ((inode)->i_sb->s_flags & (flg))
  1237. +
  1238. +#define IS_RDONLY(inode) ((inode)->i_sb->s_flags & MS_RDONLY)
  1239. +#define IS_SYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS) || ((inode)->i_flags & S_SYNC))
  1240. +#define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
  1241. +
  1242. +#define IS_QUOTAINIT(inode) ((inode)->i_flags & S_QUOTA)
  1243. +#define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
  1244. +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
  1245. +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
  1246. +#define IS_NOATIME(inode) (__IS_FLG(inode, MS_NOATIME) || ((inode)->i_flags & S_NOATIME))
  1247. +#define IS_NODIRATIME(inode) __IS_FLG(inode, MS_NODIRATIME)
  1248. +
  1249. +#define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
  1250. +
  1251. +/* the read-only stuff doesn't really belong here, but any other place is
  1252. + probably as bad and I don't want to create yet another include file. */
  1253. +
  1254. +#define BLKROSET _IO(0x12,93) /* set device read-only (0 = read-write) */
  1255. +#define BLKROGET _IO(0x12,94) /* get read-only status (0 = read_write) */
  1256. +#define BLKRRPART _IO(0x12,95) /* re-read partition table */
  1257. +#define BLKGETSIZE _IO(0x12,96) /* return device size /512 (long *arg) */
  1258. +#define BLKFLSBUF _IO(0x12,97) /* flush buffer cache */
  1259. +#define BLKRASET _IO(0x12,98) /* Set read ahead for block device */
  1260. +#define BLKRAGET _IO(0x12,99) /* get current read ahead setting */
  1261. +#define BLKFRASET _IO(0x12,100)/* set filesystem (mm/filemap.c) read-ahead */
  1262. +#define BLKFRAGET _IO(0x12,101)/* get filesystem (mm/filemap.c) read-ahead */
  1263. +#define BLKSECTSET _IO(0x12,102)/* set max sectors per request (ll_rw_blk.c) */
  1264. +#define BLKSECTGET _IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
  1265. +#define BLKSSZGET _IO(0x12,104)/* get block device sector size */
  1266. +#if 0
  1267. +#define BLKPG _IO(0x12,105)/* See blkpg.h */
  1268. +#define BLKELVGET _IOR(0x12,106,sizeof(blkelv_ioctl_arg_t))/* elevator get */
  1269. +#define BLKELVSET _IOW(0x12,107,sizeof(blkelv_ioctl_arg_t))/* elevator set */
  1270. +/* This was here just to show that the number is taken -
  1271. + probably all these _IO(0x12,*) ioctls should be moved to blkpg.h. */
  1272. +#endif
  1273. +/* A jump here: 108-111 have been used for various private purposes. */
  1274. +#define BLKBSZGET _IOR(0x12,112,sizeof(int))
  1275. +#define BLKBSZSET _IOW(0x12,113,sizeof(int))
  1276. +#define BLKGETSIZE64 _IOR(0x12,114,sizeof(u64)) /* return device size in bytes (u64 *arg) */
  1277. +
  1278. +#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
  1279. +#define FIBMAP _IO(0x00,1) /* bmap access */
  1280. +#define FIGETBSZ _IO(0x00,2) /* get the block size used for bmap */
  1281. +
  1282. +#ifdef __KERNEL__
  1283. +
  1284. +#include <asm/semaphore.h>
  1285. +#include <asm/byteorder.h>
  1286. +
  1287. +extern void update_atime (struct inode *);
  1288. +extern void update_mctime (struct inode *);
  1289. +#define UPDATE_ATIME(inode) update_atime (inode)
  1290. +
  1291. +extern void buffer_init(unsigned long);
  1292. +extern void inode_init(unsigned long);
  1293. +extern void mnt_init(unsigned long);
  1294. +extern void files_init(unsigned long mempages);
  1295. +
  1296. +/* bh state bits */
  1297. +enum bh_state_bits {
  1298. + BH_Uptodate, /* 1 if the buffer contains valid data */
  1299. + BH_Dirty, /* 1 if the buffer is dirty */
  1300. + BH_Lock, /* 1 if the buffer is locked */
  1301. + BH_Req, /* 0 if the buffer has been invalidated */
  1302. + BH_Mapped, /* 1 if the buffer has a disk mapping */
  1303. + BH_New, /* 1 if the buffer is new and not yet written out */
  1304. + BH_Async, /* 1 if the buffer is under end_buffer_io_async I/O */
  1305. + BH_Wait_IO, /* 1 if we should write out this buffer */
  1306. + BH_Launder, /* 1 if we can throttle on this buffer */
  1307. + BH_Attached, /* 1 if b_inode_buffers is linked into a list */
  1308. + BH_JBD, /* 1 if it has an attached journal_head */
  1309. + BH_Sync, /* 1 if the buffer is a sync read */
  1310. +
  1311. + BH_PrivateStart,/* not a state bit, but the first bit available
  1312. + * for private allocation by other entities
  1313. + */
  1314. +};
  1315. +
  1316. +#define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512)
  1317. +
  1318. +/*
  1319. + * Try to keep the most commonly used fields in single cache lines (16
  1320. + * bytes) to improve performance. This ordering should be
  1321. + * particularly beneficial on 32-bit processors.
  1322. + *
  1323. + * We use the first 16 bytes for the data which is used in searches
  1324. + * over the block hash lists (ie. getblk() and friends).
  1325. + *
  1326. + * The second 16 bytes we use for lru buffer scans, as used by
  1327. + * sync_buffers() and refill_freelist(). -- sct
  1328. + */
  1329. +struct buffer_head {
  1330. + /* First cache line: */
  1331. + struct buffer_head *b_next; /* Hash queue list */
  1332. + unsigned long b_blocknr; /* block number */
  1333. + unsigned short b_size; /* block size */
  1334. + unsigned short b_list; /* List that this buffer appears */
  1335. + kdev_t b_dev; /* device (B_FREE = free) */
  1336. +
  1337. + atomic_t b_count; /* users using this block */
  1338. + kdev_t b_rdev; /* Real device */
  1339. + unsigned long b_state; /* buffer state bitmap (see above) */
  1340. + unsigned long b_flushtime; /* Time when (dirty) buffer should be written */
  1341. +
  1342. + struct buffer_head *b_next_free;/* lru/free list linkage */
  1343. + struct buffer_head *b_prev_free;/* doubly linked list of buffers */
  1344. + struct buffer_head *b_this_page;/* circular list of buffers in one page */
  1345. + struct buffer_head *b_reqnext; /* request queue */
  1346. +
  1347. + struct buffer_head **b_pprev; /* doubly linked list of hash-queue */
  1348. + char * b_data; /* pointer to data block */
  1349. + struct page *b_page; /* the page this bh is mapped to */
  1350. + void (*b_end_io)(struct buffer_head *bh, int uptodate); /* I/O completion */
  1351. + void *b_private; /* reserved for b_end_io */
  1352. +
  1353. + unsigned long b_rsector; /* Real buffer location on disk */
  1354. + wait_queue_head_t b_wait;
  1355. +
  1356. + struct list_head b_inode_buffers; /* doubly linked list of inode dirty buffers */
  1357. +};
  1358. +
  1359. +typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
  1360. +void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
  1361. +
  1362. +#define __buffer_state(bh, state) (((bh)->b_state & (1UL << BH_##state)) != 0)
  1363. +
  1364. +#define buffer_uptodate(bh) __buffer_state(bh,Uptodate)
  1365. +#define buffer_dirty(bh) __buffer_state(bh,Dirty)
  1366. +#define buffer_locked(bh) __buffer_state(bh,Lock)
  1367. +#define buffer_req(bh) __buffer_state(bh,Req)
  1368. +#define buffer_mapped(bh) __buffer_state(bh,Mapped)
  1369. +#define buffer_new(bh) __buffer_state(bh,New)
  1370. +#define buffer_async(bh) __buffer_state(bh,Async)
  1371. +#define buffer_launder(bh) __buffer_state(bh,Launder)
  1372. +
  1373. +#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
  1374. +
  1375. +extern void set_bh_page(struct buffer_head *bh, struct page *page, unsigned long offset);
  1376. +
  1377. +#define touch_buffer(bh) mark_page_accessed(bh->b_page)
  1378. +
  1379. +
  1380. +#include <linux/pipe_fs_i.h>
  1381. +#include <linux/minix_fs_i.h>
  1382. +#include <linux/ext2_fs_i.h>
  1383. +#include <linux/ext3_fs_i.h>
  1384. +#include <linux/hpfs_fs_i.h>
  1385. +#include <linux/ntfs_fs_i.h>
  1386. +#include <linux/msdos_fs_i.h>
  1387. +#include <linux/umsdos_fs_i.h>
  1388. +#include <linux/iso_fs_i.h>
  1389. +#include <linux/nfs_fs_i.h>
  1390. +#include <linux/sysv_fs_i.h>
  1391. +#include <linux/affs_fs_i.h>
  1392. +#include <linux/ufs_fs_i.h>
  1393. +#include <linux/efs_fs_i.h>
  1394. +#include <linux/coda_fs_i.h>
  1395. +#include <linux/romfs_fs_i.h>
  1396. +#include <linux/shmem_fs.h>
  1397. +#include <linux/smb_fs_i.h>
  1398. +#include <linux/hfs_fs_i.h>
  1399. +#include <linux/adfs_fs_i.h>
  1400. +#include <linux/qnx4_fs_i.h>
  1401. +#include <linux/reiserfs_fs_i.h>
  1402. +#include <linux/bfs_fs_i.h>
  1403. +#include <linux/udf_fs_i.h>
  1404. +#include <linux/ncp_fs_i.h>
  1405. +#include <linux/proc_fs_i.h>
  1406. +#include <linux/usbdev_fs_i.h>
  1407. +#include <linux/jffs2_fs_i.h>
  1408. +#include <linux/cramfs_fs_sb.h>
  1409. +
  1410. +/*
  1411. + * Attribute flags. These should be or-ed together to figure out what
  1412. + * has been changed!
  1413. + */
  1414. +#define ATTR_MODE 1
  1415. +#define ATTR_UID 2
  1416. +#define ATTR_GID 4
  1417. +#define ATTR_SIZE 8
  1418. +#define ATTR_ATIME 16
  1419. +#define ATTR_MTIME 32
  1420. +#define ATTR_CTIME 64
  1421. +#define ATTR_ATIME_SET 128
  1422. +#define ATTR_MTIME_SET 256
  1423. +#define ATTR_FORCE 512 /* Not a change, but a change it */
  1424. +#define ATTR_ATTR_FLAG 1024
  1425. +
  1426. +/*
  1427. + * This is the Inode Attributes structure, used for notify_change(). It
  1428. + * uses the above definitions as flags, to know which values have changed.
  1429. + * Also, in this manner, a Filesystem can look at only the values it cares
  1430. + * about. Basically, these are the attributes that the VFS layer can
  1431. + * request to change from the FS layer.
  1432. + *
  1433. + * Derek Atkins <warlord@MIT.EDU> 94-10-20
  1434. + */
  1435. +struct iattr {
  1436. + unsigned int ia_valid;
  1437. + umode_t ia_mode;
  1438. + uid_t ia_uid;
  1439. + gid_t ia_gid;
  1440. + loff_t ia_size;
  1441. + time_t ia_atime;
  1442. + time_t ia_mtime;
  1443. + time_t ia_ctime;
  1444. + unsigned int ia_attr_flags;
  1445. +};
  1446. +
  1447. +/*
  1448. + * This is the inode attributes flag definitions
  1449. + */
  1450. +#define ATTR_FLAG_SYNCRONOUS 1 /* Syncronous write */
  1451. +#define ATTR_FLAG_NOATIME 2 /* Don't update atime */
  1452. +#define ATTR_FLAG_APPEND 4 /* Append-only file */
  1453. +#define ATTR_FLAG_IMMUTABLE 8 /* Immutable file */
  1454. +#define ATTR_FLAG_NODIRATIME 16 /* Don't update atime for directory */
  1455. +
  1456. +/*
  1457. + * Includes for diskquotas and mount structures.
  1458. + */
  1459. +#include <linux/quota.h>
  1460. +#include <linux/mount.h>
  1461. +
  1462. +/*
  1463. + * oh the beauties of C type declarations.
  1464. + */
  1465. +struct page;
  1466. +struct address_space;
  1467. +struct kiobuf;
  1468. +
  1469. +struct address_space_operations {
  1470. + int (*writepage)(struct page *);
  1471. + int (*readpage)(struct file *, struct page *);
  1472. + int (*sync_page)(struct page *);
  1473. + /*
  1474. + * ext3 requires that a successful prepare_write() call be followed
  1475. + * by a commit_write() call - they must be balanced
  1476. + */
  1477. + int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
  1478. + int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
  1479. + /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
  1480. + int (*bmap)(struct address_space *, long);
  1481. + int (*flushpage) (struct page *, unsigned long);
  1482. + int (*releasepage) (struct page *, int);
  1483. +#define KERNEL_HAS_O_DIRECT /* this is for modules out of the kernel */
  1484. + int (*direct_IO)(int, struct inode *, struct kiobuf *, unsigned long, int);
  1485. +#define KERNEL_HAS_DIRECT_FILEIO /* Unfortunate kludge due to lack of foresight */
  1486. + int (*direct_fileIO)(int, struct file *, struct kiobuf *, unsigned long, int);
  1487. + void (*removepage)(struct page *); /* called when page gets removed from the inode */
  1488. +};
  1489. +
  1490. +struct address_space {
  1491. + struct list_head clean_pages; /* list of clean pages */
  1492. + struct list_head dirty_pages; /* list of dirty pages */
  1493. + struct list_head locked_pages; /* list of locked pages */
  1494. + unsigned long nrpages; /* number of total pages */
  1495. + struct address_space_operations *a_ops; /* methods */
  1496. + struct inode *host; /* owner: inode, block_device */
  1497. + struct vm_area_struct *i_mmap; /* list of private mappings */
  1498. + struct vm_area_struct *i_mmap_shared; /* list of shared mappings */
  1499. + spinlock_t i_shared_lock; /* and spinlock protecting it */
  1500. + int gfp_mask; /* how to allocate the pages */
  1501. +};
  1502. +
  1503. +struct char_device {
  1504. + struct list_head hash;
  1505. + atomic_t count;
  1506. + dev_t dev;
  1507. + atomic_t openers;
  1508. + struct semaphore sem;
  1509. +};
  1510. +
  1511. +struct block_device {
  1512. + struct list_head bd_hash;
  1513. + atomic_t bd_count;
  1514. + struct inode * bd_inode;
  1515. + dev_t bd_dev; /* not a kdev_t - it's a search key */
  1516. + int bd_openers;
  1517. + const struct block_device_operations *bd_op;
  1518. + struct semaphore bd_sem; /* open/close mutex */
  1519. + struct list_head bd_inodes;
  1520. +};
  1521. +
  1522. +struct inode {
  1523. + struct list_head i_hash;
  1524. + struct list_head i_list;
  1525. + struct list_head i_dentry;
  1526. +
  1527. + struct list_head i_dirty_buffers;
  1528. + struct list_head i_dirty_data_buffers;
  1529. +
  1530. + unsigned long i_ino;
  1531. + atomic_t i_count;
  1532. + kdev_t i_dev;
  1533. + umode_t i_mode;
  1534. + nlink_t i_nlink;
  1535. + uid_t i_uid;
  1536. + gid_t i_gid;
  1537. + kdev_t i_rdev;
  1538. + loff_t i_size;
  1539. + time_t i_atime;
  1540. + time_t i_mtime;
  1541. + time_t i_ctime;
  1542. + unsigned int i_blkbits;
  1543. + unsigned long i_blksize;
  1544. + unsigned long i_blocks;
  1545. + unsigned long i_version;
  1546. + unsigned short i_bytes;
  1547. + struct semaphore i_sem;
  1548. + struct rw_semaphore i_alloc_sem;
  1549. + struct semaphore i_zombie;
  1550. + struct inode_operations *i_op;
  1551. + struct file_operations *i_fop; /* former ->i_op->default_file_ops */
  1552. + struct super_block *i_sb;
  1553. + wait_queue_head_t i_wait;
  1554. + struct file_lock *i_flock;
  1555. + struct address_space *i_mapping;
  1556. + struct address_space i_data;
  1557. + struct dquot *i_dquot[MAXQUOTAS];
  1558. + /* These three should probably be a union */
  1559. + struct list_head i_devices;
  1560. + struct pipe_inode_info *i_pipe;
  1561. + struct block_device *i_bdev;
  1562. + struct char_device *i_cdev;
  1563. +
  1564. + unsigned long i_dnotify_mask; /* Directory notify events */
  1565. + struct dnotify_struct *i_dnotify; /* for directory notifications */
  1566. +
  1567. + unsigned long i_state;
  1568. +
  1569. + unsigned int i_flags;
  1570. + unsigned char i_sock;
  1571. +
  1572. + atomic_t i_writecount;
  1573. + unsigned int i_attr_flags;
  1574. + __u32 i_generation;
  1575. + union {
  1576. + struct minix_inode_info minix_i;
  1577. + struct ext2_inode_info ext2_i;
  1578. + struct ext3_inode_info ext3_i;
  1579. + struct hpfs_inode_info hpfs_i;
  1580. + struct ntfs_inode_info ntfs_i;
  1581. + struct msdos_inode_info msdos_i;
  1582. + struct umsdos_inode_info umsdos_i;
  1583. + struct iso_inode_info isofs_i;
  1584. + struct nfs_inode_info nfs_i;
  1585. + struct sysv_inode_info sysv_i;
  1586. + struct affs_inode_info affs_i;
  1587. + struct ufs_inode_info ufs_i;
  1588. + struct efs_inode_info efs_i;
  1589. + struct romfs_inode_info romfs_i;
  1590. + struct shmem_inode_info shmem_i;
  1591. + struct coda_inode_info coda_i;
  1592. + struct smb_inode_info smbfs_i;
  1593. + struct hfs_inode_info hfs_i;
  1594. + struct adfs_inode_info adfs_i;
  1595. + struct qnx4_inode_info qnx4_i;
  1596. + struct reiserfs_inode_info reiserfs_i;
  1597. + struct bfs_inode_info bfs_i;
  1598. + struct udf_inode_info udf_i;
  1599. + struct ncp_inode_info ncpfs_i;
  1600. + struct proc_inode_info proc_i;
  1601. + struct socket socket_i;
  1602. + struct usbdev_inode_info usbdev_i;
  1603. + struct jffs2_inode_info jffs2_i;
  1604. + void *generic_ip;
  1605. + } u;
  1606. +};
  1607. +
  1608. +static inline void inode_add_bytes(struct inode *inode, loff_t bytes)
  1609. +{
  1610. + inode->i_blocks += bytes >> 9;
  1611. + bytes &= 511;
  1612. + inode->i_bytes += bytes;
  1613. + if (inode->i_bytes >= 512) {
  1614. + inode->i_blocks++;
  1615. + inode->i_bytes -= 512;
  1616. + }
  1617. +}
  1618. +
  1619. +static inline void inode_sub_bytes(struct inode *inode, loff_t bytes)
  1620. +{
  1621. + inode->i_blocks -= bytes >> 9;
  1622. + bytes &= 511;
  1623. + if (inode->i_bytes < bytes) {
  1624. + inode->i_blocks--;
  1625. + inode->i_bytes += 512;
  1626. + }
  1627. + inode->i_bytes -= bytes;
  1628. +}
  1629. +
  1630. +static inline loff_t inode_get_bytes(struct inode *inode)
  1631. +{
  1632. + return (((loff_t)inode->i_blocks) << 9) + inode->i_bytes;
  1633. +}
  1634. +
  1635. +static inline void inode_set_bytes(struct inode *inode, loff_t bytes)
  1636. +{
  1637. + inode->i_blocks = bytes >> 9;
  1638. + inode->i_bytes = bytes & 511;
  1639. +}
  1640. +
  1641. +struct fown_struct {
  1642. + int pid; /* pid or -pgrp where SIGIO should be sent */
  1643. + uid_t uid, euid; /* uid/euid of process setting the owner */
  1644. + int signum; /* posix.1b rt signal to be delivered on IO */
  1645. +};
  1646. +
  1647. +struct file {
  1648. + struct list_head f_list;
  1649. + struct dentry *f_dentry;
  1650. + struct vfsmount *f_vfsmnt;
  1651. + struct file_operations *f_op;
  1652. + atomic_t f_count;
  1653. + unsigned int f_flags;
  1654. + mode_t f_mode;
  1655. + loff_t f_pos;
  1656. + unsigned long f_reada, f_ramax, f_raend, f_ralen, f_rawin;
  1657. + struct fown_struct f_owner;
  1658. + unsigned int f_uid, f_gid;
  1659. + int f_error;
  1660. +
  1661. + unsigned long f_version;
  1662. +
  1663. + /* needed for tty driver, and maybe others */
  1664. + void *private_data;
  1665. +
  1666. + /* preallocated helper kiobuf to speedup O_DIRECT */
  1667. + struct kiobuf *f_iobuf;
  1668. + long f_iobuf_lock;
  1669. +};
  1670. +extern spinlock_t files_lock;
  1671. +#define file_list_lock() spin_lock(&files_lock);
  1672. +#define file_list_unlock() spin_unlock(&files_lock);
  1673. +
  1674. +#define get_file(x) atomic_inc(&(x)->f_count)
  1675. +#define file_count(x) atomic_read(&(x)->f_count)
  1676. +
  1677. +extern int init_private_file(struct file *, struct dentry *, int);
  1678. +
  1679. +#define MAX_NON_LFS ((1UL<<31) - 1)
  1680. +
  1681. +/* Page cache limit. The filesystems should put that into their s_maxbytes
  1682. + limits, otherwise bad things can happen in VM. */
  1683. +#if BITS_PER_LONG==32
  1684. +#define MAX_LFS_FILESIZE (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
  1685. +#elif BITS_PER_LONG==64
  1686. +#define MAX_LFS_FILESIZE 0x7fffffffffffffff
  1687. +#endif
  1688. +
  1689. +#define FL_POSIX 1
  1690. +#define FL_FLOCK 2
  1691. +#define FL_BROKEN 4 /* broken flock() emulation */
  1692. +#define FL_ACCESS 8 /* for processes suspended by mandatory locking */
  1693. +#define FL_LOCKD 16 /* lock held by rpc.lockd */
  1694. +#define FL_LEASE 32 /* lease held on this file */
  1695. +
  1696. +/*
  1697. + * The POSIX file lock owner is determined by
  1698. + * the "struct files_struct" in the thread group
  1699. + * (or NULL for no owner - BSD locks).
  1700. + *
  1701. + * Lockd stuffs a "host" pointer into this.
  1702. + */
  1703. +typedef struct files_struct *fl_owner_t;
  1704. +
  1705. +struct file_lock {
  1706. + struct file_lock *fl_next; /* singly linked list for this inode */
  1707. + struct list_head fl_link; /* doubly linked list of all locks */
  1708. + struct list_head fl_block; /* circular list of blocked processes */
  1709. + fl_owner_t fl_owner;
  1710. + unsigned int fl_pid;
  1711. + wait_queue_head_t fl_wait;
  1712. + struct file *fl_file;
  1713. + unsigned char fl_flags;
  1714. + unsigned char fl_type;
  1715. + loff_t fl_start;
  1716. + loff_t fl_end;
  1717. +
  1718. + void (*fl_notify)(struct file_lock *); /* unblock callback */
  1719. + void (*fl_insert)(struct file_lock *); /* lock insertion callback */
  1720. + void (*fl_remove)(struct file_lock *); /* lock removal callback */
  1721. +
  1722. + struct fasync_struct * fl_fasync; /* for lease break notifications */
  1723. + unsigned long fl_break_time; /* for nonblocking lease breaks */
  1724. +
  1725. + union {
  1726. + struct nfs_lock_info nfs_fl;
  1727. + } fl_u;
  1728. +};
  1729. +
  1730. +/* The following constant reflects the upper bound of the file/locking space */
  1731. +#ifndef OFFSET_MAX
  1732. +#define INT_LIMIT(x) (~((x)1 << (sizeof(x)*8 - 1)))
  1733. +#define OFFSET_MAX INT_LIMIT(loff_t)
  1734. +#define OFFT_OFFSET_MAX INT_LIMIT(off_t)
  1735. +#endif
  1736. +
  1737. +extern struct list_head file_lock_list;
  1738. +
  1739. +#include <linux/fcntl.h>
  1740. +
  1741. +extern int fcntl_getlk(unsigned int, struct flock *);
  1742. +extern int fcntl_setlk(unsigned int, unsigned int, struct flock *);
  1743. +
  1744. +extern int fcntl_getlk64(unsigned int, struct flock64 *);
  1745. +extern int fcntl_setlk64(unsigned int, unsigned int, struct flock64 *);
  1746. +
  1747. +/* fs/locks.c */
  1748. +extern void locks_init_lock(struct file_lock *);
  1749. +extern void locks_copy_lock(struct file_lock *, struct file_lock *);
  1750. +extern void locks_remove_posix(struct file *, fl_owner_t);
  1751. +extern void locks_remove_flock(struct file *);
  1752. +extern struct file_lock *posix_test_lock(struct file *, struct file_lock *);
  1753. +extern int posix_lock_file(struct file *, struct file_lock *, unsigned int);
  1754. +extern void posix_block_lock(struct file_lock *, struct file_lock *);
  1755. +extern void posix_unblock_lock(struct file_lock *);
  1756. +extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
  1757. +extern int __get_lease(struct inode *inode, unsigned int flags);
  1758. +extern time_t lease_get_mtime(struct inode *);
  1759. +extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
  1760. +extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
  1761. +extern void steal_locks(fl_owner_t from);
  1762. +
  1763. +struct fasync_struct {
  1764. + int magic;
  1765. + int fa_fd;
  1766. + struct fasync_struct *fa_next; /* singly linked list */
  1767. + struct file *fa_file;
  1768. +};
  1769. +
  1770. +#define FASYNC_MAGIC 0x4601
  1771. +
  1772. +/* SMP safe fasync helpers: */
  1773. +extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
  1774. +/* can be called from interrupts */
  1775. +extern void kill_fasync(struct fasync_struct **, int, int);
  1776. +/* only for net: no internal synchronization */
  1777. +extern void __kill_fasync(struct fasync_struct *, int, int);
  1778. +
  1779. +struct nameidata {
  1780. + struct dentry *dentry;
  1781. + struct vfsmount *mnt;
  1782. + struct qstr last;
  1783. + unsigned int flags;
  1784. + int last_type;
  1785. +};
  1786. +
  1787. +/*
  1788. + * Umount options
  1789. + */
  1790. +
  1791. +#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
  1792. +#define MNT_DETACH 0x00000002 /* Just detach from the tree */
  1793. +
  1794. +#include <linux/minix_fs_sb.h>
  1795. +#include <linux/ext2_fs_sb.h>
  1796. +#include <linux/ext3_fs_sb.h>
  1797. +#include <linux/hpfs_fs_sb.h>
  1798. +#include <linux/ntfs_fs_sb.h>
  1799. +#include <linux/msdos_fs_sb.h>
  1800. +#include <linux/iso_fs_sb.h>
  1801. +#include <linux/nfs_fs_sb.h>
  1802. +#include <linux/sysv_fs_sb.h>
  1803. +#include <linux/affs_fs_sb.h>
  1804. +#include <linux/ufs_fs_sb.h>
  1805. +#include <linux/efs_fs_sb.h>
  1806. +#include <linux/romfs_fs_sb.h>
  1807. +#include <linux/smb_fs_sb.h>
  1808. +#include <linux/hfs_fs_sb.h>
  1809. +#include <linux/adfs_fs_sb.h>
  1810. +#include <linux/qnx4_fs_sb.h>
  1811. +#include <linux/reiserfs_fs_sb.h>
  1812. +#include <linux/bfs_fs_sb.h>
  1813. +#include <linux/udf_fs_sb.h>
  1814. +#include <linux/ncp_fs_sb.h>
  1815. +#include <linux/usbdev_fs_sb.h>
  1816. +#include <linux/cramfs_fs_sb.h>
  1817. +#include <linux/jffs2_fs_sb.h>
  1818. +
  1819. +extern struct list_head super_blocks;
  1820. +extern spinlock_t sb_lock;
  1821. +
  1822. +#define sb_entry(list) list_entry((list), struct super_block, s_list)
  1823. +#define S_BIAS (1<<30)
  1824. +struct super_block {
  1825. + struct list_head s_list; /* Keep this first */
  1826. + kdev_t s_dev;
  1827. + unsigned long s_blocksize;
  1828. + unsigned char s_blocksize_bits;
  1829. + unsigned char s_dirt;
  1830. + unsigned long long s_maxbytes; /* Max file size */
  1831. + struct file_system_type *s_type;
  1832. + struct super_operations *s_op;
  1833. + struct dquot_operations *dq_op;
  1834. + struct quotactl_ops *s_qcop;
  1835. + unsigned long s_flags;
  1836. + unsigned long s_magic;
  1837. + struct dentry *s_root;
  1838. + struct rw_semaphore s_umount;
  1839. + struct semaphore s_lock;
  1840. + int s_count;
  1841. + atomic_t s_active;
  1842. +
  1843. + struct list_head s_dirty; /* dirty inodes */
  1844. + struct list_head s_locked_inodes;/* inodes being synced */
  1845. + struct list_head s_files;
  1846. +
  1847. + struct block_device *s_bdev;
  1848. + struct list_head s_instances;
  1849. + struct quota_info s_dquot; /* Diskquota specific options */
  1850. +
  1851. + union {
  1852. + struct minix_sb_info minix_sb;
  1853. + struct ext2_sb_info ext2_sb;
  1854. + struct ext3_sb_info ext3_sb;
  1855. + struct hpfs_sb_info hpfs_sb;
  1856. + struct ntfs_sb_info ntfs_sb;
  1857. + struct msdos_sb_info msdos_sb;
  1858. + struct isofs_sb_info isofs_sb;
  1859. + struct nfs_sb_info nfs_sb;
  1860. + struct sysv_sb_info sysv_sb;
  1861. + struct affs_sb_info affs_sb;
  1862. + struct ufs_sb_info ufs_sb;
  1863. + struct efs_sb_info efs_sb;
  1864. + struct shmem_sb_info shmem_sb;
  1865. + struct romfs_sb_info romfs_sb;
  1866. + struct smb_sb_info smbfs_sb;
  1867. + struct hfs_sb_info hfs_sb;
  1868. + struct adfs_sb_info adfs_sb;
  1869. + struct qnx4_sb_info qnx4_sb;
  1870. + struct reiserfs_sb_info reiserfs_sb;
  1871. + struct bfs_sb_info bfs_sb;
  1872. + struct udf_sb_info udf_sb;
  1873. + struct ncp_sb_info ncpfs_sb;
  1874. + struct usbdev_sb_info usbdevfs_sb;
  1875. + struct jffs2_sb_info jffs2_sb;
  1876. + struct cramfs_sb_info cramfs_sb;
  1877. + void *generic_sbp;
  1878. + } u;
  1879. + /*
  1880. + * The next field is for VFS *only*. No filesystems have any business
  1881. + * even looking at it. You had been warned.
  1882. + */
  1883. + struct semaphore s_vfs_rename_sem; /* Kludge */
  1884. +
  1885. + /* The next field is used by knfsd when converting a (inode number based)
  1886. + * file handle into a dentry. As it builds a path in the dcache tree from
  1887. + * the bottom up, there may for a time be a subpath of dentrys which is not
  1888. + * connected to the main tree. This semaphore ensure that there is only ever
  1889. + * one such free path per filesystem. Note that unconnected files (or other
  1890. + * non-directories) are allowed, but not unconnected diretories.
  1891. + */
  1892. + struct semaphore s_nfsd_free_path_sem;
  1893. +};
  1894. +
  1895. +/*
  1896. + * VFS helper functions..
  1897. + */
  1898. +extern int vfs_create(struct inode *, struct dentry *, int);
  1899. +extern int vfs_mkdir(struct inode *, struct dentry *, int);
  1900. +extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
  1901. +extern int vfs_symlink(struct inode *, struct dentry *, const char *);
  1902. +extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
  1903. +extern int vfs_rmdir(struct inode *, struct dentry *);
  1904. +extern int vfs_unlink(struct inode *, struct dentry *);
  1905. +extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
  1906. +
  1907. +/*
  1908. + * File types
  1909. + */
  1910. +#define DT_UNKNOWN 0
  1911. +#define DT_FIFO 1
  1912. +#define DT_CHR 2
  1913. +#define DT_DIR 4
  1914. +#define DT_BLK 6
  1915. +#define DT_REG 8
  1916. +#define DT_LNK 10
  1917. +#define DT_SOCK 12
  1918. +#define DT_WHT 14
  1919. +
  1920. +/*
  1921. + * This is the "filldir" function type, used by readdir() to let
  1922. + * the kernel specify what kind of dirent layout it wants to have.
  1923. + * This allows the kernel to read directories into kernel space or
  1924. + * to have different dirent layouts depending on the binary type.
  1925. + */
  1926. +typedef int (*filldir_t)(void *, const char *, int, loff_t, ino_t, unsigned);
  1927. +
  1928. +struct block_device_operations {
  1929. + int (*open) (struct inode *, struct file *);
  1930. + int (*release) (struct inode *, struct file *);
  1931. + int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long);
  1932. + int (*check_media_change) (kdev_t);
  1933. + int (*revalidate) (kdev_t);
  1934. + struct module *owner;
  1935. +};
  1936. +
  1937. +/*
  1938. + * NOTE:
  1939. + * read, write, poll, fsync, readv, writev can be called
  1940. + * without the big kernel lock held in all filesystems.
  1941. + */
  1942. +struct file_operations {
  1943. + struct module *owner;
  1944. + loff_t (*llseek) (struct file *, loff_t, int);
  1945. + ssize_t (*read) (struct file *, char *, size_t, loff_t *);
  1946. + ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
  1947. + int (*readdir) (struct file *, void *, filldir_t);
  1948. + unsigned int (*poll) (struct file *, struct poll_table_struct *);
  1949. + int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
  1950. + int (*mmap) (struct file *, struct vm_area_struct *);
  1951. + int (*open) (struct inode *, struct file *);
  1952. + int (*flush) (struct file *);
  1953. + int (*release) (struct inode *, struct file *);
  1954. + int (*fsync) (struct file *, struct dentry *, int datasync);
  1955. + int (*fasync) (int, struct file *, int);
  1956. + int (*lock) (struct file *, int, struct file_lock *);
  1957. + ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
  1958. + ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
  1959. + ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
  1960. + unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
  1961. +};
  1962. +
  1963. +struct inode_operations {
  1964. + int (*create) (struct inode *,struct dentry *,int);
  1965. + struct dentry * (*lookup) (struct inode *,struct dentry *);
  1966. + int (*link) (struct dentry *,struct inode *,struct dentry *);
  1967. + int (*unlink) (struct inode *,struct dentry *);
  1968. + int (*symlink) (struct inode *,struct dentry *,const char *);
  1969. + int (*mkdir) (struct inode *,struct dentry *,int);
  1970. + int (*rmdir) (struct inode *,struct dentry *);
  1971. + int (*mknod) (struct inode *,struct dentry *,int,int);
  1972. + int (*rename) (struct inode *, struct dentry *,
  1973. + struct inode *, struct dentry *);
  1974. + int (*readlink) (struct dentry *, char *,int);
  1975. + int (*follow_link) (struct dentry *, struct nameidata *);
  1976. + void (*truncate) (struct inode *);
  1977. + int (*permission) (struct inode *, int);
  1978. + int (*revalidate) (struct dentry *);
  1979. + int (*setattr) (struct dentry *, struct iattr *);
  1980. + int (*getattr) (struct dentry *, struct iattr *);
  1981. + int (*setxattr) (struct dentry *, const char *, void *, size_t, int);
  1982. + ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
  1983. + ssize_t (*listxattr) (struct dentry *, char *, size_t);
  1984. + int (*removexattr) (struct dentry *, const char *);
  1985. +};
  1986. +
  1987. +struct seq_file;
  1988. +
  1989. +/*
  1990. + * NOTE: write_inode, delete_inode, clear_inode, put_inode can be called
  1991. + * without the big kernel lock held in all filesystems.
  1992. + */
  1993. +struct super_operations {
  1994. + struct inode *(*alloc_inode)(struct super_block *sb);
  1995. + void (*destroy_inode)(struct inode *);
  1996. +
  1997. + void (*read_inode) (struct inode *);
  1998. +
  1999. + /* reiserfs kludge. reiserfs needs 64 bits of information to
  2000. + ** find an inode. We are using the read_inode2 call to get
  2001. + ** that information. We don't like this, and are waiting on some
  2002. + ** VFS changes for the real solution.
  2003. + ** iget4 calls read_inode2, iff it is defined
  2004. + */
  2005. + void (*read_inode2) (struct inode *, void *) ;
  2006. + void (*dirty_inode) (struct inode *);
  2007. + void (*write_inode) (struct inode *, int);
  2008. + void (*put_inode) (struct inode *);
  2009. + void (*delete_inode) (struct inode *);
  2010. + void (*put_super) (struct super_block *);
  2011. + void (*write_super) (struct super_block *);
  2012. + int (*sync_fs) (struct super_block *);
  2013. + void (*write_super_lockfs) (struct super_block *);
  2014. + void (*unlockfs) (struct super_block *);
  2015. + int (*statfs) (struct super_block *, struct statfs *);
  2016. + int (*remount_fs) (struct super_block *, int *, char *);
  2017. + void (*clear_inode) (struct inode *);
  2018. + void (*umount_begin) (struct super_block *);
  2019. +
  2020. + /* Following are for knfsd to interact with "interesting" filesystems
  2021. + * Currently just reiserfs, but possibly FAT and others later
  2022. + *
  2023. + * fh_to_dentry is given a filehandle fragement with length, and a type flag
  2024. + * and must return a dentry for the referenced object or, if "parent" is
  2025. + * set, a dentry for the parent of the object.
  2026. + * If a dentry cannot be found, a "root" dentry should be created and
  2027. + * flaged as DCACHE_NFSD_DISCONNECTED. nfsd_iget is an example implementation.
  2028. + *
  2029. + * dentry_to_fh is given a dentry and must generate the filesys specific
  2030. + * part of the file handle. Available length is passed in *lenp and used
  2031. + * length should be returned therein.
  2032. + * If need_parent is set, then dentry_to_fh should encode sufficient information
  2033. + * to find the (current) parent.
  2034. + * dentry_to_fh should return a 1byte "type" which will be passed back in
  2035. + * the fhtype arguement to fh_to_dentry. Type of 0 is reserved.
  2036. + * If filesystem was exportable before the introduction of fh_to_dentry,
  2037. + * types 1 and 2 should be used is that same way as the generic code.
  2038. + * Type 255 means error.
  2039. + *
  2040. + * Lengths are in units of 4bytes, not bytes.
  2041. + */
  2042. + struct dentry * (*fh_to_dentry)(struct super_block *sb, __u32 *fh, int len, int fhtype, int parent);
  2043. + int (*dentry_to_fh)(struct dentry *, __u32 *fh, int *lenp, int need_parent);
  2044. + int (*show_options)(struct seq_file *, struct vfsmount *);
  2045. +};
  2046. +
  2047. +/* Inode state bits.. */
  2048. +#define I_DIRTY_SYNC 1 /* Not dirty enough for O_DATASYNC */
  2049. +#define I_DIRTY_DATASYNC 2 /* Data-related inode changes pending */
  2050. +#define I_DIRTY_PAGES 4 /* Data-related inode changes pending */
  2051. +#define I_LOCK 8
  2052. +#define I_FREEING 16
  2053. +#define I_CLEAR 32
  2054. +
  2055. +#define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES)
  2056. +
  2057. +extern void __mark_inode_dirty(struct inode *, int);
  2058. +static inline void mark_inode_dirty(struct inode *inode)
  2059. +{
  2060. + __mark_inode_dirty(inode, I_DIRTY);
  2061. +}
  2062. +
  2063. +static inline void mark_inode_dirty_sync(struct inode *inode)
  2064. +{
  2065. + __mark_inode_dirty(inode, I_DIRTY_SYNC);
  2066. +}
  2067. +
  2068. +static inline void mark_inode_dirty_pages(struct inode *inode)
  2069. +{
  2070. + __mark_inode_dirty(inode, I_DIRTY_PAGES);
  2071. +}
  2072. +
  2073. +struct file_system_type {
  2074. + const char *name;
  2075. + int fs_flags;
  2076. + struct super_block *(*read_super) (struct super_block *, void *, int);
  2077. + struct module *owner;
  2078. + struct file_system_type * next;
  2079. + struct list_head fs_supers;
  2080. +};
  2081. +
  2082. +#define DECLARE_FSTYPE(var,type,read,flags) \
  2083. +struct file_system_type var = { \
  2084. + name: type, \
  2085. + read_super: read, \
  2086. + fs_flags: flags, \
  2087. + owner: THIS_MODULE, \
  2088. +}
  2089. +
  2090. +#define DECLARE_FSTYPE_DEV(var,type,read) \
  2091. + DECLARE_FSTYPE(var,type,read,FS_REQUIRES_DEV)
  2092. +
  2093. +/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
  2094. +#define fops_get(fops) \
  2095. + (((fops) && (fops)->owner) \
  2096. + ? ( try_inc_mod_count((fops)->owner) ? (fops) : NULL ) \
  2097. + : (fops))
  2098. +
  2099. +#define fops_put(fops) \
  2100. +do { \
  2101. + if ((fops) && (fops)->owner) \
  2102. + __MOD_DEC_USE_COUNT((fops)->owner); \
  2103. +} while(0)
  2104. +
  2105. +extern int register_filesystem(struct file_system_type *);
  2106. +extern int unregister_filesystem(struct file_system_type *);
  2107. +extern struct vfsmount *kern_mount(struct file_system_type *);
  2108. +extern int may_umount(struct vfsmount *);
  2109. +extern long do_mount(char *, char *, char *, unsigned long, void *);
  2110. +
  2111. +#define kern_umount mntput
  2112. +
  2113. +extern int vfs_statfs(struct super_block *, struct statfs *);
  2114. +
  2115. +/* Return value for VFS lock functions - tells locks.c to lock conventionally
  2116. + * REALLY kosha for root NFS and nfs_lock
  2117. + */
  2118. +#define LOCK_USE_CLNT 1
  2119. +
  2120. +#define FLOCK_VERIFY_READ 1
  2121. +#define FLOCK_VERIFY_WRITE 2
  2122. +
  2123. +extern int locks_mandatory_locked(struct inode *);
  2124. +extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
  2125. +
  2126. +/*
  2127. + * Candidates for mandatory locking have the setgid bit set
  2128. + * but no group execute bit - an otherwise meaningless combination.
  2129. + */
  2130. +#define MANDATORY_LOCK(inode) \
  2131. + (IS_MANDLOCK(inode) && ((inode)->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
  2132. +
  2133. +static inline int locks_verify_locked(struct inode *inode)
  2134. +{
  2135. + if (MANDATORY_LOCK(inode))
  2136. + return locks_mandatory_locked(inode);
  2137. + return 0;
  2138. +}
  2139. +
  2140. +static inline int locks_verify_area(int read_write, struct inode *inode,
  2141. + struct file *filp, loff_t offset,
  2142. + size_t count)
  2143. +{
  2144. + if (inode->i_flock && MANDATORY_LOCK(inode))
  2145. + return locks_mandatory_area(read_write, inode, filp, offset, count);
  2146. + return 0;
  2147. +}
  2148. +
  2149. +static inline int locks_verify_truncate(struct inode *inode,
  2150. + struct file *filp,
  2151. + loff_t size)
  2152. +{
  2153. + if (inode->i_flock && MANDATORY_LOCK(inode))
  2154. + return locks_mandatory_area(
  2155. + FLOCK_VERIFY_WRITE, inode, filp,
  2156. + size < inode->i_size ? size : inode->i_size,
  2157. + (size < inode->i_size ? inode->i_size - size
  2158. + : size - inode->i_size)
  2159. + );
  2160. + return 0;
  2161. +}
  2162. +
  2163. +static inline int get_lease(struct inode *inode, unsigned int mode)
  2164. +{
  2165. + if (inode->i_flock)
  2166. + return __get_lease(inode, mode);
  2167. + return 0;
  2168. +}
  2169. +
  2170. +/* fs/open.c */
  2171. +
  2172. +asmlinkage long sys_open(const char *, int, int);
  2173. +asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */
  2174. +extern int do_truncate(struct dentry *, loff_t start);
  2175. +
  2176. +extern struct file *filp_open(const char *, int, int);
  2177. +extern struct file * dentry_open(struct dentry *, struct vfsmount *, int);
  2178. +extern int filp_close(struct file *, fl_owner_t id);
  2179. +extern char * getname(const char *);
  2180. +
  2181. +/* fs/dcache.c */
  2182. +extern void vfs_caches_init(unsigned long);
  2183. +
  2184. +#define __getname() kmem_cache_alloc(names_cachep, SLAB_KERNEL)
  2185. +#define putname(name) kmem_cache_free(names_cachep, (void *)(name))
  2186. +
  2187. +enum {BDEV_FILE, BDEV_SWAP, BDEV_FS, BDEV_RAW};
  2188. +extern int register_blkdev(unsigned int, const char *, struct block_device_operations *);
  2189. +extern int unregister_blkdev(unsigned int, const char *);
  2190. +extern struct block_device *bdget(dev_t);
  2191. +extern int bd_acquire(struct inode *inode);
  2192. +extern void bd_forget(struct inode *inode);
  2193. +extern void bdput(struct block_device *);
  2194. +extern struct char_device *cdget(dev_t);
  2195. +extern void cdput(struct char_device *);
  2196. +extern int blkdev_open(struct inode *, struct file *);
  2197. +extern int blkdev_close(struct inode *, struct file *);
  2198. +extern struct file_operations def_blk_fops;
  2199. +extern struct address_space_operations def_blk_aops;
  2200. +extern struct file_operations def_fifo_fops;
  2201. +extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
  2202. +extern int blkdev_get(struct block_device *, mode_t, unsigned, int);
  2203. +extern int blkdev_put(struct block_device *, int);
  2204. +
  2205. +/* fs/devices.c */
  2206. +extern const struct block_device_operations *get_blkfops(unsigned int);
  2207. +extern int register_chrdev(unsigned int, const char *, struct file_operations *);
  2208. +extern int unregister_chrdev(unsigned int, const char *);
  2209. +extern int chrdev_open(struct inode *, struct file *);
  2210. +extern const char * bdevname(kdev_t);
  2211. +extern const char * cdevname(kdev_t);
  2212. +extern const char * kdevname(kdev_t);
  2213. +extern void init_special_inode(struct inode *, umode_t, int);
  2214. +
  2215. +/* Invalid inode operations -- fs/bad_inode.c */
  2216. +extern void make_bad_inode(struct inode *);
  2217. +extern int is_bad_inode(struct inode *);
  2218. +
  2219. +extern struct file_operations read_fifo_fops;
  2220. +extern struct file_operations write_fifo_fops;
  2221. +extern struct file_operations rdwr_fifo_fops;
  2222. +extern struct file_operations read_pipe_fops;
  2223. +extern struct file_operations write_pipe_fops;
  2224. +extern struct file_operations rdwr_pipe_fops;
  2225. +
  2226. +extern int fs_may_remount_ro(struct super_block *);
  2227. +
  2228. +extern int FASTCALL(try_to_free_buffers(struct page *, unsigned int));
  2229. +extern void refile_buffer(struct buffer_head * buf);
  2230. +extern void create_empty_buffers(struct page *, kdev_t, unsigned long);
  2231. +extern void end_buffer_io_sync(struct buffer_head *bh, int uptodate);
  2232. +
  2233. +/* reiserfs_writepage needs this */
  2234. +extern void set_buffer_async_io(struct buffer_head *bh) ;
  2235. +
  2236. +#define BUF_CLEAN 0
  2237. +#define BUF_LOCKED 1 /* Buffers scheduled for write */
  2238. +#define BUF_DIRTY 2 /* Dirty buffers, not yet scheduled for write */
  2239. +#define NR_LIST 3
  2240. +
  2241. +static inline void get_bh(struct buffer_head * bh)
  2242. +{
  2243. + atomic_inc(&(bh)->b_count);
  2244. +}
  2245. +
  2246. +static inline void put_bh(struct buffer_head *bh)
  2247. +{
  2248. + smp_mb__before_atomic_dec();
  2249. + atomic_dec(&bh->b_count);
  2250. +}
  2251. +
  2252. +/*
  2253. + * This is called by bh->b_end_io() handlers when I/O has completed.
  2254. + */
  2255. +static inline void mark_buffer_uptodate(struct buffer_head * bh, int on)
  2256. +{
  2257. + if (on)
  2258. + set_bit(BH_Uptodate, &bh->b_state);
  2259. + else
  2260. + clear_bit(BH_Uptodate, &bh->b_state);
  2261. +}
  2262. +
  2263. +#define atomic_set_buffer_clean(bh) test_and_clear_bit(BH_Dirty, &(bh)->b_state)
  2264. +
  2265. +static inline void __mark_buffer_clean(struct buffer_head *bh)
  2266. +{
  2267. + refile_buffer(bh);
  2268. +}
  2269. +
  2270. +static inline void mark_buffer_clean(struct buffer_head * bh)
  2271. +{
  2272. + if (atomic_set_buffer_clean(bh))
  2273. + __mark_buffer_clean(bh);
  2274. +}
  2275. +
  2276. +extern void FASTCALL(__mark_dirty(struct buffer_head *bh));
  2277. +extern void FASTCALL(__mark_buffer_dirty(struct buffer_head *bh));
  2278. +extern void FASTCALL(mark_buffer_dirty(struct buffer_head *bh));
  2279. +
  2280. +extern void FASTCALL(buffer_insert_list(struct buffer_head *, struct list_head *));
  2281. +
  2282. +static inline void buffer_insert_inode_queue(struct buffer_head *bh, struct inode *inode)
  2283. +{
  2284. + buffer_insert_list(bh, &inode->i_dirty_buffers);
  2285. +}
  2286. +
  2287. +static inline void buffer_insert_inode_data_queue(struct buffer_head *bh, struct inode *inode)
  2288. +{
  2289. + buffer_insert_list(bh, &inode->i_dirty_data_buffers);
  2290. +}
  2291. +
  2292. +static inline int atomic_set_buffer_dirty(struct buffer_head *bh)
  2293. +{
  2294. + return test_and_set_bit(BH_Dirty, &bh->b_state);
  2295. +}
  2296. +
  2297. +static inline void mark_buffer_async(struct buffer_head * bh, int on)
  2298. +{
  2299. + if (on)
  2300. + set_bit(BH_Async, &bh->b_state);
  2301. + else
  2302. + clear_bit(BH_Async, &bh->b_state);
  2303. +}
  2304. +
  2305. +static inline void set_buffer_attached(struct buffer_head *bh)
  2306. +{
  2307. + set_bit(BH_Attached, &bh->b_state);
  2308. +}
  2309. +
  2310. +static inline void clear_buffer_attached(struct buffer_head *bh)
  2311. +{
  2312. + clear_bit(BH_Attached, &bh->b_state);
  2313. +}
  2314. +
  2315. +static inline int buffer_attached(struct buffer_head *bh)
  2316. +{
  2317. + return test_bit(BH_Attached, &bh->b_state);
  2318. +}
  2319. +
  2320. +/*
  2321. + * If an error happens during the make_request, this function
  2322. + * has to be recalled. It marks the buffer as clean and not
  2323. + * uptodate, and it notifys the upper layer about the end
  2324. + * of the I/O.
  2325. + */
  2326. +static inline void buffer_IO_error(struct buffer_head * bh)
  2327. +{
  2328. + mark_buffer_clean(bh);
  2329. + /*
  2330. + * b_end_io has to clear the BH_Uptodate bitflag in the error case!
  2331. + */
  2332. + bh->b_end_io(bh, 0);
  2333. +}
  2334. +
  2335. +static inline void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
  2336. +{
  2337. + mark_buffer_dirty(bh);
  2338. + buffer_insert_inode_queue(bh, inode);
  2339. +}
  2340. +
  2341. +extern void set_buffer_flushtime(struct buffer_head *);
  2342. +extern void balance_dirty(void);
  2343. +extern int check_disk_change(kdev_t);
  2344. +extern int invalidate_inodes(struct super_block *);
  2345. +extern int invalidate_device(kdev_t, int);
  2346. +extern void invalidate_inode_pages(struct inode *);
  2347. +extern void invalidate_inode_pages2(struct address_space *);
  2348. +extern void invalidate_inode_buffers(struct inode *);
  2349. +#define invalidate_buffers(dev) __invalidate_buffers((dev), 0)
  2350. +#define destroy_buffers(dev) __invalidate_buffers((dev), 1)
  2351. +extern void invalidate_bdev(struct block_device *, int);
  2352. +extern void __invalidate_buffers(kdev_t dev, int);
  2353. +extern void sync_inodes(kdev_t);
  2354. +extern void sync_unlocked_inodes(void);
  2355. +extern void write_inode_now(struct inode *, int);
  2356. +extern int sync_buffers(kdev_t, int);
  2357. +extern void sync_dev(kdev_t);
  2358. +extern int fsync_dev(kdev_t);
  2359. +extern int fsync_super(struct super_block *);
  2360. +extern int fsync_no_super(kdev_t);
  2361. +extern void sync_inodes_sb(struct super_block *);
  2362. +extern int fsync_buffers_list(struct list_head *);
  2363. +static inline int fsync_inode_buffers(struct inode *inode)
  2364. +{
  2365. + return fsync_buffers_list(&inode->i_dirty_buffers);
  2366. +}
  2367. +static inline int fsync_inode_data_buffers(struct inode *inode)
  2368. +{
  2369. + return fsync_buffers_list(&inode->i_dirty_data_buffers);
  2370. +}
  2371. +extern int inode_has_buffers(struct inode *);
  2372. +extern int do_fdatasync(struct file *);
  2373. +extern int filemap_fdatasync(struct address_space *);
  2374. +extern int filemap_fdatawait(struct address_space *);
  2375. +extern void sync_supers(kdev_t dev, int wait);
  2376. +extern int bmap(struct inode *, int);
  2377. +extern int notify_change(struct dentry *, struct iattr *);
  2378. +extern int permission(struct inode *, int);
  2379. +extern int vfs_permission(struct inode *, int);
  2380. +extern int get_write_access(struct inode *);
  2381. +extern int deny_write_access(struct file *);
  2382. +static inline void put_write_access(struct inode * inode)
  2383. +{
  2384. + atomic_dec(&inode->i_writecount);
  2385. +}
  2386. +static inline void allow_write_access(struct file *file)
  2387. +{
  2388. + if (file)
  2389. + atomic_inc(&file->f_dentry->d_inode->i_writecount);
  2390. +}
  2391. +extern int do_pipe(int *);
  2392. +
  2393. +extern int open_namei(const char *, int, int, struct nameidata *);
  2394. +
  2395. +extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
  2396. +extern struct file * open_exec(const char *);
  2397. +
  2398. +/* fs/dcache.c -- generic fs support functions */
  2399. +extern int is_subdir(struct dentry *, struct dentry *);
  2400. +extern ino_t find_inode_number(struct dentry *, struct qstr *);
  2401. +
  2402. +/*
  2403. + * Kernel pointers have redundant information, so we can use a
  2404. + * scheme where we can return either an error code or a dentry
  2405. + * pointer with the same return value.
  2406. + *
  2407. + * This should be a per-architecture thing, to allow different
  2408. + * error and pointer decisions.
  2409. + */
  2410. +static inline void *ERR_PTR(long error)
  2411. +{
  2412. + return (void *) error;
  2413. +}
  2414. +
  2415. +static inline long PTR_ERR(const void *ptr)
  2416. +{
  2417. + return (long) ptr;
  2418. +}
  2419. +
  2420. +static inline long IS_ERR(const void *ptr)
  2421. +{
  2422. + return (unsigned long)ptr > (unsigned long)-1000L;
  2423. +}
  2424. +
  2425. +/*
  2426. + * The bitmask for a lookup event:
  2427. + * - follow links at the end
  2428. + * - require a directory
  2429. + * - ending slashes ok even for nonexistent files
  2430. + * - internal "there are more path compnents" flag
  2431. + */
  2432. +#define LOOKUP_FOLLOW (1)
  2433. +#define LOOKUP_DIRECTORY (2)
  2434. +#define LOOKUP_CONTINUE (4)
  2435. +#define LOOKUP_POSITIVE (8)
  2436. +#define LOOKUP_PARENT (16)
  2437. +#define LOOKUP_NOALT (32)
  2438. +/*
  2439. + * Type of the last component on LOOKUP_PARENT
  2440. + */
  2441. +enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
  2442. +
  2443. +/*
  2444. + * "descriptor" for what we're up to with a read for sendfile().
  2445. + * This allows us to use the same read code yet
  2446. + * have multiple different users of the data that
  2447. + * we read from a file.
  2448. + *
  2449. + * The simplest case just copies the data to user
  2450. + * mode.
  2451. + */
  2452. +typedef struct {
  2453. + size_t written;
  2454. + size_t count;
  2455. + char * buf;
  2456. + int error;
  2457. +} read_descriptor_t;
  2458. +
  2459. +typedef int (*read_actor_t)(read_descriptor_t *, struct page *, unsigned long, unsigned long);
  2460. +
  2461. +/* needed for stackable file system support */
  2462. +extern loff_t default_llseek(struct file *file, loff_t offset, int origin);
  2463. +
  2464. +extern int FASTCALL(__user_walk(const char *, unsigned, struct nameidata *));
  2465. +extern int FASTCALL(path_init(const char *, unsigned, struct nameidata *));
  2466. +extern int FASTCALL(path_walk(const char *, struct nameidata *));
  2467. +extern int FASTCALL(path_lookup(const char *, unsigned, struct nameidata *));
  2468. +extern int FASTCALL(link_path_walk(const char *, struct nameidata *));
  2469. +extern void path_release(struct nameidata *);
  2470. +extern int follow_down(struct vfsmount **, struct dentry **);
  2471. +extern int follow_up(struct vfsmount **, struct dentry **);
  2472. +extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
  2473. +extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
  2474. +#define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
  2475. +#define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
  2476. +
  2477. +extern void inode_init_once(struct inode *);
  2478. +extern void iput(struct inode *);
  2479. +extern void force_delete(struct inode *);
  2480. +extern struct inode * igrab(struct inode *);
  2481. +extern ino_t iunique(struct super_block *, ino_t);
  2482. +
  2483. +typedef int (*find_inode_t)(struct inode *, unsigned long, void *);
  2484. +extern struct inode * iget4(struct super_block *, unsigned long, find_inode_t, void *);
  2485. +static inline struct inode *iget(struct super_block *sb, unsigned long ino)
  2486. +{
  2487. + return iget4(sb, ino, NULL, NULL);
  2488. +}
  2489. +
  2490. +extern void clear_inode(struct inode *);
  2491. +extern struct inode *new_inode(struct super_block *sb);
  2492. +extern void remove_suid(struct inode *inode);
  2493. +
  2494. +extern void insert_inode_hash(struct inode *);
  2495. +extern void remove_inode_hash(struct inode *);
  2496. +extern struct file * get_empty_filp(void);
  2497. +extern void file_move(struct file *f, struct list_head *list);
  2498. +extern struct buffer_head * get_hash_table(kdev_t, int, int);
  2499. +extern struct buffer_head * getblk(kdev_t, int, int);
  2500. +extern void ll_rw_block(int, int, struct buffer_head * bh[]);
  2501. +extern void submit_bh(int, struct buffer_head *);
  2502. +extern int is_read_only(kdev_t);
  2503. +extern void __brelse(struct buffer_head *);
  2504. +static inline void brelse(struct buffer_head *buf)
  2505. +{
  2506. + if (buf)
  2507. + __brelse(buf);
  2508. +}
  2509. +extern void __bforget(struct buffer_head *);
  2510. +static inline void bforget(struct buffer_head *buf)
  2511. +{
  2512. + if (buf)
  2513. + __bforget(buf);
  2514. +}
  2515. +extern int set_blocksize(kdev_t, int);
  2516. +extern int sb_set_blocksize(struct super_block *, int);
  2517. +extern int sb_min_blocksize(struct super_block *, int);
  2518. +extern struct buffer_head * bread(kdev_t, int, int);
  2519. +static inline struct buffer_head * sb_bread(struct super_block *sb, int block)
  2520. +{
  2521. + return bread(sb->s_dev, block, sb->s_blocksize);
  2522. +}
  2523. +static inline struct buffer_head * sb_getblk(struct super_block *sb, int block)
  2524. +{
  2525. + return getblk(sb->s_dev, block, sb->s_blocksize);
  2526. +}
  2527. +static inline struct buffer_head * sb_get_hash_table(struct super_block *sb, int block)
  2528. +{
  2529. + return get_hash_table(sb->s_dev, block, sb->s_blocksize);
  2530. +}
  2531. +extern void wakeup_bdflush(void);
  2532. +extern void put_unused_buffer_head(struct buffer_head * bh);
  2533. +extern struct buffer_head * get_unused_buffer_head(int async);
  2534. +
  2535. +extern int brw_page(int, struct page *, kdev_t, int [], int);
  2536. +
  2537. +typedef int (get_block_t)(struct inode*,long,struct buffer_head*,int);
  2538. +
  2539. +/* Generic buffer handling for block filesystems.. */
  2540. +extern int try_to_release_page(struct page * page, int gfp_mask);
  2541. +extern int discard_bh_page(struct page *, unsigned long, int);
  2542. +#define block_flushpage(page, offset) discard_bh_page(page, offset, 1)
  2543. +#define block_invalidate_page(page) discard_bh_page(page, 0, 0)
  2544. +extern int block_symlink(struct inode *, const char *, int);
  2545. +extern int block_write_full_page(struct page*, get_block_t*);
  2546. +extern int block_read_full_page(struct page*, get_block_t*);
  2547. +extern int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
  2548. +extern int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
  2549. + unsigned long *);
  2550. +extern int generic_cont_expand(struct inode *inode, loff_t size) ;
  2551. +extern int block_commit_write(struct page *page, unsigned from, unsigned to);
  2552. +extern int block_sync_page(struct page *);
  2553. +
  2554. +int generic_block_bmap(struct address_space *, long, get_block_t *);
  2555. +int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
  2556. +int block_truncate_page(struct address_space *, loff_t, get_block_t *);
  2557. +extern int generic_direct_IO(int, struct inode *, struct kiobuf *, unsigned long, int, get_block_t *);
  2558. +extern int waitfor_one_page(struct page *);
  2559. +extern int writeout_one_page(struct page *);
  2560. +
  2561. +extern int generic_file_mmap(struct file *, struct vm_area_struct *);
  2562. +extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
  2563. +extern ssize_t generic_file_read(struct file *, char *, size_t, loff_t *);
  2564. +extern int precheck_file_write(struct file *, struct inode *, size_t *, loff_t *);
  2565. +extern ssize_t generic_file_write(struct file *, const char *, size_t, loff_t *);
  2566. +extern void do_generic_file_read(struct file *, loff_t *, read_descriptor_t *, read_actor_t);
  2567. +extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
  2568. +extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
  2569. +extern ssize_t generic_read_dir(struct file *, char *, size_t, loff_t *);
  2570. +extern int generic_file_open(struct inode * inode, struct file * filp);
  2571. +
  2572. +extern struct file_operations generic_ro_fops;
  2573. +
  2574. +extern int vfs_readlink(struct dentry *, char *, int, const char *);
  2575. +extern int vfs_follow_link(struct nameidata *, const char *);
  2576. +extern int page_readlink(struct dentry *, char *, int);
  2577. +extern int page_follow_link(struct dentry *, struct nameidata *);
  2578. +extern struct inode_operations page_symlink_inode_operations;
  2579. +
  2580. +extern int vfs_readdir(struct file *, filldir_t, void *);
  2581. +extern int dcache_dir_open(struct inode *, struct file *);
  2582. +extern int dcache_dir_close(struct inode *, struct file *);
  2583. +extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
  2584. +extern int dcache_dir_fsync(struct file *, struct dentry *, int);
  2585. +extern int dcache_readdir(struct file *, void *, filldir_t);
  2586. +extern struct file_operations dcache_dir_ops;
  2587. +
  2588. +extern struct file_system_type *get_fs_type(const char *name);
  2589. +extern struct super_block *get_super(kdev_t);
  2590. +extern void drop_super(struct super_block *sb);
  2591. +static inline int is_mounted(kdev_t dev)
  2592. +{
  2593. + struct super_block *sb = get_super(dev);
  2594. + if (sb) {
  2595. + drop_super(sb);
  2596. + return 1;
  2597. + }
  2598. + return 0;
  2599. +}
  2600. +unsigned long generate_cluster(kdev_t, int b[], int);
  2601. +unsigned long generate_cluster_swab32(kdev_t, int b[], int);
  2602. +extern kdev_t ROOT_DEV;
  2603. +extern char root_device_name[];
  2604. +
  2605. +
  2606. +extern void show_buffers(void);
  2607. +
  2608. +#ifdef CONFIG_BLK_DEV_INITRD
  2609. +extern unsigned int real_root_dev;
  2610. +#endif
  2611. +
  2612. +extern ssize_t char_read(struct file *, char *, size_t, loff_t *);
  2613. +extern ssize_t block_read(struct file *, char *, size_t, loff_t *);
  2614. +extern int read_ahead[];
  2615. +
  2616. +extern ssize_t char_write(struct file *, const char *, size_t, loff_t *);
  2617. +extern ssize_t block_write(struct file *, const char *, size_t, loff_t *);
  2618. +
  2619. +extern int file_fsync(struct file *, struct dentry *, int);
  2620. +extern int generic_buffer_fdatasync(struct inode *inode, unsigned long start_idx, unsigned long end_idx);
  2621. +extern int generic_osync_inode(struct inode *, int);
  2622. +#define OSYNC_METADATA (1<<0)
  2623. +#define OSYNC_DATA (1<<1)
  2624. +#define OSYNC_INODE (1<<2)
  2625. +
  2626. +extern int inode_change_ok(struct inode *, struct iattr *);
  2627. +extern int inode_setattr(struct inode *, struct iattr *);
  2628. +
  2629. +/* kernel/fork.c */
  2630. +extern int unshare_files(void);
  2631. +
  2632. +/*
  2633. + * Common dentry functions for inclusion in the VFS
  2634. + * or in other stackable file systems. Some of these
  2635. + * functions were in linux/fs/ C (VFS) files.
  2636. + *
  2637. + */
  2638. +
  2639. +/*
  2640. + * Locking the parent is needed to:
  2641. + * - serialize directory operations
  2642. + * - make sure the parent doesn't change from
  2643. + * under us in the middle of an operation.
  2644. + *
  2645. + * NOTE! Right now we'd rather use a "struct inode"
  2646. + * for this, but as I expect things to move toward
  2647. + * using dentries instead for most things it is
  2648. + * probably better to start with the conceptually
  2649. + * better interface of relying on a path of dentries.
  2650. + */
  2651. +static inline struct dentry *lock_parent(struct dentry *dentry)
  2652. +{
  2653. + struct dentry *dir = dget(dentry->d_parent);
  2654. +
  2655. + down(&dir->d_inode->i_sem);
  2656. + return dir;
  2657. +}
  2658. +
  2659. +static inline struct dentry *get_parent(struct dentry *dentry)
  2660. +{
  2661. + return dget(dentry->d_parent);
  2662. +}
  2663. +
  2664. +static inline void unlock_dir(struct dentry *dir)
  2665. +{
  2666. + up(&dir->d_inode->i_sem);
  2667. + dput(dir);
  2668. +}
  2669. +
  2670. +/*
  2671. + * Whee.. Deadlock country. Happily there are only two VFS
  2672. + * operations that does this..
  2673. + */
  2674. +static inline void double_down(struct semaphore *s1, struct semaphore *s2)
  2675. +{
  2676. + if (s1 != s2) {
  2677. + if ((unsigned long) s1 < (unsigned long) s2) {
  2678. + struct semaphore *tmp = s2;
  2679. + s2 = s1; s1 = tmp;
  2680. + }
  2681. + down(s1);
  2682. + }
  2683. + down(s2);
  2684. +}
  2685. +
  2686. +/*
  2687. + * Ewwwwwwww... _triple_ lock. We are guaranteed that the 3rd argument is
  2688. + * not equal to 1st and not equal to 2nd - the first case (target is parent of
  2689. + * source) would be already caught, the second is plain impossible (target is
  2690. + * its own parent and that case would be caught even earlier). Very messy.
  2691. + * I _think_ that it works, but no warranties - please, look it through.
  2692. + * Pox on bloody lusers who mandated overwriting rename() for directories...
  2693. + */
  2694. +
  2695. +static inline void triple_down(struct semaphore *s1,
  2696. + struct semaphore *s2,
  2697. + struct semaphore *s3)
  2698. +{
  2699. + if (s1 != s2) {
  2700. + if ((unsigned long) s1 < (unsigned long) s2) {
  2701. + if ((unsigned long) s1 < (unsigned long) s3) {
  2702. + struct semaphore *tmp = s3;
  2703. + s3 = s1; s1 = tmp;
  2704. + }
  2705. + if ((unsigned long) s1 < (unsigned long) s2) {
  2706. + struct semaphore *tmp = s2;
  2707. + s2 = s1; s1 = tmp;
  2708. + }
  2709. + } else {
  2710. + if ((unsigned long) s1 < (unsigned long) s3) {
  2711. + struct semaphore *tmp = s3;
  2712. + s3 = s1; s1 = tmp;
  2713. + }
  2714. + if ((unsigned long) s2 < (unsigned long) s3) {
  2715. + struct semaphore *tmp = s3;
  2716. + s3 = s2; s2 = tmp;
  2717. + }
  2718. + }
  2719. + down(s1);
  2720. + } else if ((unsigned long) s2 < (unsigned long) s3) {
  2721. + struct semaphore *tmp = s3;
  2722. + s3 = s2; s2 = tmp;
  2723. + }
  2724. + down(s2);
  2725. + down(s3);
  2726. +}
  2727. +
  2728. +static inline void double_up(struct semaphore *s1, struct semaphore *s2)
  2729. +{
  2730. + up(s1);
  2731. + if (s1 != s2)
  2732. + up(s2);
  2733. +}
  2734. +
  2735. +static inline void triple_up(struct semaphore *s1,
  2736. + struct semaphore *s2,
  2737. + struct semaphore *s3)
  2738. +{
  2739. + up(s1);
  2740. + if (s1 != s2)
  2741. + up(s2);
  2742. + up(s3);
  2743. +}
  2744. +
  2745. +static inline void double_lock(struct dentry *d1, struct dentry *d2)
  2746. +{
  2747. + double_down(&d1->d_inode->i_sem, &d2->d_inode->i_sem);
  2748. +}
  2749. +
  2750. +static inline void double_unlock(struct dentry *d1, struct dentry *d2)
  2751. +{
  2752. + double_up(&d1->d_inode->i_sem,&d2->d_inode->i_sem);
  2753. + dput(d1);
  2754. + dput(d2);
  2755. +}
  2756. +
  2757. +#endif /* __KERNEL__ */
  2758. +
  2759. +#endif /* _LINUX_FS_H */
  2760. --- lilo-22.5.8.orig/kernel-headers/linux/unistd.h
  2761. +++ lilo-22.5.8/kernel-headers/linux/unistd.h
  2762. @@ -0,0 +1,11 @@
  2763. +#ifndef _LINUX_UNISTD_H_
  2764. +#define _LINUX_UNISTD_H_
  2765. +
  2766. +extern int errno;
  2767. +
  2768. +/*
  2769. + * Include machine specific syscallX macros
  2770. + */
  2771. +#include <asm/unistd.h>
  2772. +
  2773. +#endif /* _LINUX_UNISTD_H_ */
  2774. --- lilo-22.5.8.orig/kernel-headers/linux/lvm.h
  2775. +++ lilo-22.5.8/kernel-headers/linux/lvm.h
  2776. @@ -0,0 +1,756 @@
  2777. +/*
  2778. + * include/linux/lvm.h
  2779. + * kernel/lvm.h
  2780. + * tools/lib/lvm.h
  2781. + *
  2782. + * Copyright (C) 1997 - 2002 Heinz Mauelshagen, Sistina Software
  2783. + *
  2784. + * February-November 1997
  2785. + * May-July 1998
  2786. + * January-March,July,September,October,Dezember 1999
  2787. + * January,February,July,November 2000
  2788. + * January-March,June,July 2001
  2789. + * May 2002
  2790. + *
  2791. + * lvm is free software; you can redistribute it and/or modify
  2792. + * it under the terms of the GNU General Public License as published by
  2793. + * the Free Software Foundation; either version 2, or (at your option)
  2794. + * any later version.
  2795. + *
  2796. + * lvm is distributed in the hope that it will be useful,
  2797. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  2798. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  2799. + * GNU General Public License for more details.
  2800. + *
  2801. + * You should have received a copy of the GNU General Public License
  2802. + * along with GNU CC; see the file COPYING. If not, write to
  2803. + * the Free Software Foundation, 59 Temple Place - Suite 330,
  2804. + * Boston, MA 02111-1307, USA.
  2805. + *
  2806. + */
  2807. +
  2808. +/*
  2809. + * Changelog
  2810. + *
  2811. + * 10/10/1997 - beginning of new structure creation
  2812. + * 12/05/1998 - incorporated structures from lvm_v1.h and deleted lvm_v1.h
  2813. + * 07/06/1998 - avoided LVM_KMALLOC_MAX define by using vmalloc/vfree
  2814. + * instead of kmalloc/kfree
  2815. + * 01/07/1998 - fixed wrong LVM_MAX_SIZE
  2816. + * 07/07/1998 - extended pe_t structure by ios member (for statistic)
  2817. + * 02/08/1998 - changes for official char/block major numbers
  2818. + * 07/08/1998 - avoided init_module() and cleanup_module() to be static
  2819. + * 29/08/1998 - seprated core and disk structure type definitions
  2820. + * 01/09/1998 - merged kernel integration version (mike)
  2821. + * 20/01/1999 - added LVM_PE_DISK_OFFSET macro for use in
  2822. + * vg_read_with_pv_and_lv(), pv_move_pe(), pv_show_pe_text()...
  2823. + * 18/02/1999 - added definition of time_disk_t structure for;
  2824. + * keeps time stamps on disk for nonatomic writes (future)
  2825. + * 15/03/1999 - corrected LV() and VG() macro definition to use argument
  2826. + * instead of minor
  2827. + * 03/07/1999 - define for genhd.c name handling
  2828. + * 23/07/1999 - implemented snapshot part
  2829. + * 08/12/1999 - changed LVM_LV_SIZE_MAX macro to reflect current 1TB limit
  2830. + * 01/01/2000 - extended lv_v2 core structure by wait_queue member
  2831. + * 12/02/2000 - integrated Andrea Arcagnelli's snapshot work
  2832. + * 18/02/2000 - seperated user and kernel space parts by
  2833. + * #ifdef them with __KERNEL__
  2834. + * 08/03/2000 - implemented cluster/shared bits for vg_access
  2835. + * 26/06/2000 - implemented snapshot persistency and resizing support
  2836. + * 02/11/2000 - added hash table size member to lv structure
  2837. + * 12/11/2000 - removed unneeded timestamp definitions
  2838. + * 24/12/2000 - removed LVM_TO_{CORE,DISK}*, use cpu_{from, to}_le*
  2839. + * instead - Christoph Hellwig
  2840. + * 22/01/2001 - Change ulong to uint32_t
  2841. + * 14/02/2001 - changed LVM_SNAPSHOT_MIN_CHUNK to 1 page
  2842. + * 20/02/2001 - incremented IOP version to 11 because of incompatible
  2843. + * change in VG activation (in order to support devfs better)
  2844. + * 01/03/2001 - Revert to IOP10 and add VG_CREATE_OLD call for compatibility
  2845. + * 08/03/2001 - new lv_t (in core) version number 5: changed page member
  2846. + * to (struct kiobuf *) to use for COW exception table io
  2847. + * 26/03/2001 - changed lv_v4 to lv_v5 in structure definition (HM)
  2848. + * 21/06/2001 - changed BLOCK_SIZE back to 1024 for non S/390
  2849. + * 22/06/2001 - added Andreas Dilger's PE on 4k boundary alignment enhancements
  2850. + * 19/07/2001 - added rwsem compatibility macros for 2.2 kernels
  2851. + * 13/11/2001 - reduced userspace inclusion of kernel headers to a minimum
  2852. + *
  2853. + */
  2854. +
  2855. +
  2856. +#ifndef _LVM_H_INCLUDE
  2857. +#define _LVM_H_INCLUDE
  2858. +
  2859. +#define LVM_RELEASE_NAME "1.0.5+"
  2860. +#define LVM_RELEASE_DATE "22/07/2002"
  2861. +
  2862. +#define _LVM_KERNEL_H_VERSION "LVM "LVM_RELEASE_NAME" ("LVM_RELEASE_DATE")"
  2863. +
  2864. +#include <linux/version.h>
  2865. +
  2866. +/*
  2867. + * preprocessor definitions
  2868. + */
  2869. +/* if you like emergency reset code in the driver */
  2870. +#define LVM_TOTAL_RESET
  2871. +
  2872. +#ifdef __KERNEL__
  2873. +#undef LVM_HD_NAME /* display nice names in /proc/partitions */
  2874. +
  2875. +/* lots of debugging output (see driver source)
  2876. + #define DEBUG_LVM_GET_INFO
  2877. + #define DEBUG
  2878. + #define DEBUG_MAP
  2879. + #define DEBUG_MAP_SIZE
  2880. + #define DEBUG_IOCTL
  2881. + #define DEBUG_READ
  2882. + #define DEBUG_GENDISK
  2883. + #define DEBUG_VG_CREATE
  2884. + #define DEBUG_DEVICE
  2885. + #define DEBUG_KFREE
  2886. + */
  2887. +
  2888. +#include <linux/kdev_t.h>
  2889. +#include <linux/list.h>
  2890. +#include <asm/types.h>
  2891. +#include <linux/major.h>
  2892. +#else
  2893. +/* This prevents the need to include <linux/list.h> which
  2894. + causes problems on some platforms. It's not nice but then
  2895. + neither is the alternative. */
  2896. +struct list_head {
  2897. + struct list_head *next, *prev;
  2898. +};
  2899. +#define __KERNEL__
  2900. +#include <linux/kdev_t.h>
  2901. +#undef __KERNEL__
  2902. +#endif /* #ifndef __KERNEL__ */
  2903. +
  2904. +
  2905. +#ifdef __KERNEL__
  2906. +#include <linux/spinlock.h>
  2907. +
  2908. +#include <asm/semaphore.h>
  2909. +#endif /* #ifdef __KERNEL__ */
  2910. +
  2911. +
  2912. +#include <asm/page.h>
  2913. +
  2914. +#if !defined ( LVM_BLK_MAJOR) || !defined ( LVM_CHAR_MAJOR)
  2915. +#error Bad include/linux/major.h - LVM MAJOR undefined
  2916. +#endif
  2917. +
  2918. +#ifdef BLOCK_SIZE
  2919. +#undef BLOCK_SIZE
  2920. +#endif
  2921. +
  2922. +#ifdef CONFIG_ARCH_S390
  2923. +#define BLOCK_SIZE 4096
  2924. +#else
  2925. +#define BLOCK_SIZE 1024
  2926. +#endif
  2927. +
  2928. +#ifndef SECTOR_SIZE
  2929. +#define SECTOR_SIZE 512
  2930. +#endif
  2931. +
  2932. +/* structure version */
  2933. +#define LVM_STRUCT_VERSION 1
  2934. +
  2935. +#define LVM_DIR_PREFIX "/dev/"
  2936. +
  2937. +/*
  2938. + * i/o protocol version
  2939. + *
  2940. + * defined here for the driver and defined seperate in the
  2941. + * user land tools/lib/liblvm.h
  2942. + *
  2943. + */
  2944. +#define LVM_DRIVER_IOP_VERSION 10
  2945. +
  2946. +#define LVM_NAME "lvm"
  2947. +#define LVM_GLOBAL "global"
  2948. +#define LVM_DIR "lvm"
  2949. +#define LVM_VG_SUBDIR "VGs"
  2950. +#define LVM_LV_SUBDIR "LVs"
  2951. +#define LVM_PV_SUBDIR "PVs"
  2952. +
  2953. +/*
  2954. + * VG/LV indexing macros
  2955. + */
  2956. +/* character minor maps directly to volume group */
  2957. +#define VG_CHR(a) ( a)
  2958. +
  2959. +/* block minor indexes into a volume group/logical volume indirection table */
  2960. +#define VG_BLK(a) ( vg_lv_map[a].vg_number)
  2961. +#define LV_BLK(a) ( vg_lv_map[a].lv_number)
  2962. +
  2963. +/*
  2964. + * absolute limits for VGs, PVs per VG and LVs per VG
  2965. + */
  2966. +#define ABS_MAX_VG 99
  2967. +#define ABS_MAX_PV 256
  2968. +#define ABS_MAX_LV 256 /* caused by 8 bit minor */
  2969. +
  2970. +#define MAX_VG ABS_MAX_VG
  2971. +#define MAX_LV ABS_MAX_LV
  2972. +#define MAX_PV ABS_MAX_PV
  2973. +
  2974. +#if ( MAX_VG > ABS_MAX_VG)
  2975. +#undef MAX_VG
  2976. +#define MAX_VG ABS_MAX_VG
  2977. +#endif
  2978. +
  2979. +#if ( MAX_LV > ABS_MAX_LV)
  2980. +#undef MAX_LV
  2981. +#define MAX_LV ABS_MAX_LV
  2982. +#endif
  2983. +
  2984. +
  2985. +/*
  2986. + * VGDA: default disk spaces and offsets
  2987. + *
  2988. + * there's space after the structures for later extensions.
  2989. + *
  2990. + * offset what size
  2991. + * --------------- ---------------------------------- ------------
  2992. + * 0 physical volume structure ~500 byte
  2993. + *
  2994. + * 1K volume group structure ~200 byte
  2995. + *
  2996. + * 6K namelist of physical volumes 128 byte each
  2997. + *
  2998. + * 6k + n * ~300byte n logical volume structures ~300 byte each
  2999. + *
  3000. + * + m * 4byte m physical extent alloc. structs 4 byte each
  3001. + *
  3002. + * End of disk - first physical extent typically 4 megabyte
  3003. + * PE total *
  3004. + * PE size
  3005. + *
  3006. + *
  3007. + */
  3008. +
  3009. +/* DONT TOUCH THESE !!! */
  3010. +
  3011. +
  3012. +
  3013. +
  3014. +
  3015. +
  3016. +
  3017. +/*
  3018. + * LVM_PE_T_MAX corresponds to:
  3019. + *
  3020. + * 8KB PE size can map a ~512 MB logical volume at the cost of 1MB memory,
  3021. + *
  3022. + * 128MB PE size can map a 8TB logical volume at the same cost of memory.
  3023. + *
  3024. + * Default PE size of 4 MB gives a maximum logical volume size of 256 GB.
  3025. + *
  3026. + * Maximum PE size of 16GB gives a maximum logical volume size of 1024 TB.
  3027. + *
  3028. + * AFAIK, the actual kernels limit this to 1 TB.
  3029. + *
  3030. + * Should be a sufficient spectrum ;*)
  3031. + */
  3032. +
  3033. +/* This is the usable size of pe_disk_t.le_num !!! v v */
  3034. +#define LVM_PE_T_MAX ( ( 1 << ( sizeof ( uint16_t) * 8)) - 2)
  3035. +
  3036. +#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)
  3037. +#define LVM_MIN_PE_SIZE ( 8192L / SECTOR_SIZE) /* 8 KB in sectors */
  3038. +#define LVM_MAX_PE_SIZE ( 16L * 1024L * 1024L / SECTOR_SIZE * 1024) /* 16GB in sectors */
  3039. +#define LVM_DEFAULT_PE_SIZE ( 4096L * 1024 / SECTOR_SIZE) /* 4 MB in sectors */
  3040. +#define LVM_DEFAULT_STRIPE_SIZE 16L /* 16 KB */
  3041. +#define LVM_MIN_STRIPE_SIZE ( PAGE_SIZE/SECTOR_SIZE) /* PAGESIZE in sectors */
  3042. +#define LVM_MAX_STRIPE_SIZE ( 512L * 1024 / SECTOR_SIZE) /* 512 KB in sectors */
  3043. +#define LVM_MAX_STRIPES 128 /* max # of stripes */
  3044. +#define LVM_MAX_SIZE ( 1024LU * 1024 / SECTOR_SIZE * 1024 * 1024) /* 1TB[sectors] */
  3045. +#define LVM_MAX_MIRRORS 2 /* future use */
  3046. +#define LVM_MIN_READ_AHEAD 0 /* minimum read ahead sectors */
  3047. +#define LVM_DEFAULT_READ_AHEAD 1024 /* sectors for 512k scsi segments */
  3048. +#define LVM_MAX_READ_AHEAD 1024 /* maximum read ahead sectors */
  3049. +#define LVM_MAX_LV_IO_TIMEOUT 60 /* seconds I/O timeout (future use) */
  3050. +#define LVM_PARTITION 0xfe /* LVM partition id */
  3051. +#define LVM_NEW_PARTITION 0x8e /* new LVM partition id (10/09/1999) */
  3052. +#define LVM_PE_SIZE_PV_SIZE_REL 5 /* max relation PV size and PE size */
  3053. +
  3054. +#define LVM_SNAPSHOT_MAX_CHUNK 1024 /* 1024 KB */
  3055. +#define LVM_SNAPSHOT_DEF_CHUNK 64 /* 64 KB */
  3056. +#define LVM_SNAPSHOT_MIN_CHUNK (PAGE_SIZE/1024) /* 4 or 8 KB */
  3057. +
  3058. +#define UNDEF -1
  3059. +
  3060. +/*
  3061. + * ioctls
  3062. + * FIXME: the last parameter to _IO{W,R,WR} is a data type. The macro will
  3063. + * expand this using sizeof(), so putting "1" there is misleading
  3064. + * because sizeof(1) = sizeof(int) = sizeof(2) = 4 on a 32-bit machine!
  3065. + */
  3066. +/* volume group */
  3067. +#define VG_CREATE_OLD _IOW ( 0xfe, 0x00, 1)
  3068. +#define VG_REMOVE _IOW ( 0xfe, 0x01, 1)
  3069. +
  3070. +#define VG_EXTEND _IOW ( 0xfe, 0x03, 1)
  3071. +#define VG_REDUCE _IOW ( 0xfe, 0x04, 1)
  3072. +
  3073. +#define VG_STATUS _IOWR ( 0xfe, 0x05, 1)
  3074. +#define VG_STATUS_GET_COUNT _IOWR ( 0xfe, 0x06, 1)
  3075. +#define VG_STATUS_GET_NAMELIST _IOWR ( 0xfe, 0x07, 1)
  3076. +
  3077. +#define VG_SET_EXTENDABLE _IOW ( 0xfe, 0x08, 1)
  3078. +#define VG_RENAME _IOW ( 0xfe, 0x09, 1)
  3079. +
  3080. +/* Since 0.9beta6 */
  3081. +#define VG_CREATE _IOW ( 0xfe, 0x0a, 1)
  3082. +
  3083. +/* logical volume */
  3084. +#define LV_CREATE _IOW ( 0xfe, 0x20, 1)
  3085. +#define LV_REMOVE _IOW ( 0xfe, 0x21, 1)
  3086. +
  3087. +#define LV_ACTIVATE _IO ( 0xfe, 0x22)
  3088. +#define LV_DEACTIVATE _IO ( 0xfe, 0x23)
  3089. +
  3090. +#define LV_EXTEND _IOW ( 0xfe, 0x24, 1)
  3091. +#define LV_REDUCE _IOW ( 0xfe, 0x25, 1)
  3092. +
  3093. +#define LV_STATUS_BYNAME _IOWR ( 0xfe, 0x26, 1)
  3094. +#define LV_STATUS_BYINDEX _IOWR ( 0xfe, 0x27, 1)
  3095. +
  3096. +#define LV_SET_ACCESS _IOW ( 0xfe, 0x28, 1)
  3097. +#define LV_SET_ALLOCATION _IOW ( 0xfe, 0x29, 1)
  3098. +#define LV_SET_STATUS _IOW ( 0xfe, 0x2a, 1)
  3099. +
  3100. +#define LE_REMAP _IOW ( 0xfe, 0x2b, 1)
  3101. +
  3102. +#define LV_SNAPSHOT_USE_RATE _IOWR ( 0xfe, 0x2c, 1)
  3103. +
  3104. +#define LV_STATUS_BYDEV _IOWR ( 0xfe, 0x2e, 1)
  3105. +
  3106. +#define LV_RENAME _IOW ( 0xfe, 0x2f, 1)
  3107. +
  3108. +#define LV_BMAP _IOWR ( 0xfe, 0x30, 1)
  3109. +
  3110. +
  3111. +/* physical volume */
  3112. +#define PV_STATUS _IOWR ( 0xfe, 0x40, 1)
  3113. +#define PV_CHANGE _IOWR ( 0xfe, 0x41, 1)
  3114. +#define PV_FLUSH _IOW ( 0xfe, 0x42, 1)
  3115. +
  3116. +/* physical extent */
  3117. +#define PE_LOCK_UNLOCK _IOW ( 0xfe, 0x50, 1)
  3118. +
  3119. +/* i/o protocol version */
  3120. +#define LVM_GET_IOP_VERSION _IOR ( 0xfe, 0x98, 1)
  3121. +
  3122. +#ifdef LVM_TOTAL_RESET
  3123. +/* special reset function for testing purposes */
  3124. +#define LVM_RESET _IO ( 0xfe, 0x99)
  3125. +#endif
  3126. +
  3127. +/* lock the logical volume manager */
  3128. +#if LVM_DRIVER_IOP_VERSION > 11
  3129. +#define LVM_LOCK_LVM _IO ( 0xfe, 0x9A)
  3130. +#else
  3131. +/* This is actually the same as _IO ( 0xff, 0x00), oops. Remove for IOP 12+ */
  3132. +#define LVM_LOCK_LVM _IO ( 0xfe, 0x100)
  3133. +#endif
  3134. +/* END ioctls */
  3135. +
  3136. +
  3137. +/*
  3138. + * Status flags
  3139. + */
  3140. +/* volume group */
  3141. +#define VG_ACTIVE 0x01 /* vg_status */
  3142. +#define VG_EXPORTED 0x02 /* " */
  3143. +#define VG_EXTENDABLE 0x04 /* " */
  3144. +
  3145. +#define VG_READ 0x01 /* vg_access */
  3146. +#define VG_WRITE 0x02 /* " */
  3147. +#define VG_CLUSTERED 0x04 /* " */
  3148. +#define VG_SHARED 0x08 /* " */
  3149. +
  3150. +/* logical volume */
  3151. +#define LV_ACTIVE 0x01 /* lv_status */
  3152. +#define LV_SPINDOWN 0x02 /* " */
  3153. +
  3154. +#define LV_READ 0x01 /* lv_access */
  3155. +#define LV_WRITE 0x02 /* " */
  3156. +#define LV_SNAPSHOT 0x04 /* " */
  3157. +#define LV_SNAPSHOT_ORG 0x08 /* " */
  3158. +
  3159. +#define LV_BADBLOCK_ON 0x01 /* lv_badblock */
  3160. +
  3161. +#define LV_STRICT 0x01 /* lv_allocation */
  3162. +#define LV_CONTIGUOUS 0x02 /* " */
  3163. +
  3164. +/* physical volume */
  3165. +#define PV_ACTIVE 0x01 /* pv_status */
  3166. +#define PV_ALLOCATABLE 0x02 /* pv_allocatable */
  3167. +
  3168. +
  3169. +/* misc */
  3170. +#define LVM_SNAPSHOT_DROPPED_SECTOR 1
  3171. +
  3172. +/*
  3173. + * Structure definitions core/disk follow
  3174. + *
  3175. + * conditional conversion takes place on big endian architectures
  3176. + * in functions * pv_copy_*(), vg_copy_*() and lv_copy_*()
  3177. + *
  3178. + */
  3179. +
  3180. +#define NAME_LEN 128 /* don't change!!! */
  3181. +#define UUID_LEN 32 /* don't change!!! */
  3182. +
  3183. +/* copy on write tables in disk format */
  3184. +typedef struct lv_COW_table_disk_v1 {
  3185. + uint64_t pv_org_number;
  3186. + uint64_t pv_org_rsector;
  3187. + uint64_t pv_snap_number;
  3188. + uint64_t pv_snap_rsector;
  3189. +} lv_COW_table_disk_t;
  3190. +
  3191. +/* remap physical sector/rdev pairs including hash */
  3192. +typedef struct lv_block_exception_v1 {
  3193. + struct list_head hash;
  3194. + uint32_t rsector_org;
  3195. + kdev_t rdev_org;
  3196. + uint32_t rsector_new;
  3197. + kdev_t rdev_new;
  3198. +} lv_block_exception_t;
  3199. +
  3200. +/* disk stored pe information */
  3201. +typedef struct {
  3202. + uint16_t lv_num;
  3203. + uint16_t le_num;
  3204. +} pe_disk_t;
  3205. +
  3206. +/* disk stored PV, VG, LV and PE size and offset information */
  3207. +typedef struct {
  3208. + uint32_t base;
  3209. + uint32_t size;
  3210. +} lvm_disk_data_t;
  3211. +
  3212. +
  3213. +/*
  3214. + * physical volume structures
  3215. + */
  3216. +
  3217. +/* core */
  3218. +typedef struct pv_v2 {
  3219. + char id[2]; /* Identifier */
  3220. + unsigned short version; /* HM lvm version */
  3221. + lvm_disk_data_t pv_on_disk;
  3222. + lvm_disk_data_t vg_on_disk;
  3223. + lvm_disk_data_t pv_uuidlist_on_disk;
  3224. + lvm_disk_data_t lv_on_disk;
  3225. + lvm_disk_data_t pe_on_disk;
  3226. + char pv_name[NAME_LEN];
  3227. + char vg_name[NAME_LEN];
  3228. + char system_id[NAME_LEN]; /* for vgexport/vgimport */
  3229. + kdev_t pv_dev;
  3230. + uint pv_number;
  3231. + uint pv_status;
  3232. + uint pv_allocatable;
  3233. + uint pv_size; /* HM */
  3234. + uint lv_cur;
  3235. + uint pe_size;
  3236. + uint pe_total;
  3237. + uint pe_allocated;
  3238. + uint pe_stale; /* for future use */
  3239. + pe_disk_t *pe; /* HM */
  3240. + struct block_device *bd;
  3241. + char pv_uuid[UUID_LEN+1];
  3242. +
  3243. +#ifndef __KERNEL__
  3244. + uint32_t pe_start; /* in sectors */
  3245. +#endif
  3246. +} pv_t;
  3247. +
  3248. +
  3249. +/* disk */
  3250. +typedef struct pv_disk_v2 {
  3251. + uint8_t id[2]; /* Identifier */
  3252. + uint16_t version; /* HM lvm version */
  3253. + lvm_disk_data_t pv_on_disk;
  3254. + lvm_disk_data_t vg_on_disk;
  3255. + lvm_disk_data_t pv_uuidlist_on_disk;
  3256. + lvm_disk_data_t lv_on_disk;
  3257. + lvm_disk_data_t pe_on_disk;
  3258. + uint8_t pv_uuid[NAME_LEN];
  3259. + uint8_t vg_name[NAME_LEN];
  3260. + uint8_t system_id[NAME_LEN]; /* for vgexport/vgimport */
  3261. + uint32_t pv_major;
  3262. + uint32_t pv_number;
  3263. + uint32_t pv_status;
  3264. + uint32_t pv_allocatable;
  3265. + uint32_t pv_size; /* HM */
  3266. + uint32_t lv_cur;
  3267. + uint32_t pe_size;
  3268. + uint32_t pe_total;
  3269. + uint32_t pe_allocated;
  3270. +
  3271. + /* new in struct version 2 */
  3272. + uint32_t pe_start; /* in sectors */
  3273. +
  3274. +} pv_disk_t;
  3275. +
  3276. +
  3277. +/*
  3278. + * Structures for Logical Volume (LV)
  3279. + */
  3280. +
  3281. +/* core PE information */
  3282. +typedef struct {
  3283. + kdev_t dev;
  3284. + uint32_t pe; /* to be changed if > 2TB */
  3285. + uint32_t reads;
  3286. + uint32_t writes;
  3287. +} pe_t;
  3288. +
  3289. +typedef struct {
  3290. + char lv_name[NAME_LEN];
  3291. + kdev_t old_dev;
  3292. + kdev_t new_dev;
  3293. + uint32_t old_pe;
  3294. + uint32_t new_pe;
  3295. +} le_remap_req_t;
  3296. +
  3297. +typedef struct lv_bmap {
  3298. + uint32_t lv_block;
  3299. + dev_t lv_dev;
  3300. +} lv_bmap_t;
  3301. +
  3302. +/*
  3303. + * Structure Logical Volume (LV) Version 3
  3304. + */
  3305. +
  3306. +/* core */
  3307. +typedef struct lv_v5 {
  3308. + char lv_name[NAME_LEN];
  3309. + char vg_name[NAME_LEN];
  3310. + uint lv_access;
  3311. + uint lv_status;
  3312. + uint lv_open; /* HM */
  3313. + kdev_t lv_dev; /* HM */
  3314. + uint lv_number; /* HM */
  3315. + uint lv_mirror_copies; /* for future use */
  3316. + uint lv_recovery; /* " */
  3317. + uint lv_schedule; /* " */
  3318. + uint lv_size;
  3319. + pe_t *lv_current_pe; /* HM */
  3320. + uint lv_current_le; /* for future use */
  3321. + uint lv_allocated_le;
  3322. + uint lv_stripes;
  3323. + uint lv_stripesize;
  3324. + uint lv_badblock; /* for future use */
  3325. + uint lv_allocation;
  3326. + uint lv_io_timeout; /* for future use */
  3327. + uint lv_read_ahead;
  3328. +
  3329. + /* delta to version 1 starts here */
  3330. + struct lv_v5 *lv_snapshot_org;
  3331. + struct lv_v5 *lv_snapshot_prev;
  3332. + struct lv_v5 *lv_snapshot_next;
  3333. + lv_block_exception_t *lv_block_exception;
  3334. + uint lv_remap_ptr;
  3335. + uint lv_remap_end;
  3336. + uint lv_chunk_size;
  3337. + uint lv_snapshot_minor;
  3338. +#ifdef __KERNEL__
  3339. + struct kiobuf *lv_iobuf;
  3340. + struct kiobuf *lv_COW_table_iobuf;
  3341. + struct rw_semaphore lv_lock;
  3342. + struct list_head *lv_snapshot_hash_table;
  3343. + uint32_t lv_snapshot_hash_table_size;
  3344. + uint32_t lv_snapshot_hash_mask;
  3345. + wait_queue_head_t lv_snapshot_wait;
  3346. + int lv_snapshot_use_rate;
  3347. + struct vg_v3 *vg;
  3348. +
  3349. + uint lv_allocated_snapshot_le;
  3350. +#else
  3351. + char dummy[200];
  3352. +#endif
  3353. +} lv_t;
  3354. +
  3355. +/* disk */
  3356. +typedef struct lv_disk_v3 {
  3357. + uint8_t lv_name[NAME_LEN];
  3358. + uint8_t vg_name[NAME_LEN];
  3359. + uint32_t lv_access;
  3360. + uint32_t lv_status;
  3361. + uint32_t lv_open; /* HM */
  3362. + uint32_t lv_dev; /* HM */
  3363. + uint32_t lv_number; /* HM */
  3364. + uint32_t lv_mirror_copies; /* for future use */
  3365. + uint32_t lv_recovery; /* " */
  3366. + uint32_t lv_schedule; /* " */
  3367. + uint32_t lv_size;
  3368. + uint32_t lv_snapshot_minor;/* minor number of original */
  3369. + uint16_t lv_chunk_size; /* chunk size of snapshot */
  3370. + uint16_t dummy;
  3371. + uint32_t lv_allocated_le;
  3372. + uint32_t lv_stripes;
  3373. + uint32_t lv_stripesize;
  3374. + uint32_t lv_badblock; /* for future use */
  3375. + uint32_t lv_allocation;
  3376. + uint32_t lv_io_timeout; /* for future use */
  3377. + uint32_t lv_read_ahead; /* HM */
  3378. +} lv_disk_t;
  3379. +
  3380. +/*
  3381. + * Structure Volume Group (VG) Version 1
  3382. + */
  3383. +
  3384. +/* core */
  3385. +typedef struct vg_v3 {
  3386. + char vg_name[NAME_LEN]; /* volume group name */
  3387. + uint vg_number; /* volume group number */
  3388. + uint vg_access; /* read/write */
  3389. + uint vg_status; /* active or not */
  3390. + uint lv_max; /* maximum logical volumes */
  3391. + uint lv_cur; /* current logical volumes */
  3392. + uint lv_open; /* open logical volumes */
  3393. + uint pv_max; /* maximum physical volumes */
  3394. + uint pv_cur; /* current physical volumes FU */
  3395. + uint pv_act; /* active physical volumes */
  3396. + uint dummy; /* was obsolete max_pe_per_pv */
  3397. + uint vgda; /* volume group descriptor arrays FU */
  3398. + uint pe_size; /* physical extent size in sectors */
  3399. + uint pe_total; /* total of physical extents */
  3400. + uint pe_allocated; /* allocated physical extents */
  3401. + uint pvg_total; /* physical volume groups FU */
  3402. + struct proc_dir_entry *proc;
  3403. + pv_t *pv[ABS_MAX_PV + 1]; /* physical volume struct pointers */
  3404. + lv_t *lv[ABS_MAX_LV + 1]; /* logical volume struct pointers */
  3405. + char vg_uuid[UUID_LEN+1]; /* volume group UUID */
  3406. +#ifdef __KERNEL__
  3407. + struct proc_dir_entry *vg_dir_pde;
  3408. + struct proc_dir_entry *lv_subdir_pde;
  3409. + struct proc_dir_entry *pv_subdir_pde;
  3410. +#else
  3411. + char dummy1[200];
  3412. +#endif
  3413. +} vg_t;
  3414. +
  3415. +
  3416. +/* disk */
  3417. +typedef struct vg_disk_v2 {
  3418. + uint8_t vg_uuid[UUID_LEN]; /* volume group UUID */
  3419. + uint8_t vg_name_dummy[NAME_LEN-UUID_LEN]; /* rest of v1 VG name */
  3420. + uint32_t vg_number; /* volume group number */
  3421. + uint32_t vg_access; /* read/write */
  3422. + uint32_t vg_status; /* active or not */
  3423. + uint32_t lv_max; /* maximum logical volumes */
  3424. + uint32_t lv_cur; /* current logical volumes */
  3425. + uint32_t lv_open; /* open logical volumes */
  3426. + uint32_t pv_max; /* maximum physical volumes */
  3427. + uint32_t pv_cur; /* current physical volumes FU */
  3428. + uint32_t pv_act; /* active physical volumes */
  3429. + uint32_t dummy;
  3430. + uint32_t vgda; /* volume group descriptor arrays FU */
  3431. + uint32_t pe_size; /* physical extent size in sectors */
  3432. + uint32_t pe_total; /* total of physical extents */
  3433. + uint32_t pe_allocated; /* allocated physical extents */
  3434. + uint32_t pvg_total; /* physical volume groups FU */
  3435. +} vg_disk_t;
  3436. +
  3437. +
  3438. +/*
  3439. + * Request structures for ioctls
  3440. + */
  3441. +
  3442. +/* Request structure PV_STATUS_BY_NAME... */
  3443. +typedef struct {
  3444. + char pv_name[NAME_LEN];
  3445. + pv_t *pv;
  3446. +} pv_status_req_t, pv_change_req_t;
  3447. +
  3448. +/* Request structure PV_FLUSH */
  3449. +typedef struct {
  3450. + char pv_name[NAME_LEN];
  3451. + kdev_t pv_dev;
  3452. +} pv_flush_req_t;
  3453. +
  3454. +
  3455. +/* Request structure PE_MOVE */
  3456. +typedef struct {
  3457. + enum {
  3458. + LOCK_PE, UNLOCK_PE
  3459. + } lock;
  3460. + struct {
  3461. + kdev_t lv_dev;
  3462. + kdev_t pv_dev;
  3463. + uint32_t pv_offset;
  3464. + } data;
  3465. +} pe_lock_req_t;
  3466. +
  3467. +
  3468. +/* Request structure LV_STATUS_BYNAME */
  3469. +typedef struct {
  3470. + char lv_name[NAME_LEN];
  3471. + lv_t *lv;
  3472. +} lv_status_byname_req_t, lv_req_t;
  3473. +
  3474. +/* Request structure LV_STATUS_BYINDEX */
  3475. +typedef struct {
  3476. + uint32_t lv_index;
  3477. + lv_t *lv;
  3478. + /* Transfer size because user space and kernel space differ */
  3479. + ushort size;
  3480. +} lv_status_byindex_req_t;
  3481. +
  3482. +/* Request structure LV_STATUS_BYDEV... */
  3483. +typedef struct {
  3484. + dev_t dev;
  3485. + lv_t *lv;
  3486. +} lv_status_bydev_req_t;
  3487. +
  3488. +
  3489. +/* Request structure LV_SNAPSHOT_USE_RATE */
  3490. +typedef struct {
  3491. + int block;
  3492. + int rate;
  3493. +} lv_snapshot_use_rate_req_t;
  3494. +
  3495. +
  3496. +
  3497. +/* useful inlines */
  3498. +static inline ulong round_up(ulong n, ulong size) {
  3499. + size--;
  3500. + return (n + size) & ~size;
  3501. +}
  3502. +
  3503. +static inline ulong div_up(ulong n, ulong size) {
  3504. + return round_up(n, size) / size;
  3505. +}
  3506. +
  3507. +/* FIXME: nasty capital letters */
  3508. +static int inline LVM_GET_COW_TABLE_CHUNKS_PER_PE(vg_t *vg, lv_t *lv) {
  3509. + return vg->pe_size / lv->lv_chunk_size;
  3510. +}
  3511. +
  3512. +static int inline LVM_GET_COW_TABLE_ENTRIES_PER_PE(vg_t *vg, lv_t *lv) {
  3513. + ulong chunks = vg->pe_size / lv->lv_chunk_size;
  3514. + ulong entry_size = sizeof(lv_COW_table_disk_t);
  3515. + ulong chunk_size = lv->lv_chunk_size * SECTOR_SIZE;
  3516. + ulong entries = (vg->pe_size * SECTOR_SIZE) /
  3517. + (entry_size + chunk_size);
  3518. +
  3519. + if(chunks < 2)
  3520. + return 0;
  3521. +
  3522. + for(; entries; entries--)
  3523. + if((div_up(entries * entry_size, chunk_size) + entries) <=
  3524. + chunks)
  3525. + break;
  3526. +
  3527. + return entries;
  3528. +}
  3529. +
  3530. +
  3531. +#endif /* #ifndef _LVM_H_INCLUDE */
  3532. +
  3533. --- lilo-22.5.8.orig/kernel-headers/linux/major.h
  3534. +++ lilo-22.5.8/kernel-headers/linux/major.h
  3535. @@ -0,0 +1,200 @@
  3536. +#ifndef _LINUX_MAJOR_H
  3537. +#define _LINUX_MAJOR_H
  3538. +
  3539. +/*
  3540. + * This file has definitions for major device numbers.
  3541. + * For the device number assignments, see Documentation/devices.txt.
  3542. + */
  3543. +
  3544. +/* limits */
  3545. +
  3546. +/*
  3547. + * Important: Don't change this to 256. Major number 255 is and must be
  3548. + * reserved for future expansion into a larger dev_t space.
  3549. + */
  3550. +#define MAX_CHRDEV 255
  3551. +#define MAX_BLKDEV 255
  3552. +
  3553. +#define UNNAMED_MAJOR 0
  3554. +#define MEM_MAJOR 1
  3555. +#define RAMDISK_MAJOR 1
  3556. +#define FLOPPY_MAJOR 2
  3557. +#define PTY_MASTER_MAJOR 2
  3558. +#define IDE0_MAJOR 3
  3559. +#define PTY_SLAVE_MAJOR 3
  3560. +#define HD_MAJOR IDE0_MAJOR
  3561. +#define TTY_MAJOR 4
  3562. +#define TTYAUX_MAJOR 5
  3563. +#define LP_MAJOR 6
  3564. +#define VCS_MAJOR 7
  3565. +#define LOOP_MAJOR 7
  3566. +#define SCSI_DISK0_MAJOR 8
  3567. +#define SCSI_TAPE_MAJOR 9
  3568. +#define MD_MAJOR 9
  3569. +#define MISC_MAJOR 10
  3570. +#define SCSI_CDROM_MAJOR 11
  3571. +#define MUX_MAJOR 11 /* PA-RISC only */
  3572. +#define QIC02_TAPE_MAJOR 12
  3573. +#define XT_DISK_MAJOR 13
  3574. +#define SOUND_MAJOR 14
  3575. +#define CDU31A_CDROM_MAJOR 15
  3576. +#define JOYSTICK_MAJOR 15
  3577. +#define GOLDSTAR_CDROM_MAJOR 16
  3578. +#define OPTICS_CDROM_MAJOR 17
  3579. +#define SANYO_CDROM_MAJOR 18
  3580. +#define CYCLADES_MAJOR 19
  3581. +#define CYCLADESAUX_MAJOR 20
  3582. +#define MITSUMI_X_CDROM_MAJOR 20
  3583. +#define MFM_ACORN_MAJOR 21 /* ARM Linux /dev/mfm */
  3584. +#define SCSI_GENERIC_MAJOR 21
  3585. +#define Z8530_MAJOR 34
  3586. +#define DIGI_MAJOR 23
  3587. +#define IDE1_MAJOR 22
  3588. +#define DIGICU_MAJOR 22
  3589. +#define MITSUMI_CDROM_MAJOR 23
  3590. +#define CDU535_CDROM_MAJOR 24
  3591. +#define STL_SERIALMAJOR 24
  3592. +#define MATSUSHITA_CDROM_MAJOR 25
  3593. +#define STL_CALLOUTMAJOR 25
  3594. +#define MATSUSHITA_CDROM2_MAJOR 26
  3595. +#define QIC117_TAPE_MAJOR 27
  3596. +#define MATSUSHITA_CDROM3_MAJOR 27
  3597. +#define MATSUSHITA_CDROM4_MAJOR 28
  3598. +#define STL_SIOMEMMAJOR 28
  3599. +#define ACSI_MAJOR 28
  3600. +#define AZTECH_CDROM_MAJOR 29
  3601. +#define GRAPHDEV_MAJOR 29 /* SparcLinux & Linux/68k /dev/fb */
  3602. +#define SHMIQ_MAJOR 85 /* Linux/mips, SGI /dev/shmiq */
  3603. +#define CM206_CDROM_MAJOR 32
  3604. +#define IDE2_MAJOR 33
  3605. +#define IDE3_MAJOR 34
  3606. +#define XPRAM_MAJOR 35 /* expanded storage on S/390 = "slow ram" */
  3607. + /* proposed by Peter */
  3608. +#define NETLINK_MAJOR 36
  3609. +#define PS2ESDI_MAJOR 36
  3610. +#define IDETAPE_MAJOR 37
  3611. +#define Z2RAM_MAJOR 37
  3612. +#define APBLOCK_MAJOR 38 /* AP1000 Block device */
  3613. +#define DDV_MAJOR 39 /* AP1000 DDV block device */
  3614. +#define NBD_MAJOR 43 /* Network block device */
  3615. +#define RISCOM8_NORMAL_MAJOR 48
  3616. +#define DAC960_MAJOR 48 /* 48..55 */
  3617. +#define RISCOM8_CALLOUT_MAJOR 49
  3618. +#define MKISS_MAJOR 55
  3619. +#define DSP56K_MAJOR 55 /* DSP56001 processor device */
  3620. +
  3621. +#define IDE4_MAJOR 56
  3622. +#define IDE5_MAJOR 57
  3623. +
  3624. +#define LVM_BLK_MAJOR 58 /* Logical Volume Manager */
  3625. +
  3626. +#define SCSI_DISK1_MAJOR 65
  3627. +#define SCSI_DISK2_MAJOR 66
  3628. +#define SCSI_DISK3_MAJOR 67
  3629. +#define SCSI_DISK4_MAJOR 68
  3630. +#define SCSI_DISK5_MAJOR 69
  3631. +#define SCSI_DISK6_MAJOR 70
  3632. +#define SCSI_DISK7_MAJOR 71
  3633. +
  3634. +
  3635. +#define COMPAQ_SMART2_MAJOR 72
  3636. +#define COMPAQ_SMART2_MAJOR1 73
  3637. +#define COMPAQ_SMART2_MAJOR2 74
  3638. +#define COMPAQ_SMART2_MAJOR3 75
  3639. +#define COMPAQ_SMART2_MAJOR4 76
  3640. +#define COMPAQ_SMART2_MAJOR5 77
  3641. +#define COMPAQ_SMART2_MAJOR6 78
  3642. +#define COMPAQ_SMART2_MAJOR7 79
  3643. +
  3644. +#define SPECIALIX_NORMAL_MAJOR 75
  3645. +#define SPECIALIX_CALLOUT_MAJOR 76
  3646. +
  3647. +#define COMPAQ_CISS_MAJOR 104
  3648. +#define COMPAQ_CISS_MAJOR1 105
  3649. +#define COMPAQ_CISS_MAJOR2 106
  3650. +#define COMPAQ_CISS_MAJOR3 107
  3651. +#define COMPAQ_CISS_MAJOR4 108
  3652. +#define COMPAQ_CISS_MAJOR5 109
  3653. +#define COMPAQ_CISS_MAJOR6 110
  3654. +#define COMPAQ_CISS_MAJOR7 111
  3655. +
  3656. +#define ATARAID_MAJOR 114
  3657. +
  3658. +#define SCSI_CHANGER_MAJOR 86
  3659. +
  3660. +#define DASD_MAJOR 94 /* Official assignations from Peter */
  3661. +
  3662. +#define MDISK_MAJOR 95 /* Official assignations from Peter */
  3663. +
  3664. +#define I2O_MAJOR 80 /* 80->87 */
  3665. +
  3666. +#define IDE6_MAJOR 88
  3667. +#define IDE7_MAJOR 89
  3668. +#define IDE8_MAJOR 90
  3669. +#define IDE9_MAJOR 91
  3670. +
  3671. +#define UBD_MAJOR 98
  3672. +
  3673. +#define AURORA_MAJOR 79
  3674. +
  3675. +#define JSFD_MAJOR 99
  3676. +
  3677. +#define PHONE_MAJOR 100
  3678. +
  3679. +#define LVM_CHAR_MAJOR 109 /* Logical Volume Manager */
  3680. +
  3681. +#define UMEM_MAJOR 116 /* http://www.umem.com/ Battery Backed RAM */
  3682. +
  3683. +#define RTF_MAJOR 150
  3684. +#define RAW_MAJOR 162
  3685. +
  3686. +#define USB_ACM_MAJOR 166
  3687. +#define USB_ACM_AUX_MAJOR 167
  3688. +#define USB_CHAR_MAJOR 180
  3689. +
  3690. +#define UNIX98_PTY_MASTER_MAJOR 128
  3691. +#define UNIX98_PTY_MAJOR_COUNT 8
  3692. +#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
  3693. +
  3694. +#define VXVM_MAJOR 199 /* VERITAS volume i/o driver */
  3695. +#define VXSPEC_MAJOR 200 /* VERITAS volume config driver */
  3696. +#define VXDMP_MAJOR 201 /* VERITAS volume multipath driver */
  3697. +
  3698. +#define MSR_MAJOR 202
  3699. +#define CPUID_MAJOR 203
  3700. +
  3701. +#define OSST_MAJOR 206 /* OnStream-SCx0 SCSI tape */
  3702. +
  3703. +#define IBM_TTY3270_MAJOR 227 /* Official allocations now */
  3704. +#define IBM_FS3270_MAJOR 228
  3705. +
  3706. +/*
  3707. + * Tests for SCSI devices.
  3708. + */
  3709. +
  3710. +#define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \
  3711. + ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR))
  3712. +
  3713. +#define SCSI_BLK_MAJOR(M) \
  3714. + (SCSI_DISK_MAJOR(M) \
  3715. + || (M) == SCSI_CDROM_MAJOR)
  3716. +
  3717. +static __inline__ int scsi_blk_major(int m) {
  3718. + return SCSI_BLK_MAJOR(m);
  3719. +}
  3720. +
  3721. +/*
  3722. + * Tests for IDE devices
  3723. + */
  3724. +#define IDE_DISK_MAJOR(M) ((M) == IDE0_MAJOR || (M) == IDE1_MAJOR || \
  3725. + (M) == IDE2_MAJOR || (M) == IDE3_MAJOR || \
  3726. + (M) == IDE4_MAJOR || (M) == IDE5_MAJOR || \
  3727. + (M) == IDE6_MAJOR || (M) == IDE7_MAJOR || \
  3728. + (M) == IDE8_MAJOR || (M) == IDE9_MAJOR)
  3729. +
  3730. +static __inline__ int ide_blk_major(int m)
  3731. +{
  3732. + return IDE_DISK_MAJOR(m);
  3733. +}
  3734. +
  3735. +#endif
  3736. --- lilo-22.5.8.orig/kernel-headers/linux/config.h
  3737. +++ lilo-22.5.8/kernel-headers/linux/config.h
  3738. @@ -0,0 +1,6 @@
  3739. +#ifndef _LINUX_CONFIG_H
  3740. +#define _LINUX_CONFIG_H
  3741. +
  3742. +#include <linux/autoconf.h>
  3743. +
  3744. +#endif
  3745. --- lilo-22.5.8.orig/kernel-headers/linux/genhd.h
  3746. +++ lilo-22.5.8/kernel-headers/linux/genhd.h
  3747. @@ -0,0 +1,318 @@
  3748. +#ifndef _LINUX_GENHD_H
  3749. +#define _LINUX_GENHD_H
  3750. +
  3751. +/*
  3752. + * genhd.h Copyright (C) 1992 Drew Eckhardt
  3753. + * Generic hard disk header file by
  3754. + * Drew Eckhardt
  3755. + *
  3756. + * <drew@colorado.edu>
  3757. + */
  3758. +
  3759. +#include <linux/config.h>
  3760. +#include <linux/types.h>
  3761. +#include <linux/major.h>
  3762. +
  3763. +enum {
  3764. +/* These three have identical behaviour; use the second one if DOS fdisk gets
  3765. + confused about extended/logical partitions starting past cylinder 1023. */
  3766. + DOS_EXTENDED_PARTITION = 5,
  3767. + LINUX_EXTENDED_PARTITION = 0x85,
  3768. + WIN98_EXTENDED_PARTITION = 0x0f,
  3769. +
  3770. + LINUX_SWAP_PARTITION = 0x82,
  3771. + LINUX_RAID_PARTITION = 0xfd, /* autodetect RAID partition */
  3772. +
  3773. + SOLARIS_X86_PARTITION = LINUX_SWAP_PARTITION,
  3774. +
  3775. + DM6_PARTITION = 0x54, /* has DDO: use xlated geom & offset */
  3776. + EZD_PARTITION = 0x55, /* EZ-DRIVE */
  3777. + DM6_AUX1PARTITION = 0x51, /* no DDO: use xlated geom */
  3778. + DM6_AUX3PARTITION = 0x53, /* no DDO: use xlated geom */
  3779. +
  3780. + FREEBSD_PARTITION = 0xa5, /* FreeBSD Partition ID */
  3781. + OPENBSD_PARTITION = 0xa6, /* OpenBSD Partition ID */
  3782. + NETBSD_PARTITION = 0xa9, /* NetBSD Partition ID */
  3783. + BSDI_PARTITION = 0xb7, /* BSDI Partition ID */
  3784. +/* Ours is not to wonder why.. */
  3785. + BSD_PARTITION = FREEBSD_PARTITION,
  3786. + MINIX_PARTITION = 0x81, /* Minix Partition ID */
  3787. + PLAN9_PARTITION = 0x39, /* Plan 9 Partition ID */
  3788. + UNIXWARE_PARTITION = 0x63, /* Partition ID, same as */
  3789. + /* GNU_HURD and SCO Unix */
  3790. +};
  3791. +
  3792. +struct partition {
  3793. + unsigned char boot_ind; /* 0x80 - active */
  3794. + unsigned char head; /* starting head */
  3795. + unsigned char sector; /* starting sector */
  3796. + unsigned char cyl; /* starting cylinder */
  3797. + unsigned char sys_ind; /* What partition type */
  3798. + unsigned char end_head; /* end head */
  3799. + unsigned char end_sector; /* end sector */
  3800. + unsigned char end_cyl; /* end cylinder */
  3801. + unsigned int start_sect; /* starting sector counting from 0 */
  3802. + unsigned int nr_sects; /* nr of sectors in partition */
  3803. +} __attribute__((packed));
  3804. +
  3805. +#ifdef __KERNEL__
  3806. +# include <linux/devfs_fs_kernel.h>
  3807. +
  3808. +struct hd_struct {
  3809. + unsigned long start_sect;
  3810. + unsigned long nr_sects;
  3811. + devfs_handle_t de; /* primary (master) devfs entry */
  3812. +#ifdef CONFIG_DEVFS_FS
  3813. + int number;
  3814. +#endif /* CONFIG_DEVFS_FS */
  3815. +#ifdef CONFIG_BLK_STATS
  3816. + /* Performance stats: */
  3817. + unsigned int ios_in_flight;
  3818. + unsigned int io_ticks;
  3819. + unsigned int last_idle_time;
  3820. + unsigned int last_queue_change;
  3821. + unsigned int aveq;
  3822. +
  3823. + unsigned int rd_ios;
  3824. + unsigned int rd_merges;
  3825. + unsigned int rd_ticks;
  3826. + unsigned int rd_sectors;
  3827. + unsigned int wr_ios;
  3828. + unsigned int wr_merges;
  3829. + unsigned int wr_ticks;
  3830. + unsigned int wr_sectors;
  3831. +#endif /* CONFIG_BLK_STATS */
  3832. +};
  3833. +
  3834. +#define GENHD_FL_REMOVABLE 1
  3835. +
  3836. +struct gendisk {
  3837. + int major; /* major number of driver */
  3838. + const char *major_name; /* name of major driver */
  3839. + int minor_shift; /* number of times minor is shifted to
  3840. + get real minor */
  3841. + int max_p; /* maximum partitions per device */
  3842. +
  3843. + struct hd_struct *part; /* [indexed by minor] */
  3844. + int *sizes; /* [idem], device size in blocks */
  3845. + int nr_real; /* number of real devices */
  3846. +
  3847. + void *real_devices; /* internal use */
  3848. + struct gendisk *next;
  3849. + struct block_device_operations *fops;
  3850. +
  3851. + devfs_handle_t *de_arr; /* one per physical disc */
  3852. + char *flags; /* one per physical disc */
  3853. +};
  3854. +
  3855. +/* drivers/block/genhd.c */
  3856. +extern struct gendisk *gendisk_head;
  3857. +
  3858. +extern void add_gendisk(struct gendisk *gp);
  3859. +extern void del_gendisk(struct gendisk *gp);
  3860. +extern struct gendisk *get_gendisk(kdev_t dev);
  3861. +extern int walk_gendisk(int (*walk)(struct gendisk *, void *), void *);
  3862. +
  3863. +#endif /* __KERNEL__ */
  3864. +
  3865. +#ifdef CONFIG_SOLARIS_X86_PARTITION
  3866. +
  3867. +#define SOLARIS_X86_NUMSLICE 8
  3868. +#define SOLARIS_X86_VTOC_SANE (0x600DDEEEUL)
  3869. +
  3870. +struct solaris_x86_slice {
  3871. + ushort s_tag; /* ID tag of partition */
  3872. + ushort s_flag; /* permission flags */
  3873. + unsigned int s_start; /* start sector no of partition */
  3874. + unsigned int s_size; /* # of blocks in partition */
  3875. +};
  3876. +
  3877. +struct solaris_x86_vtoc {
  3878. + unsigned int v_bootinfo[3]; /* info needed by mboot (unsupported) */
  3879. + unsigned int v_sanity; /* to verify vtoc sanity */
  3880. + unsigned int v_version; /* layout version */
  3881. + char v_volume[8]; /* volume name */
  3882. + ushort v_sectorsz; /* sector size in bytes */
  3883. + ushort v_nparts; /* number of partitions */
  3884. + unsigned int v_reserved[10]; /* free space */
  3885. + struct solaris_x86_slice
  3886. + v_slice[SOLARIS_X86_NUMSLICE]; /* slice headers */
  3887. + unsigned int timestamp[SOLARIS_X86_NUMSLICE]; /* timestamp (unsupported) */
  3888. + char v_asciilabel[128]; /* for compatibility */
  3889. +};
  3890. +
  3891. +#endif /* CONFIG_SOLARIS_X86_PARTITION */
  3892. +
  3893. +#ifdef CONFIG_BSD_DISKLABEL
  3894. +/*
  3895. + * BSD disklabel support by Yossi Gottlieb <yogo@math.tau.ac.il>
  3896. + * updated by Marc Espie <Marc.Espie@openbsd.org>
  3897. + */
  3898. +
  3899. +/* check against BSD src/sys/sys/disklabel.h for consistency */
  3900. +
  3901. +#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
  3902. +#define BSD_MAXPARTITIONS 8
  3903. +#define OPENBSD_MAXPARTITIONS 16
  3904. +#define BSD_FS_UNUSED 0 /* disklabel unused partition entry ID */
  3905. +struct bsd_disklabel {
  3906. + __u32 d_magic; /* the magic number */
  3907. + __s16 d_type; /* drive type */
  3908. + __s16 d_subtype; /* controller/d_type specific */
  3909. + char d_typename[16]; /* type name, e.g. "eagle" */
  3910. + char d_packname[16]; /* pack identifier */
  3911. + __u32 d_secsize; /* # of bytes per sector */
  3912. + __u32 d_nsectors; /* # of data sectors per track */
  3913. + __u32 d_ntracks; /* # of tracks per cylinder */
  3914. + __u32 d_ncylinders; /* # of data cylinders per unit */
  3915. + __u32 d_secpercyl; /* # of data sectors per cylinder */
  3916. + __u32 d_secperunit; /* # of data sectors per unit */
  3917. + __u16 d_sparespertrack; /* # of spare sectors per track */
  3918. + __u16 d_sparespercyl; /* # of spare sectors per cylinder */
  3919. + __u32 d_acylinders; /* # of alt. cylinders per unit */
  3920. + __u16 d_rpm; /* rotational speed */
  3921. + __u16 d_interleave; /* hardware sector interleave */
  3922. + __u16 d_trackskew; /* sector 0 skew, per track */
  3923. + __u16 d_cylskew; /* sector 0 skew, per cylinder */
  3924. + __u32 d_headswitch; /* head switch time, usec */
  3925. + __u32 d_trkseek; /* track-to-track seek, usec */
  3926. + __u32 d_flags; /* generic flags */
  3927. +#define NDDATA 5
  3928. + __u32 d_drivedata[NDDATA]; /* drive-type specific information */
  3929. +#define NSPARE 5
  3930. + __u32 d_spare[NSPARE]; /* reserved for future use */
  3931. + __u32 d_magic2; /* the magic number (again) */
  3932. + __u16 d_checksum; /* xor of data incl. partitions */
  3933. +
  3934. + /* filesystem and partition information: */
  3935. + __u16 d_npartitions; /* number of partitions in following */
  3936. + __u32 d_bbsize; /* size of boot area at sn0, bytes */
  3937. + __u32 d_sbsize; /* max size of fs superblock, bytes */
  3938. + struct bsd_partition { /* the partition table */
  3939. + __u32 p_size; /* number of sectors in partition */
  3940. + __u32 p_offset; /* starting sector */
  3941. + __u32 p_fsize; /* filesystem basic fragment size */
  3942. + __u8 p_fstype; /* filesystem type, see below */
  3943. + __u8 p_frag; /* filesystem fragments per block */
  3944. + __u16 p_cpg; /* filesystem cylinders per group */
  3945. + } d_partitions[BSD_MAXPARTITIONS]; /* actually may be more */
  3946. +};
  3947. +
  3948. +#endif /* CONFIG_BSD_DISKLABEL */
  3949. +
  3950. +#ifdef CONFIG_UNIXWARE_DISKLABEL
  3951. +/*
  3952. + * Unixware slices support by Andrzej Krzysztofowicz <ankry@mif.pg.gda.pl>
  3953. + * and Krzysztof G. Baranowski <kgb@knm.org.pl>
  3954. + */
  3955. +
  3956. +#define UNIXWARE_DISKMAGIC (0xCA5E600DUL) /* The disk magic number */
  3957. +#define UNIXWARE_DISKMAGIC2 (0x600DDEEEUL) /* The slice table magic nr */
  3958. +#define UNIXWARE_NUMSLICE 16
  3959. +#define UNIXWARE_FS_UNUSED 0 /* Unused slice entry ID */
  3960. +
  3961. +struct unixware_slice {
  3962. + __u16 s_label; /* label */
  3963. + __u16 s_flags; /* permission flags */
  3964. + __u32 start_sect; /* starting sector */
  3965. + __u32 nr_sects; /* number of sectors in slice */
  3966. +};
  3967. +
  3968. +struct unixware_disklabel {
  3969. + __u32 d_type; /* drive type */
  3970. + __u32 d_magic; /* the magic number */
  3971. + __u32 d_version; /* version number */
  3972. + char d_serial[12]; /* serial number of the device */
  3973. + __u32 d_ncylinders; /* # of data cylinders per device */
  3974. + __u32 d_ntracks; /* # of tracks per cylinder */
  3975. + __u32 d_nsectors; /* # of data sectors per track */
  3976. + __u32 d_secsize; /* # of bytes per sector */
  3977. + __u32 d_part_start; /* # of first sector of this partition */
  3978. + __u32 d_unknown1[12]; /* ? */
  3979. + __u32 d_alt_tbl; /* byte offset of alternate table */
  3980. + __u32 d_alt_len; /* byte length of alternate table */
  3981. + __u32 d_phys_cyl; /* # of physical cylinders per device */
  3982. + __u32 d_phys_trk; /* # of physical tracks per cylinder */
  3983. + __u32 d_phys_sec; /* # of physical sectors per track */
  3984. + __u32 d_phys_bytes; /* # of physical bytes per sector */
  3985. + __u32 d_unknown2; /* ? */
  3986. + __u32 d_unknown3; /* ? */
  3987. + __u32 d_pad[8]; /* pad */
  3988. +
  3989. + struct unixware_vtoc {
  3990. + __u32 v_magic; /* the magic number */
  3991. + __u32 v_version; /* version number */
  3992. + char v_name[8]; /* volume name */
  3993. + __u16 v_nslices; /* # of slices */
  3994. + __u16 v_unknown1; /* ? */
  3995. + __u32 v_reserved[10]; /* reserved */
  3996. + struct unixware_slice
  3997. + v_slice[UNIXWARE_NUMSLICE]; /* slice headers */
  3998. + } vtoc;
  3999. +
  4000. +}; /* 408 */
  4001. +
  4002. +#endif /* CONFIG_UNIXWARE_DISKLABEL */
  4003. +
  4004. +#ifdef CONFIG_MINIX_SUBPARTITION
  4005. +# define MINIX_NR_SUBPARTITIONS 4
  4006. +#endif /* CONFIG_MINIX_SUBPARTITION */
  4007. +
  4008. +#ifdef __KERNEL__
  4009. +
  4010. +char *disk_name (struct gendisk *hd, int minor, char *buf);
  4011. +
  4012. +/*
  4013. + * Account for the completion of an IO request (used by drivers which
  4014. + * bypass the normal end_request processing)
  4015. + */
  4016. +struct request;
  4017. +
  4018. +#ifdef CONFIG_BLK_STATS
  4019. +extern void disk_round_stats(struct hd_struct *hd);
  4020. +extern void req_new_io(struct request *req, int merge, int sectors);
  4021. +extern void req_merged_io(struct request *req);
  4022. +extern void req_finished_io(struct request *req);
  4023. +#else
  4024. +static inline void req_new_io(struct request *req, int merge, int sectors) { }
  4025. +static inline void req_merged_io(struct request *req) { }
  4026. +static inline void req_finished_io(struct request *req) { }
  4027. +#endif /* CONFIG_BLK_STATS */
  4028. +
  4029. +extern void devfs_register_partitions (struct gendisk *dev, int minor,
  4030. + int unregister);
  4031. +
  4032. +
  4033. +
  4034. +/*
  4035. + * FIXME: this should use genhd->minor_shift, but that is slow to look up.
  4036. + */
  4037. +static inline unsigned int disk_index (kdev_t dev)
  4038. +{
  4039. + int major = MAJOR(dev);
  4040. + int minor = MINOR(dev);
  4041. + unsigned int index;
  4042. +
  4043. + switch (major) {
  4044. + case DAC960_MAJOR+0:
  4045. + index = (minor & 0x00f8) >> 3;
  4046. + break;
  4047. + case SCSI_DISK0_MAJOR:
  4048. + index = (minor & 0x00f0) >> 4;
  4049. + break;
  4050. + case IDE0_MAJOR: /* same as HD_MAJOR */
  4051. + case XT_DISK_MAJOR:
  4052. + index = (minor & 0x0040) >> 6;
  4053. + break;
  4054. + case IDE1_MAJOR:
  4055. + index = ((minor & 0x0040) >> 6) + 2;
  4056. + break;
  4057. + default:
  4058. + return 0;
  4059. + }
  4060. + return index;
  4061. +}
  4062. +
  4063. +#endif
  4064. +
  4065. +#endif
  4066. --- lilo-22.5.8.orig/kernel-headers/linux/hdreg.h
  4067. +++ lilo-22.5.8/kernel-headers/linux/hdreg.h
  4068. @@ -0,0 +1,746 @@
  4069. +#ifndef _LINUX_HDREG_H
  4070. +#define _LINUX_HDREG_H
  4071. +
  4072. +/*
  4073. + * This file contains some defines for the AT-hd-controller.
  4074. + * Various sources.
  4075. + */
  4076. +
  4077. +#define HD_IRQ 14 /* the standard disk interrupt */
  4078. +
  4079. +/* ide.c has its own port definitions in "ide.h" */
  4080. +
  4081. +/* Hd controller regs. Ref: IBM AT Bios-listing */
  4082. +#define HD_DATA 0x1f0 /* _CTL when writing */
  4083. +#define HD_ERROR 0x1f1 /* see err-bits */
  4084. +#define HD_NSECTOR 0x1f2 /* nr of sectors to read/write */
  4085. +#define HD_SECTOR 0x1f3 /* starting sector */
  4086. +#define HD_LCYL 0x1f4 /* starting cylinder */
  4087. +#define HD_HCYL 0x1f5 /* high byte of starting cyl */
  4088. +#define HD_CURRENT 0x1f6 /* 101dhhhh , d=drive, hhhh=head */
  4089. +#define HD_STATUS 0x1f7 /* see status-bits */
  4090. +#define HD_FEATURE HD_ERROR /* same io address, read=error, write=feature */
  4091. +#define HD_PRECOMP HD_FEATURE /* obsolete use of this port - predates IDE */
  4092. +#define HD_COMMAND HD_STATUS /* same io address, read=status, write=cmd */
  4093. +
  4094. +#define HD_CMD 0x3f6 /* used for resets */
  4095. +#define HD_ALTSTATUS 0x3f6 /* same as HD_STATUS but doesn't clear irq */
  4096. +
  4097. +/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
  4098. +
  4099. +/* Bits of HD_STATUS */
  4100. +#define ERR_STAT 0x01
  4101. +#define INDEX_STAT 0x02
  4102. +#define ECC_STAT 0x04 /* Corrected error */
  4103. +#define DRQ_STAT 0x08
  4104. +#define SEEK_STAT 0x10
  4105. +#define SRV_STAT 0x10
  4106. +#define WRERR_STAT 0x20
  4107. +#define READY_STAT 0x40
  4108. +#define BUSY_STAT 0x80
  4109. +
  4110. +/* Bits for HD_ERROR */
  4111. +#define MARK_ERR 0x01 /* Bad address mark */
  4112. +#define TRK0_ERR 0x02 /* couldn't find track 0 */
  4113. +#define ABRT_ERR 0x04 /* Command aborted */
  4114. +#define MCR_ERR 0x08 /* media change request */
  4115. +#define ID_ERR 0x10 /* ID field not found */
  4116. +#define MC_ERR 0x20 /* media changed */
  4117. +#define ECC_ERR 0x40 /* Uncorrectable ECC error */
  4118. +#define BBD_ERR 0x80 /* pre-EIDE meaning: block marked bad */
  4119. +#define ICRC_ERR 0x80 /* new meaning: CRC error during transfer */
  4120. +
  4121. +/* Bits of HD_NSECTOR */
  4122. +#define CD 0x01
  4123. +#define IO 0x02
  4124. +#define REL 0x04
  4125. +#define TAG_MASK 0xf8
  4126. +
  4127. +
  4128. +/*
  4129. + * Command Header sizes for IOCTL commands
  4130. + * HDIO_DRIVE_CMD, HDIO_DRIVE_TASK, and HDIO_DRIVE_TASKFILE
  4131. + */
  4132. +
  4133. +#if 0
  4134. +#include <asm/hdreg.h>
  4135. +typedef ide_ioreg_t task_ioreg_t;
  4136. +#else
  4137. +typedef unsigned char task_ioreg_t;
  4138. +#endif
  4139. +
  4140. +typedef unsigned long sata_ioreg_t;
  4141. +
  4142. +#define HDIO_DRIVE_CMD_HDR_SIZE 4*sizeof(task_ioreg_t)
  4143. +#define HDIO_DRIVE_TASK_HDR_SIZE 8*sizeof(task_ioreg_t)
  4144. +#define HDIO_DRIVE_HOB_HDR_SIZE 8*sizeof(task_ioreg_t)
  4145. +
  4146. +#define IDE_DRIVE_TASK_INVALID -1
  4147. +#define IDE_DRIVE_TASK_NO_DATA 0
  4148. +#define IDE_DRIVE_TASK_SET_XFER 1
  4149. +
  4150. +#define IDE_DRIVE_TASK_IN 2
  4151. +
  4152. +#define IDE_DRIVE_TASK_OUT 3
  4153. +#define IDE_DRIVE_TASK_RAW_WRITE 4
  4154. +
  4155. +struct hd_drive_cmd_hdr {
  4156. + task_ioreg_t command;
  4157. + task_ioreg_t sector_number;
  4158. + task_ioreg_t feature;
  4159. + task_ioreg_t sector_count;
  4160. +};
  4161. +
  4162. +typedef struct hd_drive_task_hdr {
  4163. + task_ioreg_t data;
  4164. + task_ioreg_t feature;
  4165. + task_ioreg_t sector_count;
  4166. + task_ioreg_t sector_number;
  4167. + task_ioreg_t low_cylinder;
  4168. + task_ioreg_t high_cylinder;
  4169. + task_ioreg_t device_head;
  4170. + task_ioreg_t command;
  4171. +} task_struct_t;
  4172. +
  4173. +typedef struct hd_drive_hob_hdr {
  4174. + task_ioreg_t data;
  4175. + task_ioreg_t feature;
  4176. + task_ioreg_t sector_count;
  4177. + task_ioreg_t sector_number;
  4178. + task_ioreg_t low_cylinder;
  4179. + task_ioreg_t high_cylinder;
  4180. + task_ioreg_t device_head;
  4181. + task_ioreg_t control;
  4182. +} hob_struct_t;
  4183. +
  4184. +typedef union ide_reg_valid_s {
  4185. + unsigned all : 16;
  4186. + struct {
  4187. + unsigned data : 1;
  4188. + unsigned error_feature : 1;
  4189. + unsigned sector : 1;
  4190. + unsigned nsector : 1;
  4191. + unsigned lcyl : 1;
  4192. + unsigned hcyl : 1;
  4193. + unsigned select : 1;
  4194. + unsigned status_command : 1;
  4195. +
  4196. + unsigned data_hob : 1;
  4197. + unsigned error_feature_hob : 1;
  4198. + unsigned sector_hob : 1;
  4199. + unsigned nsector_hob : 1;
  4200. + unsigned lcyl_hob : 1;
  4201. + unsigned hcyl_hob : 1;
  4202. + unsigned select_hob : 1;
  4203. + unsigned control_hob : 1;
  4204. + } b;
  4205. +} ide_reg_valid_t;
  4206. +
  4207. +/*
  4208. + * Define standard taskfile in/out register
  4209. + */
  4210. +#define IDE_TASKFILE_STD_OUT_FLAGS 0xFE
  4211. +#define IDE_TASKFILE_STD_IN_FLAGS 0xFE
  4212. +#define IDE_HOB_STD_OUT_FLAGS 0x3C
  4213. +#define IDE_HOB_STD_IN_FLAGS 0x3C
  4214. +
  4215. +typedef struct ide_task_request_s {
  4216. + task_ioreg_t io_ports[8];
  4217. + task_ioreg_t hob_ports[8];
  4218. + ide_reg_valid_t out_flags;
  4219. + ide_reg_valid_t in_flags;
  4220. + int data_phase;
  4221. + int req_cmd;
  4222. + unsigned long out_size;
  4223. + unsigned long in_size;
  4224. +} ide_task_request_t;
  4225. +
  4226. +typedef struct ide_ioctl_request_s {
  4227. + ide_task_request_t *task_request;
  4228. + unsigned char *out_buffer;
  4229. + unsigned char *in_buffer;
  4230. +} ide_ioctl_request_t;
  4231. +
  4232. +#define TASKFILE_INVALID 0x7fff
  4233. +#define TASKFILE_48 0x8000
  4234. +
  4235. +#define TASKFILE_NO_DATA 0x0000
  4236. +
  4237. +#define TASKFILE_IN 0x0001
  4238. +#define TASKFILE_MULTI_IN 0x0002
  4239. +
  4240. +#define TASKFILE_OUT 0x0004
  4241. +#define TASKFILE_MULTI_OUT 0x0008
  4242. +#define TASKFILE_IN_OUT 0x0010
  4243. +
  4244. +#define TASKFILE_IN_DMA 0x0020
  4245. +#define TASKFILE_OUT_DMA 0x0040
  4246. +#define TASKFILE_IN_DMAQ 0x0080
  4247. +#define TASKFILE_OUT_DMAQ 0x0100
  4248. +
  4249. +#define TASKFILE_P_IN 0x0200
  4250. +#define TASKFILE_P_OUT 0x0400
  4251. +#define TASKFILE_P_IN_DMA 0x0800
  4252. +#define TASKFILE_P_OUT_DMA 0x1000
  4253. +#define TASKFILE_P_IN_DMAQ 0x2000
  4254. +#define TASKFILE_P_OUT_DMAQ 0x4000
  4255. +
  4256. +/* ATA/ATAPI Commands pre T13 Spec */
  4257. +#define WIN_NOP 0x00
  4258. +/*
  4259. + * 0x01->0x02 Reserved
  4260. + */
  4261. +#define CFA_REQ_EXT_ERROR_CODE 0x03 /* CFA Request Extended Error Code */
  4262. +/*
  4263. + * 0x04->0x07 Reserved
  4264. + */
  4265. +#define WIN_SRST 0x08 /* ATAPI soft reset command */
  4266. +#define WIN_DEVICE_RESET 0x08
  4267. +/*
  4268. + * 0x09->0x0F Reserved
  4269. + */
  4270. +#define WIN_RECAL 0x10
  4271. +#define WIN_RESTORE WIN_RECAL
  4272. +/*
  4273. + * 0x10->0x1F Reserved
  4274. + */
  4275. +#define WIN_READ 0x20 /* 28-Bit */
  4276. +#define WIN_READ_ONCE 0x21 /* 28-Bit without retries */
  4277. +#define WIN_READ_LONG 0x22 /* 28-Bit */
  4278. +#define WIN_READ_LONG_ONCE 0x23 /* 28-Bit without retries */
  4279. +#define WIN_READ_EXT 0x24 /* 48-Bit */
  4280. +#define WIN_READDMA_EXT 0x25 /* 48-Bit */
  4281. +#define WIN_READDMA_QUEUED_EXT 0x26 /* 48-Bit */
  4282. +#define WIN_READ_NATIVE_MAX_EXT 0x27 /* 48-Bit */
  4283. +/*
  4284. + * 0x28
  4285. + */
  4286. +#define WIN_MULTREAD_EXT 0x29 /* 48-Bit */
  4287. +/*
  4288. + * 0x2A->0x2F Reserved
  4289. + */
  4290. +#define WIN_WRITE 0x30 /* 28-Bit */
  4291. +#define WIN_WRITE_ONCE 0x31 /* 28-Bit without retries */
  4292. +#define WIN_WRITE_LONG 0x32 /* 28-Bit */
  4293. +#define WIN_WRITE_LONG_ONCE 0x33 /* 28-Bit without retries */
  4294. +#define WIN_WRITE_EXT 0x34 /* 48-Bit */
  4295. +#define WIN_WRITEDMA_EXT 0x35 /* 48-Bit */
  4296. +#define WIN_WRITEDMA_QUEUED_EXT 0x36 /* 48-Bit */
  4297. +#define WIN_SET_MAX_EXT 0x37 /* 48-Bit */
  4298. +#define CFA_WRITE_SECT_WO_ERASE 0x38 /* CFA Write Sectors without erase */
  4299. +#define WIN_MULTWRITE_EXT 0x39 /* 48-Bit */
  4300. +/*
  4301. + * 0x3A->0x3B Reserved
  4302. + */
  4303. +#define WIN_WRITE_VERIFY 0x3C /* 28-Bit */
  4304. +/*
  4305. + * 0x3D->0x3F Reserved
  4306. + */
  4307. +#define WIN_VERIFY 0x40 /* 28-Bit - Read Verify Sectors */
  4308. +#define WIN_VERIFY_ONCE 0x41 /* 28-Bit - without retries */
  4309. +#define WIN_VERIFY_EXT 0x42 /* 48-Bit */
  4310. +/*
  4311. + * 0x43->0x4F Reserved
  4312. + */
  4313. +#define WIN_FORMAT 0x50
  4314. +/*
  4315. + * 0x51->0x5F Reserved
  4316. + */
  4317. +#define WIN_INIT 0x60
  4318. +/*
  4319. + * 0x61->0x5F Reserved
  4320. + */
  4321. +#define WIN_SEEK 0x70 /* 0x70-0x7F Reserved */
  4322. +#define CFA_TRANSLATE_SECTOR 0x87 /* CFA Translate Sector */
  4323. +#define WIN_DIAGNOSE 0x90
  4324. +#define WIN_SPECIFY 0x91 /* set drive geometry translation */
  4325. +#define WIN_DOWNLOAD_MICROCODE 0x92
  4326. +#define WIN_STANDBYNOW2 0x94
  4327. +#define WIN_STANDBY2 0x96
  4328. +#define WIN_SETIDLE2 0x97
  4329. +#define WIN_CHECKPOWERMODE2 0x98
  4330. +#define WIN_SLEEPNOW2 0x99
  4331. +/*
  4332. + * 0x9A VENDOR
  4333. + */
  4334. +#define WIN_PACKETCMD 0xA0 /* Send a packet command. */
  4335. +#define WIN_PIDENTIFY 0xA1 /* identify ATAPI device */
  4336. +#define WIN_QUEUED_SERVICE 0xA2
  4337. +#define WIN_SMART 0xB0 /* self-monitoring and reporting */
  4338. +#define CFA_ERASE_SECTORS 0xC0
  4339. +#define WIN_MULTREAD 0xC4 /* read sectors using multiple mode*/
  4340. +#define WIN_MULTWRITE 0xC5 /* write sectors using multiple mode */
  4341. +#define WIN_SETMULT 0xC6 /* enable/disable multiple mode */
  4342. +#define WIN_READDMA_QUEUED 0xC7 /* read sectors using Queued DMA transfers */
  4343. +#define WIN_READDMA 0xC8 /* read sectors using DMA transfers */
  4344. +#define WIN_READDMA_ONCE 0xC9 /* 28-Bit - without retries */
  4345. +#define WIN_WRITEDMA 0xCA /* write sectors using DMA transfers */
  4346. +#define WIN_WRITEDMA_ONCE 0xCB /* 28-Bit - without retries */
  4347. +#define WIN_WRITEDMA_QUEUED 0xCC /* write sectors using Queued DMA transfers */
  4348. +#define CFA_WRITE_MULTI_WO_ERASE 0xCD /* CFA Write multiple without erase */
  4349. +#define WIN_GETMEDIASTATUS 0xDA
  4350. +#define WIN_ACKMEDIACHANGE 0xDB /* ATA-1, ATA-2 vendor */
  4351. +#define WIN_POSTBOOT 0xDC
  4352. +#define WIN_PREBOOT 0xDD
  4353. +#define WIN_DOORLOCK 0xDE /* lock door on removable drives */
  4354. +#define WIN_DOORUNLOCK 0xDF /* unlock door on removable drives */
  4355. +#define WIN_STANDBYNOW1 0xE0
  4356. +#define WIN_IDLEIMMEDIATE 0xE1 /* force drive to become "ready" */
  4357. +#define WIN_STANDBY 0xE2 /* Set device in Standby Mode */
  4358. +#define WIN_SETIDLE1 0xE3
  4359. +#define WIN_READ_BUFFER 0xE4 /* force read only 1 sector */
  4360. +#define WIN_CHECKPOWERMODE1 0xE5
  4361. +#define WIN_SLEEPNOW1 0xE6
  4362. +#define WIN_FLUSH_CACHE 0xE7
  4363. +#define WIN_WRITE_BUFFER 0xE8 /* force write only 1 sector */
  4364. +#define WIN_WRITE_SAME 0xE9 /* read ata-2 to use */
  4365. + /* SET_FEATURES 0x22 or 0xDD */
  4366. +#define WIN_FLUSH_CACHE_EXT 0xEA /* 48-Bit */
  4367. +#define WIN_IDENTIFY 0xEC /* ask drive to identify itself */
  4368. +#define WIN_MEDIAEJECT 0xED
  4369. +#define WIN_IDENTIFY_DMA 0xEE /* same as WIN_IDENTIFY, but DMA */
  4370. +#define WIN_SETFEATURES 0xEF /* set special drive features */
  4371. +#define EXABYTE_ENABLE_NEST 0xF0
  4372. +#define WIN_SECURITY_SET_PASS 0xF1
  4373. +#define WIN_SECURITY_UNLOCK 0xF2
  4374. +#define WIN_SECURITY_ERASE_PREPARE 0xF3
  4375. +#define WIN_SECURITY_ERASE_UNIT 0xF4
  4376. +#define WIN_SECURITY_FREEZE_LOCK 0xF5
  4377. +#define WIN_SECURITY_DISABLE 0xF6
  4378. +#define WIN_READ_NATIVE_MAX 0xF8 /* return the native maximum address */
  4379. +#define WIN_SET_MAX 0xF9
  4380. +#define DISABLE_SEAGATE 0xFB
  4381. +
  4382. +/* WIN_SMART sub-commands */
  4383. +
  4384. +#define SMART_READ_VALUES 0xD0
  4385. +#define SMART_READ_THRESHOLDS 0xD1
  4386. +#define SMART_AUTOSAVE 0xD2
  4387. +#define SMART_SAVE 0xD3
  4388. +#define SMART_IMMEDIATE_OFFLINE 0xD4
  4389. +#define SMART_READ_LOG_SECTOR 0xD5
  4390. +#define SMART_WRITE_LOG_SECTOR 0xD6
  4391. +#define SMART_WRITE_THRESHOLDS 0xD7
  4392. +#define SMART_ENABLE 0xD8
  4393. +#define SMART_DISABLE 0xD9
  4394. +#define SMART_STATUS 0xDA
  4395. +#define SMART_AUTO_OFFLINE 0xDB
  4396. +
  4397. +/* Password used in TF4 & TF5 executing SMART commands */
  4398. +
  4399. +#define SMART_LCYL_PASS 0x4F
  4400. +#define SMART_HCYL_PASS 0xC2
  4401. +
  4402. +/* WIN_SETFEATURES sub-commands */
  4403. +#define SETFEATURES_EN_8BIT 0x01 /* Enable 8-Bit Transfers */
  4404. +#define SETFEATURES_EN_WCACHE 0x02 /* Enable write cache */
  4405. +#define SETFEATURES_XFER 0x03 /* Set transfer mode */
  4406. +# define XFER_UDMA_7 0x47 /* 0100|0111 */
  4407. +# define XFER_UDMA_6 0x46 /* 0100|0110 */
  4408. +# define XFER_UDMA_5 0x45 /* 0100|0101 */
  4409. +# define XFER_UDMA_4 0x44 /* 0100|0100 */
  4410. +# define XFER_UDMA_3 0x43 /* 0100|0011 */
  4411. +# define XFER_UDMA_2 0x42 /* 0100|0010 */
  4412. +# define XFER_UDMA_1 0x41 /* 0100|0001 */
  4413. +# define XFER_UDMA_0 0x40 /* 0100|0000 */
  4414. +# define XFER_MW_DMA_2 0x22 /* 0010|0010 */
  4415. +# define XFER_MW_DMA_1 0x21 /* 0010|0001 */
  4416. +# define XFER_MW_DMA_0 0x20 /* 0010|0000 */
  4417. +# define XFER_SW_DMA_2 0x12 /* 0001|0010 */
  4418. +# define XFER_SW_DMA_1 0x11 /* 0001|0001 */
  4419. +# define XFER_SW_DMA_0 0x10 /* 0001|0000 */
  4420. +# define XFER_PIO_4 0x0C /* 0000|1100 */
  4421. +# define XFER_PIO_3 0x0B /* 0000|1011 */
  4422. +# define XFER_PIO_2 0x0A /* 0000|1010 */
  4423. +# define XFER_PIO_1 0x09 /* 0000|1001 */
  4424. +# define XFER_PIO_0 0x08 /* 0000|1000 */
  4425. +# define XFER_PIO_SLOW 0x00 /* 0000|0000 */
  4426. +#define SETFEATURES_DIS_DEFECT 0x04 /* Disable Defect Management */
  4427. +#define SETFEATURES_EN_APM 0x05 /* Enable advanced power management */
  4428. +#define SETFEATURES_EN_SAME_R 0x22 /* for a region ATA-1 */
  4429. +#define SETFEATURES_DIS_MSN 0x31 /* Disable Media Status Notification */
  4430. +#define SETFEATURES_DIS_RETRY 0x33 /* Disable Retry */
  4431. +#define SETFEATURES_EN_AAM 0x42 /* Enable Automatic Acoustic Management */
  4432. +#define SETFEATURES_RW_LONG 0x44 /* Set Lenght of VS bytes */
  4433. +#define SETFEATURES_SET_CACHE 0x54 /* Set Cache segments to SC Reg. Val */
  4434. +#define SETFEATURES_DIS_RLA 0x55 /* Disable read look-ahead feature */
  4435. +#define SETFEATURES_EN_RI 0x5D /* Enable release interrupt */
  4436. +#define SETFEATURES_EN_SI 0x5E /* Enable SERVICE interrupt */
  4437. +#define SETFEATURES_DIS_RPOD 0x66 /* Disable reverting to power on defaults */
  4438. +#define SETFEATURES_DIS_ECC 0x77 /* Disable ECC byte count */
  4439. +#define SETFEATURES_DIS_8BIT 0x81 /* Disable 8-Bit Transfers */
  4440. +#define SETFEATURES_DIS_WCACHE 0x82 /* Disable write cache */
  4441. +#define SETFEATURES_EN_DEFECT 0x84 /* Enable Defect Management */
  4442. +#define SETFEATURES_DIS_APM 0x85 /* Disable advanced power management */
  4443. +#define SETFEATURES_EN_ECC 0x88 /* Enable ECC byte count */
  4444. +#define SETFEATURES_EN_MSN 0x95 /* Enable Media Status Notification */
  4445. +#define SETFEATURES_EN_RETRY 0x99 /* Enable Retry */
  4446. +#define SETFEATURES_EN_RLA 0xAA /* Enable read look-ahead feature */
  4447. +#define SETFEATURES_PREFETCH 0xAB /* Sets drive prefetch value */
  4448. +#define SETFEATURES_EN_REST 0xAC /* ATA-1 */
  4449. +#define SETFEATURES_4B_RW_LONG 0xBB /* Set Lenght of 4 bytes */
  4450. +#define SETFEATURES_DIS_AAM 0xC2 /* Disable Automatic Acoustic Management */
  4451. +#define SETFEATURES_EN_RPOD 0xCC /* Enable reverting to power on defaults */
  4452. +#define SETFEATURES_DIS_RI 0xDD /* Disable release interrupt ATAPI */
  4453. +#define SETFEATURES_EN_SAME_M 0xDD /* for a entire device ATA-1 */
  4454. +#define SETFEATURES_DIS_SI 0xDE /* Disable SERVICE interrupt ATAPI */
  4455. +
  4456. +/* WIN_SECURITY sub-commands */
  4457. +
  4458. +#define SECURITY_SET_PASSWORD 0xBA
  4459. +#define SECURITY_UNLOCK 0xBB
  4460. +#define SECURITY_ERASE_PREPARE 0xBC
  4461. +#define SECURITY_ERASE_UNIT 0xBD
  4462. +#define SECURITY_FREEZE_LOCK 0xBE
  4463. +#define SECURITY_DISABLE_PASSWORD 0xBF
  4464. +
  4465. +struct hd_geometry {
  4466. + unsigned char heads;
  4467. + unsigned char sectors;
  4468. + unsigned short cylinders;
  4469. + unsigned long start;
  4470. +};
  4471. +
  4472. +/* BIG GEOMETRY */
  4473. +struct hd_big_geometry {
  4474. + unsigned char heads;
  4475. + unsigned char sectors;
  4476. + unsigned int cylinders;
  4477. + unsigned long start;
  4478. +};
  4479. +
  4480. +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
  4481. +#define HDIO_GETGEO 0x0301 /* get device geometry */
  4482. +#define HDIO_GET_UNMASKINTR 0x0302 /* get current unmask setting */
  4483. +#define HDIO_GET_MULTCOUNT 0x0304 /* get current IDE blockmode setting */
  4484. +#define HDIO_GET_QDMA 0x0305 /* get use-qdma flag */
  4485. +
  4486. +#define HDIO_SET_XFER 0x0306 /* set transfer rate via proc */
  4487. +
  4488. +#define HDIO_OBSOLETE_IDENTITY 0x0307 /* OBSOLETE, DO NOT USE: returns 142 bytes */
  4489. +#define HDIO_GET_KEEPSETTINGS 0x0308 /* get keep-settings-on-reset flag */
  4490. +#define HDIO_GET_32BIT 0x0309 /* get current io_32bit setting */
  4491. +#define HDIO_GET_NOWERR 0x030a /* get ignore-write-error flag */
  4492. +#define HDIO_GET_DMA 0x030b /* get use-dma flag */
  4493. +#define HDIO_GET_NICE 0x030c /* get nice flags */
  4494. +#define HDIO_GET_IDENTITY 0x030d /* get IDE identification info */
  4495. +#define HDIO_GET_WCACHE 0x030e /* get write cache mode on|off */
  4496. +#define HDIO_GET_ACOUSTIC 0x030f /* get acoustic value */
  4497. +#define HDIO_GET_ADDRESS 0x0310 /* */
  4498. +
  4499. +#define HDIO_GET_BUSSTATE 0x031a /* get the bus state of the hwif */
  4500. +#define HDIO_TRISTATE_HWIF 0x031b /* execute a channel tristate */
  4501. +#define HDIO_DRIVE_RESET 0x031c /* execute a device reset */
  4502. +#define HDIO_DRIVE_TASKFILE 0x031d /* execute raw taskfile */
  4503. +#define HDIO_DRIVE_TASK 0x031e /* execute task and special drive command */
  4504. +#define HDIO_DRIVE_CMD 0x031f /* execute a special drive command */
  4505. +
  4506. +#define HDIO_DRIVE_CMD_AEB HDIO_DRIVE_TASK
  4507. +
  4508. +/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
  4509. +#define HDIO_SET_MULTCOUNT 0x0321 /* change IDE blockmode */
  4510. +#define HDIO_SET_UNMASKINTR 0x0322 /* permit other irqs during I/O */
  4511. +#define HDIO_SET_KEEPSETTINGS 0x0323 /* keep ioctl settings on reset */
  4512. +#define HDIO_SET_32BIT 0x0324 /* change io_32bit flags */
  4513. +#define HDIO_SET_NOWERR 0x0325 /* change ignore-write-error flag */
  4514. +#define HDIO_SET_DMA 0x0326 /* change use-dma flag */
  4515. +#define HDIO_SET_PIO_MODE 0x0327 /* reconfig interface to new speed */
  4516. +#define HDIO_SCAN_HWIF 0x0328 /* register and (re)scan interface */
  4517. +#define HDIO_SET_NICE 0x0329 /* set nice flags */
  4518. +#define HDIO_UNREGISTER_HWIF 0x032a /* unregister interface */
  4519. +#define HDIO_SET_WCACHE 0x032b /* change write cache enable-disable */
  4520. +#define HDIO_SET_ACOUSTIC 0x032c /* change acoustic behavior */
  4521. +#define HDIO_SET_BUSSTATE 0x032d /* set the bus state of the hwif */
  4522. +#define HDIO_SET_QDMA 0x032e /* change use-qdma flag */
  4523. +#define HDIO_SET_ADDRESS 0x032f /* change lba addressing modes */
  4524. +
  4525. +/* bus states */
  4526. +enum {
  4527. + BUSSTATE_OFF = 0,
  4528. + BUSSTATE_ON,
  4529. + BUSSTATE_TRISTATE
  4530. +};
  4531. +
  4532. +/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
  4533. +#define HDIO_GETGEO_BIG 0x0330 /* */
  4534. +#define HDIO_GETGEO_BIG_RAW 0x0331 /* */
  4535. +
  4536. +#define HDIO_SET_IDE_SCSI 0x0338
  4537. +#define HDIO_SET_SCSI_IDE 0x0339
  4538. +
  4539. +#define __NEW_HD_DRIVE_ID
  4540. +/* structure returned by HDIO_GET_IDENTITY,
  4541. + * as per ANSI NCITS ATA6 rev.1b spec
  4542. + */
  4543. +struct hd_driveid {
  4544. + unsigned short config; /* lots of obsolete bit flags */
  4545. + unsigned short cyls; /* Obsolete, "physical" cyls */
  4546. + unsigned short reserved2; /* reserved (word 2) */
  4547. + unsigned short heads; /* Obsolete, "physical" heads */
  4548. + unsigned short track_bytes; /* unformatted bytes per track */
  4549. + unsigned short sector_bytes; /* unformatted bytes per sector */
  4550. + unsigned short sectors; /* Obsolete, "physical" sectors per track */
  4551. + unsigned short vendor0; /* vendor unique */
  4552. + unsigned short vendor1; /* vendor unique */
  4553. + unsigned short vendor2; /* Retired vendor unique */
  4554. + unsigned char serial_no[20]; /* 0 = not_specified */
  4555. + unsigned short buf_type; /* Retired */
  4556. + unsigned short buf_size; /* Retired, 512 byte increments
  4557. + * 0 = not_specified
  4558. + */
  4559. + unsigned short ecc_bytes; /* for r/w long cmds; 0 = not_specified */
  4560. + unsigned char fw_rev[8]; /* 0 = not_specified */
  4561. + unsigned char model[40]; /* 0 = not_specified */
  4562. + unsigned char max_multsect; /* 0=not_implemented */
  4563. + unsigned char vendor3; /* vendor unique */
  4564. + unsigned short dword_io; /* 0=not_implemented; 1=implemented */
  4565. + unsigned char vendor4; /* vendor unique */
  4566. + unsigned char capability; /* (upper byte of word 49)
  4567. + * 3: IORDYsup
  4568. + * 2: IORDYsw
  4569. + * 1: LBA
  4570. + * 0: DMA
  4571. + */
  4572. + unsigned short reserved50; /* reserved (word 50) */
  4573. + unsigned char vendor5; /* Obsolete, vendor unique */
  4574. + unsigned char tPIO; /* Obsolete, 0=slow, 1=medium, 2=fast */
  4575. + unsigned char vendor6; /* Obsolete, vendor unique */
  4576. + unsigned char tDMA; /* Obsolete, 0=slow, 1=medium, 2=fast */
  4577. + unsigned short field_valid; /* (word 53)
  4578. + * 2: ultra_ok word 88
  4579. + * 1: eide_ok words 64-70
  4580. + * 0: cur_ok words 54-58
  4581. + */
  4582. + unsigned short cur_cyls; /* Obsolete, logical cylinders */
  4583. + unsigned short cur_heads; /* Obsolete, l heads */
  4584. + unsigned short cur_sectors; /* Obsolete, l sectors per track */
  4585. + unsigned short cur_capacity0; /* Obsolete, l total sectors on drive */
  4586. + unsigned short cur_capacity1; /* Obsolete, (2 words, misaligned int) */
  4587. + unsigned char multsect; /* current multiple sector count */
  4588. + unsigned char multsect_valid; /* when (bit0==1) multsect is ok */
  4589. + unsigned int lba_capacity; /* Obsolete, total number of sectors */
  4590. + unsigned short dma_1word; /* Obsolete, single-word dma info */
  4591. + unsigned short dma_mword; /* multiple-word dma info */
  4592. + unsigned short eide_pio_modes; /* bits 0:mode3 1:mode4 */
  4593. + unsigned short eide_dma_min; /* min mword dma cycle time (ns) */
  4594. + unsigned short eide_dma_time; /* recommended mword dma cycle time (ns) */
  4595. + unsigned short eide_pio; /* min cycle time (ns), no IORDY */
  4596. + unsigned short eide_pio_iordy; /* min cycle time (ns), with IORDY */
  4597. + unsigned short words69_70[2]; /* reserved words 69-70
  4598. + * future command overlap and queuing
  4599. + */
  4600. + /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
  4601. + unsigned short words71_74[4]; /* reserved words 71-74
  4602. + * for IDENTIFY PACKET DEVICE command
  4603. + */
  4604. + unsigned short queue_depth; /* (word 75)
  4605. + * 15:5 reserved
  4606. + * 4:0 Maximum queue depth -1
  4607. + */
  4608. + unsigned short words76_79[4]; /* reserved words 76-79 */
  4609. + unsigned short major_rev_num; /* (word 80) */
  4610. + unsigned short minor_rev_num; /* (word 81) */
  4611. + unsigned short command_set_1; /* (word 82) supported
  4612. + * 15: Obsolete
  4613. + * 14: NOP command
  4614. + * 13: READ_BUFFER
  4615. + * 12: WRITE_BUFFER
  4616. + * 11: Obsolete
  4617. + * 10: Host Protected Area
  4618. + * 9: DEVICE Reset
  4619. + * 8: SERVICE Interrupt
  4620. + * 7: Release Interrupt
  4621. + * 6: look-ahead
  4622. + * 5: write cache
  4623. + * 4: PACKET Command
  4624. + * 3: Power Management Feature Set
  4625. + * 2: Removable Feature Set
  4626. + * 1: Security Feature Set
  4627. + * 0: SMART Feature Set
  4628. + */
  4629. + unsigned short command_set_2; /* (word 83)
  4630. + * 15: Shall be ZERO
  4631. + * 14: Shall be ONE
  4632. + * 13: FLUSH CACHE EXT
  4633. + * 12: FLUSH CACHE
  4634. + * 11: Device Configuration Overlay
  4635. + * 10: 48-bit Address Feature Set
  4636. + * 9: Automatic Acoustic Management
  4637. + * 8: SET MAX security
  4638. + * 7: reserved 1407DT PARTIES
  4639. + * 6: SetF sub-command Power-Up
  4640. + * 5: Power-Up in Standby Feature Set
  4641. + * 4: Removable Media Notification
  4642. + * 3: APM Feature Set
  4643. + * 2: CFA Feature Set
  4644. + * 1: READ/WRITE DMA QUEUED
  4645. + * 0: Download MicroCode
  4646. + */
  4647. + unsigned short cfsse; /* (word 84)
  4648. + * cmd set-feature supported extensions
  4649. + * 15: Shall be ZERO
  4650. + * 14: Shall be ONE
  4651. + * 13:6 reserved
  4652. + * 5: General Purpose Logging
  4653. + * 4: Streaming Feature Set
  4654. + * 3: Media Card Pass Through
  4655. + * 2: Media Serial Number Valid
  4656. + * 1: SMART selt-test supported
  4657. + * 0: SMART error logging
  4658. + */
  4659. + unsigned short cfs_enable_1; /* (word 85)
  4660. + * command set-feature enabled
  4661. + * 15: Obsolete
  4662. + * 14: NOP command
  4663. + * 13: READ_BUFFER
  4664. + * 12: WRITE_BUFFER
  4665. + * 11: Obsolete
  4666. + * 10: Host Protected Area
  4667. + * 9: DEVICE Reset
  4668. + * 8: SERVICE Interrupt
  4669. + * 7: Release Interrupt
  4670. + * 6: look-ahead
  4671. + * 5: write cache
  4672. + * 4: PACKET Command
  4673. + * 3: Power Management Feature Set
  4674. + * 2: Removable Feature Set
  4675. + * 1: Security Feature Set
  4676. + * 0: SMART Feature Set
  4677. + */
  4678. + unsigned short cfs_enable_2; /* (word 86)
  4679. + * command set-feature enabled
  4680. + * 15: Shall be ZERO
  4681. + * 14: Shall be ONE
  4682. + * 13: FLUSH CACHE EXT
  4683. + * 12: FLUSH CACHE
  4684. + * 11: Device Configuration Overlay
  4685. + * 10: 48-bit Address Feature Set
  4686. + * 9: Automatic Acoustic Management
  4687. + * 8: SET MAX security
  4688. + * 7: reserved 1407DT PARTIES
  4689. + * 6: SetF sub-command Power-Up
  4690. + * 5: Power-Up in Standby Feature Set
  4691. + * 4: Removable Media Notification
  4692. + * 3: APM Feature Set
  4693. + * 2: CFA Feature Set
  4694. + * 1: READ/WRITE DMA QUEUED
  4695. + * 0: Download MicroCode
  4696. + */
  4697. + unsigned short csf_default; /* (word 87)
  4698. + * command set-feature default
  4699. + * 15: Shall be ZERO
  4700. + * 14: Shall be ONE
  4701. + * 13:6 reserved
  4702. + * 5: General Purpose Logging enabled
  4703. + * 4: Valid CONFIGURE STREAM executed
  4704. + * 3: Media Card Pass Through enabled
  4705. + * 2: Media Serial Number Valid
  4706. + * 1: SMART selt-test supported
  4707. + * 0: SMART error logging
  4708. + */
  4709. + unsigned short dma_ultra; /* (word 88) */
  4710. + unsigned short trseuc; /* time required for security erase */
  4711. + unsigned short trsEuc; /* time required for enhanced erase */
  4712. + unsigned short CurAPMvalues; /* current APM values */
  4713. + unsigned short mprc; /* master password revision code */
  4714. + unsigned short hw_config; /* hardware config (word 93)
  4715. + * 15: Shall be ZERO
  4716. + * 14: Shall be ONE
  4717. + * 13:
  4718. + * 12:
  4719. + * 11:
  4720. + * 10:
  4721. + * 9:
  4722. + * 8:
  4723. + * 7:
  4724. + * 6:
  4725. + * 5:
  4726. + * 4:
  4727. + * 3:
  4728. + * 2:
  4729. + * 1:
  4730. + * 0: Shall be ONE
  4731. + */
  4732. + unsigned short acoustic; /* (word 94)
  4733. + * 15:8 Vendor's recommended value
  4734. + * 7:0 current value
  4735. + */
  4736. + unsigned short msrqs; /* min stream request size */
  4737. + unsigned short sxfert; /* stream transfer time */
  4738. + unsigned short sal; /* stream access latency */
  4739. + unsigned int spg; /* stream performance granularity */
  4740. + unsigned long long lba_capacity_2;/* 48-bit total number of sectors */
  4741. + unsigned short words104_125[22];/* reserved words 104-125 */
  4742. + unsigned short last_lun; /* (word 126) */
  4743. + unsigned short word127; /* (word 127) Feature Set
  4744. + * Removable Media Notification
  4745. + * 15:2 reserved
  4746. + * 1:0 00 = not supported
  4747. + * 01 = supported
  4748. + * 10 = reserved
  4749. + * 11 = reserved
  4750. + */
  4751. + unsigned short dlf; /* (word 128)
  4752. + * device lock function
  4753. + * 15:9 reserved
  4754. + * 8 security level 1:max 0:high
  4755. + * 7:6 reserved
  4756. + * 5 enhanced erase
  4757. + * 4 expire
  4758. + * 3 frozen
  4759. + * 2 locked
  4760. + * 1 en/disabled
  4761. + * 0 capability
  4762. + */
  4763. + unsigned short csfo; /* (word 129)
  4764. + * current set features options
  4765. + * 15:4 reserved
  4766. + * 3: auto reassign
  4767. + * 2: reverting
  4768. + * 1: read-look-ahead
  4769. + * 0: write cache
  4770. + */
  4771. + unsigned short words130_155[26];/* reserved vendor words 130-155 */
  4772. + unsigned short word156; /* reserved vendor word 156 */
  4773. + unsigned short words157_159[3];/* reserved vendor words 157-159 */
  4774. + unsigned short cfa_power; /* (word 160) CFA Power Mode
  4775. + * 15 word 160 supported
  4776. + * 14 reserved
  4777. + * 13
  4778. + * 12
  4779. + * 11:0
  4780. + */
  4781. + unsigned short words161_175[15];/* Reserved for CFA */
  4782. + unsigned short words176_205[30];/* Current Media Serial Number */
  4783. + unsigned short words206_254[49];/* reserved words 206-254 */
  4784. + unsigned short integrity_word; /* (word 255)
  4785. + * 15:8 Checksum
  4786. + * 7:0 Signature
  4787. + */
  4788. +};
  4789. +
  4790. +/*
  4791. + * IDE "nice" flags. These are used on a per drive basis to determine
  4792. + * when to be nice and give more bandwidth to the other devices which
  4793. + * share the same IDE bus.
  4794. + */
  4795. +#define IDE_NICE_DSC_OVERLAP (0) /* per the DSC overlap protocol */
  4796. +#define IDE_NICE_ATAPI_OVERLAP (1) /* not supported yet */
  4797. +#define IDE_NICE_0 (2) /* when sure that it won't affect us */
  4798. +#define IDE_NICE_1 (3) /* when probably won't affect us much */
  4799. +#define IDE_NICE_2 (4) /* when we know it's on our expense */
  4800. +
  4801. +#ifdef __KERNEL__
  4802. +/*
  4803. + * These routines are used for kernel command line parameters from main.c:
  4804. + */
  4805. +#include <linux/config.h>
  4806. +
  4807. +#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
  4808. +int ide_register(int io_port, int ctl_port, int irq);
  4809. +int ide_unregister(unsigned int);
  4810. +#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
  4811. +
  4812. +#endif /* __KERNEL__ */
  4813. +
  4814. +#endif /* _LINUX_HDREG_H */
  4815. --- lilo-22.5.8.orig/kernel-headers/linux/ioctl.h
  4816. +++ lilo-22.5.8/kernel-headers/linux/ioctl.h
  4817. @@ -0,0 +1,7 @@
  4818. +#ifndef _LINUX_IOCTL_H
  4819. +#define _LINUX_IOCTL_H
  4820. +
  4821. +#include <asm/ioctl.h>
  4822. +
  4823. +#endif /* _LINUX_IOCTL_H */
  4824. +
  4825. --- ./Makefile.orig 2004-02-09 07:34:23.517394368 +0000
  4826. +++ ./Makefile 2004-02-09 07:34:35.337597424 +0000
  4827. @@ -84,7 +84,7 @@
  4828. LD86=ld86 -0
  4829. NASM=nasm
  4830. -CFLAGS=$(OPT) -Wall -g $(PCONFIG)
  4831. +CFLAGS=$(OPT) -Wall -g $(PCONFIG) -Ikernel-headers
  4832. LDFLAGS=#-Xlinker -qmagic
  4833. LIBS=