1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/include/lustre/libiam.h
38 * iam user level library
40 * Author: Wang Di <wangdi@clusterfs.com>
41 * Author: Nikita Danilov <nikita@clusterfs.com>
42 * Author: Fan Yong <fanyong@clusterfs.com>
49 #ifndef __IAM_ULIB_H__
50 #define __IAM_ULIB_H__
53 #define DX_FMT_NAME_LEN 16
60 struct iam_uapi_info {
65 char iui_fmt_name[DX_FMT_NAME_LEN];
69 * Creat an iam file, but do NOT open it.
70 * Return 0 if success, else -1.
72 int iam_creat(char *filename, enum iam_fmt_t fmt,
73 int blocksize, int keysize, int recsize, int ptrsize);
76 * Open an iam file, but do NOT creat it if the file doesn't exist.
77 * Please use iam_creat for creating the file before use iam_open.
78 * Return file id (fd) if success, else -1.
80 int iam_open(char *filename, struct iam_uapi_info *ua);
83 * Close file opened by iam_open.
85 int iam_close(int fd);
88 * Please use iam_open before use this function.
90 int iam_insert(int fd, struct iam_uapi_info *ua,
91 int key_need_convert, char *keybuf,
92 int rec_need_convert, char *recbuf);
95 * Please use iam_open before use this function.
97 int iam_lookup(int fd, struct iam_uapi_info *ua,
98 int key_need_convert, char *key_buf,
99 int *keysize, char *save_key,
100 int rec_need_convert, char *rec_buf,
101 int *recsize, char *save_rec);
104 * Please use iam_open before use this function.
106 int iam_delete(int fd, struct iam_uapi_info *ua,
107 int key_need_convert, char *keybuf,
108 int rec_need_convert, char *recbuf);
111 * Please use iam_open before use this function.
113 int iam_it_start(int fd, struct iam_uapi_info *ua,
114 int key_need_convert, char *key_buf,
115 int *keysize, char *save_key,
116 int rec_need_convert, char *rec_buf,
117 int *recsize, char *save_rec);
120 * Please use iam_open before use this function.
122 int iam_it_next(int fd, struct iam_uapi_info *ua,
123 int key_need_convert, char *key_buf,
124 int *keysize, char *save_key,
125 int rec_need_convert, char *rec_buf,
126 int *recsize, char *save_rec);
129 * Please use iam_open before use this function.
131 int iam_it_stop(int fd, struct iam_uapi_info *ua,
132 int key_need_convert, char *keybuf,
133 int rec_need_convert, char *recbuf);
136 * Change iam file mode.
138 int iam_polymorph(char *filename, unsigned long mode);