This file is indexed.

/usr/include/xfs/dmapi.h is in libdm0-dev 2.2.10-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
/*
 * Copyright (c) 1995-2003 Silicon Graphics, Inc.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would 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 for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write the Free Software Foundation,
 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef __DMAPI_H__
#define __DMAPI_H__

#ifdef	__cplusplus
extern	"C" {
#endif

#ifndef __KERNEL__
#include <xfs/xfs.h>
#include <xfs/handle.h>
#endif

/**************************************************************************
 *									  *
 * The SGI implementation of DMAPI is based upon the X/Open document	  *
 *	Systems Management: Data Storage Managment (XDSM) API		  *
 * dated February 1997.	 Not all DMAPI functions and structure fields	  *
 * have been implemented.  Most importantly, the DMAPI functions	  *
 * dm_request_right, dm_release_right, dm_query_right, dm_upgrade_right	  *
 * and dm_downgrade_right do not work as described in the specification.  *
 *									  *
 * The XFS filesystem currently does not allow its locking mechanisms to  *
 * be externally accessed from user space.  While the above-mentioned	  *
 * dm_xxx_right functions exist and can be called by applications, they	  *
 * always return successfully without actually obtaining any locks	  *
 * within the filesystem.						  *
 *									  *
 * Applications which do not need full rights support and which only	  *
 * make dm_xxx_right calls in order to satisfy the input requirements of  *
 * other DMAPI calls should be able to use these routines to avoid	  *
 * having to implement special-case code for SGI platforms.  Applications *
 * which truely need the capabilities of a full implementation of rights  *
 * will unfortunately have to come up with alternate software solutions	  *
 * until such time as rights can be completely implemented.		  *
 *									  *
 * Functions and structure fields defined within this file which are not  *
 * supported in the SGI implementation of DMAPI are indicated by comments *
 * following their definitions such as "not supported", or "not		  *
 * completely supported".  Any function or field not so marked may be	  *
 * assumed to work exactly according to the spec.			  *
 *									  *
 **************************************************************************/



/* The first portion of this file contains defines and typedefs that are
   DMAPI implementation-dependent, and could be different on other platforms.
*/

typedef __s64		dm_attrloc_t;
typedef unsigned int	dm_boolean_t;
typedef __u64		dm_eventset_t;
typedef __u64		dm_fsid_t;
typedef __u64		dm_ino_t;
typedef __u32		dm_igen_t;
typedef __s64		dm_off_t;
typedef unsigned int	dm_sequence_t;
typedef int		dm_sessid_t;
typedef __u64		dm_size_t;
typedef __s64		dm_ssize_t;
typedef int		dm_token_t;

/* XXX dev_t, mode_t, and nlink_t are not the same size in kernel space
   and user space.  This affects the field offsets for dm_stat_t.
   The following solution is temporary.

   user space sizes:  dev_t=8  mode_t=4	 nlink_t=4
   kernel space	   :  dev_t=2  mode_t=2	 nlink_t=2

*/
typedef __s64		dm_dev_t;
typedef int		dm_mode_t;
typedef int		dm_nlink_t;


#define DM_REGION_NOEVENT	0x0
#define DM_REGION_READ		0x1
#define DM_REGION_WRITE		0x2
#define DM_REGION_TRUNCATE	0x4

/* Values for the mask argument used with dm_get_fileattr, dm_get_bulkattr,
   dm_get_dirattrs, and dm_set_fileattr.
*/

#define DM_AT_MODE	0x0001
#define DM_AT_UID	0x0002
#define DM_AT_GID	0x0004
#define DM_AT_ATIME	0x0008
#define DM_AT_MTIME	0x0010
#define DM_AT_CTIME	0x0020
#define DM_AT_SIZE	0x0040
#define DM_AT_DTIME	0x0080
#define DM_AT_HANDLE	0x0100
#define DM_AT_EMASK	0x0200
#define DM_AT_PMANR	0x0400
#define DM_AT_PATTR	0x0800
#define DM_AT_STAT	0x1000
#define DM_AT_CFLAG	0x2000

#define DM_EV_WAIT	0x1		/* used in dm_get_events() */

#define DM_MOUNT_RDONLY 0x1		/* me_mode field in dm_mount_event_t */

#define DM_RR_WAIT	0x1

#define DM_UNMOUNT_FORCE 0x1		/* ne_mode field in dm_namesp_event_t */

