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.gnu.org/licenses/gpl-2.0.html
23 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Use is subject to license terms.
27 * This file is part of Lustre, http://www.lustre.org/
28 * Lustre is a trademark of Sun Microsystems, Inc.
30 * lustre/include/lustre/libiam.h
32 * iam user level library
34 * Author: Wang Di <wangdi@clusterfs.com>
35 * Author: Nikita Danilov <nikita@clusterfs.com>
36 * Author: Fan Yong <fanyong@clusterfs.com>
43 #ifndef __IAM_ULIB_H__
44 #define __IAM_ULIB_H__
46 /** \defgroup libiam libiam
52 #define DX_FMT_NAME_LEN 16
59 struct iam_uapi_info {
64 char iui_fmt_name[DX_FMT_NAME_LEN];
68 * Creat an iam file, but do NOT open it.
69 * Return 0 if success, else -1.
71 int iam_creat(char *filename, enum iam_fmt_t fmt,
72 int blocksize, int keysize, int recsize, int ptrsize);
75 * Open an iam file, but do NOT creat it if the file doesn't exist.
76 * Please use iam_creat for creating the file before use iam_open.
77 * Return file id (fd) if success, else -1.
79 int iam_open(char *filename, struct iam_uapi_info *ua);
82 * Close file opened by iam_open.
84 int iam_close(int fd);
87 * Please use iam_open before use this function.
89 int iam_insert(int fd, struct iam_uapi_info *ua,
90 int key_need_convert, char *keybuf,
91 int rec_need_convert, char *recbuf);
94 * Please use iam_open before use this function.
96 int iam_lookup(int fd, struct iam_uapi_info *ua,
97 int key_need_convert, char *key_buf,
98 int *keysize, char *save_key,
99 int rec_need_convert, char *rec_buf,
100 int *recsize, char *save_rec);
103 * Please use iam_open before use this function.
105 int iam_delete(int fd, struct iam_uapi_info *ua,
106 int key_need_convert, char *keybuf,
107 int rec_need_convert, char *recbuf);
110 * Please use iam_open before use this function.
112 int iam_it_start(int fd, struct iam_uapi_info *ua,
113 int key_need_convert, char *key_buf,
114 int *keysize, char *save_key,
115 int rec_need_convert, char *rec_buf,
116 int *recsize, char *save_rec);
119 * Please use iam_open before use this function.
121 int iam_it_next(int fd, struct iam_uapi_info *ua,
122 int key_need_convert, char *key_buf,
123 int *keysize, char *save_key,
124 int rec_need_convert, char *rec_buf,
125 int *recsize, char *save_rec);
128 * Please use iam_open before use this function.
130 int iam_it_stop(int fd, struct iam_uapi_info *ua,
131 int key_need_convert, char *keybuf,
132 int rec_need_convert, char *recbuf);
135 * Change iam file mode.
137 int iam_polymorph(char *filename, unsigned long mode);