~ubuntu-branches/debian/jessie/btrfs-tools/jessie

« back to all changes in this revision

Viewing changes to btrfs-show-super.c

  • Committer: Package Import Robot
  • Author(s): Dimitri John Ledkov
  • Date: 2014-10-11 16:54:05 UTC
  • mfrom: (1.2.14) (6.1.39 sid)
  • Revision ID: package-import@ubuntu.com-20141011165405-zvdemnhzw41f2doj
Tags: 3.16.2-1
* New upstream release.
* Drop patches (not needed, or upstremed), but unaligned memory access.
* Update upstream location in uscan, to pull release by kdave.
* Use upstream fsck.btrfs script.

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
        }
286
286
}
287
287
 
 
288
struct readable_flag_entry {
 
289
        u64 bit;
 
290
        char *output;
 
291
};
 
292
 
 
293
#define DEF_INCOMPAT_FLAG_ENTRY(bit_name)               \
 
294
        {BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name}
 
295
 
 
296
struct readable_flag_entry incompat_flags_array[] = {
 
297
        DEF_INCOMPAT_FLAG_ENTRY(MIXED_BACKREF),
 
298
        DEF_INCOMPAT_FLAG_ENTRY(DEFAULT_SUBVOL),
 
299
        DEF_INCOMPAT_FLAG_ENTRY(MIXED_GROUPS),
 
300
        DEF_INCOMPAT_FLAG_ENTRY(COMPRESS_LZO),
 
301
        DEF_INCOMPAT_FLAG_ENTRY(COMPRESS_LZOv2),
 
302
        DEF_INCOMPAT_FLAG_ENTRY(BIG_METADATA),
 
303
        DEF_INCOMPAT_FLAG_ENTRY(EXTENDED_IREF),
 
304
        DEF_INCOMPAT_FLAG_ENTRY(RAID56),
 
305
        DEF_INCOMPAT_FLAG_ENTRY(SKINNY_METADATA),
 
306
        DEF_INCOMPAT_FLAG_ENTRY(NO_HOLES)
 
307
};
 
308
static const int incompat_flags_num = sizeof(incompat_flags_array) /
 
309
                                      sizeof(struct readable_flag_entry);
 
310
 
 
311
static void print_readable_incompat_flag(u64 flag)
 
312
{
 
313
        int i;
 
314
        int first = 1;
 
315
        struct readable_flag_entry *entry;
 
316
 
 
317
        if (!flag)
 
318
                return;
 
319
        printf("\t\t\t( ");
 
320
        for (i = 0; i < incompat_flags_num; i++) {
 
321
                entry = incompat_flags_array + i;
 
322
                if (flag & entry->bit) {
 
323
                        if (first)
 
324
                                printf("%s ", entry->output);
 
325
                        else
 
326
                                printf("|\n\t\t\t  %s ", entry->output);
 
327
                }
 
328
                first = 0;
 
329
        }
 
330
        flag &= ~BTRFS_FEATURE_INCOMPAT_SUPP;
 
331
        if (flag) {
 
332
                if (first)
 
333
                        printf("unknown flag: 0x%llx ", flag);
 
334
                else
 
335
                        printf("|\n\t\t\t  unknown flag: 0x%llx ", flag);
 
336
        }
 
337
        printf(")\n");
 
338
}
 
339
 
288
340
static void dump_superblock(struct btrfs_super_block *sb, int full)
289
341
{
290
342
        int i;
364
416
               (unsigned long long)btrfs_super_compat_ro_flags(sb));
365
417
        printf("incompat_flags\t\t0x%llx\n",
366
418
               (unsigned long long)btrfs_super_incompat_flags(sb));
 
419
        print_readable_incompat_flag(btrfs_super_incompat_flags(sb));
367
420
        printf("csum_type\t\t%llu\n",
368
421
               (unsigned long long)btrfs_super_csum_type(sb));
369
422
        printf("csum_size\t\t%llu\n",