~ubuntu-branches/ubuntu/trusty/linux-ti-omap/trusty

« back to all changes in this revision

Viewing changes to ubuntu/aufs/fstype.h

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Amit Kucheria
  • Date: 2010-03-23 18:05:12 UTC
  • Revision ID: james.westby@ubuntu.com-20100323180512-iavj906ocnphdubp
Tags: 2.6.33-500.3
[ Amit Kucheria ]

* [Config] Fix the debug package name to end in -dbgsym
* SAUCE: Add the ubuntu/ drivers to omap
* SAUCE: Re-export the symbols for aufs
* [Config] Enable AUFS and COMPCACHE

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2005-2009 Junjiro R. Okajima
 
3
 *
 
4
 * This program, aufs is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 */
 
18
 
 
19
/*
 
20
 * judging filesystem type
 
21
 */
 
22
 
 
23
#ifndef __AUFS_FSTYPE_H__
 
24
#define __AUFS_FSTYPE_H__
 
25
 
 
26
#ifdef __KERNEL__
 
27
 
 
28
#include <linux/fs.h>
 
29
#include <linux/magic.h>
 
30
#include <linux/romfs_fs.h>
 
31
#include <linux/aufs_type.h>
 
32
 
 
33
static inline int au_test_aufs(struct super_block *sb)
 
34
{
 
35
        return sb->s_magic == AUFS_SUPER_MAGIC;
 
36
}
 
37
 
 
38
static inline const char *au_sbtype(struct super_block *sb)
 
39
{
 
40
        return sb->s_type->name;
 
41
}
 
42
 
 
43
static inline int au_test_iso9660(struct super_block *sb __maybe_unused)
 
44
{
 
45
#if defined(CONFIG_ROMFS_FS) || defined(CONFIG_ROMFS_FS_MODULE)
 
46
        return sb->s_magic == ROMFS_MAGIC;
 
47
#else
 
48
        return 0;
 
49
#endif
 
50
}
 
51
 
 
52
static inline int au_test_romfs(struct super_block *sb __maybe_unused)
 
53
{
 
54
#if defined(CONFIG_ISO9660_FS) || defined(CONFIG_ISO9660_FS_MODULE)
 
55
        return sb->s_magic == ISOFS_SUPER_MAGIC;
 
56
#else
 
57
        return 0;
 
58
#endif
 
59
}
 
60
 
 
61
static inline int au_test_cramfs(struct super_block *sb __maybe_unused)
 
62
{
 
63
#if defined(CONFIG_CRAMFS) || defined(CONFIG_CRAMFS_MODULE)
 
64
        return sb->s_magic == CRAMFS_MAGIC;
 
65
#endif
 
66
        return 0;
 
67
}
 
68
 
 
69
static inline int au_test_nfs(struct super_block *sb __maybe_unused)
 
70
{
 
71
#if defined(CONFIG_NFS_FS) || defined(CONFIG_NFS_FS_MODULE)
 
72
        return sb->s_magic == NFS_SUPER_MAGIC;
 
73
#else
 
74
        return 0;
 
75
#endif
 
76
}
 
77
 
 
78
static inline int au_test_fuse(struct super_block *sb __maybe_unused)
 
79
{
 
80
#if defined(CONFIG_FUSE_FS) || defined(CONFIG_FUSE_FS_MODULE)
 
81
        return sb->s_magic == FUSE_SUPER_MAGIC;
 
82
#else
 
83
        return 0;
 
84
#endif
 
85
}
 
86
 
 
87
static inline int au_test_xfs(struct super_block *sb __maybe_unused)
 
88
{
 
89
#if defined(CONFIG_XFS_FS) || defined(CONFIG_XFS_FS_MODULE)
 
90
        return sb->s_magic == XFS_SB_MAGIC;
 
91
#else
 
92
        return 0;
 
93
#endif
 
94
}
 
95
 
 
96
static inline int au_test_tmpfs(struct super_block *sb __maybe_unused)
 