#define DM_WRITE_SYNC	0x1		/* used in dm_write_invis() */

#define DM_SESSION_INFO_LEN	256
#define DM_NO_SESSION		0
#define DM_TRUE			1
#define DM_FALSE		0
#define DM_INVALID_TOKEN	0
#define DM_NO_TOKEN		(-1)
#define DM_INVALID_HANP		NULL
#define DM_INVALID_HLEN		0
#define DM_GLOBAL_HANP		((void *)(1LL))
#define DM_GLOBAL_HLEN		((size_t)(1))
#define DM_VER_STR_CONTENTS	"SGI DMAPI (XDSM) API, Release 1.1."


#define DMEV_SET(event_type, event_list) \
	((event_list) |= (1 << (event_type)))
#define DMEV_CLR(event_type, event_list) \
	((event_list) &= ~(1 << (event_type)))
#define DMEV_ISSET(event_type, event_list) \
	(int)(((event_list) & (1 << (event_type))) != 0)
#define DMEV_ZERO(event_list) \
	(event_list) = 0


typedef struct {
	int	vd_offset;	/* offset from start of containing struct */
	unsigned int	vd_length;	/* length of data starting at vd_offset */
} dm_vardata_t;

#define DM_GET_VALUE(p, field, type) \
	((type) ((char *)(p) + (p)->field.vd_offset))

#define DM_GET_LEN(p, field) \
	((p)->field.vd_length)

#define DM_STEP_TO_NEXT(p, type) \
	((type) ((p)->_link ? (char *)(p) + (p)->_link : NULL))




/* The remainder of this include file contains defines, typedefs, and
   structures which are strictly defined by the DMAPI 2.3 specification.

   (The _link field which appears in several structures is an
   implementation-specific way to implement DM_STEP_TO_NEXT, and
   should not be referenced directly by application code.)
*/


#define DM_ATTR_NAME_SIZE	8


struct dm_attrname {
	unsigned char	an_chars[DM_ATTR_NAME_SIZE];
};
typedef struct dm_attrname	dm_attrname_t;


struct dm_attrlist {
	int		_link;
	dm_attrname_t	al_name;
	dm_vardata_t	al_data;
};
typedef struct dm_attrlist	dm_attrlist_t;


typedef enum {
	DM_CONFIG_INVALID,
	DM_CONFIG_BULKALL,
	DM_CONFIG_CREATE_BY_HANDLE,
	DM_CONFIG_DTIME_OVERLOAD,
	DM_CONFIG_LEGACY,
	DM_CONFIG_LOCK_UPGRADE,
	DM_CONFIG_MAX_ATTR_ON_DESTROY,
	DM_CONFIG_MAX_ATTRIBUTE_SIZE,
	DM_CONFIG_MAX_HANDLE_SIZE,
	DM_CONFIG_MAX_MANAGED_REGIONS,
	DM_CONFIG_MAX_MESSAGE_DATA,
	DM_CONFIG_OBJ_REF,
	DM_CONFIG_PENDING,
	DM_CONFIG_PERS_ATTRIBUTES,
	DM_CONFIG_PERS_EVENTS,
	DM_CONFIG_PERS_INHERIT_ATTRIBS,
	DM_CONFIG_PERS_MANAGED_REGIONS,
	DM_CONFIG_PUNCH_HOLE,
	DM_CONFIG_TOTAL_ATTRIBUTE_SPACE,
	DM_CONFIG_WILL_RETRY
} dm_config_t;


struct	dm_dioinfo {			/* non-standard SGI addition */
	unsigned int	d_mem;
	unsigned int	d_miniosz;
	unsigned int	d_maxiosz;
	dm_boolean_t	d_dio_only;
};
typedef struct dm_dioinfo	dm_dioinfo_t;


struct dm_dispinfo {
	int		_link;
	unsigned int	di_pad1;		/* reserved; do not reference */
	dm_vardata_t	di_fshandle;
	dm_eventset_t	di_eventset;
};
typedef struct dm_dispinfo	dm_dispinfo_t;


