137 |
dev_open (struct dev *dev) |
dev_open (struct dev *dev) |
138 |
{ |
{ |
139 |
error_t err; |
error_t err; |
140 |
|
const int flags = ((dev->readonly ? STORE_READONLY : 0) |
141 |
|
| (dev->no_fileio ? STORE_NO_FILEIO : 0)); |
142 |
|
|
143 |
assert (dev->store == 0); |
assert (dev->store == 0); |
144 |
|
|
146 |
{ |
{ |
147 |
/* This means we had no store arguments. |
/* This means we had no store arguments. |
148 |
We are to operate on our underlying node. */ |
We are to operate on our underlying node. */ |
149 |
err = store_create (storeio_fsys->underlying, |
err = store_create (storeio_fsys->underlying, flags, 0, &dev->store); |
|
dev->readonly ? STORE_READONLY : 0, |
|
|
0, &dev->store); |
|
150 |
} |
} |
151 |
else |
else |
152 |
/* Open based on the previously parsed store arguments. */ |
/* Open based on the previously parsed store arguments. */ |
153 |
err = store_parsed_open (dev->store_name, |
err = store_parsed_open (dev->store_name, flags, &dev->store); |
|
dev->readonly ? STORE_READONLY : 0, |
|
|
&dev->store); |
|
154 |
if (err) |
if (err) |
155 |
return err; |
return err; |
156 |
|
|
157 |
/* Inactivate the store, it will be activated at first access. |
/* Inactivate the store, it will be activated at first access. |
158 |
We ignore possible EINVAL here. XXX Pass STORE_INACTIVE to |
We ignore possible EINVAL here . XXX Pass STORE_INACTIVE to |
159 |
store_create/store_parsed_open instead when libstore is fixed |
store_create/store_parsed_open instead when libstore is fixed |
160 |
to support this. */ |
to support this. */ |
161 |
store_set_flags (dev->store, STORE_INACTIVE); |
store_set_flags (dev->store, STORE_INACTIVE); |