~ubuntu-branches/ubuntu/utopic/xfsprogs/utopic-proposed

« back to all changes in this revision

Viewing changes to libdisk/fstype.h

  • Committer: Bazaar Package Importer
  • Author(s): Nathan Scott
  • Date: 2009-05-06 11:29:18 UTC
  • mfrom: (8.1.1 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090506112918-uzoyzcp90rtr8td7
Tags: 3.0.2
New bugfix release

Show diffs side-by-side

added added

removed removed

Lines of Context:
242
242
#define ocfslabellen(o) assemble2le(o.label_len)
243
243
#define OCFS_MAGIC      "OracleCFS"
244
244
 
 
245
/* Common gfs/gfs2 constants: */
 
246
#define GFS_MAGIC               0x01161970
 
247
#define GFS_DEFAULT_BSIZE       4096
 
248
#define GFS_SUPERBLOCK_OFFSET   (0x10 * GFS_DEFAULT_BSIZE)
 
249
#define GFS_LOCKNAME_LEN        64
 
250
 
 
251
/* gfs1 constants: */
 
252
#define GFS_FORMAT_FS           1309
 
253
#define GFS_FORMAT_MULTI        1401
 
254
/* gfs2 constants: */
 
255
#define GFS2_FORMAT_FS          1801
 
256
#define GFS2_FORMAT_MULTI       1900
 
257
 
 
258
struct gfs2_meta_header {
 
259
        char mh_magic[4];
 
260
        char mh_type[4];
 
261
        char __pad0[8];          /* Was generation number in gfs1 */
 
262
        char mh_format[4];
 
263
        char __pad1[4];          /* Was incarnation number in gfs1 */
 
264
};
 
265
 
 
266
struct gfs2_inum {
 
267
        char no_formal_ino[8];
 
268
        char no_addr[8];
 
269
};
 
270
 
 
271
struct gfs2_sb {
 
272
        struct gfs2_meta_header sb_header;
 
273
 
 
274
        char sb_fs_format[4];
 
275
        char sb_multihost_format[4];
 
276
        char  __pad0[4];  /* Was superblock flags in gfs1 */
 
277
 
 
278
        char sb_bsize[4];
 
279
        char sb_bsize_shift[4];
 
280
        char __pad1[4];   /* Was journal segment size in gfs1 */
 
281
 
 
282
        struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */
 
283
        struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */
 
284
        struct gfs2_inum sb_root_dir;
 
285
 
 
286
        char sb_lockproto[GFS_LOCKNAME_LEN];
 
287
        char sb_locktable[GFS_LOCKNAME_LEN];
 
288
        /* In gfs1, quota and license dinodes followed */
 
289
};
 
290
 
 
291
#define gfsmagic(s)             assemble4be(s.sb_header.mh_magic)
 
292
#define gfsformat(s)            assemble4be(s.sb_fs_format)
 
293
#define gfsmultiformat(s)       assemble4be(s.sb_multihost_format)
 
294
 
 
295
/* btrfs constants */
 
296
#define BTRFS_SUPER_INFO_OFFSET (64 * 1024)
 
297
 
 
298
/* 32 bytes in various csum fields */
 
299
#define BTRFS_CSUM_SIZE 32
 
300
 
 
301
#define BTRFS_FSID_SIZE 16
 
302
 
 
303
#define BTRFS_MAGIC "_BHRfS_M"
 
304
 
 
305
/*
 
306
 * the super block basically lists the main trees of the FS
 
307
 * it currently lacks any block count etc etc
 
308
 */
 
309
struct btrfs_super_block {
 
310
        char csum[BTRFS_CSUM_SIZE];
 
311
        /* the first 3 fields must match struct btrfs_header */
 
312
        char fsid[BTRFS_FSID_SIZE];    /* FS specific uuid */
 
313
        char bytenr[8]; /* this block number */
 
314
        char flags[8];
 
315
 
 
316
        /* allowed to be different from the btrfs_header from here own down */
 
317
        char magic[8];
 
318
        /* more follows but this is all our libdisk cares about*/
 
319
} __attribute__ ((__packed__));
 
320
 
245
321
static inline int
246
322
assemble2le(char *p) {
247
323
        return (p[0] | (p[1] << 8));
251
327
assemble4le(char *p) {
252
328
        return (p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24));
253
329
}
 
330
 
 
331
static inline int
 
332
assemble4be(char *p) {
 
333
        return (p[3] | (p[2] << 8) | (p[1] << 16) | (p[0] << 24));
 
334
}