97
{
 
98
#ifdef CONFIG_TMPFS
 
99
        return sb->s_magic == TMPFS_MAGIC;
 
100
#else
 
101
        return 0;
 
102
#endif
 
103
}
 
104
 
 
105
static inline int au_test_ecryptfs(struct super_block *sb __maybe_unused)
 
106
{
 
107
#if defined(CONFIG_ECRYPT_FS) || defined(CONFIG_ECRYPT_FS_MODULE)
 
108
        return !strcmp(au_sbtype(sb), "ecryptfs");
 
109
#else
 
110
        return 0;
 
111
#endif
 
112
}
 
113
 
 
114
static inline int au_test_smbfs(struct super_block *sb __maybe_unused)
 
115
{
 
116
#if defined(CONFIG_SMB_FS) || defined(CONFIG_SMB_FS_MODULE)
 
117
        return sb->s_magic == SMB_SUPER_MAGIC;
 
118
#else
 
119
        return 0;
 
120
#endif
 
121
}
 
122
 
 
123
static inline int au_test_ocfs2(struct super_block *sb __maybe_unused)
 
124
{
 
125
#if defined(CONFIG_OCFS2_FS) || defined(CONFIG_OCFS2_FS_MODULE)
 
126
        return sb->s_magic == OCFS2_SUPER_MAGIC;
 
127
#else
 
128
        return 0;
 
129
#endif
 
130
}
 
131
 
 
132
static inline int au_test_ocfs2_dlmfs(struct super_block *sb __maybe_unused)
 
133
{
 
134
#if defined(CONFIG_OCFS2_FS_O2CB) || defined(CONFIG_OCFS2_FS_O2CB_MODULE)
 
135
        return sb->s_magic == DLMFS_MAGIC;
 
136
#else
 
137
        return 0;
 
138
#endif
 
139
}
 
140
 
 
141
static inline int au_test_coda(struct super_block *sb __maybe_unused)
 
142
{
 
143
#if defined(CONFIG_CODA_FS) || defined(CONFIG_CODA_FS_MODULE)
 
144
        return sb->s_magic == CODA_SUPER_MAGIC;
 
145
#else
 
146
        return 0;
 
147
#endif
 
148
}
 
149
 
 
150
static inline int au_test_v9fs(struct super_block *sb __maybe_unused)
 
151
{
 
152
#if defined(CONFIG_9P_FS) || defined(CONFIG_9P_FS_MODULE)
 
153
        return sb->s_magic == V9FS_MAGIC;
 
154
#else
 
155
        return 0;
 
156
#endif
 
157
}
 
158
 
 
159
static inline int au_test_ext4(struct super_block *sb __maybe_unused)
 
160
{
 
161
#if defined(CONFIG_EXT4DEV_FS) || defined(CONFIG_EXT4DEV_FS_MODULE)
 
162
        return sb->s_magic == EXT4_SUPER_MAGIC;
 
163
#else
 
164
        return 0;
 
165
#endif
 
166
}
 
167
 
 
168
static inline int au_test_sysv(struct super_block *sb __maybe_unused)
 
169
{
 
170
#if defined(CONFIG_SYSV_FS) || defined(CONFIG_SYSV_FS_MODULE)
 
171
        return !strcmp(au_sbtype(sb), "sysv");
 
172
#else
 
173
        return 0;
 
174
#endif
 
175
}
 
176
 
 
177
static inline int au_test_ramfs(struct super_block *sb)
 
178
{
 
179
        return sb->s_magic == RAMFS_MAGIC;
 
180
}
 
181
 
 
182
static inline int au_test_ubifs(struct super_block *sb __maybe_unused)
 
183
{
 
184
#if defined(CONFIG_UBIFS_FS) || defined(CONFIG_UBIFS_FS_MODULE)
 
185
        return sb->s_magic == UBIFS_SUPER_MAGIC;
 
186
#else
 
187
        return 0;
 
188
#endif
 
189
}
 
190
 
 
191
static inline int au_test_procfs(struct super_block *sb __maybe_unused)
 
