X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Ftests%2Fmultiop.c;h=a46451b1f50a8ec1a9531c92b4063de3d10c1752;hp=86274f294aad732681e965d8905fe7b268a3fe18;hb=f52ece3201af131a7bb8a7b2766d3f0a98c00fca;hpb=d1d08e3742490dec17239bcc0d4690587d4e09b6 diff --git a/lustre/tests/multiop.c b/lustre/tests/multiop.c old mode 100755 new mode 100644 index 86274f2..a46451b --- a/lustre/tests/multiop.c +++ b/lustre/tests/multiop.c @@ -1,6 +1,4 @@ -/* -*- 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. @@ -26,7 +24,7 @@ * GPL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. */ /* @@ -44,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +65,9 @@ char usage[] = " C[num] create with optional stripes\n" " d mkdir\n" " D open(O_DIRECTORY)\n" +" f statfs\n" +" G gid get grouplock\n" +" g gid put grouplock\n" " L link\n" " l symlink\n" " m mknod\n" @@ -179,19 +181,20 @@ int get_flags(char *data, int *rflags) } #define POP_ARG() (pop_arg(argc, argv)) -#define min(a,b) ((a)>(b)?(b):(a)) int main(int argc, char **argv) { char *fname, *commands; const char *newfile; struct stat st; + struct statfs stfs; size_t mmap_len = 0, i; unsigned char *mmap_ptr = NULL, junk = 0; int rc, len, fd = -1; int flags; int save_errno; int verbose = 0; + int gid = 0; if (argc < 3) { fprintf(stderr, usage, argv[0]); @@ -248,6 +251,29 @@ int main(int argc, char **argv) exit(save_errno); } break; + case 'f': + if (statfs(fname, &stfs) == -1) { + save_errno = errno; + perror("statfs()"); + exit(save_errno); + } + break; + case 'G': + gid = atoi(commands+1); + if (ioctl(fd, LL_IOC_GROUP_LOCK, gid) == -1) { + save_errno = errno; + perror("ioctl(GROUP_LOCK)"); + exit(save_errno); + } + break; + case 'g': + gid = atoi(commands+1); + if (ioctl(fd, LL_IOC_GROUP_UNLOCK, gid) == -1) { + save_errno = errno; + perror("ioctl(GROUP_UNLOCK)"); + exit(save_errno); + } + break; case 'l': newfile = POP_ARG(); if (!newfile) @@ -311,7 +337,10 @@ int main(int argc, char **argv) case 'o': len = get_flags(commands+1, &flags); commands += len; - fd = open(fname, flags); + if (flags & O_CREAT) + fd = open(fname, flags, 0666); + else + fd = open(fname, flags); if (fd == -1) { save_errno = errno; perror("open");