Add symlink support

Print out the raw symlink items.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2016-08-29 10:23:44 -07:00
parent a89f6c10b1
commit 86ffdf24a2
2 changed files with 14 additions and 1 deletions

View File

@@ -104,7 +104,8 @@ struct scoutfs_key {
#define SCOUTFS_XATTR_VAL_HASH_KEY 4
#define SCOUTFS_DIRENT_KEY 5
#define SCOUTFS_LINK_BACKREF_KEY 6
#define SCOUTFS_BMAP_KEY 7
#define SCOUTFS_SYMLINK_KEY 7
#define SCOUTFS_BMAP_KEY 8
#define SCOUTFS_MAX_ITEM_LEN 512
@@ -191,6 +192,9 @@ struct scoutfs_inode {
#define SCOUTFS_ROOT_INO 1
/* like the block size, a reasonable min PATH_MAX across platforms */
#define SCOUTFS_SYMLINK_MAX_SIZE 4096
/*
* Dirents are stored in items with an offset of the hash of their name.
* Colliding names are packed into the value.

View File

@@ -114,6 +114,12 @@ static void print_link_backref(struct scoutfs_link_backref *lref,
le64_to_cpu(lref->ino), le64_to_cpu(lref->offset));
}
/* for now show the raw component items not the whole path */
static void print_symlink(char *str, unsigned int val_len)
{
printf(" symlink: %.*s\n", val_len, str);
}
static void print_block_map(struct scoutfs_block_map *map)
{
int i;
@@ -156,6 +162,9 @@ static void print_btree_val(struct scoutfs_btree_item *item, u8 level)
print_link_backref((void *)item->val,
le16_to_cpu(item->val_len));
break;
case SCOUTFS_SYMLINK_KEY:
print_symlink((void *)item->val, le16_to_cpu(item->val_len));
break;
case SCOUTFS_BMAP_KEY:
print_block_map((void *)item->val);
break;