Whamcloud - gitweb
LU-1606 api: Rename liblustreapi.h -> lustreapi.h
authorChristopher J. Morrone <morrone2@llnl.gov>
Wed, 18 Jul 2012 00:22:18 +0000 (17:22 -0700)
committerOleg Drokin <green@whamcloud.com>
Tue, 9 Oct 2012 15:06:32 +0000 (11:06 -0400)
The header file "liblustreapi.h" is unfortunately named,
implying that it is only part of the lustre-in-user-space-client
rather than the more general lustre api for users that it is.

This patch renames it to simply "lustreapi.h" to avoid that
confusion.  This also helps to move towards making it
easier to use the lustre API for users.  They can simply

  #include <lustre/lustreapi.h>

and then compile with "-llustreapi".

For backwards compatibility, liblustreapi.h becomes a stub
that includes lustreapi.h, and can be removed at some date
in the future.

Since LU-113, LASSERT should be removed from userspace.
In this change, lustre_user.h has had LASSERTs removed.

All code examples in the man pages have been tested.

Signed-off-by: Christopher J. Morrone <morrone2@llnl.gov>
Signed-off-by: Richard Henwood <richard.henwood@intel.com>
Change-Id: Id1e709d36a855ad2a8eff206fa9f6bbe87182a29
Reviewed-on: http://review.whamcloud.com/3427
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
20 files changed:
lustre/doc/Makefile.am
lustre/doc/llapi_file_get_stripe.3
lustre/doc/llapi_file_open.3
lustre/doc/lustreapi.7 [moved from lustre/doc/liblustreapi.7 with 57% similarity]
lustre/include/lustre/Makefile.am
lustre/include/lustre/liblustreapi.h
lustre/include/lustre/lustre_user.h
lustre/include/lustre/lustreapi.h [new file with mode: 0644]
lustre/liblustre/tests/sanity.c
lustre/tests/copytool.c
lustre/tests/ll_dirstripe_verify.c
lustre/tests/mpi/cascading_rw.c
lustre/tests/mpi/mdsrate.c
lustre/tests/multiop.c
lustre/tests/rwv.c
lustre/tests/sendfile.c
lustre/utils/lfs.c
lustre/utils/liblustreapi.c
lustre/utils/lustre_rsync.c
lustre/utils/obd.c

index 26a1753..e35b9a9 100644 (file)
@@ -52,7 +52,7 @@ MANFILES = lustre.7 lfs.1 mount.lustre.8 mkfs.lustre.8 tunefs.lustre.8 lctl.8 \
        llverdev.8 llbackup.8 llapi_quotactl.3 llobdstat.8 llstat.8 \
        plot-llstat.8 l_getgroups.8 lst.8 routerstat.8 lshowmount.8 \
        ll_recover_lost_found_objs.8 llog_reader.8 llapi_file_open.3 \
        llverdev.8 llbackup.8 llapi_quotactl.3 llobdstat.8 llstat.8 \
        plot-llstat.8 l_getgroups.8 lst.8 routerstat.8 lshowmount.8 \
        ll_recover_lost_found_objs.8 llog_reader.8 llapi_file_open.3 \
-       llapi_file_create.3 llapi_file_get_stripe.3 liblustreapi.7 \
+       llapi_file_create.3 llapi_file_get_stripe.3 lustreapi.7 \
        lustre_rsync.8 lfs_migrate.1 lhbadm.8 ldev.8 ldev.conf.5 nids.5
 
 if UTILS
        lustre_rsync.8 lfs_migrate.1 lhbadm.8 ldev.8 ldev.conf.5 nids.5
 
 if UTILS
index bfc9dc6..24d172f 100644 (file)
@@ -1,4 +1,4 @@
-.TH llapi_file_get_stripe 3 "2009 Jul 22" Lustre liblustreapi
+.TH lustreapi 3 "2009 Jul 22" The Lustre user application interface library
 .SH NAME
 llapi_file_get_stripe \- get striping information for a file or a directory on a Lustre filesystem
 .SH SYNOPSIS
 .SH NAME
 llapi_file_get_stripe \- get striping information for a file or a directory on a Lustre filesystem
 .SH SYNOPSIS
@@ -6,10 +6,7 @@ llapi_file_get_stripe \- get striping information for a file or a directory on a
 .B #include <sys/types.h>
 .B #include <sys/stat.h>
 .B #include <fcntl.h>
 .B #include <sys/types.h>
 .B #include <sys/stat.h>
 .B #include <fcntl.h>
-.B #include <liblustre.h>
-.B #include <lustre/lustre_idl.h>
-.B #include <lustre/liblustreapi.h>
-.B #include <lustre/lustre_user.h>
+.B #include <lustre/lustreapi.h>
 .sp
 .BI "int llapi_file_get_stripe(const char *"path ", void *"lum );
 .sp
 .sp
 .BI "int llapi_file_get_stripe(const char *"path ", void *"lum );
 .sp