192
{
 
193
#ifdef CONFIG_PROC_FS
 
194
        return sb->s_magic == PROC_SUPER_MAGIC;
 
195
#else
 
196
        return 0;
 
197
#endif
 
198
}
 
199
 
 
200
static inline int au_test_sysfs(struct super_block *sb __maybe_unused)
 
201
{
 
202
#ifdef CONFIG_SYSFS
 
203
        return sb->s_magic == SYSFS_MAGIC;
 
204
#else
 
205
        return 0;
 
206
#endif
 
207
}
 
208
 
 
209
static inline int au_test_configfs(struct super_block *sb __maybe_unused)
 
210
{
 
211
#if defined(CONFIG_CONFIGFS_FS) || defined(CONFIG_CONFIGFS_FS_MODULE)
 
212
        return sb->s_magic == CONFIGFS_MAGIC;
 
213
#else
 
214
        return 0;
 
215
#endif
 
216
}
 
217
 
 
218
static inline int au_test_minix(struct super_block *sb __maybe_unused)
 
219
{
 
220
#if defined(CONFIG_MINIX_FS) || defined(CONFIG_MINIX_FS_MODULE)
 
221
        return sb->s_magic == MINIX3_SUPER_MAGIC
 
222
                || sb->s_magic == MINIX2_SUPER_MAGIC
 
223
                || sb->s_magic == MINIX2_SUPER_MAGIC2
 
224
                || sb->s_magic == MINIX_SUPER_MAGIC
 
225
                || sb->s_magic == MINIX_SUPER_MAGIC2;
 
226
#else
 
227
        return 0;
 
228
#endif
 
229
}
 
230
 
 
231
static inline int au_test_cifs(struct super_block *sb __maybe_unused)
 
232
{
 
233
#if defined(CONFIG_CIFS_FS) || defined(CONFIGCIFS_FS_MODULE)
 
234
        return sb->s_magic == CIFS_MAGIC_NUMBER;
 
235
#else
 
236
        return 0;
 
237
#endif
 
238
}
 
239
 
 
240
static inline int au_test_fat(struct super_block *sb __maybe_unused)
 
241
{
 
242
#if defined(CONFIG_FAT_FS) || defined(CONFIG_FAT_FS_MODULE)
 
243
        return sb->s_magic == MSDOS_SUPER_MAGIC;
 
244
#else
 
245
        return 0;
 
246
#endif
 
247
}
 
248
 
 
249
static inline int au_test_msdos(struct super_block *sb)
 
250
{
 
251
        return au_test_fat(sb);
 
252
}
 
253
 
 
254
static inline int au_test_vfat(struct super_block *sb)
 
255
{
 
256
        return au_test_fat(sb);
 
257
}
 
258
 
 
259
static inline int au_test_securityfs(struct super_block *sb __maybe_unused)
 
260
{
 
261
#ifdef CONFIG_SECURITYFS
 
262
        return sb->s_magic == SECURITYFS_MAGIC;
 
263
#else
 
264
        return 0;
 
265
#endif
 
266
}
 
267
 
 
268
static inline int au_test_squashfs(struct super_block *sb __maybe_unused)
 
269
{
 
270
#if defined(CONFIG_SQUASHFS) || defined(CONFIG_SQUASHFS_MODULE)
 
271
        return sb->s_magic == SQUASHFS_MAGIC;
 
272
#else
 
273
        return 0;
 
274
#endif
 
275
}
 
276
 
 
277
static inline int au_test_btrfs(struct super_block *sb __maybe_unused)
 
278
{
 
279
#if defined(CONFIG_BTRFS_FS) || defined(CONFIG_BTRFS_FS_MODULE)
 
280
        return sb->s_magic == BTRFS_SUPER_MAGIC;
 
281
#else
 
282
        return 0;
 
283
#endif
 
284
}
 
285
 
 
286
static inline int au_test_xenfs(struct super_block *sb __maybe_unused)
 
287
{
 
288
#if defined(CONFIG_XENFS) || defined(CONFIG_XENFS_MODULE)
 
289
        return sb->s_magic == XENFS_SUPER_MAGIC;
 
290
#else
 
291
        return 0;
 
292
#endif
 
293
}
 
