@@ -39,6 +39,8 @@ pub type u_short = ::c_ushort;
39
39
40
40
pub type caddr_t = * mut :: c_char ;
41
41
42
+ pub type fhandle_t = fhandle ;
43
+
42
44
// It's an alias over "struct __kvm_t". However, its fields aren't supposed to be used directly,
43
45
// making the type definition system dependent. Better not bind it exactly.
44
46
pub type kvm_t = :: c_void ;
@@ -645,6 +647,17 @@ s! {
645
647
pub ph1: u64 ,
646
648
pub ph2: u64 ,
647
649
}
650
+
651
+ pub struct fid {
652
+ pub fid_len: :: c_ushort,
653
+ pub fid_data0: :: c_ushort,
654
+ pub fid_data: [ :: c_char; :: MAXFIDSZ as usize ] ,
655
+ }
656
+
657
+ pub struct fhandle {
658
+ pub fh_fsid: :: fsid_t,
659
+ pub fh_fid: fid,
660
+ }
648
661
}
649
662
650
663
s_no_extra_traits ! {
@@ -3125,6 +3138,152 @@ pub const PS_FST_FFLAG_DIRECT: ::c_int = 0x1000;
3125
3138
pub const PS_FST_FFLAG_EXEC : :: c_int = 0x2000 ;
3126
3139
pub const PS_FST_FFLAG_HASLOCK : :: c_int = 0x4000 ;
3127
3140
3141
+ // sys/mount.h
3142
+
3143
+ /// File identifier.
3144
+ /// These are unique per filesystem on a single machine.
3145
+ ///
3146
+ /// Note that the offset of fid_data is 4 bytes, so care must be taken to avoid
3147
+ /// undefined behavior accessing unaligned fields within an embedded struct.
3148
+ pub const MAXFIDSZ : :: c_int = 16 ;
3149
+ /// Length of type name including null.
3150
+ pub const MFSNAMELEN : :: c_int = 16 ;
3151
+ /// Size of on/from name bufs.
3152
+ pub const MNAMELEN : :: c_int = 1024 ;
3153
+
3154
+ /// Using journaled soft updates.
3155
+ pub const MNT_SUJ : u64 = 0x100000000 ;
3156
+ /// Mounted by automountd(8).
3157
+ pub const MNT_AUTOMOUNTED : u64 = 0x200000000 ;
3158
+ /// Filesys metadata untrusted.
3159
+ pub const MNT_UNTRUSTED : u64 = 0x800000000 ;
3160
+
3161
+ /// Require TLS.
3162
+ pub const MNT_EXTLS : u64 = 0x4000000000 ;
3163
+ /// Require TLS with client cert.
3164
+ pub const MNT_EXTLSCERT : u64 = 0x8000000000 ;
3165
+ /// Require TLS with user cert.
3166
+ pub const MNT_EXTLSCERTUSER : u64 = 0x10000000000 ;
3167
+
3168
+ /// Filesystem is stored locally.
3169
+ pub const MNT_LOCAL : u64 = 0x000001000 ;
3170
+ /// Quotas are enabled on fs.
3171
+ pub const MNT_QUOTA : u64 = 0x000002000 ;
3172
+ /// Identifies the root fs.
3173
+ pub const MNT_ROOTFS : u64 = 0x000004000 ;
3174
+ /// Mounted by a user.
3175
+ pub const MNT_USER : u64 = 0x000008000 ;
3176
+ /// Do not show entry in df.
3177
+ pub const MNT_IGNORE : u64 = 0x000800000 ;
3178
+ /// Filesystem is verified.
3179
+ pub const MNT_VERIFIED : u64 = 0x400000000 ;
3180
+
3181
+ /// Do not cover a mount point.
3182
+ pub const MNT_NOCOVER : u64 = 0x001000000000 ;
3183
+ /// Only mount on empty dir.
3184
+ pub const MNT_EMPTYDIR : u64 = 0x002000000000 ;
3185
+ /// Recursively unmount uppers.
3186
+ pub const MNT_RECURSE : u64 = 0x100000000000 ;
3187
+ /// Unmount in async context.
3188
+ pub const MNT_DEFERRED : u64 = 0x200000000000 ;
3189
+
3190
+ /// Forced unmount in progress.
3191
+ pub const MNTK_UNMOUNTF : u32 = 0x00000001 ;
3192
+ /// Filtered async flag.
3193
+ pub const MNTK_ASYNC : u32 = 0x00000002 ;
3194
+ /// Async disabled by softdep.
3195
+ pub const MNTK_SOFTDEP : u32 = 0x00000004 ;
3196
+ /// Don't do msync.
3197
+ pub const MNTK_NOMSYNC : u32 = 0x00000008 ;
3198
+ /// Lock draining is happening.
3199
+ pub const MNTK_DRAINING : u32 = 0x00000010 ;
3200
+ /// Refcount expiring is happening.
3201
+ pub const MNTK_REFEXPIRE : u32 = 0x00000020 ;
3202
+ /// Allow shared locking for more ops.
3203
+ pub const MNTK_EXTENDED_SHARED : u32 = 0x00000040 ;
3204
+ /// Allow shared locking for writes.
3205
+ pub const MNTK_SHARED_WRITES : u32 = 0x00000080 ;
3206
+ /// Disallow page faults during reads and writes. Filesystem shall properly handle i/o
3207
+ /// state on EFAULT.
3208
+ pub const MNTK_NO_IOPF : u32 = 0x00000100 ;
3209
+ /// Pending recursive unmount.
3210
+ pub const MNTK_RECURSE : u32 = 0x00000200 ;
3211
+ /// Waiting to drain MNTK_UPPER_PENDING.
3212
+ pub const MNTK_UPPER_WAITER : u32 = 0x00000400 ;
3213
+ pub const MNTK_LOOKUP_EXCL_DOTDOT : u32 = 0x00000800 ;
3214
+ pub const MNTK_UNMAPPED_BUFS : u32 = 0x00002000 ;
3215
+ /// FS uses the buffer cache.
3216
+ pub const MNTK_USES_BCACHE : u32 = 0x00004000 ;
3217
+ /// Keep use ref for text.
3218
+ pub const MNTK_TEXT_REFS : u32 = 0x00008000 ;
3219
+ pub const MNTK_VMSETSIZE_BUG : u32 = 0x00010000 ;
3220
+ /// A hack for F_ISUNIONSTACK.
3221
+ pub const MNTK_UNIONFS : u32 = 0x00020000 ;
3222
+ /// fast path lookup is supported.
3223
+ pub const MNTK_FPLOOKUP : u32 = 0x00040000 ;
3224
+ /// Suspended by all-fs suspension.
3225
+ pub const MNTK_SUSPEND_ALL : u32 = 0x00080000 ;
3226
+ /// Waiting on unmount taskqueue.
3227
+ pub const MNTK_TASKQUEUE_WAITER : u32 = 0x00100000 ;
3228
+ /// Disable async.
3229
+ pub const MNTK_NOASYNC : u32 = 0x00800000 ;
3230
+ /// Unmount in progress.
3231
+ pub const MNTK_UNMOUNT : u32 = 0x01000000 ;
3232
+ /// Waiting for unmount to finish.
3233
+ pub const MNTK_MWAIT : u32 = 0x02000000 ;
3234
+ /// Request write suspension.
3235
+ pub const MNTK_SUSPEND : u32 = 0x08000000 ;
3236
+ /// Block secondary writes.
3237
+ pub const MNTK_SUSPEND2 : u32 = 0x04000000 ;
3238
+ /// Write operations are suspended.
3239
+ pub const MNTK_SUSPENDED : u32 = 0x10000000 ;
3240
+ /// auto disable cache for nullfs mounts over this fs.
3241
+ pub const MNTK_NULL_NOCACHE : u32 = 0x20000000 ;
3242
+ /// FS supports shared lock lookups.
3243
+ pub const MNTK_LOOKUP_SHARED : u32 = 0x40000000 ;
3244
+ /// Don't send KNOTEs from VOP hooks.
3245
+ pub const MNTK_NOKNOTE : u32 = 0x80000000 ;
3246
+
3247
+ /// Get configured filesystems.
3248
+ pub const VFS_VFSCONF : :: c_int = 0 ;
3249
+ /// Generic filesystem information.
3250
+ pub const VFS_GENERIC : :: c_int = 0 ;
3251
+
3252
+ /// int: highest defined filesystem type.
3253
+ pub const VFS_MAXTYPENUM : :: c_int = 1 ;
3254
+ /// struct: vfsconf for filesystem given as next argument.
3255
+ pub const VFS_CONF : :: c_int = 2 ;
3256
+
3257
+ /// Synchronously wait for I/O to complete.
3258
+ pub const MNT_WAIT : :: c_int = 1 ;
3259
+ /// Start all I/O, but do not wait for it.
3260
+ pub const MNT_NOWAIT : :: c_int = 2 ;
3261
+ /// Push data not written by filesystem syncer.
3262
+ pub const MNT_LAZY : :: c_int = 3 ;
3263
+ /// Suspend file system after sync.
3264
+ pub const MNT_SUSPEND : :: c_int = 4 ;
3265
+
3266
+ pub const MAXSECFLAVORS : :: c_int = 5 ;
3267
+
3268
+ /// Statically compiled into kernel.
3269
+ pub const VFCF_STATIC : :: c_int = 0x00010000 ;
3270
+ /// May get data over the network.
3271
+ pub const VFCF_NETWORK : :: c_int = 0x00020000 ;
3272
+ /// Writes are not implemented.
3273
+ pub const VFCF_READONLY : :: c_int = 0x00040000 ;
3274
+ /// Data does not represent real files.
3275
+ pub const VFCF_SYNTHETIC : :: c_int = 0x00080000 ;
3276
+ /// Aliases some other mounted FS.
3277
+ pub const VFCF_LOOPBACK : :: c_int = 0x00100000 ;
3278
+ /// Stores file names as Unicode.
3279
+ pub const VFCF_UNICODE : :: c_int = 0x00200000 ;
3280
+ /// Can be mounted from within a jail.
3281
+ pub const VFCF_JAIL : :: c_int = 0x00400000 ;
3282
+ /// Supports delegated administration.
3283
+ pub const VFCF_DELEGADMIN : :: c_int = 0x00800000 ;
3284
+ /// Stop at Boundary: defer stop requests to kernel->user (AST) transition.
3285
+ pub const VFCF_SBDRY : :: c_int = 0x01000000 ;
3286
+
3128
3287
const_fn ! {
3129
3288
{ const } fn _ALIGN( p: usize ) -> usize {
3130
3289
( p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -3228,6 +3387,26 @@ safe_f! {
3228
3387
}
3229
3388
}
3230
3389
3390
+ cfg_if ! {
3391
+ if #[ cfg( not( any( freebsd10, freebsd11) ) ) ] {
3392
+ extern "C" {
3393
+ pub fn fhlink( fhp: * mut fhandle_t, to: * const :: c_char) -> :: c_int;
3394
+ pub fn fhlinkat( fhp: * mut fhandle_t, tofd: :: c_int, to: * const :: c_char) -> :: c_int;
3395
+ pub fn fhreadlink(
3396
+ fhp: * mut fhandle_t,
3397
+ buf: * mut :: c_char,
3398
+ bufsize: :: size_t,
3399
+ ) -> :: c_int;
3400
+ pub fn getfhat(
3401
+ fd: :: c_int,
3402
+ path: * mut :: c_char,
3403
+ fhp: * mut fhandle,
3404
+ flag: :: c_int,
3405
+ ) -> :: c_int;
3406
+ }
3407
+ }
3408
+ }
3409
+
3231
3410
extern "C" {
3232
3411
pub fn __error ( ) -> * mut :: c_int ;
3233
3412
@@ -3520,7 +3699,21 @@ extern "C" {
3520
3699
needlelen : :: size_t ,
3521
3700
) -> * mut :: c_void ;
3522
3701
3702
+ pub fn fhopen ( fhp : * const fhandle_t , flags : :: c_int ) -> :: c_int ;
3703
+ pub fn fhstat ( fhp : * const fhandle , buf : * mut :: stat ) -> :: c_int ;
3704
+ pub fn fhstatfs ( fhp : * const fhandle_t , buf : * mut :: statfs ) -> :: c_int ;
3705
+ pub fn getfh ( path : * const :: c_char , fhp : * mut fhandle_t ) -> :: c_int ;
3706
+ pub fn lgetfh ( path : * const :: c_char , fhp : * mut fhandle_t ) -> :: c_int ;
3707
+ pub fn getfsstat ( buf : * mut :: statfs , bufsize : :: c_long , mode : :: c_int ) -> :: c_int ;
3708
+ pub fn getmntinfo ( mntbufp : * mut * mut :: statfs , mode : :: c_int ) -> :: c_int ;
3709
+ pub fn mount (
3710
+ type_ : * const :: c_char ,
3711
+ dir : * const :: c_char ,
3712
+ flags : :: c_int ,
3713
+ data : * mut :: c_void ,
3714
+ ) -> :: c_int ;
3523
3715
pub fn nmount ( iov : * mut :: iovec , niov : :: c_uint , flags : :: c_int ) -> :: c_int ;
3716
+
3524
3717
pub fn setproctitle ( fmt : * const :: c_char , ...) ;
3525
3718
pub fn rfork ( flags : :: c_int ) -> :: c_int ;
3526
3719
pub fn cpuset_getaffinity (
0 commit comments