@@ -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,159 @@ 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
+ cfg_if ! {
3152
+ if #[ cfg( any( freebsd10, freebsd11) ) ] {
3153
+ /// Size of on/from name bufs.
3154
+ pub const MNAMELEN : :: c_int = 88 ;
3155
+ } else {
3156
+ /// Size of on/from name bufs.
3157
+ pub const MNAMELEN : :: c_int = 1024 ;
3158
+ }
3159
+ }
3160
+
3161
+ /// Using journaled soft updates.
3162
+ pub const MNT_SUJ : u64 = 0x100000000 ;
3163
+ /// Mounted by automountd(8).
3164
+ pub const MNT_AUTOMOUNTED : u64 = 0x200000000 ;
3165
+ /// Filesys metadata untrusted.
3166
+ pub const MNT_UNTRUSTED : u64 = 0x800000000 ;
3167
+
3168
+ /// Require TLS.
3169
+ pub const MNT_EXTLS : u64 = 0x4000000000 ;
3170
+ /// Require TLS with client cert.
3171
+ pub const MNT_EXTLSCERT : u64 = 0x8000000000 ;
3172
+ /// Require TLS with user cert.
3173
+ pub const MNT_EXTLSCERTUSER : u64 = 0x10000000000 ;
3174
+
3175
+ /// Filesystem is stored locally.
3176
+ pub const MNT_LOCAL : u64 = 0x000001000 ;
3177
+ /// Quotas are enabled on fs.
3178
+ pub const MNT_QUOTA : u64 = 0x000002000 ;
3179
+ /// Identifies the root fs.
3180
+ pub const MNT_ROOTFS : u64 = 0x000004000 ;
3181
+ /// Mounted by a user.
3182
+ pub const MNT_USER : u64 = 0x000008000 ;
3183
+ /// Do not show entry in df.
3184
+ pub const MNT_IGNORE : u64 = 0x000800000 ;
3185
+ /// Filesystem is verified.
3186
+ pub const MNT_VERIFIED : u64 = 0x400000000 ;
3187
+
3188
+ /// Do not cover a mount point.
3189
+ pub const MNT_NOCOVER : u64 = 0x001000000000 ;
3190
+ /// Only mount on empty dir.
3191
+ pub const MNT_EMPTYDIR : u64 = 0x002000000000 ;
3192
+ /// Recursively unmount uppers.
3193
+ pub const MNT_RECURSE : u64 = 0x100000000000 ;
3194
+ /// Unmount in async context.
3195
+ pub const MNT_DEFERRED : u64 = 0x200000000000 ;
3196
+
3197
+ /// Forced unmount in progress.
3198
+ pub const MNTK_UNMOUNTF : u32 = 0x00000001 ;
3199
+ /// Filtered async flag.
3200
+ pub const MNTK_ASYNC : u32 = 0x00000002 ;
3201
+ /// Async disabled by softdep.
3202
+ pub const MNTK_SOFTDEP : u32 = 0x00000004 ;
3203
+ /// Don't do msync.
3204
+ pub const MNTK_NOMSYNC : u32 = 0x00000008 ;
3205
+ /// Lock draining is happening.
3206
+ pub const MNTK_DRAINING : u32 = 0x00000010 ;
3207
+ /// Refcount expiring is happening.
3208
+ pub const MNTK_REFEXPIRE : u32 = 0x00000020 ;
3209
+ /// Allow shared locking for more ops.
3210
+ pub const MNTK_EXTENDED_SHARED : u32 = 0x00000040 ;
3211
+ /// Allow shared locking for writes.
3212
+ pub const MNTK_SHARED_WRITES : u32 = 0x00000080 ;
3213
+ /// Disallow page faults during reads and writes. Filesystem shall properly handle i/o
3214
+ /// state on EFAULT.
3215
+ pub const MNTK_NO_IOPF : u32 = 0x00000100 ;
3216
+ /// Pending recursive unmount.
3217
+ pub const MNTK_RECURSE : u32 = 0x00000200 ;
3218
+ /// Waiting to drain MNTK_UPPER_PENDING.
3219
+ pub const MNTK_UPPER_WAITER : u32 = 0x00000400 ;
3220
+ pub const MNTK_LOOKUP_EXCL_DOTDOT : u32 = 0x00000800 ;
3221
+ pub const MNTK_UNMAPPED_BUFS : u32 = 0x00002000 ;
3222
+ /// FS uses the buffer cache.
3223
+ pub const MNTK_USES_BCACHE : u32 = 0x00004000 ;
3224
+ /// Keep use ref for text.
3225
+ pub const MNTK_TEXT_REFS : u32 = 0x00008000 ;
3226
+ pub const MNTK_VMSETSIZE_BUG : u32 = 0x00010000 ;
3227
+ /// A hack for F_ISUNIONSTACK.
3228
+ pub const MNTK_UNIONFS : u32 = 0x00020000 ;
3229
+ /// fast path lookup is supported.
3230
+ pub const MNTK_FPLOOKUP : u32 = 0x00040000 ;
3231
+ /// Suspended by all-fs suspension.
3232
+ pub const MNTK_SUSPEND_ALL : u32 = 0x00080000 ;
3233
+ /// Waiting on unmount taskqueue.
3234
+ pub const MNTK_TASKQUEUE_WAITER : u32 = 0x00100000 ;
3235
+ /// Disable async.
3236
+ pub const MNTK_NOASYNC : u32 = 0x00800000 ;
3237
+ /// Unmount in progress.
3238
+ pub const MNTK_UNMOUNT : u32 = 0x01000000 ;
3239
+ /// Waiting for unmount to finish.
3240
+ pub const MNTK_MWAIT : u32 = 0x02000000 ;
3241
+ /// Request write suspension.
3242
+ pub const MNTK_SUSPEND : u32 = 0x08000000 ;
3243
+ /// Block secondary writes.
3244
+ pub const MNTK_SUSPEND2 : u32 = 0x04000000 ;
3245
+ /// Write operations are suspended.
3246
+ pub const MNTK_SUSPENDED : u32 = 0x10000000 ;
3247
+ /// auto disable cache for nullfs mounts over this fs.
3248
+ pub const MNTK_NULL_NOCACHE : u32 = 0x20000000 ;
3249
+ /// FS supports shared lock lookups.
3250
+ pub const MNTK_LOOKUP_SHARED : u32 = 0x40000000 ;
3251
+ /// Don't send KNOTEs from VOP hooks.
3252
+ pub const MNTK_NOKNOTE : u32 = 0x80000000 ;
3253
+
3254
+ /// Get configured filesystems.
3255
+ pub const VFS_VFSCONF : :: c_int = 0 ;
3256
+ /// Generic filesystem information.
3257
+ pub const VFS_GENERIC : :: c_int = 0 ;
3258
+
3259
+ /// int: highest defined filesystem type.
3260
+ pub const VFS_MAXTYPENUM : :: c_int = 1 ;
3261
+ /// struct: vfsconf for filesystem given as next argument.
3262
+ pub const VFS_CONF : :: c_int = 2 ;
3263
+
3264
+ /// Synchronously wait for I/O to complete.
3265
+ pub const MNT_WAIT : :: c_int = 1 ;
3266
+ /// Start all I/O, but do not wait for it.
3267
+ pub const MNT_NOWAIT : :: c_int = 2 ;
3268
+ /// Push data not written by filesystem syncer.
3269
+ pub const MNT_LAZY : :: c_int = 3 ;
3270
+ /// Suspend file system after sync.
3271
+ pub const MNT_SUSPEND : :: c_int = 4 ;
3272
+
3273
+ pub const MAXSECFLAVORS : :: c_int = 5 ;
3274
+
3275
+ /// Statically compiled into kernel.
3276
+ pub const VFCF_STATIC : :: c_int = 0x00010000 ;
3277
+ /// May get data over the network.
3278
+ pub const VFCF_NETWORK : :: c_int = 0x00020000 ;
3279
+ /// Writes are not implemented.
3280
+ pub const VFCF_READONLY : :: c_int = 0x00040000 ;
3281
+ /// Data does not represent real files.
3282
+ pub const VFCF_SYNTHETIC : :: c_int = 0x00080000 ;
3283
+ /// Aliases some other mounted FS.
3284
+ pub const VFCF_LOOPBACK : :: c_int = 0x00100000 ;
3285
+ /// Stores file names as Unicode.
3286
+ pub const VFCF_UNICODE : :: c_int = 0x00200000 ;
3287
+ /// Can be mounted from within a jail.
3288
+ pub const VFCF_JAIL : :: c_int = 0x00400000 ;
3289
+ /// Supports delegated administration.
3290
+ pub const VFCF_DELEGADMIN : :: c_int = 0x00800000 ;
3291
+ /// Stop at Boundary: defer stop requests to kernel->user (AST) transition.
3292
+ pub const VFCF_SBDRY : :: c_int = 0x01000000 ;
3293
+
3128
3294
const_fn ! {
3129
3295
{ const } fn _ALIGN( p: usize ) -> usize {
3130
3296
( p + _ALIGNBYTES) & !_ALIGNBYTES
@@ -3228,6 +3394,26 @@ safe_f! {
3228
3394
}
3229
3395
}
3230
3396
3397
+ cfg_if ! {
3398
+ if #[ cfg( not( any( freebsd10, freebsd11) ) ) ] {
3399
+ extern "C" {
3400
+ pub fn fhlink( fhp: * mut fhandle_t, to: * const :: c_char) -> :: c_int;
3401
+ pub fn fhlinkat( fhp: * mut fhandle_t, tofd: :: c_int, to: * const :: c_char) -> :: c_int;
3402
+ pub fn fhreadlink(
3403
+ fhp: * mut fhandle_t,
3404
+ buf: * mut :: c_char,
3405
+ bufsize: :: size_t,
3406
+ ) -> :: c_int;
3407
+ pub fn getfhat(
3408
+ fd: :: c_int,
3409
+ path: * mut :: c_char,
3410
+ fhp: * mut fhandle,
3411
+ flag: :: c_int,
3412
+ ) -> :: c_int;
3413
+ }
3414
+ }
3415
+ }
3416
+
3231
3417
extern "C" {
3232
3418
pub fn __error ( ) -> * mut :: c_int ;
3233
3419
@@ -3520,7 +3706,21 @@ extern "C" {
3520
3706
needlelen : :: size_t ,
3521
3707
) -> * mut :: c_void ;
3522
3708
3709
+ pub fn fhopen ( fhp : * const fhandle_t , flags : :: c_int ) -> :: c_int ;
3710
+ pub fn fhstat ( fhp : * const fhandle , buf : * mut :: stat ) -> :: c_int ;
3711
+ pub fn fhstatfs ( fhp : * const fhandle_t , buf : * mut :: statfs ) -> :: c_int ;
3712
+ pub fn getfh ( path : * const :: c_char , fhp : * mut fhandle_t ) -> :: c_int ;
3713
+ pub fn lgetfh ( path : * const :: c_char , fhp : * mut fhandle_t ) -> :: c_int ;
3714
+ pub fn getfsstat ( buf : * mut :: statfs , bufsize : :: c_long , mode : :: c_int ) -> :: c_int ;
3715
+ pub fn getmntinfo ( mntbufp : * mut * mut :: statfs , mode : :: c_int ) -> :: c_int ;
3716
+ pub fn mount (
3717
+ type_ : * const :: c_char ,
3718
+ dir : * const :: c_char ,
3719
+ flags : :: c_int ,
3720
+ data : * mut :: c_void ,
3721
+ ) -> :: c_int ;
3523
3722
pub fn nmount ( iov : * mut :: iovec , niov : :: c_uint , flags : :: c_int ) -> :: c_int ;
3723
+
3524
3724
pub fn setproctitle ( fmt : * const :: c_char , ...) ;
3525
3725
pub fn rfork ( flags : :: c_int ) -> :: c_int ;
3526
3726
pub fn cpuset_getaffinity (
0 commit comments