mirror of
https://github.com/versity/scoutfs-go.git
synced 2025-12-23 05:05:17 +00:00
SendDataWaitErr: send errors to task data waiters
This commit is contained in:
@@ -32,6 +32,7 @@ package scoutfs
|
||||
// typedef uint32_t __le32;
|
||||
// typedef uint64_t __le64;
|
||||
// typedef int32_t __s32;
|
||||
// typedef int64_t __s64;
|
||||
// #define __packed
|
||||
// #include "/usr/include/scoutfs/ioctl.h"
|
||||
// typedef struct scoutfs_ioctl_walk_inodes_entry scoutfs_ioctl_walk_inodes_entry_t;
|
||||
@@ -44,6 +45,7 @@ package scoutfs
|
||||
// typedef struct scoutfs_fid scoutfs_fid_t;
|
||||
// typedef struct scoutfs_ioctl_data_waiting_entry scoutfs_ioctl_data_waiting_entry_t;
|
||||
// typedef struct scoutfs_ioctl_data_waiting scoutfs_ioctl_data_waiting_t;
|
||||
// typedef struct scoutfs_ioctl_data_wait_err scoutfs_ioctl_data_wait_err_t;
|
||||
// typedef struct scoutfs_ioctl_setattr_more scoutfs_ioctl_setattr_more_t;
|
||||
// typedef struct scoutfs_ioctl_listxattr_hidden scoutfs_ioctl_listxattr_hidden_t;
|
||||
// typedef struct scoutfs_ioctl_find_xattrs scoutfs_ioctl_find_xattrs_t;
|
||||
@@ -60,6 +62,7 @@ const IOCSETATTRMORE = C.SCOUTFS_IOC_SETATTR_MORE
|
||||
const IOCLISTXATTRHIDDEN = C.SCOUTFS_IOC_LISTXATTR_HIDDEN
|
||||
const IOCFINDXATTRS = C.SCOUTFS_IOC_FIND_XATTRS
|
||||
const IOCSTATFSMORE = C.SCOUTFS_IOC_STATFS_MORE
|
||||
const IOCDATAWAITERR = C.SCOUTFS_IOC_DATA_WAIT_ERR
|
||||
|
||||
const QUERYINODESMETASEQ = C.SCOUTFS_IOC_WALK_INODES_META_SEQ
|
||||
const QUERYINODESDATASEQ = C.SCOUTFS_IOC_WALK_INODES_DATA_SEQ
|
||||
@@ -76,6 +79,7 @@ type iocStage C.scoutfs_ioctl_stage_t
|
||||
type Stat C.scoutfs_ioctl_stat_more_t
|
||||
type DataWaitingEntry C.scoutfs_ioctl_data_waiting_entry_t
|
||||
type dataWaiting C.scoutfs_ioctl_data_waiting_t
|
||||
type dataWaitErr C.scoutfs_ioctl_data_wait_err_t
|
||||
type setattrMore C.scoutfs_ioctl_setattr_more_t
|
||||
type listXattrHidden C.scoutfs_ioctl_listxattr_hidden_t
|
||||
type findXattrs C.scoutfs_ioctl_find_xattrs_t
|
||||
|
||||
21
scoutfs.go
21
scoutfs.go
@@ -399,6 +399,27 @@ func (w *Waiters) Reset() {
|
||||
w.iblock = 0
|
||||
}
|
||||
|
||||
// SendDataWaitErr sends an error to the data waiter task indicating that
|
||||
// the data is no longer aviable.
|
||||
// An open file within scoutfs is supplied for ioctls
|
||||
// (usually just the base mount point directory)
|
||||
func SendDataWaitErr(dirfd *os.File, ino, version, offset, op, count uint64, errno int64) error {
|
||||
derr := dataWaitErr{
|
||||
Ino: ino,
|
||||
Version: version,
|
||||
Offset: offset,
|
||||
Count: count,
|
||||
Op: op,
|
||||
Err: errno,
|
||||
}
|
||||
|
||||
_, err := scoutfsctl(dirfd, IOCDATAWAITERR, unsafe.Pointer(&derr))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// XattrQuery to keep track of in-process xattr query
|
||||
type XattrQuery struct {
|
||||
next uint64
|
||||
|
||||
@@ -13,6 +13,7 @@ const IOCSETATTRMORE = 0x40287307
|
||||
const IOCLISTXATTRHIDDEN = 0x80187308
|
||||
const IOCFINDXATTRS = 0x80207309
|
||||
const IOCSTATFSMORE = 0x8018730a
|
||||
const IOCDATAWAITERR = 0x8030730b
|
||||
|
||||
const QUERYINODESMETASEQ = 0x0
|
||||
const QUERYINODESDATASEQ = 0x1
|
||||
@@ -77,6 +78,14 @@ type dataWaiting struct {
|
||||
Ents_nr uint16
|
||||
X_pad [6]uint8
|
||||
}
|
||||
type dataWaitErr struct {
|
||||
Ino uint64
|
||||
Version uint64
|
||||
Offset uint64
|
||||
Count uint64
|
||||
Op uint64
|
||||
Err int64
|
||||
}
|
||||
type setattrMore struct {
|
||||
Data_version uint64
|
||||
I_size uint64
|
||||
|
||||
Reference in New Issue
Block a user