From: Tomohiro Kusumi Date: Thu, 21 Sep 2017 16:06:37 +0000 (+0300) Subject: sys/vfs/hammer: Add typedef hammer_uuid_t X-Git-Tag: v5.1.0~68 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/90da8fc8d95e1895d63ebafb10404337f9f921f4 sys/vfs/hammer: Add typedef hammer_uuid_t Add typedef for uuid_t for better portability, similar to hammer_crc_t and other hammer_xxx_t. (Some platforms have char[16] for uuid_t instead of struct value) No functional changes. --- diff --git a/lib/libstand/hammer1.c b/lib/libstand/hammer1.c index 34ee538b61..e3dde9d1f4 100644 --- a/lib/libstand/hammer1.c +++ b/lib/libstand/hammer1.c @@ -326,7 +326,7 @@ hammer_directory_namekey(const void *name __unused, int len __unused) * Misc */ static u_int32_t -hammer_to_unix_xid(uuid_t *uuid) +hammer_to_unix_xid(hammer_uuid_t *uuid) { return(*(u_int32_t *)&uuid->node[2]); } diff --git a/sbin/hammer/cmd_cleanup.c b/sbin/hammer/cmd_cleanup.c index d5ee2b263a..a834647938 100644 --- a/sbin/hammer/cmd_cleanup.c +++ b/sbin/hammer/cmd_cleanup.c @@ -64,7 +64,7 @@ struct didpfs { struct didpfs *next; - uuid_t uuid; + hammer_uuid_t uuid; }; static void do_cleanup(const char *path); diff --git a/sbin/hammer/cmd_mirror.c b/sbin/hammer/cmd_mirror.c index c0e82bc08c..129fbb9ca3 100644 --- a/sbin/hammer/cmd_mirror.c +++ b/sbin/hammer/cmd_mirror.c @@ -699,7 +699,7 @@ generate_histogram(int fd, const char *filesystem, static void -create_pfs(const char *filesystem, uuid_t *s_uuid) +create_pfs(const char *filesystem, hammer_uuid_t *s_uuid) { if (ForceYesOpt == 1) { fprintf(stderr, "PFS slave %s does not exist. " diff --git a/sbin/hammer/hammer_util.h b/sbin/hammer/hammer_util.h index b917a33211..73c975ba9d 100644 --- a/sbin/hammer/hammer_util.h +++ b/sbin/hammer/hammer_util.h @@ -111,8 +111,8 @@ typedef struct zone_stat { int64_t used; /* bytes used */ } *zone_stat_t; -extern uuid_t Hammer_FSType; -extern uuid_t Hammer_FSId; +extern hammer_uuid_t Hammer_FSType; +extern hammer_uuid_t Hammer_FSId; extern int UseReadBehind; extern int UseReadAhead; extern int DebugOpt; @@ -174,11 +174,11 @@ void hammer_add_zone_stat_layer2(zone_stat_t stats, hammer_blockmap_layer2_t layer2); void hammer_print_zone_stat(const zone_stat_t stats); -void hammer_uuid_create(uuid_t *uuid); -int hammer_uuid_from_string(const char *str, uuid_t *uuid); -int hammer_uuid_to_string(const uuid_t *uuid, char **str); -int hammer_uuid_name_lookup(uuid_t *u, const char *str); -int hammer_uuid_compare(const uuid_t *uuid1, const uuid_t *uuid2); +void hammer_uuid_create(hammer_uuid_t *uuid); +int hammer_uuid_from_string(const char *str, hammer_uuid_t *uuid); +int hammer_uuid_to_string(const hammer_uuid_t *uuid, char **str); +int hammer_uuid_name_lookup(hammer_uuid_t *u, const char *str); +int hammer_uuid_compare(const hammer_uuid_t *uuid1, const hammer_uuid_t *uuid2); #define hwarn(format, args...) warn("WARNING: "format,## args) #define hwarnx(format, args...) warnx("WARNING: "format,## args) diff --git a/sbin/hammer/ondisk.c b/sbin/hammer/ondisk.c index e71f1782c4..d1e6b2f883 100644 --- a/sbin/hammer/ondisk.c +++ b/sbin/hammer/ondisk.c @@ -44,8 +44,8 @@ static __inline int readhammerbuf(buffer_info_t buffer); static __inline int writehammervol(volume_info_t volume); static __inline int writehammerbuf(buffer_info_t buffer); -uuid_t Hammer_FSType; -uuid_t Hammer_FSId; +hammer_uuid_t Hammer_FSType; +hammer_uuid_t Hammer_FSId; int UseReadBehind = -4; int UseReadAhead = 4; int DebugOpt; diff --git a/sbin/hammer/uuid.c b/sbin/hammer/uuid.c index eef610f738..984db886c5 100644 --- a/sbin/hammer/uuid.c +++ b/sbin/hammer/uuid.c @@ -37,12 +37,12 @@ #include "hammer_util.h" -void hammer_uuid_create(uuid_t *uuid) +void hammer_uuid_create(hammer_uuid_t *uuid) { uuid_create(uuid, NULL); } -int hammer_uuid_from_string(const char *str, uuid_t *uuid) +int hammer_uuid_from_string(const char *str, hammer_uuid_t *uuid) { uint32_t status = uuid_s_ok; @@ -53,7 +53,7 @@ int hammer_uuid_from_string(const char *str, uuid_t *uuid) return(0); } -int hammer_uuid_to_string(const uuid_t *uuid, char **str) +int hammer_uuid_to_string(const hammer_uuid_t *uuid, char **str) { uint32_t status = uuid_s_ok; @@ -64,7 +64,7 @@ int hammer_uuid_to_string(const uuid_t *uuid, char **str) return(0); } -int hammer_uuid_name_lookup(uuid_t *u, const char *str) +int hammer_uuid_name_lookup(hammer_uuid_t *u, const char *str) { uint32_t status = uuid_s_ok; @@ -75,7 +75,7 @@ int hammer_uuid_name_lookup(uuid_t *u, const char *str) return(0); } -int hammer_uuid_compare(const uuid_t *uuid1, const uuid_t *uuid2) +int hammer_uuid_compare(const hammer_uuid_t *uuid1, const hammer_uuid_t *uuid2) { return(uuid_compare(uuid1, uuid2, NULL)); } diff --git a/sys/vfs/hammer/hammer.h b/sys/vfs/hammer/hammer.h index 1f743e0424..d6de1a6e37 100644 --- a/sys/vfs/hammer/hammer.h +++ b/sys/vfs/hammer/hammer.h @@ -857,7 +857,7 @@ typedef struct hammer_mount { u_int check_interrupt; u_int check_yield; - uuid_t fsid; + hammer_uuid_t fsid; struct hammer_mod_rb_tree volu_root; /* dirty undo buffers */ struct hammer_mod_rb_tree undo_root; /* dirty undo buffers */ struct hammer_mod_rb_tree data_root; /* dirty data buffers */ @@ -1096,8 +1096,8 @@ void hammer_sync_lock_sh(hammer_transaction_t trans); int hammer_sync_lock_sh_try(hammer_transaction_t trans); void hammer_sync_unlock(hammer_transaction_t trans); -uint32_t hammer_to_unix_xid(uuid_t *uuid); -void hammer_guid_to_uuid(uuid_t *uuid, uint32_t guid); +uint32_t hammer_to_unix_xid(hammer_uuid_t *uuid); +void hammer_guid_to_uuid(hammer_uuid_t *uuid, uint32_t guid); void hammer_time_to_timespec(uint64_t xtime, struct timespec *ts); uint64_t hammer_timespec_to_time(struct timespec *ts); int hammer_str_to_tid(const char *str, int *ispfsp, @@ -1446,7 +1446,7 @@ int hammer_recover_stage2(hammer_mount_t hmp, hammer_volume_t rootvol); void hammer_recover_flush_buffers(hammer_mount_t hmp, hammer_volume_t root_volume, int final); -udev_t hammer_fsid_to_udev(uuid_t *uuid); +udev_t hammer_fsid_to_udev(hammer_uuid_t *uuid); int hammer_blocksize(int64_t file_offset); diff --git a/sys/vfs/hammer/hammer_disk.h b/sys/vfs/hammer/hammer_disk.h index 8931cfd802..6527f1092a 100644 --- a/sys/vfs/hammer/hammer_disk.h +++ b/sys/vfs/hammer/hammer_disk.h @@ -119,6 +119,7 @@ typedef uint64_t hammer_tid_t; typedef uint64_t hammer_off_t; typedef uint32_t hammer_crc_t; +typedef uuid_t hammer_uuid_t; #define HAMMER_MIN_TID 0ULL /* unsigned */ #define HAMMER_MAX_TID 0xFFFFFFFFFFFFFFFFULL /* unsigned */ @@ -747,8 +748,8 @@ typedef struct hammer_volume_ondisk { int64_t vol_buf_end; /* offset of volume EOF (on buffer boundary) */ int64_t vol_reserved01; - uuid_t vol_fsid; /* identify filesystem */ - uuid_t vol_fstype; /* identify filesystem type */ + hammer_uuid_t vol_fsid; /* identify filesystem */ + hammer_uuid_t vol_fstype; /* identify filesystem type */ char vol_label[64]; /* filesystem label */ int32_t vol_no; /* volume number within filesystem */ @@ -891,8 +892,8 @@ typedef struct hammer_inode_data { uint32_t rminor; /* used by device nodes */ uint64_t ctime; int64_t parent_obj_id; /* parent directory obj_id */ - uuid_t uid; - uuid_t gid; + hammer_uuid_t uid; + hammer_uuid_t gid; uint8_t obj_type; uint8_t cap_flags; /* capability support flags (extension) */ @@ -1002,8 +1003,8 @@ struct hammer_pseudofs_data { hammer_tid_t sync_end_tid; /* current synchronizatoin point */ uint64_t sync_beg_ts; /* real-time of last completed sync */ uint64_t sync_end_ts; /* initiation of current sync cycle */ - uuid_t shared_uuid; /* shared uuid (match required) */ - uuid_t unique_uuid; /* unique uuid of this master/slave */ + hammer_uuid_t shared_uuid; /* shared uuid (match required) */ + hammer_uuid_t unique_uuid; /* unique uuid of this master/slave */ int32_t reserved01; /* reserved for future master_id */ int32_t mirror_flags; /* misc flags */ char label[64]; /* filesystem space label */ diff --git a/sys/vfs/hammer/hammer_ioctl.h b/sys/vfs/hammer/hammer_ioctl.h index 04c6dae19c..30295f3239 100644 --- a/sys/vfs/hammer/hammer_ioctl.h +++ b/sys/vfs/hammer/hammer_ioctl.h @@ -228,8 +228,8 @@ struct hammer_ioc_info { struct hammer_ioc_head head; char vol_label[64]; - uuid_t vol_fsid; - uuid_t vol_fstype; + hammer_uuid_t vol_fsid; + hammer_uuid_t vol_fstype; int version; int nvolumes; @@ -275,7 +275,7 @@ struct hammer_ioc_mirror_rw { int size; /* max size */ int pfs_id; /* PFS id being read/written */ int reserved01; - uuid_t shared_uuid; /* validator for safety */ + hammer_uuid_t shared_uuid; /* validator for safety */ }; #define HAMMER_IOC_MIRROR_NODATA 0x0001 /* do not include bulk data */ diff --git a/sys/vfs/hammer/hammer_ondisk.c b/sys/vfs/hammer/hammer_ondisk.c index a00c4dc189..361955898a 100644 --- a/sys/vfs/hammer/hammer_ondisk.c +++ b/sys/vfs/hammer/hammer_ondisk.c @@ -214,7 +214,7 @@ hammer_install_volume(hammer_mount_t hmp, const char *volname, if (RB_EMPTY(&hmp->rb_vols_root)) { hmp->fsid = ondisk->vol_fsid; - } else if (bcmp(&hmp->fsid, &ondisk->vol_fsid, sizeof(uuid_t))) { + } else if (bcmp(&hmp->fsid, &ondisk->vol_fsid, sizeof(hammer_uuid_t))) { hkprintf("volume %s's fsid does not match other volumes\n", volume->vol_name); error = EFTYPE; diff --git a/sys/vfs/hammer/hammer_subs.c b/sys/vfs/hammer/hammer_subs.c index 5c1d24bd2d..1bae2d3d76 100644 --- a/sys/vfs/hammer/hammer_subs.c +++ b/sys/vfs/hammer/hammer_subs.c @@ -779,13 +779,13 @@ hammer_sync_unlock(hammer_transaction_t trans) * Misc */ uint32_t -hammer_to_unix_xid(uuid_t *uuid) +hammer_to_unix_xid(hammer_uuid_t *uuid) { return(*(uint32_t *)&uuid->node[2]); } void -hammer_guid_to_uuid(uuid_t *uuid, uint32_t guid) +hammer_guid_to_uuid(hammer_uuid_t *uuid, uint32_t guid) { bzero(uuid, sizeof(*uuid)); *(uint32_t *)&uuid->node[2] = guid; @@ -1129,7 +1129,7 @@ hammer_blockdemarc(int64_t file_offset1, int64_t file_offset2) } udev_t -hammer_fsid_to_udev(uuid_t *uuid) +hammer_fsid_to_udev(hammer_uuid_t *uuid) { uint32_t crc; diff --git a/sys/vfs/hammer/hammer_vnops.c b/sys/vfs/hammer/hammer_vnops.c index 9b6b6fab8b..154176d023 100644 --- a/sys/vfs/hammer/hammer_vnops.c +++ b/sys/vfs/hammer/hammer_vnops.c @@ -2195,8 +2195,8 @@ hammer_vop_setattr(struct vop_setattr_args *ap) mode_t cur_mode = ip->ino_data.mode; uid_t cur_uid = hammer_to_unix_xid(&ip->ino_data.uid); gid_t cur_gid = hammer_to_unix_xid(&ip->ino_data.gid); - uuid_t uuid_uid; - uuid_t uuid_gid; + hammer_uuid_t uuid_uid; + hammer_uuid_t uuid_gid; error = vop_helper_chown(ap->a_vp, vap->va_uid, vap->va_gid, ap->a_cred, diff --git a/usr.sbin/fstyp/hammer.c b/usr.sbin/fstyp/hammer.c index a89731da6f..1a746169a8 100644 --- a/usr.sbin/fstyp/hammer.c +++ b/usr.sbin/fstyp/hammer.c @@ -52,7 +52,7 @@ static int __test_ondisk(const hammer_volume_ondisk_t ondisk) { static int count = 0; - static uuid_t fsid, fstype; + static hammer_uuid_t fsid, fstype; static char label[64]; if (ondisk->vol_signature != HAMMER_FSBUF_VOLUME &&