2 * support.h - Header file for specific support.c
4 * Copyright (C) 1997 RĂ©gis Duchesne
5 * Copyright (c) 2001 Anton Altaparmakov (AIA)
10 #define DEBUG_MALLOC 2
16 #define DEBUG_FILE1 128
17 #define DEBUG_FILE2 256
18 #define DEBUG_FILE3 512
19 #define DEBUG_NAME1 1024
20 #define DEBUG_NAME2 2048
23 void ntfs_debug(int mask, const char *fmt, ...);
25 #define ntfs_debug(mask, fmt...) do {} while (0)
28 #include <linux/slab.h>
29 #include <linux/vmalloc.h>
31 #define ntfs_malloc(size) kmalloc(size, GFP_KERNEL)
33 #define ntfs_free(ptr) kfree(ptr)
36 * ntfs_vmalloc - allocate memory in multiples of pages
37 * @size number of bytes to allocate
39 * Allocates @size bytes of memory, rounded up to multiples of PAGE_SIZE and
40 * returns a pointer to the allocated memory.
42 * If there was insufficient memory to complete the request, return NULL.
44 static inline void *ntfs_vmalloc(unsigned long size)
46 if (size <= PAGE_SIZE) {
48 /* kmalloc() has per-CPU caches so if faster for now. */
49 return kmalloc(PAGE_SIZE, GFP_NOFS);
50 /* return (void *)__get_free_page(GFP_NOFS |
55 if (size >> PAGE_SHIFT < num_physpages)
56 return __vmalloc(size, GFP_NOFS | __GFP_HIGHMEM, PAGE_KERNEL);
60 static inline void ntfs_vfree(void *addr)
62 if ((unsigned long)addr < VMALLOC_START) {
64 /* return free_page((unsigned long)addr); */
69 void ntfs_bzero(void *s, int n);
71 void ntfs_memcpy(void *dest, const void *src, ntfs_size_t n);
73 void ntfs_memmove(void *dest, const void *src, ntfs_size_t n);
75 void ntfs_error(const char *fmt,...);
77 int ntfs_read_mft_record(ntfs_volume *vol, int mftno, char *buf);
79 int ntfs_getput_clusters(ntfs_volume *pvol, int cluster, ntfs_size_t offs,
82 ntfs_time64_t ntfs_now(void);
84 int ntfs_dupuni2map(ntfs_volume *vol, ntfs_u16 *in, int in_len, char **out,
87 int ntfs_dupmap2uni(ntfs_volume *vol, char* in, int in_len, ntfs_u16 **out,