trivial: Add FU_UDEV_DEVICE_FLAG_OPEN_SYNC for future code

This commit is contained in:
Richard Hughes 2021-11-04 14:46:08 +00:00
parent 0fb2ef3aae
commit 02222a58c8
2 changed files with 6 additions and 0 deletions

View File

@ -1248,6 +1248,10 @@ fu_udev_device_open(FuDevice *device, GError **error)
#ifdef O_NONBLOCK
if (priv->flags & FU_UDEV_DEVICE_FLAG_OPEN_NONBLOCK)
flags |= O_NONBLOCK;
#endif
#ifdef O_SYNC
if (priv->flags & FU_UDEV_DEVICE_FLAG_OPEN_SYNC)
flags |= O_SYNC;
#endif
priv->fd = g_open(priv->device_file, flags, 0);
if (priv->fd < 0) {

View File

@ -33,6 +33,7 @@ struct _FuUdevDeviceClass {
* @FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT: Get the vendor ID fallback from the parent
* @FU_UDEV_DEVICE_FLAG_USE_CONFIG: Read and write from the device config
* @FU_UDEV_DEVICE_FLAG_OPEN_NONBLOCK: Open nonblocking, e.g. O_NONBLOCK
* @FU_UDEV_DEVICE_FLAG_OPEN_SYNC: Open sync, e.g. O_SYNC
*
* Flags used when opening the device using fu_device_open().
**/
@ -43,6 +44,7 @@ typedef enum {
FU_UDEV_DEVICE_FLAG_VENDOR_FROM_PARENT = 1 << 2,
FU_UDEV_DEVICE_FLAG_USE_CONFIG = 1 << 3,
FU_UDEV_DEVICE_FLAG_OPEN_NONBLOCK = 1 << 4,
FU_UDEV_DEVICE_FLAG_OPEN_SYNC = 1 << 5,
/*< private >*/
FU_UDEV_DEVICE_FLAG_LAST
} FuUdevDeviceFlags;