#ifdef __KERNEL__
#include <linux/list.h>
#else
+#include <stdbool.h>
#include <libcfs/util/list.h>
#endif
#include <lnet/types.h>
#define MT_STR(data) mt_str((data)->ldd_mount_type)
/* Make the mdt/ost server obd name based on the filesystem name */
-static inline int server_make_name(__u32 flags, __u16 index, char *fs,
- char *name)
+static inline bool server_make_name(__u32 flags, __u16 index, char *fs,
+ char *name)
{
+ bool invalid_flag = false;
+
if (flags & (LDD_F_SV_TYPE_MDT | LDD_F_SV_TYPE_OST)) {
if (!(flags & LDD_F_SV_ALL))
sprintf(name, "%.8s%c%s%04x", fs,
sprintf(name, "MGS");
} else {
CERROR("unknown server type %#x\n", flags);
- return 1;
- }
- return 0;
+ invalid_flag = true;
+ }
+ return invalid_flag;
}
/****************** mount command *********************/
set_bit(mti->mti_stripe_index, imap);
clear_bit(FSDB_LOG_EMPTY, &fsdb->fsdb_flags);
mutex_unlock(&fsdb->fsdb_mutex);
- server_make_name(mti->mti_flags & ~(LDD_F_VIRGIN | LDD_F_WRITECONF),
- mti->mti_stripe_index, mti->mti_fsname, mti->mti_svname);
+ if (server_make_name(mti->mti_flags & ~(LDD_F_VIRGIN | LDD_F_WRITECONF),
+ mti->mti_stripe_index, mti->mti_fsname,
+ mti->mti_svname)) {
+ CERROR("unknown server type %#x\n", mti->mti_flags);
+ return -EINVAL;
+ }
CDEBUG(D_MGS, "Set index for %s to %d\n", mti->mti_svname,
mti->mti_stripe_index);
goto out;
}
- server_make_name(ldd->ldd_flags, ldd->ldd_svindex,
- ldd->ldd_fsname, ldd->ldd_svname);
+ if (server_make_name(ldd->ldd_flags, ldd->ldd_svindex,
+ ldd->ldd_fsname, ldd->ldd_svname)) {
+ printf("unknown server type %#x\n", ldd->ldd_flags);
+ goto out;
+ }
if (verbose >= 0)
print_ldd("Permanent disk data", ldd);