Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ff40f9ae authored by Ilya Dryomov's avatar Ilya Dryomov
Browse files

libceph, ceph: split ceph_show_options()



Split ceph_show_options() into two pieces and move the piece
responsible for printing client (libceph) options into net/ceph.  This
way people adding a libceph option wouldn't have to remember to update
code in fs/ceph.

Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
parent d8a2c89c
Loading
Loading
Loading
Loading
+15 −25
Original line number Original line Diff line number Diff line
@@ -411,31 +411,20 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
{
{
	struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
	struct ceph_fs_client *fsc = ceph_sb_to_client(root->d_sb);
	struct ceph_mount_options *fsopt = fsc->mount_options;
	struct ceph_mount_options *fsopt = fsc->mount_options;
	struct ceph_options *opt = fsc->client->options;
	size_t pos;

	int ret;
	if (opt->flags & CEPH_OPT_FSID)

		seq_printf(m, ",fsid=%pU", &opt->fsid);
	/* a comma between MNT/MS and client options */
	if (opt->flags & CEPH_OPT_NOSHARE)
	seq_putc(m, ',');
		seq_puts(m, ",noshare");
	pos = m->count;
	if (opt->flags & CEPH_OPT_NOCRC)

		seq_puts(m, ",nocrc");
	ret = ceph_print_client_options(m, fsc->client);
	if (opt->flags & CEPH_OPT_NOMSGAUTH)
	if (ret)
		seq_puts(m, ",nocephx_require_signatures");
		return ret;
	if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0)

		seq_puts(m, ",notcp_nodelay");
	/* retract our comma if no client options */

	if (m->count == pos)
	if (opt->name)
		m->count--;
		seq_printf(m, ",name=%s", opt->name);
	if (opt->key)
		seq_puts(m, ",secret=<hidden>");

	if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
		seq_printf(m, ",mount_timeout=%d", opt->mount_timeout);
	if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT)
		seq_printf(m, ",osd_idle_ttl=%d", opt->osd_idle_ttl);
	if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT)
		seq_printf(m, ",osdkeepalivetimeout=%d",
			   opt->osd_keepalive_timeout);


	if (fsopt->flags & CEPH_MOUNT_OPT_DIRSTAT)
	if (fsopt->flags & CEPH_MOUNT_OPT_DIRSTAT)
		seq_puts(m, ",dirstat");
		seq_puts(m, ",dirstat");
@@ -482,6 +471,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
		seq_printf(m, ",readdir_max_bytes=%d", fsopt->max_readdir_bytes);
		seq_printf(m, ",readdir_max_bytes=%d", fsopt->max_readdir_bytes);
	if (strcmp(fsopt->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT))
	if (strcmp(fsopt->snapdir_name, CEPH_SNAPDIRNAME_DEFAULT))
		seq_printf(m, ",snapdirname=%s", fsopt->snapdir_name);
		seq_printf(m, ",snapdirname=%s", fsopt->snapdir_name);

	return 0;
	return 0;
}
}


+1 −0
Original line number Original line Diff line number Diff line
@@ -191,6 +191,7 @@ extern struct ceph_options *ceph_parse_options(char *options,
			      const char *dev_name, const char *dev_name_end,
			      const char *dev_name, const char *dev_name_end,
			      int (*parse_extra_token)(char *c, void *private),
			      int (*parse_extra_token)(char *c, void *private),
			      void *private);
			      void *private);
int ceph_print_client_options(struct seq_file *m, struct ceph_client *client);
extern void ceph_destroy_options(struct ceph_options *opt);
extern void ceph_destroy_options(struct ceph_options *opt);
extern int ceph_compare_options(struct ceph_options *new_opt,
extern int ceph_compare_options(struct ceph_options *new_opt,
				struct ceph_client *client);
				struct ceph_client *client);
+37 −0
Original line number Original line Diff line number Diff line
@@ -490,6 +490,43 @@ ceph_parse_options(char *options, const char *dev_name,
}
}
EXPORT_SYMBOL(ceph_parse_options);
EXPORT_SYMBOL(ceph_parse_options);


int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
{
	struct ceph_options *opt = client->options;
	size_t pos = m->count;

	if (opt->name)
		seq_printf(m, "name=%s,", opt->name);
	if (opt->key)
		seq_puts(m, "secret=<hidden>,");

	if (opt->flags & CEPH_OPT_FSID)
		seq_printf(m, "fsid=%pU,", &opt->fsid);
	if (opt->flags & CEPH_OPT_NOSHARE)
		seq_puts(m, "noshare,");
	if (opt->flags & CEPH_OPT_NOCRC)
		seq_puts(m, "nocrc,");
	if (opt->flags & CEPH_OPT_NOMSGAUTH)
		seq_puts(m, "nocephx_require_signatures,");
	if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0)
		seq_puts(m, "notcp_nodelay,");

	if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
		seq_printf(m, "mount_timeout=%d,", opt->mount_timeout);
	if (opt->osd_idle_ttl != CEPH_OSD_IDLE_TTL_DEFAULT)
		seq_printf(m, "osd_idle_ttl=%d,", opt->osd_idle_ttl);
	if (opt->osd_keepalive_timeout != CEPH_OSD_KEEPALIVE_DEFAULT)
		seq_printf(m, "osdkeepalivetimeout=%d,",
			   opt->osd_keepalive_timeout);

	/* drop redundant comma */
	if (m->count != pos)
		m->count--;

	return 0;
}
EXPORT_SYMBOL(ceph_print_client_options);

u64 ceph_client_id(struct ceph_client *client)
u64 ceph_client_id(struct ceph_client *client)
{
{
	return client->monc.auth->global_id;
	return client->monc.auth->global_id;