Whamcloud - gitweb
Some racy problems happened when sanity-quota.sh run on buffalo.
[fs/lustre-release.git] / lustre / tests / ll_getstripe_info.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * ll_getstripe_info <file>:
5  * - get file's stripe info.
6  */
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <errno.h>
12
13 #include <liblustre.h>
14 #include <obd.h>
15 #include <obd_lov.h>
16
17 #include <lustre/liblustreapi.h>
18
19 #define MAX_LOV_UUID_COUNT      1000
20
21 int main(int argc, char** argv)
22 {
23         struct lov_user_md *lum_file = NULL;
24         int rc;
25         int lum_size;
26
27         if (argc != 2) {
28                 fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
29                 return 1;
30         }
31
32         lum_size = lov_mds_md_size(MAX_LOV_UUID_COUNT);
33
34         if ((lum_file = (struct lov_user_md *)malloc(lum_size)) == NULL) {
35                 fprintf(stderr, "unable to allocate memory for ioctl's");
36                 rc = errno;
37                 goto cleanup;
38         }
39
40         rc = llapi_file_get_stripe(argv[1], lum_file);
41         if (rc) {
42                 rc = errno;
43                 goto cleanup;
44         }
45
46         /* stripe_size stripe_count stripe_offset */
47         printf("%d %d %d\n", 
48                lum_file->lmm_stripe_size,
49                lum_file->lmm_stripe_count,
50                lum_file->lmm_objects[0].l_ost_idx);
51
52 cleanup:
53         if (lum_file != NULL)
54                 free(lum_file);
55
56         return rc;
57 }