1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
4 * Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
6 * This file is part of Lustre, http://www.lustre.org.
8 * Lustre is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU General Public
10 * License as published by the Free Software Foundation.
12 * Lustre is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Lustre; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Lustre public user-space interface definitions.
23 #ifndef _LUSTRE_USER_H
24 #define _LUSTRE_USER_H
25 #include <asm/types.h>
27 #include <linux/string.h>
32 #define IOC_MDC_TYPE 'i'
33 #define IOC_MDC_GETSTRIPE _IOWR(IOC_MDC_TYPE, 21, struct lov_mds_md *)
35 #define LL_IOC_GETFLAGS _IOR ('f', 151, long)
36 #define LL_IOC_SETFLAGS _IOW ('f', 152, long)
37 #define LL_IOC_CLRFLAGS _IOW ('f', 153, long)
38 #define LL_IOC_LOV_SETSTRIPE _IOW ('f', 154, long)
39 #define LL_IOC_LOV_GETSTRIPE _IOW ('f', 155, long)
40 #define LL_IOC_LOV_SETEA _IOW ('f', 156, long)
41 #define LL_IOC_RECREATE_OBJ _IOW ('f', 157, long)
42 #define LL_IOC_CW_LOCK _IOW ('f', 158, long)
43 #define LL_IOC_CW_UNLOCK _IOW ('f', 159, long)
44 #define LL_IOC_MDC_MKDIRSTRIPE _IOW ('f', 160, long)
45 #define LL_IOC_GROUP_LOCK _IOW ('f', 161, long)
46 #define LL_IOC_GROUP_UNLOCK _IOW ('f', 162, long)
48 #define O_LOV_DELAY_CREATE 0100000000 /* hopefully this does not conflict */
50 #define LL_FILE_IGNORE_LOCK 0x00000001
51 #define LL_FILE_GROUP_LOCKED 0x00000002
53 #define LOV_USER_MAGIC_V1 0x0BD10BD0
54 #define LOV_USER_MAGIC LOV_USER_MAGIC_V1
56 #define LOV_PATTERN_RAID0 0x001
57 #define LOV_PATTERN_RAID1 0x002
58 #define LOV_PATTERN_FIRST 0x100
60 #define lov_user_ost_data lov_user_ost_data_v1
61 struct lov_user_ost_data_v1 { /* per-stripe data structure */
62 __u64 l_object_id; /* OST object ID */
63 __u64 l_object_gr; /* OST object group (creating MDS number) */
64 __u32 l_ost_gen; /* generation of this OST index */
65 __u32 l_ost_idx; /* OST index in LOV */
66 } __attribute__((packed));
68 #define lov_user_md lov_user_md_v1
69 struct lov_user_md_v1 { /* LOV EA user data (host-endian) */
70 __u32 lmm_magic; /* magic number = LOV_USER_MAGIC_V1 */
71 __u32 lmm_pattern; /* LOV_PATTERN_RAID0, LOV_PATTERN_RAID1 */
72 __u64 lmm_object_id; /* LOV object ID */
73 __u64 lmm_object_gr; /* LOV object group */
74 __u32 lmm_stripe_size; /* size of stripe in bytes */
75 __u16 lmm_stripe_count; /* num stripes in use for this object */
76 __u16 lmm_stripe_offset; /* starting stripe offset in lmm_objects */
77 struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
78 } __attribute__((packed));
80 struct ll_user_mkdir_stripe {
87 extern int op_create_file(char *name, long stripe_size, int stripe_offset,
89 extern int op_create_dir(char *name, int stripe_count);
90 extern int get_file_stripe(char *path, struct lov_user_md *lum);
92 struct ll_recreate_obj {
101 static inline int obd_uuid_equals(struct obd_uuid *u1, struct obd_uuid *u2)
103 return strcmp(u1->uuid, u2->uuid) == 0;
106 static inline void obd_str2uuid(struct obd_uuid *uuid, char *tmp)
108 strncpy(uuid->uuid, tmp, sizeof(*uuid));
109 uuid->uuid[sizeof(*uuid) - 1] = '\0';
112 #endif /* _LUSTRE_USER_H */