/*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 only,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is included
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
* GPL HEADER END
*/
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
* Copyright (c) 2010, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*
* lustre/include/lustre/lustre_user.h
*
* Lustre public user-space interface definitions.
*/
#ifndef _LUSTRE_USER_H
#define _LUSTRE_USER_H
/** \defgroup lustreuser lustreuser
*
* @{
*/
#include "ll_fiemap.h"
#include "../linux/lustre_user.h"
/* for statfs() */
#define LL_SUPER_MAGIC 0x0BD00BD0
#ifndef FSFILT_IOC_GETFLAGS
#define FSFILT_IOC_GETFLAGS _IOR('f', 1, long)
#define FSFILT_IOC_SETFLAGS _IOW('f', 2, long)
#define FSFILT_IOC_GETVERSION _IOR('f', 3, long)
#define FSFILT_IOC_SETVERSION _IOW('f', 4, long)
#define FSFILT_IOC_GETVERSION_OLD _IOR('v', 1, long)
#define FSFILT_IOC_SETVERSION_OLD _IOW('v', 2, long)
#define FSFILT_IOC_FIEMAP _IOWR('f', 11, struct ll_user_fiemap)
#endif
/* FIEMAP flags supported by Lustre */
#define LUSTRE_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_DEVICE_ORDER)
enum obd_statfs_state {
OS_STATE_DEGRADED = 0x00000001, /**< RAID degraded/rebuilding */
OS_STATE_READONLY = 0x00000002, /**< filesystem is read-only */
OS_STATE_RDONLY_1 = 0x00000004, /**< obsolete 1.6, was EROFS=30 */
OS_STATE_RDONLY_2 = 0x00000008, /**< obsolete 1.6, was EROFS=30 */
OS_STATE_RDONLY_3 = 0x00000010, /**< obsolete 1.6, was EROFS=30 */
};
struct obd_statfs {
__u64 os_type;
__u64 os_blocks;
__u64 os_bfree;
__u64 os_bavail;
__u64 os_files;
__u64 os_ffree;
__u8 os_fsid[40];
__u32 os_bsize;
__u32 os_namelen;
__u64 os_maxbytes;
__u32 os_state; /**< obd_statfs_state OS_STATE_* flag */
__u32 os_fprecreated; /* objs available now to the caller */
/* used in QoS code to find preferred
* OSTs */
__u32 os_spare2;
__u32 os_spare3;
__u32 os_spare4;
__u32 os_spare5;
__u32 os_spare6;
__u32 os_spare7;
__u32 os_spare8;
__u32 os_spare9;
};
/**
* File IDentifier.
*
* FID is a cluster-wide unique identifier of a file or an object (stripe).
* FIDs are never reused.
**/
struct lu_fid {
/**
* FID sequence. Sequence is a unit of migration: all files (objects)
* with FIDs from a given sequence are stored on the same server.
* Lustre should support 2^64 objects, so even if each sequence
* has only a single object we can still enumerate 2^64 objects.
**/
__u64 f_seq;
/* FID number within sequence. */
__u32 f_oid;
/**
* FID version, used to distinguish different versions (in the sense
* of snapshots, etc.) of the same file system object. Not currently
* used.
**/
__u32 f_ver;
};
struct filter_fid {
struct lu_fid ff_parent; /* ff_parent.f_ver == file stripe number */
};
/* keep this one for compatibility */
struct filter_fid_old {
struct lu_fid ff_parent;
__u64 ff_objid;
__u64 ff_seq;
};
/* Userspace should treat lu_fid as opaque, and only use the following methods
* to print or parse them. Other functions (e.g. compare, swab) could be moved
* here from lustre_idl.h if needed. */
typedef struct lu_fid lustre_fid;
/**
* Following struct for object attributes, that will be kept inode's EA.
* Introduced in 2.0 release (please see b15993, for details)
* Added to all objects since Lustre 2.4 as contains self FID
*/
struct lustre_mdt_attrs {
/**
* Bitfield for supported data in this structure. From enum lma_compat.
* lma_self_fid and lma_flags are always available.
*/
__u32 lma_compat;
/**
* Per-file incompat feature list. Lustre version should support all
* flags set in this field. The supported feature mask is available in
* LMA_INCOMPAT_SUPP.
*/
__u32 lma_incompat;
/** FID of this inode */
struct lu_fid lma_self_fid;
};
/**
* Prior to 2.4, the LMA structure also included SOM attributes which has since
* been moved to a dedicated xattr
* lma_flags was also removed because of lma_compat/incompat fields.
*/
#define LMA_OLD_SIZE (sizeof(struct lustre_mdt_attrs) + 5 * sizeof(__u64))
/**
* OST object IDentifier.
*/
struct ost_id {
union {
struct ostid {
__u64 oi_id;
__u64 oi_seq;
} oi;
struct lu_fid oi_fid;
};
};
#define DOSTID "%#llx:%llu"
#define POSTID(oi) ostid_seq(oi), ostid_id(oi)
/*
* The ioctl naming rules:
* LL_* - works on the currently opened filehandle instead of parent dir
* *_OBD_* - gets data for both OSC or MDC (LOV, LMV indirectly)
* *_MDC_* - gets/sets data related to MDC
* *_LOV_* - gets/sets data related to OSC/LOV
* *FILE* - called on parent dir and passes in a filename
* *STRIPE* - set/get lov_user_md
* *INFO - set/get lov_user_mds_data
*/
/* see <lustre_lib.h> for ioctl numberss 101-150 */
#define LL_IOC_GETFLAGS _IOR ('f', 151, long)
#define LL_IOC_SETFLAGS _IOW ('f', 152, long)
#define LL_IOC_CLRFLAGS _IOW ('f', 153, long)
/* LL_IOC_LOV_SETSTRIPE: See also OBD_IOC_LOV_SETSTRIPE */
#define LL_IOC_LOV_SETSTRIPE _IOW ('f', 154, long)
/* LL_IOC_LOV_GETSTRIPE: See also OBD_IOC_LOV_GETSTRIPE */
#define LL_IOC_LOV_GETSTRIPE _IOW ('f', 155, long)
/* LL_IOC_LOV_SETEA: See also OBD_IOC_LOV_SETEA */
#define LL_IOC_LOV_SETEA _IOW ('f', 156, long)
#define LL_IOC_RECREATE_OBJ _IOW ('f', 157, long)
#define LL_IOC_RECREATE_FID _IOW ('f', 157, struct lu_fid)
#define LL_IOC_GROUP_LOCK _IOW ('f', 158, long)
#define LL_IOC_GROUP_UNLOCK _IOW ('f', 159, long)
/* LL_IOC_QUOTACHECK: See also OBD_IOC_QUOTACHECK */
#define LL_IOC_QUOTACHECK _IOW ('f', 160, int)
/* LL_IOC_POLL_QUOTACHECK: See also OBD_IOC_POLL_QUOTACHECK */
#define LL_IOC_POLL_QUOTACHECK _IOR ('f', 161, struct if_quotacheck *)
/* LL_IOC_QUOTACTL: See also OBD_IOC_QUOTACTL */
#define LL_IOC_QUOTACTL _IOWR('f', 162, struct if_quotactl)
#define IOC_OBD_STATFS _IOWR('f', 164, struct obd_statfs *)
#define IOC_LOV_GETINFO _IOWR('f', 165, struct lov_user_mds_data *)
#define LL_IOC_FLUSHCTX _IOW ('f', 166, long)
#define LL_IOC_RMTACL _IOW ('f', 167, long)
#define LL_IOC_GETOBDCOUNT _IOR ('f', 168, long)
#define LL_IOC_LLOOP_ATTACH _IOWR('f', 169, long)
#define LL_IOC_LLOOP_DETACH _IOWR('f', 170, long)
#define LL_IOC_LLOOP_INFO _IOWR('f', 171, struct lu_fid)
#define LL_IOC_LLOOP_DETACH_BYDEV _IOWR('f', 172, long)
#define LL_IOC_PATH2FID _IOR ('f', 173, long)
#define LL_IOC_GET_CONNECT_FLAGS _IOWR('f', 174, __u64 *)
#define LL_IOC_GET_MDTIDX _IOR ('f', 175, int)
/* see <lustre_lib.h> for ioctl numbers 177-210 */
#define LL_IOC_HSM_STATE_GET _IOR('f', 211, struct hsm_user_state)
#define LL_IOC_HSM_STATE_SET _IOW('f', 212, struct hsm_state_set)
#define LL_IOC_HSM_CT_START _IOW('f', 213, struct lustre_kernelcomm)
#define LL_IOC_HSM_COPY_START _IOW('f', 214, struct hsm_copy *)
#define LL_IOC_HSM_COPY_END _IOW('f', 215, struct hsm_copy *)
#define LL_IOC_HSM_PROGRESS _I