1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Add and use dev_open_readonly and variations.

This commit is contained in:
Alasdair Kergon 2011-05-24 13:36:57 +00:00
parent ba7d33be9c
commit 0b70507434
5 changed files with 21 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.86 -
=================================
Add and use dev_open_readonly and variations.
Do not log a superfluous stack message when the lv is properly processed.
Do not issue an error message when unable to remove .cache on read-only fs.
Avoid memlock size mismatch by preallocating stdio line buffers.

View File

@ -295,7 +295,7 @@ int read_config_file(struct config_tree *cft)
if (!(c->dev = dev_create_file(c->filename, NULL, NULL, 1)))
return_0;
if (!dev_open_flags(c->dev, O_RDONLY, 0, 0)) {
if (!dev_open_readonly_buffered(c->dev)) {
c->dev = 0;
return_0;
}

View File

@ -556,6 +556,21 @@ int dev_open(struct device *dev)
return dev_open_flags(dev, flags, 1, 0);
}
int dev_open_readonly(struct device *dev)
{
return dev_open_flags(dev, O_RDONLY, 1, 0);
}
int dev_open_readonly_buffered(struct device *dev)
{
return dev_open_flags(dev, O_RDONLY, 0, 0);
}
int dev_open_readonly_quiet(struct device *dev)
{
return dev_open_flags(dev, O_RDONLY, 1, 1);
}
int dev_test_excl(struct device *dev)
{
int flags;

View File

@ -74,6 +74,9 @@ int dev_discard_blocks(struct device *dev, uint64_t offset_bytes, uint64_t size_
int dev_open(struct device *dev);
int dev_open_quiet(struct device *dev);
int dev_open_flags(struct device *dev, int flags, int direct, int quiet);
int dev_open_readonly(struct device *dev);
int dev_open_readonly_buffered(struct device *dev);
int dev_open_readonly_quiet(struct device *dev);
int dev_close(struct device *dev);
int dev_close_immediate(struct device *dev);
void dev_close_all(void);

View File

@ -147,7 +147,7 @@ static int _passes_lvm_type_device_filter(struct dev_filter *f __attribute__((un
}
/* Check it's accessible */
if (!dev_open_flags(dev, O_RDONLY, 1, 1)) {
if (!dev_open_readonly_quiet(dev)) {
log_debug("%s: Skipping: open failed", name);
return 0;
}