#undef flag2str
static const char *obd_connect_names[] = {
+ /* flags names */
"read_only",
"lov_index",
"connect_from_mds",
"bulk_mbits",
"compact_obdo",
"second_flags",
+ /* flags2 names */
+ "file_secctx",
NULL
};
-static void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags, char *sep)
+static void obd_connect_seq_flags2str(struct seq_file *m, __u64 flags,
+ __u64 flags2, const char *sep)
{
bool first = true;
- __u64 mask = 1;
+ __u64 mask;
int i;
- for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+ for (i = 0, mask = 1; i < 64; i++, mask <<= 1) {
if (flags & mask) {
seq_printf(m, "%s%s",
first ? "" : sep, obd_connect_names[i]);
first = false;
}
}
- if (flags & ~(mask - 1))
+
+ if (flags & ~(mask - 1)) {
seq_printf(m, "%sunknown_"LPX64,
first ? "" : sep, flags & ~(mask - 1));
+ first = false;
+ }
+
+ if (!(flags & OBD_CONNECT_FLAGS2) || flags2 == 0)
+ return;
+
+ for (i = 64, mask = 1; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+ if (flags2 & mask) {
+ seq_printf(m, "%s%s",
+ first ? "" : sep, obd_connect_names[i]);
+ first = false;
+ }
+ }
+
+ if (flags2 & ~(mask - 1)) {
+ seq_printf(m, "%sunknown2_"LPX64,
+ first ? "" : sep, flags2 & ~(mask - 1));
+ first = false;
+ }
}
-int obd_connect_flags2str(char *page, int count, __u64 flags, char *sep)
+int obd_connect_flags2str(char *page, int count, __u64 flags, __u64 flags2,
+ const char *sep)
{
- __u64 mask = 1;
+ __u64 mask;
int i, ret = 0;
- for (i = 0; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+ for (i = 0, mask = 1; i < 64; i++, mask <<= 1) {
if (flags & mask)
ret += snprintf(page + ret, count - ret, "%s%s",
ret ? sep : "", obd_connect_names[i]);
}
+
if (flags & ~(mask - 1))
ret += snprintf(page + ret, count - ret,
"%sunknown_"LPX64,
ret ? sep : "", flags & ~(mask - 1));
+
+ if (!(flags & OBD_CONNECT_FLAGS2) || flags2 == 0)
+ return ret;
+
+ for (i = 64, mask = 1; obd_connect_names[i] != NULL; i++, mask <<= 1) {
+ if (flags2 & mask)
+ ret += snprintf(page + ret, count - ret, "%s%s",
+ ret ? sep : "", obd_connect_names[i]);
+ }
+
+ if (flags2 & ~(mask - 1))
+ ret += snprintf(page + ret, count - ret,
+ "%sunknown2_"LPX64,
+ ret ? sep : "", flags2 & ~(mask - 1));
+
return ret;
}
EXPORT_SYMBOL(obd_connect_flags2str);
obd2cli_tgt(obd),
ptlrpc_import_state_name(imp->imp_state));
obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags,
+ imp->imp_connect_data.ocd_connect_flags2,
", ");
seq_printf(m, " ]\n");
obd_connect_data_seqprint(m, ocd);
{
struct obd_device *obd = data;
__u64 flags;
+ __u64 flags2;
LPROCFS_CLIMP_CHECK(obd);
flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags;
+ flags2 = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags2;
seq_printf(m, "flags="LPX64"\n", flags);
- obd_connect_seq_flags2str(m, flags, "\n");
+ seq_printf(m, "flags2="LPX64"\n", flags2);
+ obd_connect_seq_flags2str(m, flags, flags2, "\n");
seq_printf(m, "\n");
LPROCFS_CLIMP_EXIT(obd);
return 0;
struct lprocfs_counter_header *hdr;
struct lprocfs_counter ctr;
int idx = *(loff_t *)v;
- int rc = 0;
if (idx == 0) {
struct timeval now;
do_gettimeofday(&now);
seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
"snapshot_time", now.tv_sec, now.tv_usec);
- if (rc < 0)
- return rc;
}
hdr = &stats->ls_cnt_header[idx];
lprocfs_stats_collect(stats, idx, &ctr);
if (ctr.lc_count == 0)
- goto out;
+ return 0;
seq_printf(p, "%-25s "LPD64" samples [%s]", hdr->lc_name,
ctr.lc_count, hdr->lc_units);
- if (rc < 0)
- goto out;
if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) && ctr.lc_count > 0) {
seq_printf(p, " "LPD64" "LPD64" "LPD64,
ctr.lc_min, ctr.lc_max, ctr.lc_sum);
- if (rc < 0)
- goto out;
if (hdr->lc_config & LPROCFS_CNTR_STDDEV)
seq_printf(p, " "LPD64, ctr.lc_sumsquare);
- if (rc < 0)
- goto out;
}
seq_putc(p, '\n');
-out:
- return (rc < 0) ? rc : 0;
+ return 0;
}
static const struct seq_operations lprocfs_stats_seq_sops = {
void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
{
- LPROCFS_MD_OP_INIT(num_private_stats, stats, getstatus);
+ LPROCFS_MD_OP_INIT(num_private_stats, stats, get_root);
LPROCFS_MD_OP_INIT(num_private_stats, stats, null_inode);
LPROCFS_MD_OP_INIT(num_private_stats, stats, close);
LPROCFS_MD_OP_INIT(num_private_stats, stats, create);
start = buffer;
while (*buffer) {
+ /* allow for a single new line before the null terminator */
+ if (*buffer == '\n') {
+ *buffer = '\0';
+ buffer++;
+
+ if (*buffer)
+ return -EINVAL;
+
+ break;
+ }
+
/* any chars after our unit indicates a malformed string */
if (hit_unit)
return -EINVAL;