btrfs-progs: subvol list: consilidate naming of otime varaibles

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-10-31 12:19:50 +01:00
parent ebb46b13ac
commit 1aeb6baee3

View File

@ -394,7 +394,7 @@ static struct root_info *root_tree_search(struct root_lookup *root_tree,
static int update_root(struct root_lookup *root_lookup, static int update_root(struct root_lookup *root_lookup,
u64 root_id, u64 ref_tree, u64 root_offset, u64 flags, u64 root_id, u64 ref_tree, u64 root_offset, u64 flags,
u64 dir_id, char *name, int name_len, u64 ogen, u64 gen, u64 dir_id, char *name, int name_len, u64 ogen, u64 gen,
time_t ot, void *uuid, void *puuid, void *ruuid) time_t otime, void *uuid, void *puuid, void *ruuid)
{ {
struct root_info *ri; struct root_info *ri;
@ -426,8 +426,8 @@ static int update_root(struct root_lookup *root_lookup,
ri->ogen = ogen; ri->ogen = ogen;
if (!ri->ogen && root_offset) if (!ri->ogen && root_offset)
ri->ogen = root_offset; ri->ogen = root_offset;
if (ot) if (otime)
ri->otime = ot; ri->otime = otime;
if (uuid) if (uuid)
memcpy(&ri->uuid, uuid, BTRFS_UUID_SIZE); memcpy(&ri->uuid, uuid, BTRFS_UUID_SIZE);
if (puuid) if (puuid)
@ -449,7 +449,7 @@ static int update_root(struct root_lookup *root_lookup,
* name_len: the length of name * name_len: the length of name
* ogen: the original generation of the root * ogen: the original generation of the root
* gen: the current generation of the root * gen: the current generation of the root
* ot: the original time(create time) of the root * otime: the original time (creation time) of the root
* uuid: uuid of the root * uuid: uuid of the root
* puuid: uuid of the root parent if any * puuid: uuid of the root parent if any
* ruuid: uuid of the received subvol, if any * ruuid: uuid of the received subvol, if any
@ -457,13 +457,13 @@ static int update_root(struct root_lookup *root_lookup,
static int add_root(struct root_lookup *root_lookup, static int add_root(struct root_lookup *root_lookup,
u64 root_id, u64 ref_tree, u64 root_offset, u64 flags, u64 root_id, u64 ref_tree, u64 root_offset, u64 flags,
u64 dir_id, char *name, int name_len, u64 ogen, u64 gen, u64 dir_id, char *name, int name_len, u64 ogen, u64 gen,
time_t ot, void *uuid, void *puuid, void *ruuid) time_t otime, void *uuid, void *puuid, void *ruuid)
{ {
struct root_info *ri; struct root_info *ri;
int ret; int ret;
ret = update_root(root_lookup, root_id, ref_tree, root_offset, flags, ret = update_root(root_lookup, root_id, ref_tree, root_offset, flags,
dir_id, name, name_len, ogen, gen, ot, dir_id, name, name_len, ogen, gen, otime,
uuid, puuid, ruuid); uuid, puuid, ruuid);
if (!ret) if (!ret)
return 0; return 0;
@ -498,8 +498,8 @@ static int add_root(struct root_lookup *root_lookup,
ri->ogen = ogen; ri->ogen = ogen;
if (!ri->ogen && root_offset) if (!ri->ogen && root_offset)
ri->ogen = root_offset; ri->ogen = root_offset;
if (ot) if (otime)
ri->otime = ot; ri->otime = otime;
if (uuid) if (uuid)
memcpy(&ri->uuid, uuid, BTRFS_UUID_SIZE); memcpy(&ri->uuid, uuid, BTRFS_UUID_SIZE);
@ -970,7 +970,6 @@ static int list_subvol_search(int fd, struct root_lookup *root_lookup)
u64 ogen; u64 ogen;
u64 flags; u64 flags;
int i; int i;
time_t t;
u8 uuid[BTRFS_UUID_SIZE]; u8 uuid[BTRFS_UUID_SIZE];
u8 puuid[BTRFS_UUID_SIZE]; u8 puuid[BTRFS_UUID_SIZE];
u8 ruuid[BTRFS_UUID_SIZE]; u8 ruuid[BTRFS_UUID_SIZE];
@ -1014,18 +1013,20 @@ static int list_subvol_search(int fd, struct root_lookup *root_lookup)
0, 0, dir_id, name, name_len, 0, 0, 0, 0, 0, dir_id, name, name_len, 0, 0, 0,
NULL, NULL, NULL); NULL, NULL, NULL);
} else if (sh.type == BTRFS_ROOT_ITEM_KEY) { } else if (sh.type == BTRFS_ROOT_ITEM_KEY) {
time_t otime;
ri = (struct btrfs_root_item *)(args.buf + off); ri = (struct btrfs_root_item *)(args.buf + off);
gen = btrfs_root_generation(ri); gen = btrfs_root_generation(ri);
flags = btrfs_root_flags(ri); flags = btrfs_root_flags(ri);
if(sh.len > if(sh.len >
sizeof(struct btrfs_root_item_v0)) { sizeof(struct btrfs_root_item_v0)) {
t = btrfs_stack_timespec_sec(&ri->otime); otime = btrfs_stack_timespec_sec(&ri->otime);
ogen = btrfs_root_otransid(ri); ogen = btrfs_root_otransid(ri);
memcpy(uuid, ri->uuid, BTRFS_UUID_SIZE); memcpy(uuid, ri->uuid, BTRFS_UUID_SIZE);
memcpy(puuid, ri->parent_uuid, BTRFS_UUID_SIZE); memcpy(puuid, ri->parent_uuid, BTRFS_UUID_SIZE);
memcpy(ruuid, ri->received_uuid, BTRFS_UUID_SIZE); memcpy(ruuid, ri->received_uuid, BTRFS_UUID_SIZE);
} else { } else {
t = 0; otime = 0;
ogen = 0; ogen = 0;
memset(uuid, 0, BTRFS_UUID_SIZE); memset(uuid, 0, BTRFS_UUID_SIZE);
memset(puuid, 0, BTRFS_UUID_SIZE); memset(puuid, 0, BTRFS_UUID_SIZE);
@ -1034,7 +1035,7 @@ static int list_subvol_search(int fd, struct root_lookup *root_lookup)
add_root(root_lookup, sh.objectid, 0, add_root(root_lookup, sh.objectid, 0,
sh.offset, flags, 0, NULL, 0, ogen, sh.offset, flags, 0, NULL, 0, ogen,
gen, t, uuid, puuid, ruuid); gen, otime, uuid, puuid, ruuid);
} }
off += sh.len; off += sh.len;