@@ -140,12 +137,7 @@ is not properly mapped.
 .SH "EXAMPLE"
 .nf
 #include <sys/vfs.h>
 .SH "EXAMPLE"
 .nf
 #include <sys/vfs.h>
-#include <liblustre.h>
-#include <lnet/lnetctl.h>
-#include <obd.h>
-#include <lustre_lib.h>
-#include <lustre/liblustreapi.h>
-#include <obd_lov.h>
+#include <lustre/lustreapi.h>
 
 static inline int maxint(int a, int b)
 {
 
 static inline int maxint(int a, int b)
 {
@@ -201,4 +193,4 @@ cleanup:
 .fi
 .SH "SEE ALSO"
 .BR lustre (7),
 .fi
 .SH "SEE ALSO"
 .BR lustre (7),
-.BR liblustreapi (7)
+.BR lustreapi (7)
index ce015ac..a62a2dc 100644 (file)
@@ -1,4 +1,4 @@
-.TH LLAPI_FILE_OPEN 3 "2009 Jul 10" Lustre API
+.TH lustreapi 3 "2009 Jul 10" The Lustre user application interface library
 .SH NAME
 llapi_file_open, llapi_file_create \- open and possibly create a file or a device on a Lustre filesystem
 .SH SYNOPSIS
 .SH NAME
 llapi_file_open, llapi_file_create \- open and possibly create a file or a device on a Lustre filesystem
 .SH SYNOPSIS
@@ -6,10 +6,7 @@ llapi_file_open, llapi_file_create \- open and possibly create a file or a devic
 .B #include <sys/types.h>
 .B #include <sys/stat.h>
 .B #include <fcntl.h>
 .B #include <sys/types.h>
 .B #include <sys/stat.h>
 .B #include <fcntl.h>
-.B #include <liblustre.h>
-.B #include <lustre/lustre_idl.h>
-.B #include <lustre/liblustreapi.h>
-.B #include <lustre/lustre_user.h>
+.B #include <lustre/lustreapi.h>
 .sp
 .BI "int llapi_file_open(const char *"name ", int " flags ", int " mode "," 
 .BI "                    unsigned long long " stripe_size ", int " stripe_offset "," 
 .sp
 .BI "int llapi_file_open(const char *"name ", int " flags ", int " mode "," 
 .BI "                    unsigned long long " stripe_size ", int " stripe_offset "," 
@@ -128,10 +125,7 @@ may not point to a Lustre filesystem.
 #include <fcntl.h>
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <stdio.h>
-#include <liblustre.h>
-#include <lustre/lustre_idl.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
+#include <lustre/lustreapi.h>
 int main(int argc, char *argv[])
 {
         int rc;
 int main(int argc, char *argv[])
 {
         int rc;
@@ -152,4 +146,4 @@ int main(int argc, char *argv[])
 .SH "SEE ALSO"
 .BR open (2),
 .BR lustre (7),
 .SH "SEE ALSO"
 .BR open (2),
 .BR lustre (7),
-.BR liblustreapi (7)
+.BR lustreapi (7)
similarity index 57%
rename from lustre/doc/liblustreapi.7
rename to lustre/doc/lustreapi.7
index ebd86bf..d266be6 100644 (file)
@@ -1,8 +1,8 @@
-.TH liblustreapi 7 "2009 Aug 10" Lustre liblustreapi
+.TH lustreapi 7 "2009 Aug 10" The Lustre user application interface library
 .SH NAME
 .SH NAME
-liblustre \- The liblustre library
+lustreapi \- The lustre API library
 .SH DESCRIPTION
 .SH DESCRIPTION
-The liblustre library provides functions to access and/or modify settings specific to the Lustre filesystem (allocation policies, quotas, etc).
+The lustreapi library provides functions to access and/or modify settings specific to the Lustre filesystem (allocation policies, quotas, etc).
 .SH "SEE ALSO"
 .BR lustre (7),
 .BR llapi_file_create (3),
 .SH "SEE ALSO"
 .BR lustre (7),
 .BR llapi_file_create (3),
index e58a6fe..810c9e2 100644 (file)
@@ -35,9 +35,9 @@
 #
 
 if UTILS
 #
 
 if UTILS
-pkginclude_HEADERS = lustre_idl.h lustre_user.h liblustreapi.h libiam.h \
-        ll_fiemap.h
+pkginclude_HEADERS = lustreapi.h lustre_idl.h lustre_user.h liblustreapi.h \
+       libiam.h ll_fiemap.h
 endif
 
 endif
 
-EXTRA_DIST = lustre_idl.h lustre_user.h liblustreapi.h libiam.h ll_fiemap.h \
-            lustre_lfsck_user.h
+EXTRA_DIST = lustreapi.h lustre_idl.h lustre_user.h liblustreapi.h \
+       libiam.h ll_fiemap.h lustre_lfsck_user.h
index 8a87398..707eb74 100644 (file)
  * GPL HEADER END
  */
 /*
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
- */
-/*
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
-#ifndef _LIBLUSTREAPI_H_
-#define _LIBLUSTREAPI_H_
-
-/** \defgroup llapi llapi
- *
- * @{
+/*
+ * NOTE: This file is DEPRECATED!  Please include lustreapi.h directly
+ * instead of this file.  This file will be removed from a future version
+ * of lustre!
  */
 
  */
 
-#include <lustre/lustre_user.h>
-
-typedef void (*llapi_cb_t)(char *obd_type_name, char *obd_name, char *obd_uuid, void *args);
-
-/* liblustreapi message severity level */
-enum llapi_message_level {
-        LLAPI_MSG_OFF    = 0,
-        LLAPI_MSG_FATAL  = 1,
-        LLAPI_MSG_ERROR  = 2,
-        LLAPI_MSG_WARN   = 3,
-        LLAPI_MSG_NORMAL = 4,
-        LLAPI_MSG_INFO   = 5,
-        LLAPI_MSG_DEBUG  = 6,
-        LLAPI_MSG_MAX
-};
-
-/* the bottom three bits reserved for llapi_message_level */
-#define LLAPI_MSG_MASK          0x00000007
-#define LLAPI_MSG_NO_ERRNO      0x00000010
-
-/* liblustreapi.c */
-extern void llapi_msg_set_level(int level);
-extern void llapi_error(int level, int rc, char *fmt, ...);
-#define llapi_err_noerrno(level, fmt, a...)                             \
-       llapi_error((level) | LLAPI_MSG_NO_ERRNO, 0, fmt, ## a)
-extern void llapi_printf(int level, char *fmt, ...);
-extern int llapi_file_create(const char *name, unsigned long long stripe_size,
-                             int stripe_offset, int stripe_count,
-                             int stripe_pattern);
-extern int llapi_file_open(const char *name, int flags, int mode,
-                           unsigned long long stripe_size, int stripe_offset,
-                           int stripe_count, int stripe_pattern);
-extern int llapi_file_create_pool(const char *name,
-                                  unsigned long long stripe_size,
-                                  int stripe_offset, int stripe_count,
-                                  int stripe_pattern, char *pool_name);
-extern int llapi_file_open_pool(const char *name, int flags, int mode,
-                                unsigned long long stripe_size,
-                                int stripe_offset, int stripe_count,
-                                int stripe_pattern, char *pool_name);
-extern int llapi_poollist(const char *name);
-extern int llapi_get_poollist(const char *name, char **poollist, int list_size,
-                              char *buffer, int buffer_size);
-extern int llapi_get_poolmembers(const char *poolname, char **members,
-                                 int list_size, char *buffer, int buffer_size);
-extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum);
-#define HAVE_LLAPI_FILE_LOOKUP
-extern int llapi_file_lookup(int dirfd, const char *name);
-
-#define VERBOSE_COUNT      0x1
-#define VERBOSE_SIZE       0x2
-#define VERBOSE_OFFSET     0x4
-#define VERBOSE_POOL       0x8
-#define VERBOSE_DETAIL     0x10
-#define VERBOSE_OBJID      0x20
-#define VERBOSE_GENERATION 0x40
-#define VERBOSE_MDTINDEX   0x80
-#define VERBOSE_ALL        (VERBOSE_COUNT | VERBOSE_SIZE | VERBOSE_OFFSET | \
-                            VERBOSE_POOL | VERBOSE_OBJID | VERBOSE_GENERATION)
-
-struct find_param {
-        unsigned int maxdepth;
-        time_t  atime;
-        time_t  mtime;
-        time_t  ctime;
-        int     asign;  /* cannot be bitfields due to using pointers to */
-        int     csign;  /* access them during argument parsing. */
-        int     msign;
-        int     type;
-        int             size_sign:2,        /* these need to be signed values */
-                        stripesize_sign:2,
-                        stripecount_sign:2;
-        unsigned long long size;
-        unsigned long long size_units;
-        uid_t uid;
-        gid_t gid;
-
-        unsigned long   zeroend:1,
-                        recursive:1,
-                        exclude_pattern:1,
-                        exclude_type:1,
-                        exclude_obd:1,
-                        exclude_mdt:1,
-                        exclude_gid:1,
-                        exclude_uid:1,
-                        check_gid:1,            /* group ID */
-                        check_uid:1,            /* user ID */
-                        check_pool:1,           /* LOV pool name */
-                        check_size:1,           /* file size */
-                        exclude_pool:1,
-                        exclude_size:1,
-                        exclude_atime:1,
-                        exclude_mtime:1,
-                        exclude_ctime:1,
-                        get_lmv:1,              /* get MDT list from LMV */
-                        raw:1,                  /* do not fill in defaults */
-                        check_stripesize:1,     /* LOV stripe size */
-                        exclude_stripesize:1,
-                        check_stripecount:1,    /* LOV stripe count */
-                        exclude_stripecount:1;
-
-        int     verbose;
-        int     quiet;
-
-        /* regular expression */
-        char   *pattern;
-
-        char   *print_fmt;
-
-        struct  obd_uuid       *obduuid;
-        int                     num_obds;
-        int                     num_alloc_obds;
-        int                     obdindex;
-        int                    *obdindexes;
-
-        struct  obd_uuid       *mdtuuid;
-        int                     num_mdts;
-        int                     num_alloc_mdts;
-        int                     mdtindex;
-        int                    *mdtindexes;
-        int                     file_mdtindex;
-
-        int     lumlen;
-        struct  lov_user_mds_data *lmd;
-
-        char poolname[LOV_MAXPOOLNAME + 1];
-
-        unsigned long long stripesize;
-        unsigned long long stripesize_units;
-        unsigned long long stripecount;
-
-        /* In-process parameters. */
-        unsigned long   got_uuids:1,
-                        obds_printed:1,
-                        have_fileinfo:1;        /* file attrs and LOV xattr */
-        unsigned int    depth;
-        dev_t           st_dev;
-};
-
-extern int llapi_ostlist(char *path, struct find_param *param);
-extern int llapi_uuid_match(char *real_uuid, char *search_uuid);
-extern int llapi_getstripe(char *path, struct find_param *param);
-extern int llapi_find(char *path, struct find_param *param);
-
-extern int llapi_file_fget_mdtidx(int fd, int *mdtidx);
-extern int llapi_obd_statfs(char *path, __u32 type, __u32 index,
-                     struct obd_statfs *stat_buf,
-                     struct obd_uuid *uuid_buf);
-extern int llapi_ping(char *obd_type, char *obd_name);
-extern int llapi_target_check(int num_types, char **obd_types, char *dir);
-extern int llapi_file_get_lov_uuid(const char *path, struct obd_uuid *lov_uuid);
-extern int llapi_file_fget_lov_uuid(int fd, struct obd_uuid *lov_uuid);
-extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
-extern int llapi_lmv_get_uuids(int fd, struct obd_uuid *uuidp, int *mdt_count);
-extern int llapi_is_lustre_mnttype(const char *type);
-extern int llapi_search_ost(char *fsname, char *poolname, char *ostname);
-extern int llapi_get_obd_count(char *mnt, int *count, int is_mdt);
-extern int parse_size(char *optarg, unsigned long long *size,
-                      unsigned long long *size_units, int bytes_spec);
-extern int llapi_path2fid(const char *path, lustre_fid *fid);
-extern int llapi_search_mounts(const char *pathname, int index,
-                               char *mntdir, char *fsname);
-extern int llapi_search_fsname(const char *pathname, char *fsname);
-extern int llapi_getname(const char *path, char *buf, size_t size);
-
-extern void llapi_ping_target(char *obd_type, char *obd_name,
-                              char *obd_uuid, void *args);
-
-struct mntent;
-#define HAVE_LLAPI_IS_LUSTRE_MNT
-extern int llapi_is_lustre_mnt(struct mntent *mnt);
-extern int llapi_quotachown(char *path, int flag);
-extern int llapi_quotacheck(char *mnt, int check_type);
-extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
-extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
-extern int llapi_target_iterate(int type_num, char **obd_type, void *args, llapi_cb_t cb);
-extern int llapi_get_connect_flags(const char *mnt, __u64 *flags);
-extern int llapi_lsetfacl(int argc, char *argv[]);
-extern int llapi_lgetfacl(int argc, char *argv[]);
-extern int llapi_rsetfacl(int argc, char *argv[]);
-extern int llapi_rgetfacl(int argc, char *argv[]);
-extern int llapi_cp(int argc, char *argv[]);
-extern int llapi_ls(int argc, char *argv[]);
-extern int llapi_fid2path(const char *device, const char *fidstr, char *path,
-                          int pathlen, long long *recno, int *linkno);
-extern int llapi_path2fid(const char *path, lustre_fid *fid);
-extern int llapi_get_version(char *buffer, int buffer_size, char **version);
-
-extern int llapi_get_data_version(int fd, __u64 *data_version, __u64 flags);
-
-/* Changelog interface.  priv is private state, managed internally
-   by these functions */
-#define CHANGELOG_FLAG_FOLLOW 0x01   /* Not yet implemented */
-#define CHANGELOG_FLAG_BLOCK  0x02   /* Blocking IO makes sense in case of
-   slow user parsing of the records, but it also prevents us from cleaning
-   up if the records are not consumed. */
-
-/* Records received are in extentded format now, though most of them are still
- * written in disk in changelog_rec format (to save space and time), it's
- * converted to extented format in liblustre to ease changelog analysis. */
-#define HAVE_CHANGELOG_EXTEND_REC 1
-
-extern int llapi_changelog_start(void **priv, int flags, const char *mdtname,
-                                 long long startrec);
-extern int llapi_changelog_fini(void **priv);
-extern int llapi_changelog_recv(void *priv, struct changelog_ext_rec **rech);
-extern int llapi_changelog_free(struct changelog_ext_rec **rech);
-/* Allow records up to endrec to be destroyed; requires registered id. */
-extern int llapi_changelog_clear(const char *mdtname, const char *idstr,
-                                 long long endrec);
-
-/* HSM copytool interface.  priv is private state, managed internally
-   by these functions */
-extern int llapi_copytool_start(void **priv, char *fsname, int flags,
-                                int archive_count, int *archives);
-extern int llapi_copytool_fini(void **priv);
-extern int llapi_copytool_recv(void *priv, struct hsm_action_list **hal,
-                               int *msgsize);
-extern int llapi_copytool_free(struct hsm_action_list **hal);
+#ifndef _LIBLUSTREAPI_H_
+#define _LIBLUSTREAPI_H_
 
 
-/** @} llapi */
+#include <lustre/lustreapi.h>
+#warning "Including liblustreapi.h is deprecated. Include lustreapi.h directly."
 
 #endif
 
 #endif
-
-
-
index 42f1bd0..c0c95d7 100644 (file)
@@ -686,13 +686,11 @@ static inline char *changelog_rec_name(struct changelog_rec *rec)
 
 static inline int changelog_rec_snamelen(struct changelog_ext_rec *rec)
 {
 
 static inline int changelog_rec_snamelen(struct changelog_ext_rec *rec)
 {
-       LASSERT(CHANGELOG_REC_EXTENDED(rec));
        return rec->cr_namelen - strlen(rec->cr_name) - 1;
 }
 
 static inline char *changelog_rec_sname(struct changelog_ext_rec *rec)
 {
        return rec->cr_namelen - strlen(rec->cr_name) - 1;
 }
 
 static inline char *changelog_rec_sname(struct changelog_ext_rec *rec)
 {
-       LASSERT(CHANGELOG_REC_EXTENDED(rec));
        return rec->cr_name + strlen(rec->cr_name) + 1;
 }
 
        return rec->cr_name + strlen(rec->cr_name) + 1;
 }
 
diff --git a/lustre/include/lustre/lustreapi.h b/lustre/include/lustre/lustreapi.h
new file mode 100644 (file)
index 0000000..3abe2c8
--- /dev/null
@@ -0,0 +1,270 @@
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ * Lustre is a trademark of Sun Microsystems, Inc.
+ */
+
+#ifndef _LUSTREAPI_H_
+#define _LUSTREAPI_H_
+
+/** \defgroup llapi llapi
+ *
+ * @{
+ */
+
+#include <lustre/lustre_user.h>
+#include <lustre/lustre_idl.h>
+
+typedef void (*llapi_cb_t)(char *obd_type_name, char *obd_name, char *obd_uuid, void *args);
+
+/* lustreapi message severity level */
+enum llapi_message_level {
+        LLAPI_MSG_OFF    = 0,
+        LLAPI_MSG_FATAL  = 1,
+        LLAPI_MSG_ERROR  = 2,
+        LLAPI_MSG_WARN   = 3,
+        LLAPI_MSG_NORMAL = 4,
+        LLAPI_MSG_INFO   = 5,
+        LLAPI_MSG_DEBUG  = 6,
+        LLAPI_MSG_MAX
+};
+
+/* the bottom three bits reserved for llapi_message_level */
+#define LLAPI_MSG_MASK          0x00000007
+#define LLAPI_MSG_NO_ERRNO      0x00000010
+
+extern void llapi_msg_set_level(int level);
+extern void llapi_error(int level, int rc, char *fmt, ...);
+#define llapi_err_noerrno(level, fmt, a...)                             \
+       llapi_error((level) | LLAPI_MSG_NO_ERRNO, 0, fmt, ## a)
+extern void llapi_printf(int level, char *fmt, ...);
+extern int llapi_file_create(const char *name, unsigned long long stripe_size,
+                             int stripe_offset, int stripe_count,
+                             int stripe_pattern);
+extern int llapi_file_open(const char *name, int flags, int mode,
+                           unsigned long long stripe_size, int stripe_offset,
+                           int stripe_count, int stripe_pattern);
+extern int llapi_file_create_pool(const char *name,
+                                  unsigned long long stripe_size,
+                                  int stripe_offset, int stripe_count,
+                                  int stripe_pattern, char *pool_name);
+extern int llapi_file_open_pool(const char *name, int flags, int mode,
+                                unsigned long long stripe_size,
+                                int stripe_offset, int stripe_count,
+                                int stripe_pattern, char *pool_name);
+extern int llapi_poollist(const char *name);
+extern int llapi_get_poollist(const char *name, char **poollist, int list_size,
+                              char *buffer, int buffer_size);
+extern int llapi_get_poolmembers(const char *poolname, char **members,
+                                 int list_size, char *buffer, int buffer_size);
+extern int llapi_file_get_stripe(const char *path, struct lov_user_md *lum);
+#define HAVE_LLAPI_FILE_LOOKUP
+extern int llapi_file_lookup(int dirfd, const char *name);
+
+#define VERBOSE_COUNT      0x1
+#define VERBOSE_SIZE       0x2
+#define VERBOSE_OFFSET     0x4
+#define VERBOSE_POOL       0x8
+#define VERBOSE_DETAIL     0x10
+#define VERBOSE_OBJID      0x20
+#define VERBOSE_GENERATION 0x40
+#define VERBOSE_MDTINDEX   0x80
+#define VERBOSE_ALL        (VERBOSE_COUNT | VERBOSE_SIZE | VERBOSE_OFFSET | \
+                            VERBOSE_POOL | VERBOSE_OBJID | VERBOSE_GENERATION)
+
+struct find_param {
+        unsigned int maxdepth;
+        time_t  atime;
+        time_t  mtime;
+        time_t  ctime;
+        int     asign;  /* cannot be bitfields due to using pointers to */
+        int     csign;  /* access them during argument parsing. */
+        int     msign;
+        int     type;
+        int             size_sign:2,        /* these need to be signed values */
+                        stripesize_sign:2,
+                        stripecount_sign:2;
+        unsigned long long size;
+        unsigned long long size_units;
+        uid_t uid;
+        gid_t gid;
+
+        unsigned long   zeroend:1,
+                        recursive:1,
+                        exclude_pattern:1,
+                        exclude_type:1,
+                        exclude_obd:1,
+                        exclude_mdt:1,
+                        exclude_gid:1,
+                        exclude_uid:1,
+                        check_gid:1,            /* group ID */
+                        check_uid:1,            /* user ID */
+                        check_pool:1,           /* LOV pool name */
+                        check_size:1,           /* file size */
+                        exclude_pool:1,
+                        exclude_size:1,
+                        exclude_atime:1,
+                        exclude_mtime:1,
+                        exclude_ctime:1,
+                        get_lmv:1,              /* get MDT list from LMV */
+                        raw:1,                  /* do not fill in defaults */
+                        check_stripesize:1,     /* LOV stripe size */
+                        exclude_stripesize:1,
+                        check_stripecount:1,    /* LOV stripe count */
+                        exclude_stripecount:1;
+
+        int     verbose;
+        int     quiet;
+
+        /* regular expression */
+        char   *pattern;
+
+        char   *print_fmt;
+
+        struct  obd_uuid       *obduuid;
+        int                     num_obds;
+        int                     num_alloc_obds;
+        int                     obdindex;
+        int                    *obdindexes;
+
+        struct  obd_uuid       *mdtuuid;
+        int                     num_mdts;
+        int                     num_alloc_mdts;
+        int                     mdtindex;
+        int                    *mdtindexes;
+        int                     file_mdtindex;
+
+        int     lumlen;
+        struct  lov_user_mds_data *lmd;
+
+        char poolname[LOV_MAXPOOLNAME + 1];
+
+        unsigned long long stripesize;
+        unsigned long long stripesize_units;
+        unsigned long long stripecount;
+
+        /* In-process parameters. */
+        unsigned long   got_uuids:1,
+                        obds_printed:1,
+                        have_fileinfo:1;        /* file attrs and LOV xattr */
+        unsigned int    depth;
+        dev_t           st_dev;
+};
+
+extern int llapi_ostlist(char *path, struct find_param *param);
+extern int llapi_uuid_match(char *real_uuid, char *search_uuid);
+extern int llapi_getstripe(char *path, struct find_param *param);
+extern int llapi_find(char *path, struct find_param *param);
+
+extern int llapi_file_fget_mdtidx(int fd, int *mdtidx);
+extern int llapi_obd_statfs(char *path, __u32 type, __u32 index,
+                     struct obd_statfs *stat_buf,
+                     struct obd_uuid *uuid_buf);
+extern int llapi_ping(char *obd_type, char *obd_name);
+extern int llapi_target_check(int num_types, char **obd_types, char *dir);
+extern int llapi_file_get_lov_uuid(const char *path, struct obd_uuid *lov_uuid);
+extern int llapi_file_fget_lov_uuid(int fd, struct obd_uuid *lov_uuid);
+extern int llapi_lov_get_uuids(int fd, struct obd_uuid *uuidp, int *ost_count);
+extern int llapi_lmv_get_uuids(int fd, struct obd_uuid *uuidp, int *mdt_count);
+extern int llapi_is_lustre_mnttype(const char *type);
+extern int llapi_search_ost(char *fsname, char *poolname, char *ostname);
+extern int llapi_get_obd_count(char *mnt, int *count, int is_mdt);
+extern int parse_size(char *optarg, unsigned long long *size,
+                      unsigned long long *size_units, int bytes_spec);
+extern int llapi_path2fid(const char *path, lustre_fid *fid);
+extern int llapi_search_mounts(const char *pathname, int index,
+                               char *mntdir, char *fsname);
+extern int llapi_search_fsname(const char *pathname, char *fsname);
+extern int llapi_getname(const char *path, char *buf, size_t size);
+
+extern void llapi_ping_target(char *obd_type, char *obd_name,
+                              char *obd_uuid, void *args);
+
+struct mntent;
+#define HAVE_LLAPI_IS_LUSTRE_MNT
+extern int llapi_is_lustre_mnt(struct mntent *mnt);
+extern int llapi_quotachown(char *path, int flag);
+extern int llapi_quotacheck(char *mnt, int check_type);
+extern int llapi_poll_quotacheck(char *mnt, struct if_quotacheck *qchk);
+extern int llapi_quotactl(char *mnt, struct if_quotactl *qctl);
+extern int llapi_target_iterate(int type_num, char **obd_type, void *args, llapi_cb_t cb);
+extern int llapi_get_connect_flags(const char *mnt, __u64 *flags);
+extern int llapi_lsetfacl(int argc, char *argv[]);
+extern int llapi_lgetfacl(int argc, char *argv[]);
+extern int llapi_rsetfacl(int argc, char *argv[]);
+extern int llapi_rgetfacl(int argc, char *argv[]);
+extern int llapi_cp(int argc, char *argv[]);
+extern int llapi_ls(int argc, char *argv[]);
+extern int llapi_fid2path(const char *device, const char *fidstr, char *path,
+                          int pathlen, long long *recno, int *linkno);
+extern int llapi_path2fid(const char *path, lustre_fid *fid);
+extern int llapi_get_version(char *buffer, int buffer_size, char **version);
+
+extern int llapi_get_data_version(int fd, __u64 *data_version, __u64 flags);
+
+/* Changelog interface.  priv is private state, managed internally
+   by these functions */
+#define CHANGELOG_FLAG_FOLLOW 0x01   /* Not yet implemented */
+#define CHANGELOG_FLAG_BLOCK  0x02   /* Blocking IO makes sense in case of
+   slow user parsing of the records, but it also prevents us from cleaning
+   up if the records are not consumed. */
+
+/* Records received are in extentded format now, though most of them are still
+ * written in disk in changelog_rec format (to save space and time), it's
+ * converted to extented format in the lustre api to ease changelog analysis. */
+#define HAVE_CHANGELOG_EXTEND_REC 1
+
+extern int llapi_changelog_start(void **priv, int flags, const char *mdtname,
+                                 long long startrec);
+extern int llapi_changelog_fini(void **priv);
+extern int llapi_changelog_recv(void *priv, struct changelog_ext_rec **rech);
+extern int llapi_changelog_free(struct changelog_ext_rec **rech);
+/* Allow records up to endrec to be destroyed; requires registered id. */
+extern int llapi_changelog_clear(const char *mdtname, const char *idstr,
+                                 long long endrec);
+
+/* HSM copytool interface.  priv is private state, managed internally
+   by these functions */
+extern int llapi_copytool_start(void **priv, char *fsname, int flags,
+                                int archive_count, int *archives);
+extern int llapi_copytool_fini(void **priv);
+extern int llapi_copytool_recv(void *priv, struct hsm_action_list **hal,
+                               int *msgsize);
+extern int llapi_copytool_free(struct hsm_action_list **hal);
+
+/** @} llapi */
+
+#endif
+
+
+
index b9f0533..dc41d06 100644 (file)
@@ -56,7 +56,7 @@
 
 #include <liblustre.h>
 #include "test_common.h"
 
 #include <liblustre.h>
 #include "test_common.h"
-#include <lustre/liblustreapi.h>
+#include <lustre/lustreapi.h>
 
 #define _npages (2048)
 
 
 #define _npages (2048)
 
index af3c0e0..36e86cc 100644 (file)
@@ -47,9 +47,8 @@
 #include <stdio.h>
 #include <getopt.h>
 #include <signal.h>
 #include <stdio.h>
 #include <getopt.h>
 #include <signal.h>
-#include <libcfs/libcfs.h>
-#include <lustre/lustre_user.h>
-#include <lustre/liblustreapi.h>
+
+#include <lustre/lustreapi.h>
 
 void *ctdata;
 
 
 void *ctdata;
 
index 0f85109..5a044e9 100644 (file)
@@ -54,7 +54,7 @@
 #include <liblustre.h>
 #include <obd.h>
 #include <lustre_lib.h>
 #include <liblustre.h>
 #include <obd.h>
 #include <lustre_lib.h>
-#include <lustre/liblustreapi.h>
+#include <lustre/lustreapi.h>
 #include <obd_lov.h>
 
 #include <lnet/lnetctl.h>
 #include <obd_lov.h>
 
 #include <lnet/lnetctl.h>
index 7cd2b58..1d73fad 100644 (file)
 #include <getopt.h>
 #include <errno.h>
 
 #include <getopt.h>
 #include <errno.h>
 
-#include <libcfs/libcfs.h>
+#include <lustre/lustreapi.h>
 #include "lp_utils.h"
 #ifndef _IOWR
 # include <ioctl.h>
 #endif
 
 #include "lp_utils.h"
 #ifndef _IOWR
 # include <ioctl.h>
 #endif
 
-#include <lustre/liblustreapi.h>
 
 int rank = 0;
 int size = 0;
 
 int rank = 0;
 int size = 0;
index f930ed6..8449fe1 100644 (file)
@@ -30,8 +30,7 @@
 #include "mpi.h"
 
 /* lustre */
 #include "mpi.h"
 
 /* lustre */
-#include <liblustre.h>
-#include <lustre/liblustreapi.h>        /* for O_LOV_DELAY_CREATE */
+#include <lustre/lustreapi.h>        /* for O_LOV_DELAY_CREATE */
 
 #define CHECK_COUNT 10000
 #define DISPLAY_COUNT (CHECK_COUNT * 10)
 
 #define CHECK_COUNT 10000
 #define DISPLAY_COUNT (CHECK_COUNT * 10)
index a46451b..6c6a70a 100644 (file)
@@ -47,8 +47,8 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <semaphore.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <semaphore.h>
-#include <libcfs/libcfs.h>
-#include <lustre/liblustreapi.h>
+
+#include <lustre/lustreapi.h>
 
 #define T1 "write data before unlink\n"
 #define T2 "write data after unlink\n"
 
 #define T1 "write data before unlink\n"
 #define T2 "write data after unlink\n"
index 7bf4d73..9af08f0 100644 (file)
 #include <unistd.h>
 
 #include <liblustre.h>
 #include <unistd.h>
 
 #include <liblustre.h>
-#include <lnet/lnetctl.h>
-#include <obd.h>
-#include <lustre_lib.h>
-#include <obd_lov.h>
-#include <lustre/liblustreapi.h>
+#include <obd.h> /* needed for lov_stripe_md_size */
+#include <lustre/lustreapi.h>
 
 #define ACT_NONE        0
 #define ACT_READ        1
 
 #define ACT_NONE        0
 #define ACT_READ        1
index 23c591a..feea955 100644 (file)
 #include <sys/stat.h>
 #include <sys/socket.h>
 
 #include <sys/stat.h>
 #include <sys/socket.h>
 
-#include <liblustre.h>
-#include <lnet/lnetctl.h>
-#include <obd.h>
-#include <lustre_lib.h>
-#include <obd_lov.h>
-#include <lustre/liblustreapi.h>
+#include <lustre/lustreapi.h>
 
 #define syserr(str) { perror(str); exit(-1); }
 
 
 #define syserr(str) { perror(str); exit(-1); }
 
index 902752d..c38f12e 100644 (file)
 /* For dirname() */
 #include <libgen.h>
 
 /* For dirname() */
 #include <libgen.h>
 
-#include <lnet/api-support.h>
 #include <lnet/lnetctl.h>
 
 #include <liblustre.h>
 #include <lnet/lnetctl.h>
 
 #include <liblustre.h>
-#include <lustre/lustre_idl.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_user.h>
+#include <lustre/lustreapi.h>
 #include <lustre_quota.h>
 
 #include <libcfs/libcfsutil.h>
 #include <lustre_quota.h>
 
 #include <libcfs/libcfsutil.h>
index 11ff8e2..ab42640 100644 (file)
@@ -71,9 +71,8 @@
 #include <liblustre.h>
 #include <lnet/lnetctl.h>
 #include <obd.h>
 #include <liblustre.h>
 #include <lnet/lnetctl.h>
 #include <obd.h>
-#include <lustre_lib.h>
 #include <obd_lov.h>
 #include <obd_lov.h>
-#include <lustre/liblustreapi.h>
+#include <lustre/lustreapi.h>
 
 static unsigned llapi_dir_filetype_table[] = {
         [DT_UNKNOWN]= 0,
 
 static unsigned llapi_dir_filetype_table[] = {
         [DT_UNKNOWN]= 0,
index 85c8a1f..e352a45 100644 (file)
 #include <utime.h>
 #include <sys/xattr.h>
 
 #include <utime.h>
 #include <sys/xattr.h>
 
-#include <libcfs/libcfs.h>
 #include <libcfs/libcfsutil.h>
 #include <libcfs/libcfsutil.h>
-#include <lustre/liblustreapi.h>
-#include <lustre/lustre_idl.h>
+#include <lustre/lustreapi.h>
 #include "lustre_rsync.h"
 
 #define REPLICATE_STATUS_VER 1
 #include "lustre_rsync.h"
 
 #define REPLICATE_STATUS_VER 1
index f8c3053..7ddbf8a 100644 (file)
 #include <obd.h>          /* for struct lov_stripe_md */
 #include <lustre/lustre_build_version.h>
 
 #include <obd.h>          /* for struct lov_stripe_md */
 #include <lustre/lustre_build_version.h>
 
-#include <obd_class.h>
 #include <lnet/lnetctl.h>
 #include <libcfs/libcfsutil.h>
 #include <lnet/lnetctl.h>
 #include <libcfs/libcfsutil.h>
-#include <lustre/liblustreapi.h>
+#include <lustre/lustreapi.h>
 
 #define MAX_STRING_SIZE 128
 #define DEVICES_LIST "/proc/fs/lustre/devices"
 
 #define MAX_STRING_SIZE 128
 #define DEVICES_LIST "/proc/fs/lustre/devices"