mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 11:11:27 +00:00
scst: Use kernel_{read,write}() instead of scst_{read,write}()
This patch does not change any functionality. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8065 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -452,6 +452,24 @@ kernel_read_backport(struct file *file, void *buf, size_t count, loff_t *pos)
|
|||||||
|
|
||||||
#define kernel_read(file, buf, count, pos) \
|
#define kernel_read(file, buf, count, pos) \
|
||||||
kernel_read_backport((file), (buf), (count), (pos))
|
kernel_read_backport((file), (buf), (count), (pos))
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
|
||||||
|
/*
|
||||||
|
* See also commit 7bb307e894d5 ("export kernel_write(), convert open-coded
|
||||||
|
* instances") # v3.9.
|
||||||
|
*/
|
||||||
|
static inline ssize_t
|
||||||
|
kernel_write_backport(struct file *file, const void *buf, size_t count,
|
||||||
|
loff_t *pos)
|
||||||
|
{
|
||||||
|
return kernel_write(file, buf, count, *pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define kernel_write kernel_write_backport
|
||||||
|
#else
|
||||||
|
ssize_t kernel_write(struct file *file, const void *buf, size_t count,
|
||||||
|
loff_t *pos);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* <linux/iocontext.h> */
|
/* <linux/iocontext.h> */
|
||||||
|
|||||||
@@ -5599,9 +5599,6 @@ struct scst_data_descriptor {
|
|||||||
uint64_t sdd_blocks;
|
uint64_t sdd_blocks;
|
||||||
};
|
};
|
||||||
|
|
||||||
ssize_t scst_read(struct file *file, void *buf, size_t count, loff_t *pos);
|
|
||||||
ssize_t scst_write(struct file *file, const void *buf, size_t count,
|
|
||||||
loff_t *pos);
|
|
||||||
ssize_t scst_readv(struct file *file, const struct iovec *vec,
|
ssize_t scst_readv(struct file *file, const struct iovec *vec,
|
||||||
unsigned long vlen, loff_t *pos);
|
unsigned long vlen, loff_t *pos);
|
||||||
ssize_t scst_writev(struct file *file, const struct iovec *vec,
|
ssize_t scst_writev(struct file *file, const struct iovec *vec,
|
||||||
|
|||||||
@@ -2995,21 +2995,6 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: Updates *@loff if reading succeeded. */
|
|
||||||
static ssize_t fileio_read_sync(struct file *fd, void *buf, size_t len,
|
|
||||||
loff_t *loff)
|
|
||||||
{
|
|
||||||
mm_segment_t old_fs;
|
|
||||||
ssize_t ret;
|
|
||||||
|
|
||||||
old_fs = get_fs();
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
ret = scst_read(fd, buf, len, loff);
|
|
||||||
set_fs(old_fs);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Note: Updates *@loff if reading succeeded except for NULLIO devices. */
|
/* Note: Updates *@loff if reading succeeded except for NULLIO devices. */
|
||||||
static ssize_t vdev_read_sync(struct scst_vdisk_dev *virt_dev, void *buf,
|
static ssize_t vdev_read_sync(struct scst_vdisk_dev *virt_dev, void *buf,
|
||||||
size_t len, loff_t *loff)
|
size_t len, loff_t *loff)
|
||||||
@@ -3027,7 +3012,7 @@ static ssize_t vdev_read_sync(struct scst_vdisk_dev *virt_dev, void *buf,
|
|||||||
}
|
}
|
||||||
return read;
|
return read;
|
||||||
} else {
|
} else {
|
||||||
return fileio_read_sync(virt_dev->fd, buf, len, loff);
|
return kernel_read(virt_dev->fd, buf, len, loff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5933,44 +5933,31 @@ static int scst_cmp_fs_ds(void)
|
|||||||
return memcmp(&fs, &ds, sizeof(fs));
|
return memcmp(&fs, &ds, sizeof(fs));
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t scst_read(struct file *file, void *buf, size_t count, loff_t *pos)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) && !defined(RHEL_MAJOR)
|
||||||
|
ssize_t kernel_write(struct file *file, const void *buf, size_t count,
|
||||||
|
loff_t *pos)
|
||||||
{
|
{
|
||||||
|
mm_segment_t old_fs = get_fs();
|
||||||
|
ssize_t result;
|
||||||
|
set_fs(KERNEL_DS);
|
||||||
|
{
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
|
||||||
struct iovec iov = {
|
struct iovec iov = {
|
||||||
.iov_base = (void __force __user *)buf,
|
.iov_base = (void __force __user *)buf,
|
||||||
.iov_len = count
|
.iov_len = count
|
||||||
};
|
};
|
||||||
|
|
||||||
WARN_ON_ONCE(scst_cmp_fs_ds() != 0);
|
result = scst_writev(file, &iov, 1, pos);
|
||||||
|
|
||||||
return scst_readv(file, &iov, 1, pos);
|
|
||||||
#else
|
#else
|
||||||
WARN_ON_ONCE(scst_cmp_fs_ds() != 0);
|
result = vfs_write(file, (void __force __user *)buf, count, pos);
|
||||||
|
|
||||||
return vfs_read(file, (void __force __user *)buf, count, pos);
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
set_fs(old_fs);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(scst_read);
|
EXPORT_SYMBOL(kernel_write);
|
||||||
|
|
||||||
ssize_t scst_write(struct file *file, const void *buf, size_t count,
|
|
||||||
loff_t *pos)
|
|
||||||
{
|
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)
|
|
||||||
struct iovec iov = {
|
|
||||||
.iov_base = (void __force __user *)buf,
|
|
||||||
.iov_len = count
|
|
||||||
};
|
|
||||||
|
|
||||||
WARN_ON_ONCE(scst_cmp_fs_ds() != 0);
|
|
||||||
|
|
||||||
return scst_writev(file, &iov, 1, pos);
|
|
||||||
#else
|
|
||||||
WARN_ON_ONCE(scst_cmp_fs_ds() != 0);
|
|
||||||
|
|
||||||
return vfs_write(file, (void __force __user *)buf, count, pos);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(scst_write);
|
|
||||||
|
|
||||||
ssize_t scst_readv(struct file *file, const struct iovec *vec,
|
ssize_t scst_readv(struct file *file, const struct iovec *vec,
|
||||||
unsigned long vlen, loff_t *pos)
|
unsigned long vlen, loff_t *pos)
|
||||||
@@ -15044,7 +15031,6 @@ int scst_copy_file(const char *src, const char *dest)
|
|||||||
loff_t file_size, pos;
|
loff_t file_size, pos;
|
||||||
uint8_t *buf = NULL;
|
uint8_t *buf = NULL;
|
||||||
struct file *file_src = NULL, *file_dest = NULL;
|
struct file *file_src = NULL, *file_dest = NULL;
|
||||||
mm_segment_t old_fs = get_fs();
|
|
||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
@@ -15057,8 +15043,6 @@ int scst_copy_file(const char *src, const char *dest)
|
|||||||
|
|
||||||
TRACE_DBG("Copying '%s' into '%s'", src, dest);
|
TRACE_DBG("Copying '%s' into '%s'", src, dest);
|
||||||
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
file_src = filp_open(src, O_RDONLY, 0);
|
file_src = filp_open(src, O_RDONLY, 0);
|
||||||
if (IS_ERR(file_src)) {
|
if (IS_ERR(file_src)) {
|
||||||
res = PTR_ERR(file_src);
|
res = PTR_ERR(file_src);
|
||||||
@@ -15083,7 +15067,6 @@ int scst_copy_file(const char *src, const char *dest)
|
|||||||
} else {
|
} else {
|
||||||
PRINT_ERROR("Invalid file mode 0x%x", inode->i_mode);
|
PRINT_ERROR("Invalid file mode 0x%x", inode->i_mode);
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
set_fs(old_fs);
|
|
||||||
goto out_skip;
|
goto out_skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15097,14 +15080,14 @@ int scst_copy_file(const char *src, const char *dest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
res = scst_read(file_src, buf, file_size, &pos);
|
res = kernel_read(file_src, buf, file_size, &pos);
|
||||||
if (res != file_size) {
|
if (res != file_size) {
|
||||||
PRINT_ERROR("Unable to read file '%s' - error %d", src, res);
|
PRINT_ERROR("Unable to read file '%s' - error %d", src, res);
|
||||||
goto out_skip;
|
goto out_skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
res = scst_write(file_dest, buf, file_size, &pos);
|
res = kernel_write(file_dest, buf, file_size, &pos);
|
||||||
if (res != file_size) {
|
if (res != file_size) {
|
||||||
PRINT_ERROR("Unable to write to '%s' - error %d", dest, res);
|
PRINT_ERROR("Unable to write to '%s' - error %d", dest, res);
|
||||||
goto out_skip;
|
goto out_skip;
|
||||||
@@ -15126,8 +15109,6 @@ out_free:
|
|||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
vfree(buf);
|
vfree(buf);
|
||||||
|
|
||||||
set_fs(old_fs);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
TRACE_EXIT_RES(res);
|
TRACE_EXIT_RES(res);
|
||||||
return res;
|
return res;
|
||||||
@@ -15174,7 +15155,6 @@ int scst_write_file_transactional(const char *name, const char *name1,
|
|||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
struct file *file;
|
struct file *file;
|
||||||
mm_segment_t old_fs = get_fs();
|
|
||||||
loff_t pos = 0;
|
loff_t pos = 0;
|
||||||
char n = '\n';
|
char n = '\n';
|
||||||
|
|
||||||
@@ -15184,8 +15164,6 @@ int scst_write_file_transactional(const char *name, const char *name1,
|
|||||||
if ((res != 0) && (res != -ENOENT))
|
if ((res != 0) && (res != -ENOENT))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
file = filp_open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
file = filp_open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
if (IS_ERR(file)) {
|
if (IS_ERR(file)) {
|
||||||
res = PTR_ERR(file);
|
res = PTR_ERR(file);
|
||||||
@@ -15198,7 +15176,7 @@ int scst_write_file_transactional(const char *name, const char *name1,
|
|||||||
|
|
||||||
pos = signature_len+1;
|
pos = signature_len+1;
|
||||||
|
|
||||||
res = scst_write(file, buf, size, &pos);
|
res = kernel_write(file, buf, size, &pos);
|
||||||
if (res != size)
|
if (res != size)
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
@@ -15209,11 +15187,11 @@ int scst_write_file_transactional(const char *name, const char *name1,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
res = scst_write(file, signature, signature_len, &pos);
|
res = kernel_write(file, signature, signature_len, &pos);
|
||||||
if (res != signature_len)
|
if (res != signature_len)
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
res = scst_write(file, &n, sizeof(n), &pos);
|
res = kernel_write(file, &n, sizeof(n), &pos);
|
||||||
if (res != sizeof(n))
|
if (res != sizeof(n))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
@@ -15228,8 +15206,6 @@ int scst_write_file_transactional(const char *name, const char *name1,
|
|||||||
filp_close(file, NULL);
|
filp_close(file, NULL);
|
||||||
|
|
||||||
out_set_fs:
|
out_set_fs:
|
||||||
set_fs(old_fs);
|
|
||||||
|
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
scst_remove_file(name1);
|
scst_remove_file(name1);
|
||||||
else
|
else
|
||||||
@@ -15257,13 +15233,9 @@ static int __scst_read_file_transactional(const char *file_name,
|
|||||||
struct file *file = NULL;
|
struct file *file = NULL;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
loff_t file_size, pos;
|
loff_t file_size, pos;
|
||||||
mm_segment_t old_fs;
|
|
||||||
|
|
||||||
TRACE_ENTRY();
|
TRACE_ENTRY();
|
||||||
|
|
||||||
old_fs = get_fs();
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
TRACE_DBG("Loading file '%s'", file_name);
|
TRACE_DBG("Loading file '%s'", file_name);
|
||||||
|
|
||||||
file = filp_open(file_name, O_RDONLY, 0);
|
file = filp_open(file_name, O_RDONLY, 0);
|
||||||
@@ -15295,7 +15267,7 @@ static int __scst_read_file_transactional(const char *file_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
res = scst_read(file, buf, file_size, &pos);
|
res = kernel_read(file, buf, file_size, &pos);
|
||||||
if (res != file_size) {
|
if (res != file_size) {
|
||||||
PRINT_ERROR("Unable to read file '%s' - error %d", file_name, res);
|
PRINT_ERROR("Unable to read file '%s' - error %d", file_name, res);
|
||||||
if (res > 0)
|
if (res > 0)
|
||||||
@@ -15313,8 +15285,6 @@ out_close:
|
|||||||
filp_close(file, NULL);
|
filp_close(file, NULL);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
set_fs(old_fs);
|
|
||||||
|
|
||||||
TRACE_EXIT_RES(res);
|
TRACE_EXIT_RES(res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -664,7 +664,6 @@ static int scst_pr_do_load_device_file(struct scst_device *dev,
|
|||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
loff_t file_size, pos, data_size;
|
loff_t file_size, pos, data_size;
|
||||||
uint64_t sign, version;
|
uint64_t sign, version;
|
||||||
mm_segment_t old_fs;
|
|
||||||
uint8_t pr_is_set, aptpl;
|
uint8_t pr_is_set, aptpl;
|
||||||
__be64 key;
|
__be64 key;
|
||||||
uint16_t rel_tgt_id;
|
uint16_t rel_tgt_id;
|
||||||
@@ -675,9 +674,6 @@ static int scst_pr_do_load_device_file(struct scst_device *dev,
|
|||||||
|
|
||||||
scst_pr_remove_registrants(dev);
|
scst_pr_remove_registrants(dev);
|
||||||
|
|
||||||
old_fs = get_fs();
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
TRACE_PR("Loading persistent file '%s'", file_name);
|
TRACE_PR("Loading persistent file '%s'", file_name);
|
||||||
|
|
||||||
file = filp_open(file_name, O_RDONLY, 0);
|
file = filp_open(file_name, O_RDONLY, 0);
|
||||||
@@ -715,7 +711,7 @@ static int scst_pr_do_load_device_file(struct scst_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pos = 0;
|
pos = 0;
|
||||||
rc = scst_read(file, buf, file_size, &pos);
|
rc = kernel_read(file, buf, file_size, &pos);
|
||||||
if (rc != file_size) {
|
if (rc != file_size) {
|
||||||
PRINT_ERROR("Unable to read file '%s' - error %d", file_name,
|
PRINT_ERROR("Unable to read file '%s' - error %d", file_name,
|
||||||
rc);
|
rc);
|
||||||
@@ -822,8 +818,6 @@ out:
|
|||||||
if (buf != NULL)
|
if (buf != NULL)
|
||||||
vfree(buf);
|
vfree(buf);
|
||||||
|
|
||||||
set_fs(old_fs);
|
|
||||||
|
|
||||||
TRACE_EXIT_RES(res);
|
TRACE_EXIT_RES(res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@@ -885,7 +879,6 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
struct file *file;
|
struct file *file;
|
||||||
mm_segment_t old_fs = get_fs();
|
|
||||||
loff_t pos = 0;
|
loff_t pos = 0;
|
||||||
uint64_t sign;
|
uint64_t sign;
|
||||||
uint64_t version;
|
uint64_t version;
|
||||||
@@ -903,14 +896,12 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
|
|
||||||
scst_copy_file(dev->pr_file_name, dev->pr_file_name1);
|
scst_copy_file(dev->pr_file_name, dev->pr_file_name1);
|
||||||
|
|
||||||
set_fs(KERNEL_DS);
|
|
||||||
|
|
||||||
file = filp_open(dev->pr_file_name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
file = filp_open(dev->pr_file_name, O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||||
if (IS_ERR(file)) {
|
if (IS_ERR(file)) {
|
||||||
res = PTR_ERR(file);
|
res = PTR_ERR(file);
|
||||||
PRINT_ERROR("Unable to (re)create PR file '%s' - error %d",
|
PRINT_ERROR("Unable to (re)create PR file '%s' - error %d",
|
||||||
dev->pr_file_name, res);
|
dev->pr_file_name, res);
|
||||||
goto out_set_fs;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE_PR("Updating pr file '%s'", dev->pr_file_name);
|
TRACE_PR("Updating pr file '%s'", dev->pr_file_name);
|
||||||
@@ -920,7 +911,7 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
*/
|
*/
|
||||||
sign = 0;
|
sign = 0;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
res = scst_write(file, &sign, sizeof(sign), &pos);
|
res = kernel_write(file, &sign, sizeof(sign), &pos);
|
||||||
if (res != sizeof(sign))
|
if (res != sizeof(sign))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
@@ -928,7 +919,7 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
* version
|
* version
|
||||||
*/
|
*/
|
||||||
version = SCST_PR_FILE_VERSION;
|
version = SCST_PR_FILE_VERSION;
|
||||||
res = scst_write(file, &version, sizeof(version), &pos);
|
res = kernel_write(file, &version, sizeof(version), &pos);
|
||||||
if (res != sizeof(version))
|
if (res != sizeof(version))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
@@ -936,7 +927,7 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
* APTPL
|
* APTPL
|
||||||
*/
|
*/
|
||||||
aptpl = dev->pr_aptpl;
|
aptpl = dev->pr_aptpl;
|
||||||
res = scst_write(file, &aptpl, sizeof(aptpl), &pos);
|
res = kernel_write(file, &aptpl, sizeof(aptpl), &pos);
|
||||||
if (res != sizeof(aptpl))
|
if (res != sizeof(aptpl))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
@@ -944,15 +935,15 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
* reservation
|
* reservation
|
||||||
*/
|
*/
|
||||||
pr_is_set = dev->pr_is_set;
|
pr_is_set = dev->pr_is_set;
|
||||||
res = scst_write(file, &pr_is_set, sizeof(pr_is_set), &pos);
|
res = kernel_write(file, &pr_is_set, sizeof(pr_is_set), &pos);
|
||||||
if (res != sizeof(pr_is_set))
|
if (res != sizeof(pr_is_set))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
res = scst_write(file, &dev->pr_type, sizeof(dev->pr_type), &pos);
|
res = kernel_write(file, &dev->pr_type, sizeof(dev->pr_type), &pos);
|
||||||
if (res != sizeof(dev->pr_type))
|
if (res != sizeof(dev->pr_type))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
res = scst_write(file, &dev->pr_scope, sizeof(dev->pr_scope), &pos);
|
res = kernel_write(file, &dev->pr_scope, sizeof(dev->pr_scope), &pos);
|
||||||
if (res != sizeof(dev->pr_scope))
|
if (res != sizeof(dev->pr_scope))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
@@ -966,24 +957,21 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
|
|
||||||
is_holder = (dev->pr_holder == reg);
|
is_holder = (dev->pr_holder == reg);
|
||||||
|
|
||||||
res = scst_write(file, &is_holder,
|
res = kernel_write(file, &is_holder, sizeof(is_holder), &pos);
|
||||||
sizeof(is_holder), &pos);
|
|
||||||
if (res != sizeof(is_holder))
|
if (res != sizeof(is_holder))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
size = scst_tid_size(reg->transport_id);
|
size = scst_tid_size(reg->transport_id);
|
||||||
res = scst_write(file, reg->transport_id,
|
res = kernel_write(file, reg->transport_id, size, &pos);
|
||||||
size, &pos);
|
|
||||||
if (res != size)
|
if (res != size)
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
res = scst_write(file, ®->key,
|
res = kernel_write(file, ®->key, sizeof(reg->key), &pos);
|
||||||
sizeof(reg->key), &pos);
|
|
||||||
if (res != sizeof(reg->key))
|
if (res != sizeof(reg->key))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
res = scst_write(file, ®->rel_tgt_id,
|
res = kernel_write(file, ®->rel_tgt_id,
|
||||||
sizeof(reg->rel_tgt_id), &pos);
|
sizeof(reg->rel_tgt_id), &pos);
|
||||||
if (res != sizeof(reg->rel_tgt_id))
|
if (res != sizeof(reg->rel_tgt_id))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
}
|
}
|
||||||
@@ -996,7 +984,7 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
|
|
||||||
sign = SCST_PR_FILE_SIGN;
|
sign = SCST_PR_FILE_SIGN;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
res = scst_write(file, &sign, sizeof(sign), &pos);
|
res = kernel_write(file, &sign, sizeof(sign), &pos);
|
||||||
if (res != sizeof(sign))
|
if (res != sizeof(sign))
|
||||||
goto write_error;
|
goto write_error;
|
||||||
|
|
||||||
@@ -1010,9 +998,6 @@ void scst_pr_sync_device_file(struct scst_device *dev)
|
|||||||
|
|
||||||
filp_close(file, NULL);
|
filp_close(file, NULL);
|
||||||
|
|
||||||
out_set_fs:
|
|
||||||
set_fs(old_fs);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (res != 0) {
|
if (res != 0) {
|
||||||
PRINT_CRIT_ERROR("Unable to save persistent information "
|
PRINT_CRIT_ERROR("Unable to save persistent information "
|
||||||
@@ -1057,7 +1042,7 @@ write_error_close:
|
|||||||
dev->pr_file_name, rc);
|
dev->pr_file_name, rc);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
goto out_set_fs;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user