#ifndef HAVE_DM_EVENTTYPE_T
#define HAVE_DM_EVENTTYPE_T
typedef enum {
	DM_EVENT_INVALID	= -1,
	DM_EVENT_CANCEL		= 0,		/* not supported */
	DM_EVENT_MOUNT		= 1,
	DM_EVENT_PREUNMOUNT	= 2,
	DM_EVENT_UNMOUNT	= 3,
	DM_EVENT_DEBUT		= 4,		/* not supported */
	DM_EVENT_CREATE		= 5,
	DM_EVENT_CLOSE		= 6,		/* not supported */
	DM_EVENT_POSTCREATE	= 7,
	DM_EVENT_REMOVE		= 8,
	DM_EVENT_POSTREMOVE	= 9,
	DM_EVENT_RENAME		= 10,
	DM_EVENT_POSTRENAME	= 11,
	DM_EVENT_LINK		= 12,
	DM_EVENT_POSTLINK	= 13,
	DM_EVENT_SYMLINK	= 14,
	DM_EVENT_POSTSYMLINK	= 15,
	DM_EVENT_READ		= 16,
	DM_EVENT_WRITE		= 17,
	DM_EVENT_TRUNCATE	= 18,
	DM_EVENT_ATTRIBUTE	= 19,
	DM_EVENT_DESTROY	= 20,
	DM_EVENT_NOSPACE	= 21,
	DM_EVENT_USER		= 22,
	DM_EVENT_MAX		= 23
} dm_eventtype_t;
#endif


struct dm_eventmsg {
	int		_link;
	dm_eventtype_t	ev_type;
	dm_token_t	ev_token;
	dm_sequence_t	ev_sequence;
	dm_vardata_t	ev_data;
};
typedef struct dm_eventmsg	dm_eventmsg_t;


struct dm_cancel_event {			/* not supported */
	dm_sequence_t	ce_sequence;
	dm_token_t	ce_token;
};
typedef struct dm_cancel_event	dm_cancel_event_t;


struct dm_data_event {
	dm_vardata_t	de_handle;
	dm_off_t	de_offset;
	dm_size_t	de_length;
};
typedef struct dm_data_event dm_data_event_t;

struct dm_destroy_event {
	dm_vardata_t		ds_handle;
	dm_attrname_t		ds_attrname;
	dm_vardata_t		ds_attrcopy;
};
typedef struct dm_destroy_event dm_destroy_event_t;

struct dm_mount_event {
	dm_mode_t	me_mode;
	dm_vardata_t	me_handle1;
	dm_vardata_t	me_handle2;
	dm_vardata_t	me_name1;
	dm_vardata_t	me_name2;
	dm_vardata_t	me_roothandle;
};
typedef struct dm_mount_event dm_mount_event_t;

struct dm_namesp_event {
	dm_mode_t	ne_mode;
	dm_vardata_t	ne_handle1;
	dm_vardata_t	ne_handle2;
	dm_vardata_t	ne_name1;
	dm_vardata_t	ne_name2;
	int		ne_retcode;
};
typedef struct dm_namesp_event dm_namesp_event_t;


typedef enum {
	DM_EXTENT_INVALID,
	DM_EXTENT_RES,
	DM_EXTENT_HOLE
} dm_extenttype_t;


struct dm_extent {
	dm_extenttype_t ex_type;
	unsigned int	ex_pad1;		/* reserved; do not reference */
	dm_off_t	ex_offset;
	dm_size_t	ex_length;
};
typedef struct dm_extent dm_extent_t;

struct dm_fileattr {
	dm_mode_t	fa_mode;
	uid_t		fa_uid;
	gid_t		fa_gid;
	time_t		fa_atime;
	time_t		fa_mtime;
	time_t		fa_ctime;
	time_t		fa_dtime;
	unsigned int	fa_pad1;		/* reserved; do not reference */
	dm_off_t	fa_size;
};
typedef struct dm_fileattr dm_fileattr_t;


struct dm_inherit {				/* not supported */
	dm_attrname_t	ih_name;
	dm_mode_t	ih_filetype;
};
typedef struct dm_inherit dm_inherit_t;


typedef enum {
	DM_MSGTYPE_INVALID,
	DM_MSGTYPE_SYNC,
	DM_MSGTYPE_ASYNC
} dm_msgtype_t;


struct dm_region {
	dm_off_t	rg_offset;
	dm_size_t	rg_size;
	unsigned int	rg_flags;
	unsigned int	rg_pad1;		/* reserved; do not reference */
};
typedef struct dm_region dm_region_t;


typedef enum {
	DM_RESP_INVALID,
	DM_RESP_CONTINUE,
	DM_RESP_ABORT,
	DM_RESP_DONTCARE
} dm_response_t;


