ReactOS 0.4.15-dev-7958-gcd0bb1a
module.h
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYRIGHT.TXT
3 * PROJECT: Ext2 File System Driver for WinNT/2K/XP
4 * FILE: Modules.h
5 * PURPOSE: Header file: nls structures & linux kernel ...
6 * PROGRAMMER: Matt Wu <mattwu@163.com>
7 * HOMEPAGE: http://www.ext2fsd.com
8 * UPDATE HISTORY:
9 */
10
11#ifndef _EXT2_MODULE_HEADER_
12#define _EXT2_MODULE_HEADER_
13
14/* INCLUDES *************************************************************/
15
16#include <linux/types.h>
17#include <linux/errno.h>
18#include <linux/rbtree.h>
19#include <linux/fs.h>
20#include <linux/log2.h>
21
22#if _WIN32_WINNT <= 0x500
23#define _WIN2K_TARGET_ 1
24#endif
25
26/* STRUCTS ******************************************************/
27
28#ifndef offsetof
29# define offsetof(type, member) ((ULONG_PTR)&(((type *)0)->member))
30#endif
31
32#ifndef container_of
33#define container_of(ptr, type, member) \
34 ((type *)((char *)ptr - (char *)offsetof(type, member)))
35#endif
36
37//
38// Byte order swapping routines
39//
40
41/* use the runtime routine or compiler's implementation */
42#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
43 ((defined(_M_AMD64) || defined(_M_IA64)) && \
44 (_MSC_FULL_VER > 13009175))
45#ifdef __cplusplus
46extern "C" {
47#endif
48 unsigned short __cdecl _byteswap_ushort(unsigned short);
49 unsigned long __cdecl _byteswap_ulong (unsigned long);
50 unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
51#ifdef __cplusplus
52}
53#endif
54#pragma intrinsic(_byteswap_ushort)
55#pragma intrinsic(_byteswap_ulong)
56#pragma intrinsic(_byteswap_uint64)
57
58#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
59#define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
60#define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
61
62#else
63#ifndef __REACTOS__
64
69);
70
75);
76
81);
82#endif //#ifndef __REACTOS__
83#endif
84
85#define __swab16(x) RtlUshortByteSwap(x)
86#define __swab32(x) RtlUlongByteSwap(x)
87#define __swab64(x) RtlUlonglongByteSwap(x)
88
89#define __constant_swab32 __swab32
90#define __constant_swab64 __swab64
91
92#define __constant_htonl(x) __constant_swab32((x))
93#define __constant_ntohl(x) __constant_swab32((x))
94#define __constant_htons(x) __constant_swab16((x))
95#define __constant_ntohs(x) __constant_swab16((x))
96#define __constant_cpu_to_le64(x) ((__u64)(x))
97#define __constant_le64_to_cpu(x) ((__u64)(x))
98#define __constant_cpu_to_le32(x) ((__u32)(x))
99#define __constant_le32_to_cpu(x) ((__u32)(x))
100#define __constant_cpu_to_le16(x) ((__u16)(x))
101#define __constant_le16_to_cpu(x) ((__u16)(x))
102#define __constant_cpu_to_be64(x) __constant_swab64((x))
103#define __constant_be64_to_cpu(x) __constant_swab64((x))
104#define __constant_cpu_to_be32(x) __constant_swab32((x))
105#define __constant_be32_to_cpu(x) __constant_swab32((x))
106#define __constant_cpu_to_be16(x) __constant_swab16((x))
107#define __constant_be16_to_cpu(x) __constant_swab16((x))
108#define __cpu_to_le64(x) ((__u64)(x))
109#define __le64_to_cpu(x) ((__u64)(x))
110#define __cpu_to_le32(x) ((__u32)(x))
111#define __le32_to_cpu(x) ((__u32)(x))
112#define __cpu_to_le16(x) ((__u16)(x))
113#define __le16_to_cpu(x) ((__u16)(x))
114#define __cpu_to_be64(x) __swab64((x))
115#define __be64_to_cpu(x) __swab64((x))
116#define __cpu_to_be32(x) __swab32((x))
117#define __be32_to_cpu(x) __swab32((x))
118#define __cpu_to_be16(x) __swab16((x))
119#define __be16_to_cpu(x) __swab16((x))
120#define __cpu_to_le64p(x) (*(__u64*)(x))
121#define __le64_to_cpup(x) (*(__u64*)(x))
122#define __cpu_to_le32p(x) (*(__u32*)(x))
123#define __le32_to_cpup(x) (*(__u32*)(x))
124#define __cpu_to_le16p(x) (*(__u16*)(x))
125#define __le16_to_cpup(x) (*(__u16*)(x))
126#define __cpu_to_be64p(x) __swab64p((x))
127#define __be64_to_cpup(x) __swab64p((x))
128#define __cpu_to_be32p(x) __swab32p((x))
129#define __be32_to_cpup(x) __swab32p((x))
130#define __cpu_to_be16p(x) __swab16p((x))
131#define __be16_to_cpup(x) __swab16p((x))
132#define __cpu_to_le64s(x) ((__s64)(x))
133#define __le64_to_cpus(x) ((__s64)(x))
134#define __cpu_to_le32s(x) ((__s32)(x))
135#define __le32_to_cpus(x) ((__s32)(x))
136#define __cpu_to_le16s(x) ((__s16)(x))
137#define __le16_to_cpus(x) ((__s16)(x))
138#define __cpu_to_be64s(x) __swab64s((x))
139#define __be64_to_cpus(x) __swab64s((x))
140#define __cpu_to_be32s(x) __swab32s((x))
141#define __be32_to_cpus(x) __swab32s((x))
142#define __cpu_to_be16s(x) __swab16s((x))
143#define __be16_to_cpus(x) __swab16s((x))
144
145#ifndef cpu_to_le64
146#define cpu_to_le64 __cpu_to_le64
147#define le64_to_cpu __le64_to_cpu
148#define cpu_to_le32 __cpu_to_le32
149#define le32_to_cpu __le32_to_cpu
150#define cpu_to_le16 __cpu_to_le16
151#define le16_to_cpu __le16_to_cpu
152#endif
153
154#define cpu_to_be64 __cpu_to_be64
155#define be64_to_cpu __be64_to_cpu
156#define cpu_to_be32 __cpu_to_be32
157#define be32_to_cpu __be32_to_cpu
158#define cpu_to_be16 __cpu_to_be16
159#define be16_to_cpu __be16_to_cpu
160#define cpu_to_le64p __cpu_to_le64p
161#define le64_to_cpup __le64_to_cpup
162#define cpu_to_le32p __cpu_to_le32p
163#define le32_to_cpup __le32_to_cpup
164#define cpu_to_le16p __cpu_to_le16p
165#define le16_to_cpup __le16_to_cpup
166#define cpu_to_be64p __cpu_to_be64p
167#define be64_to_cpup __be64_to_cpup
168#define cpu_to_be32p __cpu_to_be32p
169#define be32_to_cpup __be32_to_cpup
170#define cpu_to_be16p __cpu_to_be16p
171#define be16_to_cpup __be16_to_cpup
172#define cpu_to_le64s __cpu_to_le64s
173#define le64_to_cpus __le64_to_cpus
174#define cpu_to_le32s __cpu_to_le32s
175#define le32_to_cpus __le32_to_cpus
176#define cpu_to_le16s __cpu_to_le16s
177#define le16_to_cpus __le16_to_cpus
178#define cpu_to_be64s __cpu_to_be64s
179#define be64_to_cpus __be64_to_cpus
180#define cpu_to_be32s __cpu_to_be32s
181#define be32_to_cpus __be32_to_cpus
182#define cpu_to_be16s __cpu_to_be16s
183#define be16_to_cpus __be16_to_cpus
184
185
186static inline void le16_add_cpu(__le16 *var, u16 val)
187{
189}
190
191static inline void le32_add_cpu(__le32 *var, u32 val)
192{
194}
195
196static inline void le64_add_cpu(__le64 *var, u64 val)
197{
199}
200
201//
202// Network to host byte swap functions
203//
204
205#define ntohl(x) ( ( ( ( x ) & 0x000000ff ) << 24 ) | \
206 ( ( ( x ) & 0x0000ff00 ) << 8 ) | \
207 ( ( ( x ) & 0x00ff0000 ) >> 8 ) | \
208 ( ( ( x ) & 0xff000000 ) >> 24 ) )
209
210#define ntohs(x) ( ( ( ( x ) & 0xff00 ) >> 8 ) | \
211 ( ( ( x ) & 0x00ff ) << 8 ) )
212
213
214#define htonl(x) ntohl(x)
215#define htons(x) ntohs(x)
216
217
218//
219// kernel printk flags
220//
221
222#define KERN_EMERG "<0>" /* system is unusable */
223#define KERN_ALERT "<1>" /* action must be taken immediately */
224#define KERN_CRIT "<2>" /* critical conditions */
225#define KERN_ERR "<3>" /* error conditions */
226#define KERN_WARNING "<4>" /* warning conditions */
227#define KERN_NOTICE "<5>" /* normal but significant condition */
228#define KERN_INFO "<6>" /* informational */
229#define KERN_DEBUG "<7>" /* debug-level messages */
230
231#define printk DbgPrint
232
233/*
234 * error pointer
235 */
236#define MAX_ERRNO 4095
237#define IS_ERR_VALUE(x) ((x) >= (unsigned long)-MAX_ERRNO)
238
239static inline void *ERR_PTR(long error)
240{
241 return (void *)(long_ptr_t) error;
242}
243
244static inline long PTR_ERR(const void *ptr)
245{
246 return (long)(long_ptr_t) ptr;
247}
248
249static inline long IS_ERR(const void *ptr)
250{
251 return IS_ERR_VALUE((unsigned long)(long_ptr_t)ptr);
252}
253
254
255#define BUG_ON(c) assert(!(c))
256
257#define WARN_ON(c) BUG_ON(c)
258
259//
260// Linux module definitions
261//
262
263#define likely
264#define unlikely
265
266#define __init
267#define __exit
268
269#define THIS_MODULE NULL
270#define MODULE_LICENSE(x)
271#define MODULE_ALIAS_NLS(x)
272#define EXPORT_SYMBOL(x)
273
274
275#define try_module_get(x) (TRUE)
276#define module_put(x)
277
278#define module_init(X) int __init module_##X() {return X();}
279#define module_exit(X) void __exit module_##X() {X();}
280
281#define DECLARE_INIT(X) int __init module_##X(void)
282#define DECLARE_EXIT(X) void __exit module_##X(void)
283
284#define LOAD_MODULE(X) do { \
285 rc = module_##X(); \
286 } while(0)
287
288#define UNLOAD_MODULE(X) do { \
289 module_##X(); \
290 } while(0)
291
292#define LOAD_NLS LOAD_MODULE
293#define UNLOAD_NLS UNLOAD_MODULE
294
295//
296// spinlocks .....
297//
298
299typedef struct _spinlock_t {
300
304
305#define spin_lock_init(sl) KeInitializeSpinLock(&((sl)->lock))
306#define spin_lock(sl) KeAcquireSpinLock(&((sl)->lock), &((sl)->irql))
307#define spin_unlock(sl) KeReleaseSpinLock(&((sl)->lock), (sl)->irql)
308#define spin_lock_irqsave(sl, flags) do {spin_lock(sl); flags=(sl)->irql;} while(0)
309#define spin_unlock_irqrestore(sl, flags) do {ASSERT((KIRQL)(flags)==(sl)->irql); spin_unlock(sl);} while(0)
310
311#define assert_spin_locked(x) do {} while(0)
312
313/*
314 * Does a critical section need to be broken due to another
315 * task waiting?: (technically does not depend on CONFIG_PREEMPT,
316 * but a general need for low latency)
317 */
318static inline int spin_needbreak(spinlock_t *lock)
319{
320#ifdef CONFIG_PREEMPT
321 return spin_is_contended(lock);
322#else
323 return 0;
324#endif
325}
326
327//
328// bit operations
329//
330
340static inline int set_bit(int nr, volatile unsigned long *addr)
341{
342 addr += (nr >> ORDER_PER_LONG);
343 nr &= (BITS_PER_LONG - 1);
344
345 return !!(InterlockedOr(addr, (1 << nr)) & (1 << nr));
346}
347
348
359static inline int clear_bit(int nr, volatile unsigned long *addr)
360{
361 addr += (nr >> ORDER_PER_LONG);
362 nr &= (BITS_PER_LONG - 1);
363
364 return !!(InterlockedAnd(addr, ~(1 << nr)) & (1 << nr));
365}
366
375static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
376{
377 return clear_bit(nr, addr);
378}
379
380/*
381 * test
382 */
383static int test_bit(int nr, volatile const unsigned long *addr)
384{
385 return !!((1 << (nr & (BITS_PER_LONG - 1))) &
386 (addr[nr >> ORDER_PER_LONG]));
387}
388
397static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
398{
399 return set_bit(nr, addr);
400}
401
402//
403// list definition ...
404//
405
406#include <linux/list.h>
407
408
409/*********************************************
410 * linux scheduler related structures *
411*********************************************/
412
413//
414// task structure
415//
416
417#define TASK_INTERRUPTIBLE 1
418#define TASK_UNINTERRUPTIBLE 2
419
423 char comm[32];
425};
426
427extern struct task_struct *current;
428
429//
430// scheduler routines
431//
432
433
434#ifdef __REACTOS__
435static inline int cond_resched() {
436#else
437static inline cond_resched() {
438#endif
439 return FALSE;
440}
441#ifdef __REACTOS__
442static inline int need_resched() {
443#else
444static inline need_resched() {
445#endif
446 return FALSE;
447}
448
449#define yield() do {} while(0)
450#define might_sleep() do {} while(0)
451
452//
453// mutex
454//
455
456typedef struct mutex {
459
460#define mutex_init(x) ExInitializeFastMutex(&((x)->lock))
461#define mutex_lock(x) ExAcquireFastMutex(&((x)->lock))
462#define mutex_unlock(x) ExReleaseFastMutex(&((x)->lock))
463
464
465//
466// wait_queue
467//
468
469
471
472#define WQ_FLAG_EXCLUSIVE 0x01
473#define WQ_FLAG_AUTO_REMOVAL 0x02
474
476 unsigned int flags;
477 void * private;
480};
481
482
483#define DEFINE_WAIT(name) \
484 wait_queue_t name = (PVOID)wait_queue_create();
485
486/*
487struct wait_bit_key {
488 void *flags;
489 int bit_nr;
490};
491
492struct wait_bit_queue {
493 struct wait_bit_key key;
494 wait_queue_t wait;
495};
496*/
497
501};
503
504#define is_sync_wait(wait) (TRUE)
505#define set_current_state(state) do {} while(0)
506#define __set_current_state(state) do {} while(0)
507
510
511
512/*
513 * Waitqueues which are removed from the waitqueue_head at wakeup time
514 */
516void wait_queue_destroy(struct __wait_queue *);
517
521int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
522int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
523
524
525//
526// timer structure
527//
528
531 unsigned long expires;
532
533 void (*function)(unsigned long);
534 unsigned long data;
535
536#ifdef CONFIG_TIMER_STATS
537 void *start_site;
538 char start_comm[16];
539 int start_pid;
540#endif
541};
542
543
545
547
548 unsigned long bd_flags; /* flags */
549 atomic_t bd_count; /* reference count */
550 PDEVICE_OBJECT bd_dev; /* device object */
551 ANSI_STRING bd_name; /* name in ansi string */
552 DISK_GEOMETRY bd_geo; /* disk geometry */
553 PARTITION_INFORMATION bd_part; /* partition information */
554 void * bd_priv; /* pointers to EXT2_VCB
555 NULL if it's a journal dev */
556 PFILE_OBJECT bd_volume; /* streaming object file */
557 LARGE_MCB bd_extents; /* dirty extents */
558
559 kmem_cache_t * bd_bh_cache;/* memory cache for buffer_head */
560 ERESOURCE bd_bh_lock; /* lock for bh tree and reaper list */
561 struct rb_root bd_bh_root; /* buffer_head red-black tree root */
562 LIST_ENTRY bd_bh_free; /* reaper list */
563 KEVENT bd_bh_notify; /* notification event for cleanup */
564};
565
566//
567// page information
568//
569
570// vom trata paginile in felul urmator:
571// alocam la sfarsitul structurii inca PAGE_SIZE octeti cand alocam o structura
572// de tip pagina - acolo vor veni toate buffer-headurile
573// deci -> page_address(page) = page + sizeof(page)
574#define page_address(_page) ((char*)_page + sizeof(struct page))
575
576typedef struct page {
577 void *addr;
578 void *mapping;
579 void *private;
584
585#define get_page(p) atomic_inc(&(p)->count)
586
587#define PG_locked 0 /* Page is locked. Don't touch. */
588#define PG_error 1
589#define PG_referenced 2
590#define PG_uptodate 3
591#define PG_dirty 4
592#define PG_unused 5
593#define PG_lru 6
594#define PG_active 7
595#define PG_slab 8
596#define PG_skip 10
597#define PG_highmem 11
598#define PG_checked 12 /* kill me in 2.5.<early>. */
599#define PG_arch_1 13
600#define PG_reserved 14
601#define PG_launder 15 /* written out by VM pressure.. */
602#define PG_fs_1 16 /* Filesystem specific */
603
604#ifndef arch_set_page_uptodate
605#define arch_set_page_uptodate(page)
606#endif
607
608/* Make it prettier to test the above... */
609#define UnlockPage(page) unlock_page(page)
610#define Page_Uptodate(page) test_bit(PG_uptodate, &(page)->flags)
611#define SetPageUptodate(page) \
612 do { \
613 arch_set_page_uptodate(page); \
614 set_bit(PG_uptodate, &(page)->flags); \
615 } while (0)
616#define ClearPageUptodate(page) clear_bit(PG_uptodate, &(page)->flags)
617#define PageDirty(page) test_bit(PG_dirty, &(page)->flags)
618#define SetPageDirty(page) set_bit(PG_dirty, &(page)->flags)
619#define ClearPageDirty(page) clear_bit(PG_dirty, &(page)->flags)
620#define PageLocked(page) test_bit(PG_locked, &(page)->flags)
621#define LockPage(page) set_bit(PG_locked, &(page)->flags)
622#define TryLockPage(page) test_and_set_bit(PG_locked, &(page)->flags)
623#define PageChecked(page) test_bit(PG_checked, &(page)->flags)
624#define SetPageChecked(page) set_bit(PG_checked, &(page)->flags)
625#define ClearPageChecked(page) clear_bit(PG_checked, &(page)->flags)
626#define PageLaunder(page) test_bit(PG_launder, &(page)->flags)
627#define SetPageLaunder(page) set_bit(PG_launder, &(page)->flags)
628#define ClearPageLaunder(page) clear_bit(PG_launder, &(page)->flags)
629#define ClearPageArch1(page) clear_bit(PG_arch_1, &(page)->flags)
630
631#define PageError(page) test_bit(PG_error, &(page)->flags)
632#define SetPageError(page) set_bit(PG_error, &(page)->flags)
633#define ClearPageError(page) clear_bit(PG_error, &(page)->flags)
634#define PageReferenced(page) test_bit(PG_referenced, &(page)->flags)
635#define SetPageReferenced(page) set_bit(PG_referenced, &(page)->flags)
636#define ClearPageReferenced(page) clear_bit(PG_referenced, &(page)->flags)
637
638#define PageActive(page) test_bit(PG_active, &(page)->flags)
639#define SetPageActive(page) set_bit(PG_active, &(page)->flags)
640#define ClearPageActive(page) clear_bit(PG_active, &(page)->flags)
641
642
643extern unsigned long __get_free_pages(unsigned int gfp_mask, unsigned int order);
644#define __get_free_page(gfp_mask) \
645 __get_free_pages((gfp_mask),0)
646
647extern void __free_pages(struct page *page, unsigned int order);
648extern void free_pages(unsigned long addr, unsigned int order);
649
650#define __free_page(page) __free_pages((page), 0)
651#define free_page(addr) free_pages((addr),0)
652
653#ifndef __REACTOS__
654extern void truncate_inode_pages(struct address_space *, loff_t);
655#endif
656
657#define __GFP_HIGHMEM 0x02
658
659#define __GFP_WAIT 0x10 /* Can wait and reschedule? */
660#define __GFP_HIGH 0x20 /* Should access emergency pools? */
661#define __GFP_IO 0x40 /* Can start low memory physical IO? */
662#define __GFP_HIGHIO 0x80 /* Can start high mem physical IO? */
663#define __GFP_FS 0x100 /* Can call down to low-level FS? */
664
665#define GFP_ATOMIC (__GFP_HIGH)
666#define GFP_USER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS)
667#define GFP_HIGHUSER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS | __GFP_HIGHMEM)
668#define GFP_KERNEL (__GFP_HIGH | __GFP_WAIT | __GFP_IO | __GFP_HIGHIO | __GFP_FS)
669#define GFP_NOFS 0
670#define __GFP_NOFAIL 0
671
672
673#define KM_USER0 0
674
675//
676// buffer head definitions
677//
678
680 BH_Uptodate, /* Contains valid data */
681 BH_Dirty, /* Is dirty */
682 BH_Verified, /* Is verified */
683 BH_Lock, /* Is locked */
684 BH_Req, /* Has been submitted for I/O */
685 BH_Uptodate_Lock, /* Used by the first bh in a page, to serialise
686 * IO completion of other buffers in the page
687 */
688
689 BH_Mapped, /* Has a disk mapping */
690 BH_New, /* Disk mapping was newly created by get_block */
691 BH_Async_Read, /* Is under end_buffer_async_read I/O */
692 BH_Async_Write, /* Is under end_buffer_async_write I/O */
693 BH_Delay, /* Buffer is not yet allocated on disk */
694 BH_Boundary, /* Block is followed by a discontiguity */
695 BH_Write_EIO, /* I/O error on write */
696 BH_Ordered, /* ordered write */
697 BH_Eopnotsupp, /* operation not supported (barrier) */
698 BH_Unwritten, /* Buffer is allocated on disk but not written */
699
700 BH_PrivateStart, /* not a state bit, but the first bit available
701 * for private allocation by other entities
702 */
703};
704
705#define PAGE_CACHE_SIZE (PAGE_SIZE)
706#define PAGE_CACHE_SHIFT (12)
707#define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512)
708
709#ifdef __REACTOS__
710struct buffer_head;
711#endif
712typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
713
714/*
715 * Historically, a buffer_head was used to map a single block
716 * within a page, and of course as the unit of I/O through the
717 * filesystem and block layers. Nowadays the basic I/O unit
718 * is the bio, and buffer_heads are used for extracting block
719 * mappings (via a get_block_t call), for tracking state within
720 * a page (via a page_mapping) and for wrapping bio submission
721 * for backward compatibility reasons (e.g. submit_bh).
722 */
724 LIST_ENTRY b_link; /* to be added to reaper list */
725 unsigned long b_state; /* buffer state bitmap (see above) */
726 struct page *b_page; /* the page this bh is mapped to */
727 PMDL b_mdl; /* MDL of the locked buffer */
728 void *b_bcb; /* BCB of the buffer */
729
730 // kdev_t b_dev; /* device (B_FREE = free) */
731 struct block_device *b_bdev; /* block device object */
732
733 blkcnt_t b_blocknr; /* start block number */
734 size_t b_size; /* size of mapping */
735 char * b_data; /* pointer to data within the page */
736 bh_end_io_t *b_end_io; /* I/O completion */
737 void *b_private; /* reserved for b_end_io */
738 // struct list_head b_assoc_buffers; /* associated with another mapping */
739 // struct address_space *b_assoc_map; /* mapping this buffer is associated with */
740 atomic_t b_count; /* users using this buffer_head */
741 struct rb_node b_rb_node; /* Red-black tree node entry */
742
743 LARGE_INTEGER b_ts_creat; /* creation time*/
744 LARGE_INTEGER b_ts_drop; /* drop time (to be released) */
745};
746
747
748/*
749 * macro tricks to expand the set_buffer_foo(), clear_buffer_foo()
750 * and buffer_foo() functions.
751 */
752#define BUFFER_FNS(bit, name) \
753static inline void set_buffer_##name(struct buffer_head *bh) \
754{ \
755 set_bit(BH_##bit, &(bh)->b_state); \
756} \
757static inline void clear_buffer_##name(struct buffer_head *bh) \
758{ \
759 clear_bit(BH_##bit, &(bh)->b_state); \
760} \
761static inline int buffer_##name(const struct buffer_head *bh) \
762{ \
763 return test_bit(BH_##bit, &(bh)->b_state); \
764}
765
766/*
767 * test_set_buffer_foo() and test_clear_buffer_foo()
768 */
769#define TAS_BUFFER_FNS(bit, name) \
770static inline int test_set_buffer_##name(struct buffer_head *bh) \
771{ \
772 return test_and_set_bit(BH_##bit, &(bh)->b_state); \
773} \
774static inline int test_clear_buffer_##name(struct buffer_head *bh) \
775{ \
776 return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
777} \
778
779/*
780 * Emit the buffer bitops functions. Note that there are also functions
781 * of the form "mark_buffer_foo()". These are higher-level functions which
782 * do something in addition to setting a b_state bit.
783 */
784BUFFER_FNS(Uptodate, uptodate)
785BUFFER_FNS(Dirty, dirty)
786TAS_BUFFER_FNS(Dirty, dirty)
787BUFFER_FNS(Verified, verified)
788BUFFER_FNS(Lock, locked)
789TAS_BUFFER_FNS(Lock, locked)
790BUFFER_FNS(Req, req)
791TAS_BUFFER_FNS(Req, req)
792BUFFER_FNS(Mapped, mapped)
793BUFFER_FNS(New, new)
794BUFFER_FNS(Async_Read, async_read)
795BUFFER_FNS(Async_Write, async_write)
796BUFFER_FNS(Delay, delay)
797BUFFER_FNS(Boundary, boundary)
798BUFFER_FNS(Write_EIO, write_io_error)
799BUFFER_FNS(Ordered, ordered)
800BUFFER_FNS(Eopnotsupp, eopnotsupp)
801BUFFER_FNS(Unwritten, unwritten)
802
803#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
804#define touch_buffer(bh) mark_page_accessed(bh->b_page)
805
806/* If we *know* page->private refers to buffer_heads */
807
808#define page_buffers(page) \
809 ( \
810 BUG_ON(!PagePrivate(page)), \
811 ((struct buffer_head *)page_private(page)) \
812 )
813#define page_has_buffers(page) PagePrivate(page)
814
815
816/*
817 * Declarations
818 */
819
820void mark_buffer_dirty(struct buffer_head *bh);
821void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
822void set_bh_page(struct buffer_head *bh,
823 struct page *page, unsigned long offset);
825struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
826 int retry);
827void create_empty_buffers(struct page *, unsigned long,
828 unsigned long b_state);
829
830/* Things to do with buffers at mapping->private_list */
835#ifndef __REACTOS__
836int sync_mapping_buffers(struct address_space *mapping);
837#endif
839
842int sync_blockdev(struct block_device *bdev);
843void __wait_on_buffer(struct buffer_head *);
847void thaw_bdev(struct block_device *, struct super_block *);
851 unsigned long size);
853 unsigned long size, int zero);
854struct buffer_head *__getblk(struct block_device *bdev, sector_t block,
855 unsigned long size);
856void __brelse(struct buffer_head *);
857void __bforget(struct buffer_head *);
858void __breadahead(struct block_device *, sector_t block, unsigned int size);
859struct buffer_head *__bread(struct block_device *, sector_t block, unsigned size);
862void free_buffer_head(struct buffer_head * bh);
863void unlock_buffer(struct buffer_head *bh);
864void __lock_buffer(struct buffer_head *bh);
865void ll_rw_block(int, int, struct buffer_head * bh[]);
866int sync_dirty_buffer(struct buffer_head *bh);
867int submit_bh(int, struct buffer_head *);
869 sector_t bblock, unsigned blocksize);
871int bh_submit_read(struct buffer_head *bh);
872/* They are separately managed */
876void extents_brelse(struct buffer_head *bh);
877void extents_bforget(struct buffer_head *bh);
878void buffer_head_remove(struct block_device *bdev, struct buffer_head *bh);
879
880extern int buffer_heads_over_limit;
881
882/*
883 * Generic address_space_operations implementations for buffer_head-backed
884 * address_spaces.
885 */
886
887#if 0
888
889int block_write_full_page(struct page *page, get_block_t *get_block,
890 struct writeback_control *wbc);
891int block_read_full_page(struct page*, get_block_t*);
892int block_write_begin(struct file *, struct address_space *,
893 loff_t, unsigned, unsigned,
894 struct page **, void **, get_block_t*);
895int block_write_end(struct file *, struct address_space *,
896 loff_t, unsigned, unsigned,
897 struct page *, void *);
898int generic_write_end(struct file *, struct address_space *,
899 loff_t, unsigned, unsigned,
900 struct page *, void *);
901
902int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
903int cont_write_begin(struct file *, struct address_space *, loff_t,
904 unsigned, unsigned, struct page **, void **,
905 get_block_t *, loff_t *);
906int block_page_mkwrite(struct vm_area_struct *vma, struct page *page,
907 get_block_t get_block);
908sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
909int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
910int block_truncate_page(struct address_space *, loff_t, get_block_t *);
911int file_fsync(struct file *, struct dentry *, int);
912int nobh_write_begin(struct file *, struct address_space *,
913 loff_t, unsigned, unsigned,
914 struct page **, void **, get_block_t*);
915int nobh_write_end(struct file *, struct address_space *,
916 loff_t, unsigned, unsigned,
917 struct page *, void *);
918int nobh_truncate_page(struct address_space *, loff_t, get_block_t *);
919int nobh_writepage(struct page *page, get_block_t *get_block,
920 struct writeback_control *wbc);
921int generic_cont_expand_simple(struct inode *inode, loff_t size);
922#endif
923
924void block_invalidatepage(struct page *page, unsigned long offset);
925void page_zero_new_buffers(struct page *page, unsigned from, unsigned to);
926int block_commit_write(struct page *page, unsigned from, unsigned to);
927void block_sync_page(struct page *);
928
929void buffer_init(void);
930
931/*
932 * inline definitions
933 */
934#if 0
935static inline void attach_page_buffers(struct page *page,
936 struct buffer_head *head)
937{
938 page_cache_get(page);
939 SetPagePrivate(page);
940 set_page_private(page, (unsigned long)head);
941}
942#endif
943
944static inline void get_bh(struct buffer_head *bh)
945{
946 atomic_inc(&bh->b_count);
947}
948
949static inline void put_bh(struct buffer_head *bh)
950{
951 if (bh)
952 __brelse(bh);
953}
954
955static inline void brelse(struct buffer_head *bh)
956{
957 if (bh)
958 __brelse(bh);
959}
960
961static inline void fini_bh(struct buffer_head **bh)
962{
963 if (bh && *bh) {
964 brelse(*bh);
965 *bh = NULL;
966 }
967}
968
969static inline void bforget(struct buffer_head *bh)
970{
971 if (bh)
972 __bforget(bh);
973}
974
975static inline struct buffer_head *
977{
978 return get_block_bh(sb->s_bdev, block, sb->s_blocksize, 0);
979}
980
981static inline struct buffer_head *
983{
984 return get_block_bh(sb->s_bdev, block, sb->s_blocksize, 1);
985}
986
987static inline struct buffer_head *
989{
990 struct buffer_head *bh = __getblk(sb->s_bdev, block, sb->s_blocksize);
991 if (!bh)
992 return NULL;
993 if (!buffer_uptodate(bh) && (bh_submit_read(bh) < 0)) {
994 brelse(bh);
995 return NULL;
996 }
997 return bh;
998}
999
1000static inline struct buffer_head *
1002{
1003 return __find_get_block(sb->s_bdev, block, sb->s_blocksize);
1004}
1005
1006static inline void
1008{
1009 set_buffer_mapped(bh);
1010 bh->b_bdev = sb->s_bdev;
1011 bh->b_blocknr = block;
1012 bh->b_size = sb->s_blocksize;
1013}
1014
1015/*
1016 * Calling wait_on_buffer() for a zero-ref buffer is illegal, so we call into
1017 * __wait_on_buffer() just to trip a debug check. Because debug code in inline
1018 * functions is bloaty.
1019 */
1020
1021static inline void wait_on_buffer(struct buffer_head *bh)
1022{
1023 might_sleep();
1024 if (buffer_locked(bh) || atomic_read(&bh->b_count) == 0)
1025 __wait_on_buffer(bh);
1026}
1027
1028static inline void lock_buffer(struct buffer_head *bh)
1029{
1030 might_sleep();
1031 if (test_set_buffer_locked(bh))
1032 __lock_buffer(bh);
1033}
1034
1036
1037//
1038// unicode character
1039//
1040
1042 char *charset;
1043 char *alias;
1044 int (*uni2char) (wchar_t uni, unsigned char *out, int boundlen);
1045 int (*char2uni) (const unsigned char *rawstring, int boundlen,
1046 wchar_t *uni);
1047 unsigned char *charset2lower;
1048 unsigned char *charset2upper;
1049 struct module *owner;
1051};
1052
1053/* this value hold the maximum octet of charset */
1054#define NLS_MAX_CHARSET_SIZE 6 /* for UTF-8 */
1055
1056/* nls.c */
1057extern int register_nls(struct nls_table *);
1058extern int unregister_nls(struct nls_table *);
1059extern struct nls_table *load_nls(char *);
1060extern void unload_nls(struct nls_table *);
1061extern struct nls_table *load_nls_default(void);
1062
1063extern int utf8_mbtowc(wchar_t *, const __u8 *, int);
1064extern int utf8_mbstowcs(wchar_t *, const __u8 *, int);
1065extern int utf8_wctomb(__u8 *, wchar_t, int);
1066extern int utf8_wcstombs(__u8 *, const wchar_t *, int);
1067
1068//
1069// kernel jiffies
1070//
1071
1072#define HZ (100)
1073
1074static inline __u32 JIFFIES()
1075{
1076 LARGE_INTEGER Tick;
1077
1078 KeQueryTickCount(&Tick);
1080 Tick.QuadPart /= (10000000 / HZ);
1081
1082 return Tick.LowPart;
1083}
1084
1085#define jiffies JIFFIES()
1086
1087//
1088// memory routines
1089//
1090
1091#ifdef _WIN2K_TARGET_
1092
1093typedef GUID UUID;
1097 OUT UUID *Uuid
1098);
1099
1101PVOID
1102NTAPI
1106 IN ULONG Tag
1107);
1108
1109#define ExFreePoolWithTag(_P, _T) ExFreePool(_P)
1110#endif
1111
1115 IN ULONG Tag
1116);
1117
1118VOID
1120 IN PVOID P,
1121 IN ULONG Tag
1122);
1123
1124void *kzalloc(int size, int flags);
1125#define kmalloc(size, gfp) Ext2AllocatePool(NonPagedPool, size, 'JBDM')
1126#define kfree(p) Ext2FreePool(p, 'JBDM')
1127
1128
1129/* memory slab */
1130
1131#define SLAB_HWCACHE_ALIGN 0x00002000U /* align objs on a h/w cache lines */
1132#define SLAB_KERNEL 0x00000001U
1133#define SLAB_TEMPORARY 0x00000002U
1134
1135typedef void (*kmem_cache_cb_t)(void*, kmem_cache_t *, unsigned long);
1136
1145};
1146
1147
1150 const char *name,
1151 size_t size,
1152 size_t offset,
1153 unsigned long flags,
1155);
1156
1157void* kmem_cache_alloc(kmem_cache_t *kc, int flags);
1158void kmem_cache_free(kmem_cache_t *kc, void *p);
1160
1161
1162//
1163// block device
1164//
1165
1166#define BDEVNAME_SIZE 32 /* Largest string for a blockdev identifier */
1167
1168//
1169// ll_rw_block ....
1170//
1171
1172
1173#define RW_MASK 1
1174#define RWA_MASK 2
1175#define READ 0
1176#define WRITE 1
1177#define READA 2 /* read-ahead - don't block if no resources */
1178#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
1179#define READ_SYNC (READ | (1 << BIO_RW_SYNC))
1180#define READ_META (READ | (1 << BIO_RW_META))
1181#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNC))
1182#define WRITE_BARRIER ((1 << BIO_RW) | (1 << BIO_RW_BARRIER))
1183
1184//
1185// timer routines
1186//
1187
1188/*
1189 * These inlines deal with timer wrapping correctly. You are
1190 * strongly encouraged to use them
1191 * 1. Because people otherwise forget
1192 * 2. Because if the timer wrap changes in future you won't have to
1193 * alter your driver code.
1194 *
1195 * time_after(a,b) returns true if the time a is after time b.
1196 *
1197 * Do this with "<0" and ">=0" to only test the sign of the result. A
1198 * good compiler would generate better code (and a really good compiler
1199 * wouldn't care). Gcc is currently neither.
1200 */
1201#define typecheck(x, y) (TRUE)
1202
1203#define time_after(a,b) \
1204 (typecheck(unsigned long, a) && \
1205 typecheck(unsigned long, b) && \
1206 ((long)(b) - (long)(a) < 0))
1207#define time_before(a,b) time_after(b,a)
1208
1209#define time_after_eq(a,b) \
1210 (typecheck(unsigned long, a) && \
1211 typecheck(unsigned long, b) && \
1212 ((long)(a) - (long)(b) >= 0))
1213#define time_before_eq(a,b) time_after_eq(b,a)
1214
1215#define time_in_range(a,b,c) \
1216 (time_after_eq(a,b) && \
1217 time_before_eq(a,c))
1218
1219#define smp_rmb() do {}while(0)
1220
1221
1222static inline __u32 do_div64 (__u64 * n, __u64 b)
1223{
1224 __u64 mod;
1225
1226 mod = *n % b;
1227 *n = *n / b;
1228 return (__u32) mod;
1229}
1230#define do_div(n, b) do_div64(&(n), (__u64)b)
1231
1232#endif // _EXT2_MODULE_HEADER_
#define __cdecl
Definition: accygwin.h:79
struct outqueuenode * head
Definition: adnsresfilter.c:66
static int state
Definition: maze.c:121
#define atomic_read(v)
Definition: atomic.h:23
static void atomic_inc(atomic_t volatile *v)
Definition: atomic.h:95
LONG NTSTATUS
Definition: precomp.h:26
#define __int64
Definition: basetyps.h:16
u8 __u8
Definition: btrfs.h:17
ULONG32 u32
Definition: btrfs.h:14
ULONG64 u64
Definition: btrfs.h:15
u32 __u32
Definition: btrfs.h:19
USHORT u16
Definition: btrfs.h:13
u64 __u64
Definition: btrfs.h:20
Definition: _queue.h:67
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
DWORD pid_t
Definition: types.h:91
#define P(row, col)
#define RtlUlongByteSwap(_x)
Definition: compat.h:815
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
static DWORD async_read(http_request_t *req, void *buf, DWORD size, DWORD read_pos, DWORD *ret_read)
Definition: http.c:3157
superblock * sb
Definition: btrfs.c:4261
r dirty
Definition: btrfs.c:3004
#define __le64
Definition: types.h:45
unsigned __int64 sector_t
Definition: types.h:82
unsigned __bitwise gfp_t
Definition: types.h:73
#define BITS_PER_LONG
Definition: types.h:86
#define __le16
Definition: types.h:43
#define __le32
Definition: types.h:44
#define ORDER_PER_LONG
Definition: types.h:87
unsigned __int64 blkcnt_t
Definition: types.h:83
unsigned __int64 loff_t
Definition: types.h:84
long long_ptr_t
Definition: types.h:95
unsigned int __u32
Definition: linux.h:41
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
UCHAR KIRQL
Definition: env_spec_w32.h:591
ULONG KSPIN_LOCK
Definition: env_spec_w32.h:72
ULONG ERESOURCE
Definition: env_spec_w32.h:594
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLsizeiptr size
Definition: glext.h:5919
GLdouble n
Definition: glext.h:7729
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum mode
Definition: glext.h:6217
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLenum GLenum GLenum mapping
Definition: glext.h:9031
GLfloat GLfloat p
Definition: glext.h:8902
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLintptr offset
Definition: glext.h:5920
static int mod
Definition: i386-dis.c:1288
#define InterlockedOr
Definition: interlocked.h:224
#define InterlockedAnd
Definition: interlocked.h:62
_Check_return_ unsigned __int64 __cdecl _byteswap_uint64(_In_ unsigned __int64)
_Check_return_ unsigned long __cdecl _byteswap_ulong(_In_ unsigned long)
_Check_return_ unsigned short __cdecl _byteswap_ushort(_In_ unsigned short)
#define b
Definition: ke_i.h:79
#define error(str)
Definition: mkdosfs.c:1605
struct buffer_head * __bread(struct block_device *, sector_t block, unsigned size)
static need_resched()
Definition: module.h:444
VOID Ext2FreePool(IN PVOID P, IN ULONG Tag)
Definition: debug.c:2697
void free_buffer_head(struct buffer_head *bh)
Definition: linux.c:346
static void bforget(struct buffer_head *bh)
Definition: module.h:969
unsigned long __get_free_pages(unsigned int gfp_mask, unsigned int order)
void __free_pages(struct page *page, unsigned int order)
void __bforget(struct buffer_head *)
Definition: linux.c:843
static void map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
Definition: module.h:1007
struct super_block * freeze_bdev(struct block_device *)
static int spin_needbreak(spinlock_t *lock)
Definition: module.h:318
int utf8_wctomb(__u8 *, wchar_t, int)
Definition: nls_base.c:108
void create_empty_buffers(struct page *, unsigned long, unsigned long b_state)
static cond_resched()
Definition: module.h:437
kmem_cache_t * kmem_cache_create(const char *name, size_t size, size_t offset, unsigned long flags, kmem_cache_cb_t ctor)
Definition: linux.c:48
struct buffer_head * extents_bread(struct super_block *sb, sector_t block)
Definition: ext4_bh.c:15
#define le64_to_cpu
Definition: module.h:147
static int test_and_set_bit(int nr, volatile unsigned long *addr)
Definition: module.h:397
struct buffer_head * alloc_page_buffers(struct page *page, unsigned long size, int retry)
int register_nls(struct nls_table *)
Definition: nls_base.c:162
void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state)
Definition: linux.c:212
void block_invalidatepage(struct page *page, unsigned long offset)
static void put_bh(struct buffer_head *bh)
Definition: module.h:949
void unload_nls(struct nls_table *)
Definition: nls_base.c:240
void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode)
static struct buffer_head * sb_find_get_block(struct super_block *sb, sector_t block)
Definition: module.h:1001
static void lock_buffer(struct buffer_head *bh)
Definition: module.h:1028
static long IS_ERR(const void *ptr)
Definition: module.h:249
static int set_bit(int nr, volatile unsigned long *addr)
Definition: module.h:340
int try_to_free_buffers(struct page *)
#define cpu_to_le64
Definition: module.h:146
GUID UUID
Definition: module.h:1093
PVOID Ext2AllocatePool(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
Definition: debug.c:2684
void set_bh_page(struct buffer_head *bh, struct page *page, unsigned long offset)
int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
struct buffer_head * __find_get_block(struct block_device *bdev, sector_t block, unsigned long size)
Definition: linux.c:932
static void * ERR_PTR(long error)
Definition: module.h:239
struct task_struct * current
Definition: linux.c:32
PVOID wait_queue_t
Definition: module.h:470
static long PTR_ERR(const void *ptr)
Definition: module.h:244
int inode_has_buffers(struct inode *)
void kmem_cache_free(kmem_cache_t *kc, void *p)
Definition: linux.c:103
void init_buffer(struct buffer_head *, bh_end_io_t *, void *)
#define TAS_BUFFER_FNS(bit, name)
Definition: module.h:769
static __u32 do_div64(__u64 *n, __u64 b)
Definition: module.h:1222
void __wait_on_buffer(struct buffer_head *)
Definition: linux.c:858
void invalidate_bdev(struct block_device *)
int block_commit_write(struct page *page, unsigned from, unsigned to)
int utf8_mbstowcs(wchar_t *, const __u8 *, int)
Definition: nls_base.c:79
void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
Definition: linux.c:250
void unlock_buffer(struct buffer_head *bh)
Definition: linux.c:853
void free_pages(unsigned long addr, unsigned int order)
int unregister_nls(struct nls_table *)
Definition: nls_base.c:185
int submit_bh(int, struct buffer_head *)
Definition: linux.c:792
void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state)
Definition: linux.c:231
int __set_page_dirty_buffers(struct page *page)
struct buffer_head * get_block_bh(struct block_device *bdev, sector_t block, unsigned long size, int zero)
Definition: linux.c:782
struct __wait_queue * wait_queue_create()
Definition: linux.c:122
wait_queue_head_t * bh_waitq_head(struct buffer_head *bh)
static void le64_add_cpu(__le64 *var, u64 val)
Definition: module.h:196
void extents_brelse(struct buffer_head *bh)
Definition: ext4_bh.c:51
int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
struct buffer_head * __getblk(struct block_device *bdev, sector_t block, unsigned long size)
Definition: linux.c:799
int bh_uptodate_or_lock(struct buffer_head *bh)
void * kmem_cache_alloc(kmem_cache_t *kc, int flags)
Definition: linux.c:92
struct page mem_map_t
int buffer_heads_over_limit
#define BUFFER_FNS(bit, name)
Definition: module.h:752
#define le16_to_cpu
Definition: module.h:151
int fsync_no_super(struct block_device *)
#define HZ
Definition: module.h:1072
#define cpu_to_le32
Definition: module.h:148
int kmem_cache_destroy(kmem_cache_t *kc)
Definition: linux.c:82
void write_boundary_block(struct block_device *bdev, sector_t bblock, unsigned blocksize)
void mark_buffer_async_write(struct buffer_head *bh)
int utf8_mbtowc(wchar_t *, const __u8 *, int)
Definition: nls_base.c:49
void truncate_inode_pages(struct address_space *, loff_t)
static void get_bh(struct buffer_head *bh)
Definition: module.h:944
void * kzalloc(int size, int flags)
Definition: linux.c:34
static void fini_bh(struct buffer_head **bh)
Definition: module.h:961
static void wait_on_buffer(struct buffer_head *bh)
Definition: module.h:1021
struct nls_table * load_nls(char *)
Definition: nls_base.c:218
int sync_mapping_buffers(struct address_space *mapping)
int wake_up(wait_queue_head_t *queue)
Definition: linux.c:279
int bh_submit_read(struct buffer_head *bh)
Definition: linux.c:892
static void le16_add_cpu(__le16 *var, u16 val)
Definition: module.h:186
void(* kmem_cache_cb_t)(void *, kmem_cache_t *, unsigned long)
Definition: module.h:1135
static int clear_bit(int nr, volatile unsigned long *addr)
Definition: module.h:359
int sync_dirty_buffer(struct buffer_head *bh)
Definition: linux.c:898
struct _spinlock_t spinlock_t
int fsync_bdev(struct block_device *)
void ll_rw_block(int, int, struct buffer_head *bh[])
Definition: linux.c:862
static int test_and_clear_bit(int nr, volatile unsigned long *addr)
Definition: module.h:375
#define IS_ERR_VALUE(x)
Definition: module.h:237
static struct buffer_head * sb_bread(struct super_block *sb, sector_t block)
Definition: module.h:988
static __u32 JIFFIES()
Definition: module.h:1074
void __breadahead(struct block_device *, sector_t block, unsigned int size)
static struct buffer_head * sb_getblk(struct super_block *sb, sector_t block)
Definition: module.h:976
void buffer_head_remove(struct block_device *bdev, struct buffer_head *bh)
Definition: linux.c:424
NTKERNELAPI NTSTATUS ExUuidCreate(OUT UUID *Uuid)
Definition: uuid.c:380
void page_zero_new_buffers(struct page *page, unsigned from, unsigned to)
struct buffer_head * extents_bwrite(struct super_block *sb, sector_t block)
Definition: ext4_bh.c:27
struct mutex mutex_t
void init_waitqueue_head(wait_queue_head_t *q)
Definition: linux.c:115
void __lock_buffer(struct buffer_head *bh)
Definition: linux.c:849
bh_state_bits
Definition: module.h:679
@ BH_PrivateStart
Definition: module.h:700
@ BH_Uptodate
Definition: module.h:680
@ BH_Req
Definition: module.h:684
@ BH_Async_Write
Definition: module.h:692
@ BH_Ordered
Definition: module.h:696
@ BH_Unwritten
Definition: module.h:698
@ BH_Write_EIO
Definition: module.h:695
@ BH_Verified
Definition: module.h:682
@ BH_Async_Read
Definition: module.h:691
@ BH_Eopnotsupp
Definition: module.h:697
@ BH_Mapped
Definition: module.h:689
@ BH_Uptodate_Lock
Definition: module.h:685
@ BH_Delay
Definition: module.h:693
@ BH_Boundary
Definition: module.h:694
@ BH_Lock
Definition: module.h:683
@ BH_Dirty
Definition: module.h:681
@ BH_New
Definition: module.h:690
#define le32_to_cpu
Definition: module.h:149
#define might_sleep()
Definition: module.h:450
static void brelse(struct buffer_head *bh)
Definition: module.h:955
static void le32_add_cpu(__le32 *var, u32 val)
Definition: module.h:191
void block_sync_page(struct page *)
int utf8_wcstombs(__u8 *, const wchar_t *, int)
Definition: nls_base.c:136
void __brelse(struct buffer_head *)
Definition: linux.c:808
void unmap_underlying_metadata(struct block_device *bdev, sector_t block)
void invalidate_inode_buffers(struct inode *)
int fsync_super(struct super_block *)
static struct buffer_head * sb_getblk_zero(struct super_block *sb, sector_t block)
Definition: module.h:982
static int test_bit(int nr, volatile const unsigned long *addr)
Definition: module.h:383
void buffer_init(void)
struct nls_table * load_nls_default(void)
int sync_blockdev(struct block_device *bdev)
Definition: linux.c:919
void wait_queue_destroy(struct __wait_queue *)
Definition: linux.c:142
struct buffer_head * alloc_buffer_head(gfp_t gfp_flags)
void mark_buffer_dirty(struct buffer_head *bh)
Definition: linux.c:914
int remove_inode_buffers(struct inode *inode)
void extents_bforget(struct buffer_head *bh)
Definition: ext4_bh.c:64
void invalidate_bh_lrus(void)
void extents_mark_buffer_dirty(struct buffer_head *bh)
Definition: ext4_bh.c:39
void thaw_bdev(struct block_device *, struct super_block *)
void() bh_end_io_t(struct buffer_head *bh, int uptodate)
Definition: module.h:712
#define cpu_to_le16
Definition: module.h:150
static PVOID ptr
Definition: dispmode.c:27
ULONG nr
Definition: thread.c:7
const char * var
Definition: shader.c:5666
LPFNCONSTRUCTOR ctor
Definition: msctf.c:83
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
#define FASTCALL
Definition: nt_native.h:50
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
unsigned short USHORT
Definition: pedump.c:61
#define long
Definition: qsort.c:33
static FILE * out
Definition: regtests2xml.c:44
#define New(t)
Definition: rtf.h:1086
#define KeQueryTickCount(CurrentCount)
Definition: ke.h:43
int zero
Definition: sehframes.cpp:29
CardRegion * from
Definition: spigame.cpp:19
Definition: typedefs.h:120
struct list_head task_list
Definition: module.h:500
spinlock_t lock
Definition: module.h:499
unsigned int flags
Definition: module.h:476
struct list_head task_list
Definition: module.h:479
KEVENT event
Definition: module.h:478
KIRQL irql
Definition: module.h:302
KSPIN_LOCK lock
Definition: module.h:301
void * bd_priv
Definition: module.h:554
unsigned long bd_flags
Definition: module.h:548
PARTITION_INFORMATION bd_part
Definition: module.h:553
atomic_t bd_count
Definition: module.h:549
LARGE_MCB bd_extents
Definition: module.h:557
ERESOURCE bd_bh_lock
Definition: module.h:560
struct rb_root bd_bh_root
Definition: module.h:561
KEVENT bd_bh_notify
Definition: module.h:563
DISK_GEOMETRY bd_geo
Definition: module.h:552
PFILE_OBJECT bd_volume
Definition: module.h:556
kmem_cache_t * bd_bh_cache
Definition: module.h:559
PDEVICE_OBJECT bd_dev
Definition: module.h:550
ANSI_STRING bd_name
Definition: module.h:551
LIST_ENTRY bd_bh_free
Definition: module.h:562
struct block_device * b_bdev
Definition: module.h:731
struct rb_node b_rb_node
Definition: module.h:741
size_t b_size
Definition: module.h:734
LIST_ENTRY b_link
Definition: module.h:724
void * b_private
Definition: module.h:737
blkcnt_t b_blocknr
Definition: module.h:733
unsigned long b_state
Definition: module.h:725
LARGE_INTEGER b_ts_creat
Definition: module.h:743
bh_end_io_t * b_end_io
Definition: module.h:736
void * b_bcb
Definition: module.h:728
atomic_t b_count
Definition: module.h:740
struct page * b_page
Definition: module.h:726
PMDL b_mdl
Definition: module.h:727
char * b_data
Definition: module.h:735
LARGE_INTEGER b_ts_drop
Definition: module.h:744
Definition: fs.h:117
Definition: fci.c:127
Definition: fs.h:78
Definition: copy.c:22
ULONG size
Definition: module.h:1140
atomic_t acount
Definition: module.h:1142
atomic_t count
Definition: module.h:1141
kmem_cache_cb_t constructor
Definition: module.h:1144
NPAGED_LOOKASIDE_LIST la
Definition: module.h:1143
ULONG flags
Definition: module.h:1139
Definition: list.h:15
Definition: module.h:456
FAST_MUTEX lock
Definition: module.h:457
Definition: name.c:39
unsigned char * charset2upper
Definition: module.h:1048
struct nls_table * next
Definition: module.h:1050
unsigned char * charset2lower
Definition: module.h:1047
char * alias
Definition: module.h:1043
int(* char2uni)(const unsigned char *rawstring, int boundlen, wchar_t *uni)
Definition: module.h:1045
int(* uni2char)(wchar_t uni, unsigned char *out, int boundlen)
Definition: module.h:1044
char * charset
Definition: module.h:1042
struct module * owner
Definition: module.h:1049
Definition: module.h:576
__u32 flags
Definition: module.h:582
atomic_t count
Definition: module.h:580
void * mapping
Definition: module.h:578
__u32 index
Definition: module.h:581
void * addr
Definition: module.h:577
Definition: rbtree.h:98
Definition: fs.h:64
void * journal_info
Definition: module.h:424
pid_t tid
Definition: module.h:422
char comm[32]
Definition: module.h:423
pid_t pid
Definition: module.h:421
void(* function)(unsigned long)
Definition: module.h:533
struct list_head entry
Definition: module.h:530
unsigned long data
Definition: module.h:534
unsigned long expires
Definition: module.h:531
rwlock_t lock
Definition: tcpcore.h:0
INT POOL_TYPE
Definition: typedefs.h:78
#define NTAPI
Definition: typedefs.h:36
ULONG_PTR SIZE_T
Definition: typedefs.h:80
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
uint64_t ULONGLONG
Definition: typedefs.h:67
#define OUT
Definition: typedefs.h:40
LONGLONG QuadPart
Definition: typedefs.h:114
ULONG LowPart
Definition: typedefs.h:106
_Must_inspect_result_ _In_ WDFDEVICE _In_ BOOLEAN _In_opt_ PVOID Tag
Definition: wdfdevice.h:4065
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfdevice.h:3815
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFWAITLOCK * Lock
Definition: wdfsync.h:127
#define NTKERNELAPI
FAST_MUTEX
Definition: extypes.h:17
struct LOOKASIDE_ALIGN _NPAGED_LOOKASIDE_LIST NPAGED_LOOKASIDE_LIST
* PFILE_OBJECT
Definition: iotypes.h:1998
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
Definition: iotypes.h:1036
#define RtlUlonglongByteSwap(_x)
Definition: rtlfuncs.h:3199
#define RtlUshortByteSwap(_x)
Definition: rtlfuncs.h:3197
static unsigned int block
Definition: xmlmemory.c:101
char CHAR
Definition: xmlstorage.h:175