diff --git a/src/backends/native/meta-device-pool.c b/src/backends/native/meta-device-pool.c index ba1cdbaaa..f15ad90a3 100644 --- a/src/backends/native/meta-device-pool.c +++ b/src/backends/native/meta-device-pool.c @@ -43,6 +43,7 @@ struct _MetaDeviceFile int minor; int fd; MetaDeviceFileFlags flags; + uint32_t tags[META_DEVICE_FILE_N_TAGS]; }; struct _MetaDevicePool @@ -107,6 +108,22 @@ meta_device_file_get_path (MetaDeviceFile *device_file) return device_file->path; } +void +meta_device_file_tag (MetaDeviceFile *device_file, + MetaDeviceFileTags tag, + uint32_t value) +{ + device_file->tags[tag] |= value; +} + +uint32_t +meta_device_file_has_tag (MetaDeviceFile *device_file, + MetaDeviceFileTags tag, + uint32_t value) +{ + return (device_file->tags[tag] & value) == value; +} + static MetaDeviceFile * meta_device_file_acquire_locked (MetaDeviceFile *file) { diff --git a/src/backends/native/meta-device-pool.h b/src/backends/native/meta-device-pool.h index f37fc7302..083bc7b53 100644 --- a/src/backends/native/meta-device-pool.h +++ b/src/backends/native/meta-device-pool.h @@ -30,6 +30,11 @@ typedef enum _MetaDeviceFileFlags META_DEVICE_FILE_FLAG_READ_ONLY = 1 << 1, } MetaDeviceFileFlags; +typedef enum _MetaDeviceFileTags +{ + META_DEVICE_FILE_N_TAGS, +} MetaDeviceFileTags; + typedef struct _MetaDeviceFile MetaDeviceFile; typedef struct _MetaDevicePool MetaDevicePool; @@ -37,6 +42,14 @@ int meta_device_file_get_fd (MetaDeviceFile *device_file); const char * meta_device_file_get_path (MetaDeviceFile *device_file); +void meta_device_file_tag (MetaDeviceFile *device_file, + MetaDeviceFileTags tag, + uint32_t value); + +uint32_t meta_device_file_has_tag (MetaDeviceFile *device_file, + MetaDeviceFileTags tag, + uint32_t value); + MetaDeviceFile * meta_device_file_acquire (MetaDeviceFile *file); void meta_device_file_release (MetaDeviceFile *device_file);