Commit 450e2b88 authored by Daniel Verkamp's avatar Daniel Verkamp Committed by Jim Harris
Browse files

blobfs: use struct spdk_bs_type to represent types



Rather than using char arrays to represent blobstore types, just use the
publicly-defined struct spdk_bs_type.

Change-Id: I8bbfd95085e16f9d53106c176038e067ff1266d7
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/382853


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 80b44ea2
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -614,8 +614,8 @@ load_cb(void *ctx, struct spdk_blob_store *bs, int bserrno)
	struct spdk_fs_cb_args *args = &req->args;
	struct spdk_filesystem *fs = args->fs;
	struct spdk_bs_type bstype;
	static const char blobfs_type[SPDK_BLOBSTORE_TYPE_LENGTH] = {"BLOBFS"};
	static const char zeros[SPDK_BLOBSTORE_TYPE_LENGTH];
	static const struct spdk_bs_type blobfs_type = {"BLOBFS"};
	static const struct spdk_bs_type zeros;

	if (bserrno != 0) {
		args->fn.fs_op_with_handle(args->arg, NULL, bserrno);
@@ -626,11 +626,10 @@ load_cb(void *ctx, struct spdk_blob_store *bs, int bserrno)

	bstype = spdk_bs_get_bstype(bs);

	if (!memcmp(&bstype, zeros, SPDK_BLOBSTORE_TYPE_LENGTH)) {
	if (!memcmp(&bstype, &zeros, sizeof(bstype))) {
		SPDK_DEBUGLOG(SPDK_TRACE_BLOB, "assigning bstype");
		snprintf(bstype.bstype, SPDK_BLOBSTORE_TYPE_LENGTH, blobfs_type);
		spdk_bs_set_bstype(bs, bstype);
	} else if (strncmp(bstype.bstype, blobfs_type, SPDK_BLOBSTORE_TYPE_LENGTH)) {
		spdk_bs_set_bstype(bs, blobfs_type);
	} else if (memcmp(&bstype, &blobfs_type, sizeof(bstype))) {
		SPDK_DEBUGLOG(SPDK_TRACE_BLOB, "not blobfs: %s", bstype.bstype);
		args->fn.fs_op_with_handle(args->arg, NULL, bserrno);
		free_fs_request(req);