all: adapt to removal of get_ds()

See 736706bee3298208343a76096370e4f6a5c55915
This commit is contained in:
Thomas Schoebel-Theuer 2021-01-29 22:35:46 +01:00
parent 4b6163463d
commit d0c5b5699f
7 changed files with 29 additions and 28 deletions

View File

@ -383,7 +383,7 @@ struct say_channel *_make_channel(const char *name, bool must_exist)
int status;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
status = vfs_stat((char*)name, &kstat);
set_fs(oldfs);
@ -691,7 +691,8 @@ void out_to_file(struct file *file, char *buf, int len)
&log_pos);
#else
mm_segment_t oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
(void)vfs_write(file, buf, len, &log_pos);
set_fs(oldfs);
#endif
@ -772,7 +773,7 @@ void _rollover_channel(struct say_channel *ch)
}
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
#ifdef MARS_HAS_PREPATCH_V2
mars_rename(old, new);
#elif defined(MARS_HAS_PREPATCH)

View File

@ -242,7 +242,7 @@ struct mapfree_info *mapfree_get(const char *name, int flags, int *error)
mf->mf_max = -1;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
mf->mf_filp = filp_open(name, flags, prot);
set_fs(oldfs);

View File

@ -423,7 +423,7 @@ static int aio_submit(struct aio_output *output, struct aio_mref_aspect *mref_a,
}
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
latency = TIME_STATS(
this_timing,
#ifdef MARS_HAS_PREPATCH_V2
@ -466,7 +466,7 @@ static int aio_submit_dummy(struct aio_output *output)
struct iocb *iocbp = &iocb;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
#ifdef MARS_HAS_PREPATCH_V2
res = ksys_io_submit(output->ctxp, 1, &iocbp);
#else
@ -691,7 +691,7 @@ static int aio_event_thread(void *data)
#endif
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
/* TODO: don't timeout upon termination.
* Probably we should submit a dummy request.
*/
@ -809,7 +809,7 @@ void _destroy_ioctx(struct aio_output *output)
MARS_DBG("ioctx count = %d destroying %p\n", atomic_read(&ioctx_count), (void*)output->ctxp);
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
#ifdef MARS_HAS_PREPATCH_V2
err = ksys_io_destroy(output->ctxp);
#else
@ -951,7 +951,7 @@ int _create_ioctx(struct aio_output *output)
output->ctxp = 0;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
#ifdef MARS_HAS_PREPATCH_V2
err = ksys_io_setup(MARS_MAX_AIO, &output->ctxp);
#else

View File

@ -1048,7 +1048,7 @@ void _mars_log(char *buf, int len)
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
mutex_lock(&trace_lock);
vfs_write(mars_log_file, buf, len, &mars_log_pos);
@ -1182,7 +1182,7 @@ int __init init_mars(void)
int prot = 0600;
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
mars_log_file = filp_open("/mars/trace.csv", flags, prot);
set_fs(oldfs);
if (IS_ERR(mars_log_file)) {

View File

@ -175,7 +175,7 @@ int write_aops(struct sio_output *output, struct mref_object *mref)
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
ret = vfs_write(file, data, len, &pos);
set_fs(oldfs);
#else
@ -309,7 +309,7 @@ int read_aops(struct sio_output *output, struct mref_object *mref)
(void) sio_direct_splice_actor; // shut up gcc
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
ret = vfs_read(output->mf->mf_filp, mref->ref_data, len, &pos);
set_fs(oldfs);
#else

View File

@ -2615,7 +2615,7 @@ void touch_systemd_trigger(const char *filename)
"%lld.%09ld\n",
(s64)now.tv_sec, now.tv_nsec);
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
f = filp_open(filename, flags, prot);
if (!f || IS_ERR(f)) {
/* remove any .deleted symlink and try again */
@ -3924,7 +3924,7 @@ void _create_new_logfile(const char *path)
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
f = filp_open(path, flags, prot);
set_fs(oldfs);
if (IS_ERR(f)) {

View File

@ -530,7 +530,7 @@ bool mars_is_mountpoint(const char *pathname)
bool res = false;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
status = user_path_at(AT_FDCWD, pathname, 0, &path);
if (unlikely(status < 0)) {
@ -566,7 +566,7 @@ int mars_stat(const char *path, struct kstat *stat, bool use_lstat)
int status;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
if (use_lstat) {
status = vfs_lstat((char*)path, stat);
} else {
@ -588,7 +588,7 @@ void mars_sync(void)
mm_segment_t oldfs;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
f = filp_open("/mars", O_DIRECTORY | O_RDONLY, 0);
set_fs(oldfs);
if (unlikely(IS_ERR(f)))
@ -615,7 +615,7 @@ int mars_mkdir(const char *path)
int status;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
#ifdef MARS_HAS_PREPATCH
status = sys_mkdir(path, 0700);
#else
@ -634,7 +634,7 @@ int mars_rmdir(const char *path)
int status;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
status = sys_rmdir(path);
set_fs(oldfs);
@ -651,7 +651,7 @@ int mars_unlink(const char *path)
int status;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
#ifdef MARS_HAS_PREPATCH
status = sys_unlink(path);
#else
@ -687,7 +687,7 @@ int mars_symlink(const char *oldpath, const char *newpath,
#endif
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
status = vfs_lstat((char*)newpath, &stat);
@ -774,7 +774,7 @@ char *mars_readlink(const char *newpath, struct lamport_time *stamp)
int status = -ENOMEM;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
status = user_lpath(newpath, &path);
if (unlikely(status < 0)) {
@ -851,7 +851,7 @@ int mars_rename(const char *oldpath, const char *newpath)
int status;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
#ifdef MARS_HAS_PREPATCH
status = sys_rename(oldpath, newpath);
#else
@ -870,7 +870,7 @@ int mars_chmod(const char *path, mode_t mode)
int status;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
status = sys_chmod(path, mode);
set_fs(oldfs);
@ -914,7 +914,7 @@ void mars_remaining_space(const char *fspath, loff_t *total, loff_t *remaining)
*total = *remaining = 0;
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
res = user_path_at(AT_FDCWD, fspath, 0, &path);
@ -1346,7 +1346,7 @@ int get_inode(char *newpath, struct mars_dent *dent, bool get_deleted)
struct kstat tmp = {};
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
status = vfs_lstat(newpath, &tmp);
if (status < 0) {
@ -1885,7 +1885,7 @@ static int _mars_readdir(struct mars_cookie *cookie)
}
oldfs = get_fs();
set_fs(get_ds());
set_fs(KERNEL_DS);
f = filp_open(cookie->path, O_DIRECTORY | O_RDONLY, 0);
set_fs(oldfs);
if (unlikely(IS_ERR(f))) {