Home | History | Annotate | Download | only in nfs
      1 /*
      2  * CDDL HEADER START
      3  *
      4  * The contents of this file are subject to the terms of the
      5  * Common Development and Distribution License (the "License").
      6  * You may not use this file except in compliance with the License.
      7  *
      8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9  * or http://www.opensolaris.org/os/licensing.
     10  * See the License for the specific language governing permissions
     11  * and limitations under the License.
     12  *
     13  * When distributing Covered Code, include this CDDL HEADER in each
     14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15  * If applicable, add the following below this CDDL HEADER, with the
     16  * fields enclosed by brackets "[]" replaced with your own identifying
     17  * information: Portions Copyright [yyyy] [name of copyright owner]
     18  *
     19  * CDDL HEADER END
     20  */
     21 /*
     22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     23  * Use is subject to license terms.
     24  */
     25 
     26 #ifndef _DS_FILEHANDLE_H
     27 #define	_DS_FILEHANDLE_H
     28 
     29 #ifdef	__cplusplus
     30 extern "C" {
     31 #endif
     32 
     33 #include <nfs/nfs41_filehandle.h>
     34 
     35 enum ds_fh_version {
     36 	DS_FH_v1 = 1
     37 };
     38 typedef enum ds_fh_version ds_fh_version;
     39 
     40 #define	DS_MAXFIDSZ 64
     41 
     42 struct mds_sid_content {
     43 	uint64_t id;
     44 	uint64_t aun;
     45 };
     46 typedef struct mds_sid_content mds_sid_content;
     47 
     48 struct mds_sid {
     49 	uint_t len;
     50 	char *val;
     51 };
     52 typedef struct mds_sid mds_sid;
     53 
     54 struct mds_dataset_id {
     55 	uint_t len;
     56 	char val[NFS_FH4MAXDATA];
     57 };
     58 typedef struct mds_dataset_id mds_dataset_id;
     59 
     60 struct ds_fh_v1 {
     61 	uint32_t flags;			/* FH flags */
     62 	uint32_t gen;			/* Used to revoke/recall */
     63 	uint64_t mds_id;		/* Which MDS contains the object */
     64 	mds_sid mds_sid;		/* Used to map where on the DS */
     65 					/* the object resides in. */
     66 	mds_dataset_id mds_dataset_id;	/* Used to map where on the MDS */
     67 					/* the object resides in. */
     68 	nfs41_fid_t mds_fid;		/* Used by both the DS and MDS */
     69 					/* to index into the dataset */
     70 };
     71 typedef struct ds_fh_v1 ds_fh_v1;
     72 
     73 struct mds_ds_fh {
     74 	nfs41_fh_type_t type;		/* MDS or DS? */
     75 	ds_fh_version vers;		/* OTW version number */
     76 	union {
     77 		ds_fh_v1 v1;
     78 		/* new versions will be added here */
     79 	} fh;
     80 };
     81 typedef struct mds_ds_fh mds_ds_fh;
     82 
     83 extern void free_mds_ds_fh(mds_ds_fh *);
     84 extern mds_ds_fh *get_mds_ds_fh(nfs_fh4 *);
     85 extern int mds_alloc_ds_fh(fsid_t, nfs41_fid_t, mds_sid *, nfs_fh4 *);
     86 extern bool_t xdr_ds_fh_fmt(XDR *, mds_ds_fh *);
     87 extern bool_t xdr_mds_sid_content(XDR *, mds_sid_content *);
     88 extern bool_t xdr_mds_sid(XDR *, mds_sid *);
     89 extern bool_t xdr_mds_dataset_id(XDR *, mds_dataset_id *);
     90 extern bool_t xdr_ds_fh_v1(XDR *, ds_fh_v1 *);
     91 extern bool_t xdr_encode_ds_fh(mds_ds_fh *, nfs_fh4 *);
     92 extern bool_t xdr_decode_ds_fh(XDR *, nfs_fh4 *);
     93 extern void xdr_free_ds_fh(nfs_fh4 *);
     94 
     95 #ifdef	__cplusplus
     96 }
     97 #endif
     98 
     99 #endif /* _DS_FILEHANDLE_H */
    100