/*ARGSUSED*/ int fp_uuid( void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array) { char bp[40]; /* UUID string is 36 chars + trailing '\0' */ int i; uuid_t *p; ASSERT(bitoffs(bit) == 0); for (p = (uuid_t *)((char *)obj + byteize(bit)), i = 0; i < count && !seenint(); i++, p++) { if (array) dbprintf("%d:", i + base); platform_uuid_unparse(p, bp); dbprintf("%s", bp); if (i < count - 1) dbprintf(" "); } return 1; }
int fp_charns( void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array) { int i; char *p; ASSERT(bitoffs(bit) == 0); ASSERT(size == bitsz(char)); dbprintf("\""); for (i = 0, p = (char *)obj + byteize(bit); i < count && !seenint(); i++, p++) { if (*p == '\\' || *p == '\'' || *p == '"' || *p == '\?') dbprintf("\\%c", *p); else if (isgraph((int)*p) || *p == ' ') dbprintf("%c", *p); else if (*p == '\a' || *p == '\b' || *p == '\f' || *p == '\n' || *p == '\r' || *p == '\t' || *p == '\v') dbprintf("\\%c", *p + ('a' - '\a')); else dbprintf("\\%03o", *p & 0xff); } dbprintf("\""); return 1; }
/*ARGSUSED*/ int fp_time( void *obj, int bit, int count, char *fmtstr, int size, int arg, int base, int array) { int bitpos; char *c; int i; time_t t; ASSERT(bitoffs(bit) == 0); for (i = 0, bitpos = bit; i < count && !seenint(); i++, bitpos += size) { if (array) dbprintf("%d:", i + base); t=(time_t)getbitval((char *)obj + byteize(bitpos), 0, sizeof(int32_t)*8, 0); c = ctime(&t); dbprintf("%24.24s", c); if (i < count - 1) dbprintf(" "); } return 1; }
static int attr_shortform_list_count( void *obj, int startoff) { xfs_attr_shortform_t *sf; ASSERT(bitoffs(startoff) == 0); sf = (xfs_attr_shortform_t *)((char *)obj + byteize(startoff)); return sf->hdr.count; }
static int dir2_sf_list_count( void *obj, int startoff) { xfs_dir2_sf_t *sf; ASSERT(bitoffs(startoff) == 0); sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff)); return sf->hdr.count; }
static int dir2_sf_entry_name_count( void *obj, int startoff) { xfs_dir2_sf_entry_t *e; ASSERT(bitoffs(startoff) == 0); e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff)); return e->namelen; }
static int attr_sf_entry_value_count( void *obj, int startoff) { xfs_attr_sf_entry_t *e; ASSERT(bitoffs(startoff) == 0); e = (xfs_attr_sf_entry_t *)((char *)obj + byteize(startoff)); return e->valuelen; }
/*ARGSUSED*/ int dir2_sf_hdr_size( void *obj, int startoff, int idx) { xfs_dir2_sf_t *sf; ASSERT(bitoffs(startoff) == 0); ASSERT(idx == 0); sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff)); return bitize(xfs_dir2_sf_hdr_size(sf->hdr.i8count)); }
/*ARGSUSED*/ static int dir2_sf_entry_inumber_offset( void *obj, int startoff, int idx) { xfs_dir2_sf_entry_t *e; ASSERT(bitoffs(startoff) == 0); ASSERT(idx == 0); e = (xfs_dir2_sf_entry_t *)((char *)obj + byteize(startoff)); return bitize((int)((char *)xfs_dir2_sf_inumberp(e) - (char *)e)); }
static int inode_u_muuid_count( void *obj, int startoff) { xfs_dinode_t *dip; ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff)); return dip->di_format == XFS_DINODE_FMT_UUID; }
/*ARGSUSED*/ static int attr_sf_entry_value_offset( void *obj, int startoff, int idx) { xfs_attr_sf_entry_t *e; ASSERT(bitoffs(startoff) == 0); ASSERT(idx == 0); e = (xfs_attr_sf_entry_t *)((char *)obj + byteize(startoff)); return bitize((int)((char *)&e->nameval[e->namelen] - (char *)e)); }
static int inode_u_bmx_count( void *obj, int startoff) { xfs_dinode_t *dip; ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff)); return dip->di_format == XFS_DINODE_FMT_EXTENTS ? be32_to_cpu(dip->di_nextents) : 0; }
static int inode_a_sfattr_count( void *obj, int startoff) { xfs_dinode_t *dip; ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; if (!XFS_DFORK_Q(dip)) return 0; ASSERT((char *)XFS_DFORK_APTR(dip) - (char *)dip == byteize(startoff)); return dip->di_aformat == XFS_DINODE_FMT_LOCAL; }
static int inode_u_symlink_count( void *obj, int startoff) { xfs_dinode_t *dip; ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff)); return dip->di_format == XFS_DINODE_FMT_LOCAL && (be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFLNK ? (int)be64_to_cpu(dip->di_size) : 0; }
static int inode_u_sfdir3_count( void *obj, int startoff) { xfs_dinode_t *dip; ASSERT(bitoffs(startoff) == 0); ASSERT(obj == iocur_top->data); dip = obj; ASSERT((char *)XFS_DFORK_DPTR(dip) - (char *)dip == byteize(startoff)); return dip->di_format == XFS_DINODE_FMT_LOCAL && (be16_to_cpu(dip->di_mode) & S_IFMT) == S_IFDIR && xfs_sb_version_hasftype(&mp->m_sb); }
static int dir2_sf_list_offset( void *obj, int startoff, int idx) { xfs_dir2_sf_entry_t *e; int i; xfs_dir2_sf_t *sf; ASSERT(bitoffs(startoff) == 0); sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff)); e = xfs_dir2_sf_firstentry(sf); for (i = 0; i < idx; i++) e = xfs_dir2_sf_nextentry(sf, e); return bitize((int)((char *)e - (char *)sf)); }
int attr_sf_entry_size( void *obj, int startoff, int idx) { xfs_attr_sf_entry_t *e; int i; xfs_attr_shortform_t *sf; ASSERT(bitoffs(startoff) == 0); sf = (xfs_attr_shortform_t *)((char *)obj + byteize(startoff)); e = &sf->list[0]; for (i = 0; i < idx; i++) e = XFS_ATTR_SF_NEXTENTRY(e); return bitize((int)XFS_ATTR_SF_ENTSIZE(e)); }
/*ARGSUSED*/ int dir2sf_size( void *obj, int startoff, int idx) { xfs_dir2_sf_entry_t *e; int i; xfs_dir2_sf_t *sf; ASSERT(bitoffs(startoff) == 0); ASSERT(idx == 0); sf = (xfs_dir2_sf_t *)((char *)obj + byteize(startoff)); e = xfs_dir2_sf_firstentry(sf); for (i = 0; i < sf->hdr.count; i++) e = xfs_dir2_sf_nextentry(sf, e); return bitize((int)((char *)e - (char *)sf)); }
static int dir_leaf_name_count( void *obj, int startoff) { xfs_dir_leafblock_t *block; xfs_dir_leaf_entry_t *e; int i; int off; ASSERT(bitoffs(startoff) == 0); off = byteize(startoff); block = obj; if (INT_GET(block->hdr.info.magic, ARCH_CONVERT) != XFS_DIR_LEAF_MAGIC) return 0; for (i = 0; i < INT_GET(block->hdr.count, ARCH_CONVERT); i++) { e = &block->entries[i]; if (INT_GET(e->nameidx, ARCH_CONVERT) == off) return e->namelen; } return 0; }