294
 
 
295
static inline int au_test_debugfs(struct super_block *sb __maybe_unused)
 
296
{
 
297
#ifdef CONFIG_DEBUG_FS
 
298
        return sb->s_magic == DEBUGFS_MAGIC;
 
299
#else
 
300
        return 0;
 
301
#endif
 
302
}
 
303
 
 
304
static inline int au_test_nilfs(struct super_block *sb __maybe_unused)
 
305
{
 
306
#if defined(CONFIG_NILFS) || defined(CONFIG_NILFS_MODULE)
 
307
        return sb->s_magic == NILFS_SUPER_MAGIC;
 
308
#else
 
309
        return 0;
 
310
#endif
 
311
}
 
312
 
 
313
/* ---------------------------------------------------------------------- */
 
314
/*
 
315
 * they can't be an aufs branch.
 
316
 */
 
317
static inline int au_test_fs_unsuppoted(struct super_block *sb)
 
318
{
 
319
        return
 
320
#ifndef CONFIG_AUFS_BR_RAMFS
 
321
                au_test_ramfs(sb) ||
 
322
#endif
 
323
                au_test_procfs(sb)
 
324
                || au_test_sysfs(sb)
 
325
                || au_test_configfs(sb)
 
326
                || au_test_debugfs(sb)
 
327
                || au_test_securityfs(sb)
 
328
                || au_test_xenfs(sb)
 
329
                || au_test_ecryptfs(sb)
 
330
                /* || !strcmp(au_sbtype(sb), "unionfs") */
 
331
                || au_test_aufs(sb); /* will be supported in next version */
 
332
}
 
333
 
 
334
/*
 
335
 * If the filesystem supports NFS-export, then it has to support NULL as
 
336
 * a nameidata parameter for ->create(), ->lookup() and ->d_revalidate().
 
337
 * We can apply this principle when we handle a lower filesystem.
 
338
 */
 
339
static inline int au_test_fs_null_nd(struct super_block *sb)
 
340
{
 
341
        return !!sb->s_export_op;
 
342
}
 
343
 
 
344
static inline int au_test_fs_remote(struct super_block *sb)
 
345
{
 
346
        return !au_test_tmpfs(sb)
 
347
#ifdef CONFIG_AUFS_BR_RAMFS
 
348
                && !au_test_ramfs(sb)
 
349
#endif
 
350
                && !(sb->s_type->fs_flags & FS_REQUIRES_DEV);
 
351
}
 
352
 
 
353
/* ---------------------------------------------------------------------- */
 
354
 
 
355
/*
 
356
 * Note: these functions (below) are created after reading ->getattr() in all
 
357
 * filesystems under linux/fs. it means we have to do so in every update...
 
358
 */
 
359
 
 
360
/*
 
361
 * some filesystems require getattr to refresh the inode attributes before
 
362
 * referencing.
 
363
 * in most cases, we can rely on the inode attribute in NFS (or every remote fs)
 
364
 * and leave the work for d_revalidate()
 
365
 */
 
366
static inline int au_test_fs_refresh_iattr(struct super_block *sb)
 
367
{
 
368
        return au_test_nfs(sb)
 
369
                || au_test_fuse(sb)
 
370
                /* || au_test_smbfs(sb) */      /* untested */
 
371
                /* || au_test_ocfs2(sb) */      /* untested */
 
372
                /* || au_test_btrfs(sb) */      /* untested */
 
373
                /* || au_test_coda(sb) */       /* untested */
 
374
                /* || au_test_v9fs(sb) */       /* untested */
 
375
                ;
 
376
}
 
377
 
 
378
/*
 
379
 * filesystems which don't maintain i_size or i_blocks.
 
380
 */
 
381
static inline int au_test_fs_bad_iattr_size(struct super_block *sb)
 
