4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
31 * This file is part of Lustre, http://www.lustre.org/
32 * Lustre is a trademark of Sun Microsystems, Inc.
34 * lustre/include/lustre/libiam.h
36 * iam user level library
38 * Author: Wang Di <wangdi@clusterfs.com>
39 * Author: Nikita Danilov <nikita@clusterfs.com>
40 * Author: Fan Yong <fanyong@clusterfs.com>
47 #ifndef __IAM_ULIB_H__
48 #define __IAM_ULIB_H__
50 /** \defgroup libiam libiam
56 #define DX_FMT_NAME_LEN 16
63 struct iam_uapi_info {
68 char iui_fmt_name[DX_FMT_NAME_LEN];
72 * Creat an iam file, but do NOT open it.
73 * Return 0 if success, else -1.
75 int iam_creat(char *filename, enum iam_fmt_t fmt,
76 int blocksize, int keysize, int recsize, int ptrsize);
79 * Open an iam file, but do NOT creat it if the file doesn't exist.
80 * Please use iam_creat for creating the file before use iam_open.
81 * Return file id (fd) if success, else -1.
83 int iam_open(char *filename, struct iam_uapi_info *ua);
86 * Close file opened by iam_open.
88 int iam_close(int fd);
91 * Please use iam_open before use this function.
93 int iam_insert(int fd, struct iam_uapi_info *ua,
94 int key_need_convert, char *keybuf,
95 int rec_need_convert, char *recbuf);
98 * Please use iam_open before use this function.
100 int iam_lookup(int fd, struct iam_uapi_info *ua,
101 int key_need_convert, char *key_buf,
102 int *keysize, char *save_key,
103 int rec_need_convert, char *rec_buf,
104 int *recsize, char *save_rec);
107 * Please use iam_open before use this function.
109 int iam_delete(int fd, struct iam_uapi_info *ua,
110 int key_need_convert, char *keybuf,
111 int rec_need_convert, char *recbuf);
114 * Please use iam_open before use this function.
116 int iam_it_start(int fd, struct iam_uapi_info *ua,
117 int key_need_convert, char *key_buf,
118 int *keysize, char *save_key,
119 int rec_need_convert, char *rec_buf,
120 int *recsize, char *save_rec);
123 * Please use iam_open before use this function.
125 int iam_it_next(int fd, struct iam_uapi_info *ua,
126 int key_need_convert, char *key_buf,
127 int *keysize, char *save_key,
128 int rec_need_convert, char *rec_buf,
129 int *recsize, char *save_rec);
132 * Please use iam_open before use this function.
134 int iam_it_stop(int fd, struct iam_uapi_info *ua,
135 int key_need_convert, char *keybuf,
136 int rec_need_convert, char *recbuf);
139 * Change iam file mode.
141 int iam_polymorph(char *filename, unsigned long mode);