-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2013, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <sys/time.h>
#include <lnet/lnetctl.h>
+#include <lnet/nidstr.h>
#include <libcfs/libcfsutil.h>
+#include <lustre_ioctl.h>
#include "obdctl.h"
static char cmdname[512];
/* See jt_obd_create */
static int obj_create(struct kid_t *kid)
{
- struct obd_ioctl_data data;
- int rc;
-
- memset(&data, 0, sizeof(data));
- data.ioc_dev = kid->k_dev;
- data.ioc_obdo1.o_mode = 0100644;
- data.ioc_obdo1.o_id = 0;
- data.ioc_obdo1.o_gr = 2;
- data.ioc_obdo1.o_uid = 0;
- data.ioc_obdo1.o_gid = 0;
- data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID;
+ struct obd_ioctl_data data;
+ int rc;
+
+ memset(&data, 0, sizeof(data));
+ data.ioc_dev = kid->k_dev;
+ data.ioc_obdo1.o_mode = 0100644;
+ ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
+ ostid_set_id(&data.ioc_obdo1.o_oi, 1);
+ data.ioc_obdo1.o_uid = 0;
+ data.ioc_obdo1.o_gid = 0;
+ data.ioc_obdo1.o_valid = OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLID | OBD_MD_FLUID | OBD_MD_FLGID;
rc = obj_ioctl(OBD_IOC_CREATE, &data, 1);
if (rc) {
return rc;
}
- kid->k_objid = data.ioc_obdo1.o_id;
+ kid->k_objid = ostid_id(&data.ioc_obdo1.o_oi);
if (o_verbose > 4)
printf("%d: cr "LPX64"\n", kid->k_id, kid->k_objid);
memset(&data, 0, sizeof(data));
data.ioc_dev = kid->k_dev;
- data.ioc_obdo1.o_id = kid->k_objid;
+ ostid_set_id(&data.ioc_obdo1.o_oi, kid->k_objid);
data.ioc_obdo1.o_mode = S_IFREG | 0644;
data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLMODE;
data.ioc_pbuf1 = (void *)1;
data.ioc_plen1 = 1;
- data.ioc_obdo1.o_id = kid->k_objid;
- data.ioc_obdo1.o_mode = S_IFREG;
- data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE |
- OBD_MD_FLFLAGS;
- data.ioc_obdo1.o_flags = OBD_FL_DEBUG_CHECK;
- data.ioc_count = len;
- data.ioc_offset = 0;
+ ostid_set_seq_echo(&data.ioc_obdo1.o_oi);
+ ostid_set_id(&data.ioc_obdo1.o_oi, kid->k_objid);
+ data.ioc_obdo1.o_mode = S_IFREG;
+ data.ioc_obdo1.o_valid = OBD_MD_FLID | OBD_MD_FLTYPE | OBD_MD_FLMODE |
+ OBD_MD_FLFLAGS | OBD_MD_FLGROUP;
+ data.ioc_obdo1.o_flags = OBD_FL_DEBUG_CHECK;
+ data.ioc_count = len;
+ data.ioc_offset = 0;
gettimeofday(&start, NULL);
static void *run_one_child(void *threadvp)
{
- struct kid_t *kid;
- char oname[10], ename[10];
- int thread = (long)threadvp, dev = 0;
- int rc = 0, err;
-
- if (o_verbose > 2)
- printf("%s: running thread #%d\n", cmdname, thread);
-
- sprintf(oname, "o%.5d", thread);
- sprintf(ename, "e%.5d", thread);
+ struct kid_t *kid;
+ char oname[16], ename[16];
+ int thread = (long)threadvp;
+ int dev = 0;
+ int err;
+ int rc;
+
+ if (o_verbose > 2)
+ printf("%s: running thread #%d\n", cmdname, thread);
+
+ rc = snprintf(oname, sizeof(oname), "o%.5d", thread);
+ if (rc != 1) {
+ rc = -EFAULT;
+ goto out_exit;
+ }
+ rc = snprintf(ename, sizeof(ename), "e%.5d", thread);
+ if (rc != 1) {
+ rc = -EFAULT;
+ goto out_exit;
+ }
rc = echocli_setup(oname, ename, &dev);
if (rc) {
fprintf(stderr, "%s: can't setup '%s/%s' (%d)\n",
cmdname, oname, ename, rc);
- pthread_exit((void *)(long)rc);
+ goto out_exit;
}
kid = push_kid(thread);
err = cleanup(oname, 0);
if (!rc) rc = err;
- pthread_exit((void *)(long)rc);
+out_exit:
+ pthread_exit((void *)(long)rc);
}
/*