Whamcloud - gitweb
b=13128
[fs/lustre-release.git] / lustre / include / lustre / liblustreapi.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *   This file is part of Lustre, http://www.lustre.org
5  */
6 #ifndef _LIBLUSTREAPI_H_
7 #define _LIBLUSTREAPI_H_
8
9 #include <lustre/lustre_user.h>
10
11 /* Initially allocate for these many OSTs, realloc if needed */
12 #define INIT_ALLOC_NUM_OSTS     1024
13
14 /* Maximum number of osts that can be specified to lfs find */
15 #define FIND_MAX_OSTS   1024
16
17 typedef void (*llapi_cb_t)(char *obd_type_name, char *obd_name, char *obd_uuid, void *args);
18
19 /* liblustreapi.c */
20 extern int llapi_file_create(const char *name, unsigned long stripe_size,
21                              int stripe_offset, int stripe_count,
22                              int stripe_pattern);
23 extern int llapi_file_open(const char *name, int flags, int mode,
24                            unsigned long stripe_size, int stripe_offset,
25                            int stripe_count, int stripe_pattern);
26 extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum);
27 #define HAVE_LLAPI_FILE_LOOKUP
28 extern int llapi_file_lookup(int dirfd, const char *name);
29  
30 struct find_param {
31         unsigned int maxdepth;
32         time_t  atime;
33         time_t  mtime;
34         time_t  ctime;
35         int     asign;
36         int     csign;
37         int     msign;
38         int     type;
39         unsigned long long size;
40         int     size_sign;
41         unsigned long long size_units;
42
43         unsigned zeroend:1, recursive:1, got_uuids:1, obds_printed:1, exclude_pattern:1, exclude_type:1;
44
45         int     verbose;
46         int     quiet;
47
48         /* regular expression */
49         char   *pattern;
50
51         char   *print_fmt;
52
53         struct  obd_uuid        *obduuid;
54         int                     num_obds;
55         int                     num_alloc_obds;
56         int                     obdindex;
57         int                     *obdindexes;
58
59         int     lumlen;
60         struct  lov_user_mds_data *lmd;
61
62         /* In-precess parameters. */
63         unsigned int depth;
64         dev_t   st_dev;
65 };
66
67 extern int llapi_getstripe(char *path, struct find_param *param);
68 extern int llapi_find(char *path, struct find_param *param);
69
70 extern int llapi_obd_statfs(char *path, __u32 type, __u32 index,
71                      struct obd_statfs *stat_buf,
72                      struct obd_uuid *uuid_buf);
73 extern int llapi_ping(char *obd_type, char *obd_name);
74 extern int llapi_target_check(int num_types, char **obd_types, char *dir);
75 extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
76 extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
77 extern int llapi_is_lustre_mnttype(const char *type);
78 extern int parse_size(char *optarg, unsigned long long *size,
79                       unsigned long long *size_units);
80 struct mntent;
81 #define HAVE_LLAPI_IS_LUSTRE_MNT
82 extern int llapi_is_lustre_mnt(struct mntent *mnt);
83 extern int llapi_quotachown(char *path, int flag);
84 extern int llapi_quotacheck(char *mnt, int check_type);
85 extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
86 extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
87 extern int llapi_target_iterate(int type_num, char **obd_type, void *args, llapi_cb_t cb);
88 extern int llapi_getfacl(char *fname, char *cmd);
89 extern int llapi_setfacl(char *fname, char *cmd);
90 #endif