disk_unblock_events(disk);
bdev_file->f_flags |= O_LARGEFILE;
- bdev_file->f_mode |= FMODE_BUF_RASYNC | FMODE_CAN_ODIRECT;
+ bdev_file->f_mode |= FMODE_CAN_ODIRECT;
if (bdev_nowait(bdev))
bdev_file->f_mode |= FMODE_NOWAIT;
+ if (mode & BLK_OPEN_RESTRICT_WRITES)
+ bdev_file->f_mode |= FMODE_WRITE_RESTRICTED;
bdev_file->f_mapping = bdev->bd_inode->i_mapping;
bdev_file->f_wb_err = filemap_sample_wb_err(bdev_file->f_mapping);
bdev_file->private_data = holder;
*/
/* file is open for reading */
- #define FMODE_READ ((__force fmode_t)0x1)
+ #define FMODE_READ ((__force fmode_t)(1 << 0))
/* file is open for writing */
- #define FMODE_WRITE ((__force fmode_t)0x2)
+ #define FMODE_WRITE ((__force fmode_t)(1 << 1))
/* file is seekable */
- #define FMODE_LSEEK ((__force fmode_t)0x4)
+ #define FMODE_LSEEK ((__force fmode_t)(1 << 2))
/* file can be accessed using pread */
- #define FMODE_PREAD ((__force fmode_t)0x8)
+ #define FMODE_PREAD ((__force fmode_t)(1 << 3))
/* file can be accessed using pwrite */
- #define FMODE_PWRITE ((__force fmode_t)0x10)
+ #define FMODE_PWRITE ((__force fmode_t)(1 << 4))
/* File is opened for execution with sys_execve / sys_uselib */
- #define FMODE_EXEC ((__force fmode_t)0x20)
+ #define FMODE_EXEC ((__force fmode_t)(1 << 5))
+/* File writes are restricted (block device specific) */
- #define FMODE_WRITE_RESTRICTED ((__force fmode_t)0x40)
++#define FMODE_WRITE_RESTRICTED ((__force fmode_t)(1 << 6))
+
-/* FMODE_* bits 6 to 8 */
++/* FMODE_* bits 7 to 8 */
+
/* 32bit hashes as llseek() offset (for directories) */
- #define FMODE_32BITHASH ((__force fmode_t)0x200)
+ #define FMODE_32BITHASH ((__force fmode_t)(1 << 9))
/* 64bit hashes as llseek() offset (for directories) */
- #define FMODE_64BITHASH ((__force fmode_t)0x400)
+ #define FMODE_64BITHASH ((__force fmode_t)(1 << 10))
/*
* Don't update ctime and mtime.