#ifndef HAVE_DM_RIGHT_T
#define HAVE_DM_RIGHT_T
typedef enum {
	DM_RIGHT_NULL,
	DM_RIGHT_SHARED,
	DM_RIGHT_EXCL
} dm_right_t;
#endif


struct dm_stat {
	int		_link;
	dm_vardata_t	dt_handle;
	dm_vardata_t	dt_compname;
	int		dt_nevents;
	dm_eventset_t	dt_emask;
	int		dt_pers;		/* field not supported */
	int		dt_pmanreg;
	time_t		dt_dtime;
	unsigned int	dt_change;		/* field not supported */
	unsigned int	dt_pad1;		/* reserved; do not reference */
	dm_dev_t	dt_dev;
	dm_ino_t	dt_ino;
	dm_mode_t	dt_mode;
	dm_nlink_t	dt_nlink;
	uid_t		dt_uid;
	gid_t		dt_gid;
	dm_dev_t	dt_rdev;
	unsigned int	dt_pad2;		/* reserved; do not reference */
	dm_off_t	dt_size;
	time_t		dt_atime;
	time_t		dt_mtime;
	time_t		dt_ctime;
	unsigned int	dt_blksize;
	dm_size_t	dt_blocks;

	/* Non-standard filesystem-specific fields.  Currently XFS is the only
	   supported filesystem type.
	*/

	__u64	dt_pad3;	/* reserved; do not reference */
	int		dt_fstype;	/* filesystem index; see sysfs(2) */
	union	{
		struct	{
			dm_igen_t	igen;
			unsigned int	xflags;
			unsigned int	extsize;
			unsigned int	extents;
			unsigned short	aextents;
			unsigned short	dmstate;
		} sgi_xfs;
	} fsys_dep;
};
typedef struct dm_stat	dm_stat_t;

#define dt_xfs_igen	fsys_dep.sgi_xfs.igen
#define dt_xfs_xflags	fsys_dep.sgi_xfs.xflags
#define dt_xfs_extsize	fsys_dep.sgi_xfs.extsize
#define dt_xfs_extents	fsys_dep.sgi_xfs.extents
#define dt_xfs_aextents fsys_dep.sgi_xfs.aextents
#define dt_xfs_dmstate	fsys_dep.sgi_xfs.dmstate

/* Flags for the non-standard dt_xfs_xflags field. */

#define DM_XFLAG_REALTIME	0x00000001
#define DM_XFLAG_PREALLOC	0x00000002
#define DM_XFLAG_IMMUTABLE	0x00000008
#define DM_XFLAG_APPEND		0x00000010
#define DM_XFLAG_SYNC		0x00000020
#define DM_XFLAG_NOATIME	0x00000040
#define DM_XFLAG_NODUMP		0x00000080
#define DM_XFLAG_HASATTR	0x80000000


struct	dm_timestruct {
	time_t		dm_tv_sec;
	int		dm_tv_nsec;
};
typedef struct dm_timestruct dm_timestruct_t;


struct	dm_xstat {				/* not supported */
	dm_stat_t	dx_statinfo;
	dm_vardata_t	dx_attrdata;
};
typedef struct dm_xstat dm_xstat_t;


#define MAXDMFSFIDSZ	46

struct dm_fid {
	__u16	dm_fid_len;		/* length of remainder	*/
	__u16	dm_fid_pad;
	__u32	dm_fid_gen;		/* generation number	*/
	__u64	dm_fid_ino;		/* 64 bits inode number */
};
typedef struct dm_fid dm_fid_t;


struct dm_handle {
	union {
		__s64	    align;	/* force alignment of ha_fid	 */
		dm_fsid_t  _ha_fsid;	/* unique file system identifier */
	} ha_u;
	dm_fid_t	ha_fid;		/* file system specific file ID	 */
};
typedef struct dm_handle dm_handle_t;
#define ha_fsid ha_u._ha_fsid

#define DM_HSIZE(handle)	(((char *) &(handle).ha_fid.dm_fid_pad	 \
				 - (char *) &(handle))			  \
				 + (handle).ha_fid.dm_fid_len)

#define DM_HANDLE_CMP(h1, h2)	memcmp(h1, h2, sizeof(dm_handle_t))

#define DM_FSHSIZE		sizeof(dm_fsid_t)


/* The following list provides the prototypes for all functions defined in
   the DMAPI interface.
*/

extern int
dm_clear_inherit(				/* not supported */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_attrname_t	*attrnamep);

