1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
5 * iam user level library
7 * Copyright (c) 2006 Cluster File Systems, Inc.
8 * Author: Wang Di <wangdi@clusterfs.com>
9 * Author: Nikita Danilov <nikita@clusterfs.com>
10 * Author: Fan Yong <fanyong@clusterfs.com>
12 * This file is part of the Lustre file system, http://www.lustre.org
13 * Lustre is a trademark of Cluster File Systems, Inc.
15 * You may have signed or agreed to another license before downloading
16 * this software. If so, you are bound by the terms and conditions
17 * of that agreement, and the following does not apply to you. See the
18 * LICENSE file included with this distribution for more information.
20 * If you did not agree to a different license, then this copy of Lustre
21 * is open source software; you can redistribute it and/or modify it
22 * under the terms of version 2 of the GNU General Public License as
23 * published by the Free Software Foundation.
25 * In either case, Lustre is distributed in the hope that it will be
26 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
27 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * license text for more details.
35 #ifndef __IAM_ULIB_H__
36 #define __IAM_ULIB_H__
39 #define DX_FMT_NAME_LEN 16
46 struct iam_uapi_info {
51 char iui_fmt_name[DX_FMT_NAME_LEN];
55 * Creat an iam file, but do NOT open it.
56 * Return 0 if success, else -1.
58 int iam_creat(char *filename, enum iam_fmt_t fmt,
59 int blocksize, int keysize, int recsize, int ptrsize);
62 * Open an iam file, but do NOT creat it if the file doesn't exist.
63 * Please use iam_creat for creating the file before use iam_open.
64 * Return file id (fd) if success, else -1.
66 int iam_open(char *filename, struct iam_uapi_info *ua);
69 * Close file opened by iam_open.
71 int iam_close(int fd);
74 * Please use iam_open before use this function.
76 int iam_insert(int fd, struct iam_uapi_info *ua,
77 int key_need_convert, char *keybuf,
78 int rec_need_convert, char *recbuf);
81 * Please use iam_open before use this function.
83 int iam_lookup(int fd, struct iam_uapi_info *ua,
84 int key_need_convert, char *key_buf,
85 int *keysize, char *save_key,
86 int rec_need_convert, char *rec_buf,
87 int *recsize, char *save_rec);
90 * Please use iam_open before use this function.
92 int iam_delete(int fd, struct iam_uapi_info *ua,
93 int key_need_convert, char *keybuf,
94 int rec_need_convert, char *recbuf);
97 * Please use iam_open before use this function.
99 int iam_it_start(int fd, struct iam_uapi_info *ua,
100 int key_need_convert, char *key_buf,
101 int *keysize, char *save_key,
102 int rec_need_convert, char *rec_buf,
103 int *recsize, char *save_rec);
106 * Please use iam_open before use this function.
108 int iam_it_next(int fd, struct iam_uapi_info *ua,
109 int key_need_convert, char *key_buf,
110 int *keysize, char *save_key,
111 int rec_need_convert, char *rec_buf,
112 int *recsize, char *save_rec);
115 * Please use iam_open before use this function.
117 int iam_it_stop(int fd, struct iam_uapi_info *ua,
118 int key_need_convert, char *keybuf,
119 int rec_need_convert, char *recbuf);
122 * Change iam file mode.
124 int iam_polymorph(char *filename, unsigned long mode);