382
{
 
383
        return au_test_xfs(sb)
 
384
                /* || au_test_ext4(sb) */       /* untested */
 
385
                /* || au_test_ocfs2(sb) */      /* untested */
 
386
                /* || au_test_ocfs2_dlmfs(sb) */ /* untested */
 
387
                /* || au_test_sysv(sb) */       /* untested */
 
388
                /* || au_test_ubifs(sb) */      /* untested */
 
389
                /* || au_test_minix(sb) */      /* untested */
 
390
                ;
 
391
}
 
392
 
 
393
/*
 
394
 * filesystems which don't store the correct value in some of their inode
 
395
 * attributes.
 
396
 */
 
397
static inline int au_test_fs_bad_iattr(struct super_block *sb)
 
398
{
 
399
        return au_test_fs_bad_iattr_size(sb)
 
400
                /* || au_test_cifs(sb) */       /* untested */
 
401
                || au_test_fat(sb)
 
402
                || au_test_msdos(sb)
 
403
                || au_test_vfat(sb);
 
404
}
 
405
 
 
406
/* they don't check i_nlink in link(2) */
 
407
static inline int au_test_fs_no_limit_nlink(struct super_block *sb)
 
408
{
 
409
        return au_test_tmpfs(sb)
 
410
#ifdef CONFIG_AUFS_BR_RAMFS
 
411
                || au_test_ramfs(sb)
 
412
#endif
 
413
                || au_test_ubifs(sb);
 
414
}
 
415
 
 
416
/*
 
417
 * filesystems which sets S_NOATIME and S_NOCMTIME.
 
418
 */
 
419
static inline int au_test_fs_notime(struct super_block *sb)
 
420
{
 
421
        return au_test_nfs(sb)
 
422
                || au_test_fuse(sb)
 
423
                || au_test_ubifs(sb)
 
424
                /* || au_test_cifs(sb) */       /* untested */
 
425
                ;
 
426
}
 
427
 
 
428
/*
 
429
 * filesystems which requires replacing i_mapping.
 
430
 */
 
431
static inline int au_test_fs_bad_mapping(struct super_block *sb)
 
432
{
 
433
        return au_test_fuse(sb)
 
434
                || au_test_ubifs(sb);
 
435
}
 
436
 
 
437
/* temporary support for i#1 in cramfs */
 
438
static inline int au_test_fs_unique_ino(struct inode *inode)
 
439
{
 
440
        if (au_test_cramfs(inode->i_sb))
 
441
                return inode->i_ino != 1;
 
442
        return 1;
 
443
}
 
444
 
 
445
/* ---------------------------------------------------------------------- */
 
446
 
 
447
/*
 
448
 * the filesystem where the xino files placed must support i/o after unlink and
 
449
 * maintain i_size and i_blocks.
 
450
 */
 
451
static inline int au_test_fs_bad_xino(struct super_block *sb)
 
452
{
 
453
        return au_test_fs_remote(sb)
 
454
                || au_test_fs_bad_iattr_size(sb)
 
455
#ifdef CONFIG_AUFS_BR_RAMFS
 
456
                || !(au_test_ramfs(sb) || au_test_fs_null_nd(sb))
 
457
#else
 
458
                || !au_test_fs_null_nd(sb) /* to keep xino code simple */
 
459
#endif
 
460
                /* don't want unnecessary work for xino */
 
461
                || au_test_aufs(sb)
 
462
                || au_test_ecryptfs(sb)
 
463
                || au_test_nilfs(sb);
 
464
}
 
465
 
 
466
static inline int au_test_fs_trunc_xino(struct super_block *sb)
 
467
{
 
468
        return au_test_tmpfs(sb)
 
469
                || au_test_ramfs(sb);
 
470
}
 
471
 
 
472
/*
 
473
 * test if the @sb is real-readonly.
 
474
 */
 
475
static inline int au_test_fs_rr(struct super_block *sb)
 
476
{
 
477
        return au_test_squashfs(sb)
 
478
                || au_test_iso9660(sb)
 
479
                || au_test_cramfs(sb)
 
480
                || au_test_romfs(sb);
 
481
}
 
482
 
 
483
#endif /* __KERNEL__ */
 
484
#endif /* __AUFS_FSTYPE_H__ */