extern int
dm_create_by_handle(				/* not supported */
	dm_sessid_t	sid,
	void		*dirhanp,
	size_t		dirhlen,
	dm_token_t	token,
	void		*hanp,
	size_t		hlen,
	char		*cname);

extern int
dm_create_session(
	dm_sessid_t	oldsid,
	char		*sessinfop,
	dm_sessid_t	*newsidp);

extern int
dm_create_userevent(
	dm_sessid_t	sid,
	size_t		msglen,
	void		*msgdatap,
	dm_token_t	*tokenp);

extern int
dm_destroy_session(
	dm_sessid_t	sid);

extern int
dm_downgrade_right(		/* not completely supported; see caveat above */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token);

extern int
dm_fd_to_handle(
	int		fd,
	void		**hanpp,
	size_t		*hlenp);

extern int
dm_find_eventmsg(
	dm_sessid_t	sid,
	dm_token_t	token,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_get_allocinfo(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_off_t	*offp,
	unsigned int	nelem,
	dm_extent_t	*extentp,
	unsigned int	*nelemp);

extern int
dm_get_bulkall(					/* not supported */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	mask,
	dm_attrname_t	*attrnamep,
	dm_attrloc_t	*locp,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_get_bulkattr(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	mask,
	dm_attrloc_t	*locp,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_get_config(
	void		*hanp,
	size_t		hlen,
	dm_config_t	flagname,
	dm_size_t	*retvalp);

extern int
dm_get_config_events(
	void		*hanp,
	size_t		hlen,
	unsigned int	nelem,
	dm_eventset_t	*eventsetp,
	unsigned int	*nelemp);

extern int
dm_get_dirattrs(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	mask,
	dm_attrloc_t	*locp,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_get_dmattr(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_attrname_t	*attrnamep,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_get_eventlist(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	nelem,
	dm_eventset_t	*eventsetp,
	unsigned int	*nelemp);

extern int
dm_get_events(
	dm_sessid_t	sid,
	unsigned int	maxmsgs,
	unsigned int	flags,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_get_fileattr(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	mask,
	dm_stat_t	*statp);

extern int
dm_get_mountinfo(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_get_region(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	nelem,
	dm_region_t	*regbufp,
	unsigned int	*nelemp);

extern int
dm_getall_disp(
	dm_sessid_t	sid,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_getall_dmattr(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern int
dm_getall_inherit(				/* not supported */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	nelem,
	dm_inherit_t	*inheritbufp,
	unsigned int	*nelemp);

extern int
dm_getall_sessions(
	unsigned int	nelem,
	dm_sessid_t	*sidbufp,
	unsigned int	*nelemp);

extern int
dm_getall_tokens(
	dm_sessid_t	sid,
	unsigned int	nelem,
	dm_token_t	*tokenbufp,
	unsigned int	*nelemp);

extern int
dm_handle_cmp(
	void		*hanp1,
	size_t		hlen1,
	void		*hanp2,
	size_t		hlen2);

extern void
dm_handle_free(
	void		*hanp,
	size_t		hlen);

extern u_int
dm_handle_hash(
	void		*hanp,
	size_t		hlen);

extern dm_boolean_t
dm_handle_is_valid(
	void		*hanp,
	size_t		hlen);

extern int
dm_handle_to_fshandle(
	void		*hanp,
	size_t		hlen,
	void		**fshanpp,
	size_t		*fshlenp);

extern int
dm_handle_to_fsid(
	void		*hanp,
	size_t		hlen,
	dm_fsid_t	*fsidp);

extern int
dm_handle_to_igen(
	void		*hanp,
	size_t		hlen,
	dm_igen_t	*igenp);

extern int
dm_handle_to_ino(
	void		*hanp,
	size_t		hlen,
	dm_ino_t	*inop);

extern int
dm_handle_to_path(
	void		*dirhanp,
	size_t		dirhlen,
	void		*targhanp,
	size_t		targhlen,
	size_t		buflen,
	char		*pathbufp,
	size_t		*rlenp);

extern int
dm_init_attrloc(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_attrloc_t	*locp);

extern int
dm_init_service(
	char		**versionstrpp);

extern int
dm_make_handle(
	dm_fsid_t	*fsidp,
	dm_ino_t	*inop,
	dm_igen_t	*igenp,
	void		**hanpp,
	size_t		*hlenp);

extern int
dm_make_fshandle(
	dm_fsid_t	*fsidp,
	void		**hanpp,
	size_t		*hlenp);

extern int
dm_mkdir_by_handle(				/* not supported */
	dm_sessid_t	sid,
	void		*dirhanp,
	size_t		dirhlen,
	dm_token_t	token,
	void		*hanp,
	size_t		hlen,
	char		*cname);

extern int
dm_move_event(
	dm_sessid_t	srcsid,
	dm_token_t	token,
	dm_sessid_t	targetsid,
	dm_token_t	*rtokenp);

extern int
dm_obj_ref_hold(
	dm_sessid_t	sid,
	dm_token_t	token,
	void		*hanp,
	size_t		hlen);

extern int
dm_obj_ref_query(
	dm_sessid_t	sid,
	dm_token_t	token,
	void		*hanp,
	size_t		hlen);

extern int
dm_obj_ref_rele(
	dm_sessid_t	sid,
	dm_token_t	token,
	void		*hanp,
	size_t		hlen);

extern int
dm_path_to_fshandle(
	char		*path,
	void		**hanpp,
	size_t		*hlenp);

extern int
dm_path_to_handle(
	char		*path,
	void		**hanpp,
	size_t		*hlenp);

extern int
dm_pending(
	dm_sessid_t	sid,
	dm_token_t	token,
	dm_timestruct_t *delay);

extern int
dm_probe_hole(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_off_t	off,
	dm_size_t	len,
	dm_off_t	*roffp,
	dm_size_t	*rlenp);

extern int
dm_punch_hole(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_off_t	off,
	dm_size_t	len);

extern int
dm_query_right(			/* not completely supported; see caveat above */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_right_t	*rightp);

extern int
dm_query_session(
	dm_sessid_t	sid,
	size_t		buflen,
	void		*bufp,
	size_t		*rlenp);

extern dm_ssize_t
dm_read_invis(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_off_t	off,
	dm_size_t	len,
	void		*bufp);

extern int
dm_release_right(		/* not completely supported; see caveat above */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token);

extern int
dm_remove_dmattr(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	int		setdtime,
	dm_attrname_t	*attrnamep);

extern int
dm_request_right(		/* not completely supported; see caveat above */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	flags,
	dm_right_t	right);

extern int
dm_respond_event(
	dm_sessid_t	sid,
	dm_token_t	token,
	dm_response_t	response,
	int		reterror,
	size_t		buflen,
	void		*respbufp);

extern int
dm_send_msg(
	dm_sessid_t	targetsid,
	dm_msgtype_t	msgtype,
	size_t		buflen,
	void		*bufp);

extern int
dm_set_disp(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_eventset_t	*eventsetp,
	unsigned int	maxevent);

extern int
dm_set_dmattr(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_attrname_t	*attrnamep,
	int		setdtime,
	size_t		buflen,
	void		*bufp);

extern int
dm_set_eventlist(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_eventset_t	*eventsetp,
	unsigned int	maxevent);

extern int
dm_set_fileattr(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	mask,
	dm_fileattr_t	*attrp);

extern int
dm_set_inherit(					/* not supported */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_attrname_t	*attrnamep,
	mode_t		mode);

extern int
dm_set_region(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	unsigned int	nelem,
	dm_region_t	*regbufp,
	dm_boolean_t	*exactflagp);

extern int
dm_set_return_on_destroy(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_attrname_t	*attrnamep,
	dm_boolean_t	enable);

extern int
dm_symlink_by_handle(				/* not supported */
	dm_sessid_t	sid,
	void		*dirhanp,
	size_t		dirhlen,
	dm_token_t	token,
	void		*hanp,
	size_t		hlen,
	char		*cname,
	char		*path);

extern int
dm_sync_by_handle(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token);

extern int
dm_upgrade_right(		/* not completely supported; see caveat above */
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token);

extern dm_ssize_t
dm_write_invis(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	int		flags,
	dm_off_t	off,
	dm_size_t	len,
	void		*bufp);

/* Non-standard SGI additions to the DMAPI interface. */

int
dm_open_by_handle(
	void		*hanp,
	size_t		hlen,
	int		mode);

extern int
dm_get_dioinfo(
	dm_sessid_t	sid,
	void		*hanp,
	size_t		hlen,
	dm_token_t	token,
	dm_dioinfo_t	*diop);

#ifdef	__cplusplus
}
#endif

#endif /* __DMAPI_H__ */