Project

General

Profile

ceph_mkdir_test.c

"backported" reproducer - Jeff Layton, 10/18/2016 03:23 PM

Download (1.15 KB)

 
1
#define _FILE_OFFSET_BITS (64)
2
#define _GNU_SOURCE 1
3
#include <stdio.h>
4
#include <cephfs/libcephfs.h>
5
#include <string.h>
6
#include <limits.h>
7

    
8
#define BUFSZ                (16 * 1024)
9
#define NUMFILES        256
10

    
11
int
12
main(void) {
13
        struct ceph_mount_info *cmount;
14
        int ret;
15
        struct stat st;
16
        Inode *root, *dir1, *dir2;
17

    
18
        ret = ceph_create(&cmount, NULL);
19
        if (ret) {
20
                fprintf(stderr, "mount info create: %d\n", ret);
21
                return 1;
22
        }
23

    
24
        ret = ceph_conf_read_file(cmount, NULL);
25
        if (ret) {
26
                fprintf(stderr, "read conf file: %d\n", ret);
27
                return 1;
28
        }
29

    
30
        ret = ceph_conf_parse_env(cmount, NULL);
31
        if (ret) {
32
                fprintf(stderr, "parse env: %d\n", ret);
33
                return 1;
34
        }
35

    
36
        ret = ceph_mount(cmount, "/");
37
        if (ret) {
38
                fprintf(stderr, "mount: %d\n", ret);
39
                return 1;
40
        }
41

    
42
        ret = ceph_ll_lookup_root(cmount, &root);
43
        if (ret) {
44
                fprintf(stderr, "lookup root: %d\n", ret);
45
                return 1;
46
        }
47

    
48
        ret = ceph_ll_mkdir(cmount, root, "dir1", 0700, &st, &dir1,
49
                            10000, 10000);
50
        if (ret) {
51
                fprintf(stderr, "mkdir1: %d\n", ret);
52
                return 1;
53
        }
54

    
55
        ret = ceph_ll_mkdir(cmount, dir1, "dir2", 0700, &st, &dir2,
56
                            10001, 10001);
57
        if (ret) {
58
                fprintf(stderr, "mkdir2: %d\n", ret);
59
                return 1;
60
        }
61

    
62

    
63
        return 0;
64
}