Whamcloud - gitweb
land b_colibri_devel on HEAD:
[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 message severity level */
20 enum llapi_message_level {
21         LLAPI_MSG_OFF    = 0,
22         LLAPI_MSG_FATAL  = 1,
23         LLAPI_MSG_ERROR  = 2,
24         LLAPI_MSG_WARN   = 3,
25         LLAPI_MSG_NORMAL = 4,
26         LLAPI_MSG_INFO   = 5,
27         LLAPI_MSG_DEBUG  = 6,
28         LLAPI_MSG_MAX
29 };
30
31 /* the bottom three bits reserved for llapi_message_level */
32 #define LLAPI_MSG_MASK          0x00000007
33 #define LLAPI_MSG_NO_ERRNO      0x00000010 
34
35 /* liblustreapi.c */
36 extern void llapi_msg_set_level(int level);
37 extern void llapi_err(int level, char *fmt, ...);
38 extern void llapi_printf(int level, char *fmt, ...);
39 extern int llapi_file_create(const char *name, unsigned long stripe_size,
40                              int stripe_offset, int stripe_count,
41                              int stripe_pattern);
42 extern int llapi_file_open(const char *name, int flags, int mode,
43                            unsigned long stripe_size, int stripe_offset,
44                            int stripe_count, int stripe_pattern);
45 extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum);
46 #define HAVE_LLAPI_FILE_LOOKUP
47 extern int llapi_file_lookup(int dirfd, const char *name);
48  
49 struct find_param {
50         unsigned int maxdepth;
51         time_t  atime;
52         time_t  mtime;
53         time_t  ctime;
54         int     asign;
55         int     csign;
56         int     msign;
57         int     type;
58         unsigned long long size;
59         int     size_sign;
60         unsigned long long size_units;
61
62         unsigned long   zeroend:1,
63                         recursive:1,
64                         got_uuids:1,
65                         obds_printed:1,
66                         exclude_pattern:1,
67                         exclude_type:1,
68                         have_fileinfo:1;
69
70         int     verbose;
71         int     quiet;
72
73         /* regular expression */
74         char   *pattern;
75
76         char   *print_fmt;
77
78         struct  obd_uuid        *obduuid;
79         int                     num_obds;
80         int                     num_alloc_obds;
81         int                     obdindex;
82         int                     *obdindexes;
83
84         int     lumlen;
85         struct  lov_user_mds_data *lmd;
86
87         /* In-precess parameters. */
88         unsigned int depth;
89         dev_t   st_dev;
90 };
91
92 extern int llapi_getstripe(char *path, struct find_param *param);
93 extern int llapi_find(char *path, struct find_param *param);
94
95 extern int llapi_obd_statfs(char *path, __u32 type, __u32 index,
96                      struct obd_statfs *stat_buf,
97                      struct obd_uuid *uuid_buf);
98 extern int llapi_ping(char *obd_type, char *obd_name);
99 extern int llapi_target_check(int num_types, char **obd_types, char *dir);
100 extern int llapi_catinfo(char *dir, char *keyword, char *node_name);
101 extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
102 extern int llapi_is_lustre_mnttype(const char *type);
103 extern int parse_size(char *optarg, unsigned long long *size,
104                       unsigned long long *size_units);
105 struct mntent;
106 #define HAVE_LLAPI_IS_LUSTRE_MNT
107 extern int llapi_is_lustre_mnt(struct mntent *mnt);
108 extern int llapi_quotachown(char *path, int flag);
109 extern int llapi_quotacheck(char *mnt, int check_type);
110 extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
111 extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
112 extern int llapi_target_iterate(int type_num, char **obd_type, void *args, llapi_cb_t cb);
113 extern int llapi_lsetfacl(int argc, char *argv[]);
114 extern int llapi_lgetfacl(int argc, char *argv[]);
115 extern int llapi_rsetfacl(int argc, char *argv[]);
116 extern int llapi_rgetfacl(int argc, char *argv[]);
117 extern int llapi_cp(int argc, char *argv[]);
118 extern int llapi_ls(int argc, char *argv[]);
119 #endif