diff options
-rw-r--r-- | fs/orangefs/orangefs-sysfs.c | 465 |
1 files changed, 148 insertions, 317 deletions
diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c index 6cbc2468f5ba..2642cb2f26b2 100644 --- a/fs/orangefs/orangefs-sysfs.c +++ b/fs/orangefs/orangefs-sysfs.c | |||
@@ -141,9 +141,11 @@ | |||
141 | 141 | ||
142 | struct orangefs_attribute { | 142 | struct orangefs_attribute { |
143 | struct attribute attr; | 143 | struct attribute attr; |
144 | ssize_t (*show)(struct orangefs_attribute *attr, | 144 | ssize_t (*show)(struct kobject *kobj, |
145 | struct orangefs_attribute *attr, | ||
145 | char *buf); | 146 | char *buf); |
146 | ssize_t (*store)(struct orangefs_attribute *attr, | 147 | ssize_t (*store)(struct kobject *kobj, |
148 | struct orangefs_attribute *attr, | ||
147 | const char *buf, | 149 | const char *buf, |
148 | size_t count); | 150 | size_t count); |
149 | }; | 151 | }; |
@@ -162,7 +164,7 @@ static ssize_t orangefs_attr_show(struct kobject *kobj, | |||
162 | goto out; | 164 | goto out; |
163 | } | 165 | } |
164 | 166 | ||
165 | rc = attribute->show(attribute, buf); | 167 | rc = attribute->show(kobj, attribute, buf); |
166 | 168 | ||
167 | out: | 169 | out: |
168 | return rc; | 170 | return rc; |
@@ -186,7 +188,7 @@ static ssize_t orangefs_attr_store(struct kobject *kobj, | |||
186 | goto out; | 188 | goto out; |
187 | } | 189 | } |
188 | 190 | ||
189 | rc = attribute->store(attribute, buf, len); | 191 | rc = attribute->store(kobj, attribute, buf, len); |
190 | 192 | ||
191 | out: | 193 | out: |
192 | return rc; | 194 | return rc; |
@@ -225,35 +227,36 @@ static const struct sysfs_ops stats_orangefs_sysfs_ops = { | |||
225 | .show = orangefs_attr_show, | 227 | .show = orangefs_attr_show, |
226 | }; | 228 | }; |
227 | 229 | ||
228 | static ssize_t sysfs_int_show(char *kobj_id, char *buf, void *attr) | 230 | static ssize_t sysfs_int_show(struct kobject *kobj, |
231 | struct orangefs_attribute *attr, char *buf) | ||
229 | { | 232 | { |
230 | int rc = -EIO; | 233 | int rc = -EIO; |
231 | struct orangefs_attribute *orangefs_attr = attr; | ||
232 | 234 | ||
233 | gossip_debug(GOSSIP_SYSFS_DEBUG, "sysfs_int_show: id:%s:\n", kobj_id); | 235 | gossip_debug(GOSSIP_SYSFS_DEBUG, "sysfs_int_show: id:%s:\n", |
236 | kobj->name); | ||
234 | 237 | ||
235 | if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { | 238 | if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) { |
236 | if (!strcmp(orangefs_attr->attr.name, "op_timeout_secs")) { | 239 | if (!strcmp(attr->attr.name, "op_timeout_secs")) { |
237 | rc = scnprintf(buf, | 240 | rc = scnprintf(buf, |
238 | PAGE_SIZE, | 241 | PAGE_SIZE, |
239 | "%d\n", | 242 | "%d\n", |
240 | op_timeout_secs); | 243 | op_timeout_secs); |
241 | goto out; | 244 | goto out; |
242 | } else if (!strcmp(orangefs_attr->attr.name, | 245 | } else if (!strcmp(attr->attr.name, |
243 | "slot_timeout_secs")) { | 246 | "slot_timeout_secs")) { |
244 | rc = scnprintf(buf, | 247 | rc = scnprintf(buf, |
245 | PAGE_SIZE, | 248 | PAGE_SIZE, |
246 | "%d\n", | 249 | "%d\n", |
247 | slot_timeout_secs); | 250 | slot_timeout_secs); |
248 | goto out; | 251 | goto out; |
249 | } else if (!strcmp(orangefs_attr->attr.name, | 252 | } else if (!strcmp(attr->attr.name, |
250 | "dcache_timeout_msecs")) { | 253 | "dcache_timeout_msecs")) { |
251 | rc = scnprintf(buf, | 254 | rc = scnprintf(buf, |
252 | PAGE_SIZE, | 255 | PAGE_SIZE, |
253 | "%d\n", | 256 | "%d\n", |
254 | dcache_timeout_msecs); | 257 | dcache_timeout_msecs); |
255 | goto out; | 258 | goto out; |
256 | } else if (!strcmp(orangefs_attr->attr.name, | 259 | } else if (!strcmp(attr->attr.name, |
257 | "getattr_timeout_msecs")) { | 260 | "getattr_timeout_msecs")) { |
258 | rc = scnprintf(buf, | 261 | rc = scnprintf(buf, |
259 | PAGE_SIZE, | 262 | PAGE_SIZE, |
@@ -264,14 +267,14 @@ static ssize_t sysfs_int_show(char *kobj_id, char *buf, void *attr) | |||
264 | goto out; | 267 | goto out; |
265 | } | 268 | } |
266 | 269 | ||
267 | } else if (!strcmp(kobj_id, STATS_KOBJ_ID)) { | 270 | } else if (!strcmp(kobj->name, STATS_KOBJ_ID)) { |
268 | if (!strcmp(orangefs_attr->attr.name, "reads")) { | 271 | if (!strcmp(attr->attr.name, "reads")) { |
269 | rc = scnprintf(buf, | 272 | rc = scnprintf(buf, |
270 | PAGE_SIZE, | 273 | PAGE_SIZE, |
271 | "%lu\n", | 274 | "%lu\n", |
272 | g_orangefs_stats.reads); | 275 | g_orangefs_stats.reads); |
273 | goto out; | 276 | goto out; |
274 | } else if (!strcmp(orangefs_attr->attr.name, "writes")) { | 277 | } else if (!strcmp(attr->attr.name, "writes")) { |
275 | rc = scnprintf(buf, | 278 | rc = scnprintf(buf, |
276 | PAGE_SIZE, | 279 | PAGE_SIZE, |
277 | "%lu\n", | 280 | "%lu\n", |
@@ -287,42 +290,13 @@ out: | |||
287 | return rc; | 290 | return rc; |
288 | } | 291 | } |
289 | 292 | ||
290 | static ssize_t int_orangefs_show(struct orangefs_attribute *attr, | 293 | static ssize_t sysfs_int_store(struct kobject *kobj, |
291 | char *buf) | 294 | struct orangefs_attribute *attr, const char *buf, size_t count) |
292 | { | ||
293 | int rc; | ||
294 | |||
295 | gossip_debug(GOSSIP_SYSFS_DEBUG, | ||
296 | "int_orangefs_show:start attr->attr.name:%s:\n", | ||
297 | attr->attr.name); | ||
298 | |||
299 | rc = sysfs_int_show(ORANGEFS_KOBJ_ID, buf, (void *) attr); | ||
300 | |||
301 | return rc; | ||
302 | } | ||
303 | |||
304 | static ssize_t int_stats_show(struct orangefs_attribute *attr, | ||
305 | char *buf) | ||
306 | { | ||
307 | int rc; | ||
308 | |||
309 | gossip_debug(GOSSIP_SYSFS_DEBUG, | ||
310 | "int_stats_show:start attr->attr.name:%s:\n", | ||
311 | attr->attr.name); | ||
312 | |||
313 | rc = sysfs_int_show(STATS_KOBJ_ID, buf, (void *) attr); | ||
314 | |||
315 | return rc; | ||
316 | } | ||
317 | |||
318 | static ssize_t int_store(struct orangefs_attribute *attr, | ||
319 | const char *buf, | ||
320 | size_t count) | ||
321 | { | 295 | { |
322 | int rc = 0; | 296 | int rc = 0; |
323 | 297 | ||
324 | gossip_debug(GOSSIP_SYSFS_DEBUG, | 298 | gossip_debug(GOSSIP_SYSFS_DEBUG, |
325 | "int_store: start attr->attr.name:%s: buf:%s:\n", | 299 | "sysfs_int_store: start attr->attr.name:%s: buf:%s:\n", |
326 | attr->attr.name, buf); | 300 | attr->attr.name, buf); |
327 | 301 | ||
328 | if (!strcmp(attr->attr.name, "op_timeout_secs")) { | 302 | if (!strcmp(attr->attr.name, "op_timeout_secs")) { |
@@ -353,19 +327,19 @@ out: | |||
353 | /* | 327 | /* |
354 | * obtain attribute values from userspace with a service operation. | 328 | * obtain attribute values from userspace with a service operation. |
355 | */ | 329 | */ |
356 | static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) | 330 | static ssize_t sysfs_service_op_show(struct kobject *kobj, |
331 | struct orangefs_attribute *attr, char *buf) | ||
357 | { | 332 | { |
358 | struct orangefs_kernel_op_s *new_op = NULL; | 333 | struct orangefs_kernel_op_s *new_op = NULL; |
359 | int rc = 0; | 334 | int rc = 0; |
360 | char *ser_op_type = NULL; | 335 | char *ser_op_type = NULL; |
361 | struct orangefs_attribute *orangefs_attr = attr; | ||
362 | __u32 op_alloc_type; | 336 | __u32 op_alloc_type; |
363 | 337 | ||
364 | gossip_debug(GOSSIP_SYSFS_DEBUG, | 338 | gossip_debug(GOSSIP_SYSFS_DEBUG, |
365 | "sysfs_service_op_show: id:%s:\n", | 339 | "sysfs_service_op_show: id:%s:\n", |
366 | kobj_id); | 340 | kobj->name); |
367 | 341 | ||
368 | if (strcmp(kobj_id, PC_KOBJ_ID)) | 342 | if (strcmp(kobj->name, PC_KOBJ_ID)) |
369 | op_alloc_type = ORANGEFS_VFS_OP_PARAM; | 343 | op_alloc_type = ORANGEFS_VFS_OP_PARAM; |
370 | else | 344 | else |
371 | op_alloc_type = ORANGEFS_VFS_OP_PERF_COUNT; | 345 | op_alloc_type = ORANGEFS_VFS_OP_PERF_COUNT; |
@@ -383,126 +357,126 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) | |||
383 | goto out; | 357 | goto out; |
384 | } | 358 | } |
385 | 359 | ||
386 | if (strcmp(kobj_id, PC_KOBJ_ID)) | 360 | if (strcmp(kobj->name, PC_KOBJ_ID)) |
387 | new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_GET; | 361 | new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_GET; |
388 | 362 | ||
389 | if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { | 363 | if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) { |
390 | if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) | 364 | if (!strcmp(attr->attr.name, "perf_history_size")) |
391 | new_op->upcall.req.param.op = | 365 | new_op->upcall.req.param.op = |
392 | ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE; | 366 | ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE; |
393 | else if (!strcmp(orangefs_attr->attr.name, | 367 | else if (!strcmp(attr->attr.name, |
394 | "perf_time_interval_secs")) | 368 | "perf_time_interval_secs")) |
395 | new_op->upcall.req.param.op = | 369 | new_op->upcall.req.param.op = |
396 | ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS; | 370 | ORANGEFS_PARAM_REQUEST_OP_PERF_TIME_INTERVAL_SECS; |
397 | else if (!strcmp(orangefs_attr->attr.name, | 371 | else if (!strcmp(attr->attr.name, |
398 | "perf_counter_reset")) | 372 | "perf_counter_reset")) |
399 | new_op->upcall.req.param.op = | 373 | new_op->upcall.req.param.op = |
400 | ORANGEFS_PARAM_REQUEST_OP_PERF_RESET; | 374 | ORANGEFS_PARAM_REQUEST_OP_PERF_RESET; |
401 | 375 | ||
402 | else if (!strcmp(orangefs_attr->attr.name, | 376 | else if (!strcmp(attr->attr.name, |
403 | "readahead_count")) | 377 | "readahead_count")) |
404 | new_op->upcall.req.param.op = | 378 | new_op->upcall.req.param.op = |
405 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT; | 379 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT; |
406 | 380 | ||
407 | else if (!strcmp(orangefs_attr->attr.name, | 381 | else if (!strcmp(attr->attr.name, |
408 | "readahead_size")) | 382 | "readahead_size")) |
409 | new_op->upcall.req.param.op = | 383 | new_op->upcall.req.param.op = |
410 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE; | 384 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_SIZE; |
411 | 385 | ||
412 | else if (!strcmp(orangefs_attr->attr.name, | 386 | else if (!strcmp(attr->attr.name, |
413 | "readahead_count_size")) | 387 | "readahead_count_size")) |
414 | new_op->upcall.req.param.op = | 388 | new_op->upcall.req.param.op = |
415 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE; | 389 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE; |
416 | } else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) { | 390 | } else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) { |
417 | if (!strcmp(orangefs_attr->attr.name, "timeout_msecs")) | 391 | if (!strcmp(attr->attr.name, "timeout_msecs")) |
418 | new_op->upcall.req.param.op = | 392 | new_op->upcall.req.param.op = |
419 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS; | 393 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS; |
420 | 394 | ||
421 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) | 395 | if (!strcmp(attr->attr.name, "hard_limit")) |
422 | new_op->upcall.req.param.op = | 396 | new_op->upcall.req.param.op = |
423 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT; | 397 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT; |
424 | 398 | ||
425 | if (!strcmp(orangefs_attr->attr.name, "soft_limit")) | 399 | if (!strcmp(attr->attr.name, "soft_limit")) |
426 | new_op->upcall.req.param.op = | 400 | new_op->upcall.req.param.op = |
427 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT; | 401 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT; |
428 | 402 | ||
429 | if (!strcmp(orangefs_attr->attr.name, "reclaim_percentage")) | 403 | if (!strcmp(attr->attr.name, "reclaim_percentage")) |
430 | new_op->upcall.req.param.op = | 404 | new_op->upcall.req.param.op = |
431 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE; | 405 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_RECLAIM_PERCENTAGE; |
432 | 406 | ||
433 | } else if (!strcmp(kobj_id, CAPCACHE_KOBJ_ID)) { | 407 | } else if (!strcmp(kobj->name, CAPCACHE_KOBJ_ID)) { |
434 | if (!strcmp(orangefs_attr->attr.name, "timeout_secs")) | 408 | if (!strcmp(attr->attr.name, "timeout_secs")) |
435 | new_op->upcall.req.param.op = | 409 | new_op->upcall.req.param.op = |
436 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS; | 410 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS; |
437 | 411 | ||
438 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) | 412 | if (!strcmp(attr->attr.name, "hard_limit")) |
439 | new_op->upcall.req.param.op = | 413 | new_op->upcall.req.param.op = |
440 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT; | 414 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT; |
441 | 415 | ||
442 | if (!strcmp(orangefs_attr->attr.name, "soft_limit")) | 416 | if (!strcmp(attr->attr.name, "soft_limit")) |
443 | new_op->upcall.req.param.op = | 417 | new_op->upcall.req.param.op = |
444 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT; | 418 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT; |
445 | 419 | ||
446 | if (!strcmp(orangefs_attr->attr.name, "reclaim_percentage")) | 420 | if (!strcmp(attr->attr.name, "reclaim_percentage")) |
447 | new_op->upcall.req.param.op = | 421 | new_op->upcall.req.param.op = |
448 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE; | 422 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_RECLAIM_PERCENTAGE; |
449 | 423 | ||
450 | } else if (!strcmp(kobj_id, CCACHE_KOBJ_ID)) { | 424 | } else if (!strcmp(kobj->name, CCACHE_KOBJ_ID)) { |
451 | if (!strcmp(orangefs_attr->attr.name, "timeout_secs")) | 425 | if (!strcmp(attr->attr.name, "timeout_secs")) |
452 | new_op->upcall.req.param.op = | 426 | new_op->upcall.req.param.op = |
453 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS; | 427 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS; |
454 | 428 | ||
455 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) | 429 | if (!strcmp(attr->attr.name, "hard_limit")) |
456 | new_op->upcall.req.param.op = | 430 | new_op->upcall.req.param.op = |
457 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT; | 431 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT; |
458 | 432 | ||
459 | if (!strcmp(orangefs_attr->attr.name, "soft_limit")) | 433 | if (!strcmp(attr->attr.name, "soft_limit")) |
460 | new_op->upcall.req.param.op = | 434 | new_op->upcall.req.param.op = |
461 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT; | 435 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT; |
462 | 436 | ||
463 | if (!strcmp(orangefs_attr->attr.name, "reclaim_percentage")) | 437 | if (!strcmp(attr->attr.name, "reclaim_percentage")) |
464 | new_op->upcall.req.param.op = | 438 | new_op->upcall.req.param.op = |
465 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE; | 439 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_RECLAIM_PERCENTAGE; |
466 | 440 | ||
467 | } else if (!strcmp(kobj_id, NCACHE_KOBJ_ID)) { | 441 | } else if (!strcmp(kobj->name, NCACHE_KOBJ_ID)) { |
468 | if (!strcmp(orangefs_attr->attr.name, "timeout_msecs")) | 442 | if (!strcmp(attr->attr.name, "timeout_msecs")) |
469 | new_op->upcall.req.param.op = | 443 | new_op->upcall.req.param.op = |
470 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS; | 444 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS; |
471 | 445 | ||
472 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) | 446 | if (!strcmp(attr->attr.name, "hard_limit")) |
473 | new_op->upcall.req.param.op = | 447 | new_op->upcall.req.param.op = |
474 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT; | 448 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT; |
475 | 449 | ||
476 | if (!strcmp(orangefs_attr->attr.name, "soft_limit")) | 450 | if (!strcmp(attr->attr.name, "soft_limit")) |
477 | new_op->upcall.req.param.op = | 451 | new_op->upcall.req.param.op = |
478 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT; | 452 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT; |
479 | 453 | ||
480 | if (!strcmp(orangefs_attr->attr.name, "reclaim_percentage")) | 454 | if (!strcmp(attr->attr.name, "reclaim_percentage")) |
481 | new_op->upcall.req.param.op = | 455 | new_op->upcall.req.param.op = |
482 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE; | 456 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_RECLAIM_PERCENTAGE; |
483 | 457 | ||
484 | } else if (!strcmp(kobj_id, PC_KOBJ_ID)) { | 458 | } else if (!strcmp(kobj->name, PC_KOBJ_ID)) { |
485 | if (!strcmp(orangefs_attr->attr.name, ACACHE_KOBJ_ID)) | 459 | if (!strcmp(attr->attr.name, ACACHE_KOBJ_ID)) |
486 | new_op->upcall.req.perf_count.type = | 460 | new_op->upcall.req.perf_count.type = |
487 | ORANGEFS_PERF_COUNT_REQUEST_ACACHE; | 461 | ORANGEFS_PERF_COUNT_REQUEST_ACACHE; |
488 | 462 | ||
489 | if (!strcmp(orangefs_attr->attr.name, CAPCACHE_KOBJ_ID)) | 463 | if (!strcmp(attr->attr.name, CAPCACHE_KOBJ_ID)) |
490 | new_op->upcall.req.perf_count.type = | 464 | new_op->upcall.req.perf_count.type = |
491 | ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE; | 465 | ORANGEFS_PERF_COUNT_REQUEST_CAPCACHE; |
492 | 466 | ||
493 | if (!strcmp(orangefs_attr->attr.name, NCACHE_KOBJ_ID)) | 467 | if (!strcmp(attr->attr.name, NCACHE_KOBJ_ID)) |
494 | new_op->upcall.req.perf_count.type = | 468 | new_op->upcall.req.perf_count.type = |
495 | ORANGEFS_PERF_COUNT_REQUEST_NCACHE; | 469 | ORANGEFS_PERF_COUNT_REQUEST_NCACHE; |
496 | 470 | ||
497 | } else { | 471 | } else { |
498 | gossip_err("sysfs_service_op_show: unknown kobj_id:%s:\n", | 472 | gossip_err("sysfs_service_op_show: unknown kobj_id:%s:\n", |
499 | kobj_id); | 473 | kobj->name); |
500 | rc = -EINVAL; | 474 | rc = -EINVAL; |
501 | goto out; | 475 | goto out; |
502 | } | 476 | } |
503 | 477 | ||
504 | 478 | ||
505 | if (strcmp(kobj_id, PC_KOBJ_ID)) | 479 | if (strcmp(kobj->name, PC_KOBJ_ID)) |
506 | ser_op_type = "orangefs_param"; | 480 | ser_op_type = "orangefs_param"; |
507 | else | 481 | else |
508 | ser_op_type = "orangefs_perf_count"; | 482 | ser_op_type = "orangefs_perf_count"; |
@@ -515,7 +489,7 @@ static int sysfs_service_op_show(char *kobj_id, char *buf, void *attr) | |||
515 | 489 | ||
516 | out: | 490 | out: |
517 | if (!rc) { | 491 | if (!rc) { |
518 | if (strcmp(kobj_id, PC_KOBJ_ID)) { | 492 | if (strcmp(kobj->name, PC_KOBJ_ID)) { |
519 | if (new_op->upcall.req.param.op == | 493 | if (new_op->upcall.req.param.op == |
520 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) { | 494 | ORANGEFS_PARAM_REQUEST_OP_READAHEAD_COUNT_SIZE) { |
521 | rc = scnprintf(buf, PAGE_SIZE, "%d %d\n", | 495 | rc = scnprintf(buf, PAGE_SIZE, "%d %d\n", |
@@ -542,69 +516,6 @@ out: | |||
542 | 516 | ||
543 | } | 517 | } |
544 | 518 | ||
545 | static ssize_t service_orangefs_show(struct orangefs_attribute *attr, | ||
546 | char *buf) | ||
547 | { | ||
548 | int rc = 0; | ||
549 | |||
550 | rc = sysfs_service_op_show(ORANGEFS_KOBJ_ID, buf, (void *)attr); | ||
551 | |||
552 | return rc; | ||
553 | } | ||
554 | |||
555 | static ssize_t | ||
556 | service_acache_show(struct orangefs_attribute *attr, | ||
557 | char *buf) | ||
558 | { | ||
559 | int rc = 0; | ||
560 | |||
561 | rc = sysfs_service_op_show(ACACHE_KOBJ_ID, buf, (void *)attr); | ||
562 | |||
563 | return rc; | ||
564 | } | ||
565 | |||
566 | static ssize_t service_capcache_show(struct orangefs_attribute *attr, | ||
567 | char *buf) | ||
568 | { | ||
569 | int rc = 0; | ||
570 | |||
571 | rc = sysfs_service_op_show(CAPCACHE_KOBJ_ID, buf, (void *)attr); | ||
572 | |||
573 | return rc; | ||
574 | } | ||
575 | |||
576 | static ssize_t service_ccache_show(struct orangefs_attribute *attr, | ||
577 | char *buf) | ||
578 | { | ||
579 | int rc = 0; | ||
580 | |||
581 | rc = sysfs_service_op_show(CCACHE_KOBJ_ID, buf, (void *)attr); | ||
582 | |||
583 | return rc; | ||
584 | } | ||
585 | |||
586 | static ssize_t | ||
587 | service_ncache_show(struct orangefs_attribute *attr, | ||
588 | char *buf) | ||
589 | { | ||
590 | int rc = 0; | ||
591 | |||
592 | rc = sysfs_service_op_show(NCACHE_KOBJ_ID, buf, (void *)attr); | ||
593 | |||
594 | return rc; | ||
595 | } | ||
596 | |||
597 | static ssize_t | ||
598 | service_pc_show(struct orangefs_attribute *attr, | ||
599 | char *buf) | ||
600 | { | ||
601 | int rc = 0; | ||
602 | |||
603 | rc = sysfs_service_op_show(PC_KOBJ_ID, buf, (void *)attr); | ||
604 | |||
605 | return rc; | ||
606 | } | ||
607 | |||
608 | /* | 519 | /* |
609 | * pass attribute values back to userspace with a service operation. | 520 | * pass attribute values back to userspace with a service operation. |
610 | * | 521 | * |
@@ -616,16 +527,16 @@ static ssize_t | |||
616 | * We want to return 1 if we think everything went OK, and | 527 | * We want to return 1 if we think everything went OK, and |
617 | * EINVAL if not. | 528 | * EINVAL if not. |
618 | */ | 529 | */ |
619 | static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | 530 | static ssize_t sysfs_service_op_store(struct kobject *kobj, |
531 | struct orangefs_attribute *attr, const char *buf, size_t count) | ||
620 | { | 532 | { |
621 | struct orangefs_kernel_op_s *new_op = NULL; | 533 | struct orangefs_kernel_op_s *new_op = NULL; |
622 | int val = 0; | 534 | int val = 0; |
623 | int rc = 0; | 535 | int rc = 0; |
624 | struct orangefs_attribute *orangefs_attr = attr; | ||
625 | 536 | ||
626 | gossip_debug(GOSSIP_SYSFS_DEBUG, | 537 | gossip_debug(GOSSIP_SYSFS_DEBUG, |
627 | "sysfs_service_op_store: id:%s:\n", | 538 | "sysfs_service_op_store: id:%s:\n", |
628 | kobj_id); | 539 | kobj->name); |
629 | 540 | ||
630 | new_op = op_alloc(ORANGEFS_VFS_OP_PARAM); | 541 | new_op = op_alloc(ORANGEFS_VFS_OP_PARAM); |
631 | if (!new_op) | 542 | if (!new_op) |
@@ -644,9 +555,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
644 | * The value we want to send back to userspace is in buf, unless this | 555 | * The value we want to send back to userspace is in buf, unless this |
645 | * there are two parameters, which is specially handled below. | 556 | * there are two parameters, which is specially handled below. |
646 | */ | 557 | */ |
647 | if (strcmp(kobj_id, ORANGEFS_KOBJ_ID) || | 558 | if (strcmp(kobj->name, ORANGEFS_KOBJ_ID) || |
648 | strcmp(((struct orangefs_attribute *)attr)->attr.name, | 559 | strcmp(attr->attr.name, "readahead_count_size")) { |
649 | "readahead_count_size")) { | ||
650 | rc = kstrtoint(buf, 0, &val); | 560 | rc = kstrtoint(buf, 0, &val); |
651 | if (rc) | 561 | if (rc) |
652 | goto out; | 562 | goto out; |
@@ -654,8 +564,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
654 | 564 | ||
655 | new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET; | 565 | new_op->upcall.req.param.type = ORANGEFS_PARAM_REQUEST_SET; |
656 | 566 | ||
657 | if (!strcmp(kobj_id, ORANGEFS_KOBJ_ID)) { | 567 | if (!strcmp(kobj->name, ORANGEFS_KOBJ_ID)) { |
658 | if (!strcmp(orangefs_attr->attr.name, "perf_history_size")) { | 568 | if (!strcmp(attr->attr.name, "perf_history_size")) { |
659 | if (val > 0) { | 569 | if (val > 0) { |
660 | new_op->upcall.req.param.op = | 570 | new_op->upcall.req.param.op = |
661 | ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE; | 571 | ORANGEFS_PARAM_REQUEST_OP_PERF_HISTORY_SIZE; |
@@ -663,7 +573,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
663 | rc = 0; | 573 | rc = 0; |
664 | goto out; | 574 | goto out; |
665 | } | 575 | } |
666 | } else if (!strcmp(orangefs_attr->attr.name, | 576 | } else if (!strcmp(attr->attr.name, |
667 | "perf_time_interval_secs")) { | 577 | "perf_time_interval_secs")) { |
668 | if (val > 0) { | 578 | if (val > 0) { |
669 | new_op->upcall.req.param.op = | 579 | new_op->upcall.req.param.op = |
@@ -672,7 +582,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
672 | rc = 0; | 582 | rc = 0; |
673 | goto out; | 583 | goto out; |
674 | } | 584 | } |
675 | } else if (!strcmp(orangefs_attr->attr.name, | 585 | } else if (!strcmp(attr->attr.name, |
676 | "perf_counter_reset")) { | 586 | "perf_counter_reset")) { |
677 | if ((val == 0) || (val == 1)) { | 587 | if ((val == 0) || (val == 1)) { |
678 | new_op->upcall.req.param.op = | 588 | new_op->upcall.req.param.op = |
@@ -681,7 +591,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
681 | rc = 0; | 591 | rc = 0; |
682 | goto out; | 592 | goto out; |
683 | } | 593 | } |
684 | } else if (!strcmp(orangefs_attr->attr.name, | 594 | } else if (!strcmp(attr->attr.name, |
685 | "readahead_count")) { | 595 | "readahead_count")) { |
686 | if ((val >= 0)) { | 596 | if ((val >= 0)) { |
687 | new_op->upcall.req.param.op = | 597 | new_op->upcall.req.param.op = |
@@ -690,7 +600,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
690 | rc = 0; | 600 | rc = 0; |
691 | goto out; | 601 | goto out; |
692 | } | 602 | } |
693 | } else if (!strcmp(orangefs_attr->attr.name, | 603 | } else if (!strcmp(attr->attr.name, |
694 | "readahead_size")) { | 604 | "readahead_size")) { |
695 | if ((val >= 0)) { | 605 | if ((val >= 0)) { |
696 | new_op->upcall.req.param.op = | 606 | new_op->upcall.req.param.op = |
@@ -699,7 +609,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
699 | rc = 0; | 609 | rc = 0; |
700 | goto out; | 610 | goto out; |
701 | } | 611 | } |
702 | } else if (!strcmp(orangefs_attr->attr.name, | 612 | } else if (!strcmp(attr->attr.name, |
703 | "readahead_count_size")) { | 613 | "readahead_count_size")) { |
704 | int val1, val2; | 614 | int val1, val2; |
705 | rc = sscanf(buf, "%d %d", &val1, &val2); | 615 | rc = sscanf(buf, "%d %d", &val1, &val2); |
@@ -717,7 +627,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
717 | new_op->upcall.req.param.u.value32[0] = val1; | 627 | new_op->upcall.req.param.u.value32[0] = val1; |
718 | new_op->upcall.req.param.u.value32[1] = val2; | 628 | new_op->upcall.req.param.u.value32[1] = val2; |
719 | goto value_set; | 629 | goto value_set; |
720 | } else if (!strcmp(orangefs_attr->attr.name, | 630 | } else if (!strcmp(attr->attr.name, |
721 | "perf_counter_reset")) { | 631 | "perf_counter_reset")) { |
722 | if ((val > 0)) { | 632 | if ((val > 0)) { |
723 | new_op->upcall.req.param.op = | 633 | new_op->upcall.req.param.op = |
@@ -728,8 +638,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
728 | } | 638 | } |
729 | } | 639 | } |
730 | 640 | ||
731 | } else if (!strcmp(kobj_id, ACACHE_KOBJ_ID)) { | 641 | } else if (!strcmp(kobj->name, ACACHE_KOBJ_ID)) { |
732 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) { | 642 | if (!strcmp(attr->attr.name, "hard_limit")) { |
733 | if (val > -1) { | 643 | if (val > -1) { |
734 | new_op->upcall.req.param.op = | 644 | new_op->upcall.req.param.op = |
735 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT; | 645 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_HARD_LIMIT; |
@@ -737,7 +647,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
737 | rc = 0; | 647 | rc = 0; |
738 | goto out; | 648 | goto out; |
739 | } | 649 | } |
740 | } else if (!strcmp(orangefs_attr->attr.name, "soft_limit")) { | 650 | } else if (!strcmp(attr->attr.name, "soft_limit")) { |
741 | if (val > -1) { | 651 | if (val > -1) { |
742 | new_op->upcall.req.param.op = | 652 | new_op->upcall.req.param.op = |
743 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT; | 653 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_SOFT_LIMIT; |
@@ -745,7 +655,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
745 | rc = 0; | 655 | rc = 0; |
746 | goto out; | 656 | goto out; |
747 | } | 657 | } |
748 | } else if (!strcmp(orangefs_attr->attr.name, | 658 | } else if (!strcmp(attr->attr.name, |
749 | "reclaim_percentage")) { | 659 | "reclaim_percentage")) { |
750 | if ((val > -1) && (val < 101)) { | 660 | if ((val > -1) && (val < 101)) { |
751 | new_op->upcall.req.param.op = | 661 | new_op->upcall.req.param.op = |
@@ -754,7 +664,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
754 | rc = 0; | 664 | rc = 0; |
755 | goto out; | 665 | goto out; |
756 | } | 666 | } |
757 | } else if (!strcmp(orangefs_attr->attr.name, "timeout_msecs")) { | 667 | } else if (!strcmp(attr->attr.name, "timeout_msecs")) { |
758 | if (val > -1) { | 668 | if (val > -1) { |
759 | new_op->upcall.req.param.op = | 669 | new_op->upcall.req.param.op = |
760 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS; | 670 | ORANGEFS_PARAM_REQUEST_OP_ACACHE_TIMEOUT_MSECS; |
@@ -764,8 +674,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
764 | } | 674 | } |
765 | } | 675 | } |
766 | 676 | ||
767 | } else if (!strcmp(kobj_id, CAPCACHE_KOBJ_ID)) { | 677 | } else if (!strcmp(kobj->name, CAPCACHE_KOBJ_ID)) { |
768 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) { | 678 | if (!strcmp(attr->attr.name, "hard_limit")) { |
769 | if (val > -1) { | 679 | if (val > -1) { |
770 | new_op->upcall.req.param.op = | 680 | new_op->upcall.req.param.op = |
771 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT; | 681 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_HARD_LIMIT; |
@@ -773,7 +683,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
773 | rc = 0; | 683 | rc = 0; |
774 | goto out; | 684 | goto out; |
775 | } | 685 | } |
776 | } else if (!strcmp(orangefs_attr->attr.name, "soft_limit")) { | 686 | } else if (!strcmp(attr->attr.name, "soft_limit")) { |
777 | if (val > -1) { | 687 | if (val > -1) { |
778 | new_op->upcall.req.param.op = | 688 | new_op->upcall.req.param.op = |
779 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT; | 689 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_SOFT_LIMIT; |
@@ -781,7 +691,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
781 | rc = 0; | 691 | rc = 0; |
782 | goto out; | 692 | goto out; |
783 | } | 693 | } |
784 | } else if (!strcmp(orangefs_attr->attr.name, | 694 | } else if (!strcmp(attr->attr.name, |
785 | "reclaim_percentage")) { | 695 | "reclaim_percentage")) { |
786 | if ((val > -1) && (val < 101)) { | 696 | if ((val > -1) && (val < 101)) { |
787 | new_op->upcall.req.param.op = | 697 | new_op->upcall.req.param.op = |
@@ -790,7 +700,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
790 | rc = 0; | 700 | rc = 0; |
791 | goto out; | 701 | goto out; |
792 | } | 702 | } |
793 | } else if (!strcmp(orangefs_attr->attr.name, "timeout_secs")) { | 703 | } else if (!strcmp(attr->attr.name, "timeout_secs")) { |
794 | if (val > -1) { | 704 | if (val > -1) { |
795 | new_op->upcall.req.param.op = | 705 | new_op->upcall.req.param.op = |
796 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS; | 706 | ORANGEFS_PARAM_REQUEST_OP_CAPCACHE_TIMEOUT_SECS; |
@@ -800,8 +710,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
800 | } | 710 | } |
801 | } | 711 | } |
802 | 712 | ||
803 | } else if (!strcmp(kobj_id, CCACHE_KOBJ_ID)) { | 713 | } else if (!strcmp(kobj->name, CCACHE_KOBJ_ID)) { |
804 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) { | 714 | if (!strcmp(attr->attr.name, "hard_limit")) { |
805 | if (val > -1) { | 715 | if (val > -1) { |
806 | new_op->upcall.req.param.op = | 716 | new_op->upcall.req.param.op = |
807 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT; | 717 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_HARD_LIMIT; |
@@ -809,7 +719,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
809 | rc = 0; | 719 | rc = 0; |
810 | goto out; | 720 | goto out; |
811 | } | 721 | } |
812 | } else if (!strcmp(orangefs_attr->attr.name, "soft_limit")) { | 722 | } else if (!strcmp(attr->attr.name, "soft_limit")) { |
813 | if (val > -1) { | 723 | if (val > -1) { |
814 | new_op->upcall.req.param.op = | 724 | new_op->upcall.req.param.op = |
815 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT; | 725 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_SOFT_LIMIT; |
@@ -817,7 +727,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
817 | rc = 0; | 727 | rc = 0; |
818 | goto out; | 728 | goto out; |
819 | } | 729 | } |
820 | } else if (!strcmp(orangefs_attr->attr.name, | 730 | } else if (!strcmp(attr->attr.name, |
821 | "reclaim_percentage")) { | 731 | "reclaim_percentage")) { |
822 | if ((val > -1) && (val < 101)) { | 732 | if ((val > -1) && (val < 101)) { |
823 | new_op->upcall.req.param.op = | 733 | new_op->upcall.req.param.op = |
@@ -826,7 +736,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
826 | rc = 0; | 736 | rc = 0; |
827 | goto out; | 737 | goto out; |
828 | } | 738 | } |
829 | } else if (!strcmp(orangefs_attr->attr.name, "timeout_secs")) { | 739 | } else if (!strcmp(attr->attr.name, "timeout_secs")) { |
830 | if (val > -1) { | 740 | if (val > -1) { |
831 | new_op->upcall.req.param.op = | 741 | new_op->upcall.req.param.op = |
832 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS; | 742 | ORANGEFS_PARAM_REQUEST_OP_CCACHE_TIMEOUT_SECS; |
@@ -836,8 +746,8 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
836 | } | 746 | } |
837 | } | 747 | } |
838 | 748 | ||
839 | } else if (!strcmp(kobj_id, NCACHE_KOBJ_ID)) { | 749 | } else if (!strcmp(kobj->name, NCACHE_KOBJ_ID)) { |
840 | if (!strcmp(orangefs_attr->attr.name, "hard_limit")) { | 750 | if (!strcmp(attr->attr.name, "hard_limit")) { |
841 | if (val > -1) { | 751 | if (val > -1) { |
842 | new_op->upcall.req.param.op = | 752 | new_op->upcall.req.param.op = |
843 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT; | 753 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_HARD_LIMIT; |
@@ -845,7 +755,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
845 | rc = 0; | 755 | rc = 0; |
846 | goto out; | 756 | goto out; |
847 | } | 757 | } |
848 | } else if (!strcmp(orangefs_attr->attr.name, "soft_limit")) { | 758 | } else if (!strcmp(attr->attr.name, "soft_limit")) { |
849 | if (val > -1) { | 759 | if (val > -1) { |
850 | new_op->upcall.req.param.op = | 760 | new_op->upcall.req.param.op = |
851 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT; | 761 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_SOFT_LIMIT; |
@@ -853,7 +763,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
853 | rc = 0; | 763 | rc = 0; |
854 | goto out; | 764 | goto out; |
855 | } | 765 | } |
856 | } else if (!strcmp(orangefs_attr->attr.name, | 766 | } else if (!strcmp(attr->attr.name, |
857 | "reclaim_percentage")) { | 767 | "reclaim_percentage")) { |
858 | if ((val > -1) && (val < 101)) { | 768 | if ((val > -1) && (val < 101)) { |
859 | new_op->upcall.req.param.op = | 769 | new_op->upcall.req.param.op = |
@@ -862,7 +772,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
862 | rc = 0; | 772 | rc = 0; |
863 | goto out; | 773 | goto out; |
864 | } | 774 | } |
865 | } else if (!strcmp(orangefs_attr->attr.name, "timeout_msecs")) { | 775 | } else if (!strcmp(attr->attr.name, "timeout_msecs")) { |
866 | if (val > -1) { | 776 | if (val > -1) { |
867 | new_op->upcall.req.param.op = | 777 | new_op->upcall.req.param.op = |
868 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS; | 778 | ORANGEFS_PARAM_REQUEST_OP_NCACHE_TIMEOUT_MSECS; |
@@ -874,7 +784,7 @@ static int sysfs_service_op_store(char *kobj_id, const char *buf, void *attr) | |||
874 | 784 | ||
875 | } else { | 785 | } else { |
876 | gossip_err("sysfs_service_op_store: unknown kobj_id:%s:\n", | 786 | gossip_err("sysfs_service_op_store: unknown kobj_id:%s:\n", |
877 | kobj_id); | 787 | kobj->name); |
878 | rc = -EINVAL; | 788 | rc = -EINVAL; |
879 | goto out; | 789 | goto out; |
880 | } | 790 | } |
@@ -893,7 +803,7 @@ value_set: | |||
893 | rc); | 803 | rc); |
894 | rc = 0; | 804 | rc = 0; |
895 | } else { | 805 | } else { |
896 | rc = 1; | 806 | rc = count; |
897 | } | 807 | } |
898 | 808 | ||
899 | out: | 809 | out: |
@@ -905,126 +815,47 @@ out: | |||
905 | return rc; | 815 | return rc; |
906 | } | 816 | } |
907 | 817 | ||
908 | static ssize_t | ||
909 | service_orangefs_store(struct orangefs_attribute *attr, | ||
910 | const char *buf, | ||
911 | size_t count) | ||
912 | { | ||
913 | int rc = 0; | ||
914 | |||
915 | rc = sysfs_service_op_store(ORANGEFS_KOBJ_ID, buf, (void *) attr); | ||
916 | |||
917 | /* rc should have an errno value if the service_op went bad. */ | ||
918 | if (rc == 1) | ||
919 | rc = count; | ||
920 | |||
921 | return rc; | ||
922 | } | ||
923 | |||
924 | static ssize_t | ||
925 | service_acache_store(struct orangefs_attribute *attr, | ||
926 | const char *buf, | ||
927 | size_t count) | ||
928 | { | ||
929 | int rc = 0; | ||
930 | |||
931 | rc = sysfs_service_op_store(ACACHE_KOBJ_ID, buf, (void *) attr); | ||
932 | |||
933 | /* rc should have an errno value if the service_op went bad. */ | ||
934 | if (rc == 1) | ||
935 | rc = count; | ||
936 | |||
937 | return rc; | ||
938 | } | ||
939 | |||
940 | static ssize_t | ||
941 | service_capcache_store(struct orangefs_attribute *attr, | ||
942 | const char *buf, | ||
943 | size_t count) | ||
944 | { | ||
945 | int rc = 0; | ||
946 | |||
947 | rc = sysfs_service_op_store(CAPCACHE_KOBJ_ID, buf, (void *) attr); | ||
948 | |||
949 | /* rc should have an errno value if the service_op went bad. */ | ||
950 | if (rc == 1) | ||
951 | rc = count; | ||
952 | |||
953 | return rc; | ||
954 | } | ||
955 | |||
956 | static ssize_t service_ccache_store(struct orangefs_attribute *attr, | ||
957 | const char *buf, | ||
958 | size_t count) | ||
959 | { | ||
960 | int rc = 0; | ||
961 | |||
962 | rc = sysfs_service_op_store(CCACHE_KOBJ_ID, buf, (void *) attr); | ||
963 | |||
964 | /* rc should have an errno value if the service_op went bad. */ | ||
965 | if (rc == 1) | ||
966 | rc = count; | ||
967 | |||
968 | return rc; | ||
969 | } | ||
970 | |||
971 | static ssize_t | ||
972 | service_ncache_store(struct orangefs_attribute *attr, | ||
973 | const char *buf, | ||
974 | size_t count) | ||
975 | { | ||
976 | int rc = 0; | ||
977 | |||
978 | rc = sysfs_service_op_store(NCACHE_KOBJ_ID, buf, (void *) attr); | ||
979 | |||
980 | /* rc should have an errno value if the service_op went bad. */ | ||
981 | if (rc == 1) | ||
982 | rc = count; | ||
983 | |||
984 | return rc; | ||
985 | } | ||
986 | |||
987 | static struct orangefs_attribute op_timeout_secs_attribute = | 818 | static struct orangefs_attribute op_timeout_secs_attribute = |
988 | __ATTR(op_timeout_secs, 0664, int_orangefs_show, int_store); | 819 | __ATTR(op_timeout_secs, 0664, sysfs_int_show, sysfs_int_store); |
989 | 820 | ||
990 | static struct orangefs_attribute slot_timeout_secs_attribute = | 821 | static struct orangefs_attribute slot_timeout_secs_attribute = |
991 | __ATTR(slot_timeout_secs, 0664, int_orangefs_show, int_store); | 822 | __ATTR(slot_timeout_secs, 0664, sysfs_int_show, sysfs_int_store); |
992 | 823 | ||
993 | static struct orangefs_attribute dcache_timeout_msecs_attribute = | 824 | static struct orangefs_attribute dcache_timeout_msecs_attribute = |
994 | __ATTR(dcache_timeout_msecs, 0664, int_orangefs_show, int_store); | 825 | __ATTR(dcache_timeout_msecs, 0664, sysfs_int_show, sysfs_int_store); |
995 | 826 | ||
996 | static struct orangefs_attribute getattr_timeout_msecs_attribute = | 827 | static struct orangefs_attribute getattr_timeout_msecs_attribute = |
997 | __ATTR(getattr_timeout_msecs, 0664, int_orangefs_show, int_store); | 828 | __ATTR(getattr_timeout_msecs, 0664, sysfs_int_show, sysfs_int_store); |
998 | 829 | ||
999 | static struct orangefs_attribute readahead_count_attribute = | 830 | static struct orangefs_attribute readahead_count_attribute = |
1000 | __ATTR(readahead_count, 0664, service_orangefs_show, | 831 | __ATTR(readahead_count, 0664, sysfs_service_op_show, |
1001 | service_orangefs_store); | 832 | sysfs_service_op_store); |
1002 | 833 | ||
1003 | static struct orangefs_attribute readahead_size_attribute = | 834 | static struct orangefs_attribute readahead_size_attribute = |
1004 | __ATTR(readahead_size, 0664, service_orangefs_show, | 835 | __ATTR(readahead_size, 0664, sysfs_service_op_show, |
1005 | service_orangefs_store); | 836 | sysfs_service_op_store); |
1006 | 837 | ||
1007 | static struct orangefs_attribute readahead_count_size_attribute = | 838 | static struct orangefs_attribute readahead_count_size_attribute = |
1008 | __ATTR(readahead_count_size, 0664, service_orangefs_show, | 839 | __ATTR(readahead_count_size, 0664, sysfs_service_op_show, |
1009 | service_orangefs_store); | 840 | sysfs_service_op_store); |
1010 | 841 | ||
1011 | static struct orangefs_attribute perf_counter_reset_attribute = | 842 | static struct orangefs_attribute perf_counter_reset_attribute = |
1012 | __ATTR(perf_counter_reset, | 843 | __ATTR(perf_counter_reset, |
1013 | 0664, | 844 | 0664, |
1014 | service_orangefs_show, | 845 | sysfs_service_op_show, |
1015 | service_orangefs_store); | 846 | sysfs_service_op_store); |
1016 | 847 | ||
1017 | static struct orangefs_attribute perf_history_size_attribute = | 848 | static struct orangefs_attribute perf_history_size_attribute = |
1018 | __ATTR(perf_history_size, | 849 | __ATTR(perf_history_size, |
1019 | 0664, | 850 | 0664, |
1020 | service_orangefs_show, | 851 | sysfs_service_op_show, |
1021 | service_orangefs_store); | 852 | sysfs_service_op_store); |
1022 | 853 | ||
1023 | static struct orangefs_attribute perf_time_interval_secs_attribute = | 854 | static struct orangefs_attribute perf_time_interval_secs_attribute = |
1024 | __ATTR(perf_time_interval_secs, | 855 | __ATTR(perf_time_interval_secs, |
1025 | 0664, | 856 | 0664, |
1026 | service_orangefs_show, | 857 | sysfs_service_op_show, |
1027 | service_orangefs_store); | 858 | sysfs_service_op_store); |
1028 | 859 | ||
1029 | static struct attribute *orangefs_default_attrs[] = { | 860 | static struct attribute *orangefs_default_attrs[] = { |
1030 | &op_timeout_secs_attribute.attr, | 861 | &op_timeout_secs_attribute.attr, |
@@ -1048,26 +879,26 @@ static struct kobj_type orangefs_ktype = { | |||
1048 | static struct orangefs_attribute acache_hard_limit_attribute = | 879 | static struct orangefs_attribute acache_hard_limit_attribute = |
1049 | __ATTR(hard_limit, | 880 | __ATTR(hard_limit, |
1050 | 0664, | 881 | 0664, |
1051 | service_acache_show, | 882 | sysfs_service_op_show, |
1052 | service_acache_store); | 883 | sysfs_service_op_store); |
1053 | 884 | ||
1054 | static struct orangefs_attribute acache_reclaim_percent_attribute = | 885 | static struct orangefs_attribute acache_reclaim_percent_attribute = |
1055 | __ATTR(reclaim_percentage, | 886 | __ATTR(reclaim_percentage, |
1056 | 0664, | 887 | 0664, |
1057 | service_acache_show, | 888 | sysfs_service_op_show, |
1058 | service_acache_store); | 889 | sysfs_service_op_store); |
1059 | 890 | ||
1060 | static struct orangefs_attribute acache_soft_limit_attribute = | 891 | static struct orangefs_attribute acache_soft_limit_attribute = |
1061 | __ATTR(soft_limit, | 892 | __ATTR(soft_limit, |
1062 | 0664, | 893 | 0664, |
1063 | service_acache_show, | 894 | sysfs_service_op_show, |
1064 | service_acache_store); | 895 | sysfs_service_op_store); |
1065 | 896 | ||
1066 | static struct orangefs_attribute acache_timeout_msecs_attribute = | 897 | static struct orangefs_attribute acache_timeout_msecs_attribute = |
1067 | __ATTR(timeout_msecs, | 898 | __ATTR(timeout_msecs, |
1068 | 0664, | 899 | 0664, |
1069 | service_acache_show, | 900 | sysfs_service_op_show, |
1070 | service_acache_store); | 901 | sysfs_service_op_store); |
1071 | 902 | ||
1072 | static struct attribute *acache_orangefs_default_attrs[] = { | 903 | static struct attribute *acache_orangefs_default_attrs[] = { |
1073 | &acache_hard_limit_attribute.attr, | 904 | &acache_hard_limit_attribute.attr, |
@@ -1085,26 +916,26 @@ static struct kobj_type acache_orangefs_ktype = { | |||
1085 | static struct orangefs_attribute capcache_hard_limit_attribute = | 916 | static struct orangefs_attribute capcache_hard_limit_attribute = |
1086 | __ATTR(hard_limit, | 917 | __ATTR(hard_limit, |
1087 | 0664, | 918 | 0664, |
1088 | service_capcache_show, | 919 | sysfs_service_op_show, |
1089 | service_capcache_store); | 920 | sysfs_service_op_store); |
1090 | 921 | ||
1091 | static struct orangefs_attribute capcache_reclaim_percent_attribute = | 922 | static struct orangefs_attribute capcache_reclaim_percent_attribute = |
1092 | __ATTR(reclaim_percentage, | 923 | __ATTR(reclaim_percentage, |
1093 | 0664, | 924 | 0664, |
1094 | service_capcache_show, | 925 | sysfs_service_op_show, |
1095 | service_capcache_store); | 926 | sysfs_service_op_store); |
1096 | 927 | ||
1097 | static struct orangefs_attribute capcache_soft_limit_attribute = | 928 | static struct orangefs_attribute capcache_soft_limit_attribute = |
1098 | __ATTR(soft_limit, | 929 | __ATTR(soft_limit, |
1099 | 0664, | 930 | 0664, |
1100 | service_capcache_show, | 931 | sysfs_service_op_show, |
1101 | service_capcache_store); | 932 | sysfs_service_op_store); |
1102 | 933 | ||
1103 | static struct orangefs_attribute capcache_timeout_secs_attribute = | 934 | static struct orangefs_attribute capcache_timeout_secs_attribute = |
1104 | __ATTR(timeout_secs, | 935 | __ATTR(timeout_secs, |
1105 | 0664, | 936 | 0664, |
1106 | service_capcache_show, | 937 | sysfs_service_op_show, |
1107 | service_capcache_store); | 938 | sysfs_service_op_store); |
1108 | 939 | ||
1109 | static struct attribute *capcache_orangefs_default_attrs[] = { | 940 | static struct attribute *capcache_orangefs_default_attrs[] = { |
1110 | &capcache_hard_limit_attribute.attr, | 941 | &capcache_hard_limit_attribute.attr, |
@@ -1122,26 +953,26 @@ static struct kobj_type capcache_orangefs_ktype = { | |||
1122 | static struct orangefs_attribute ccache_hard_limit_attribute = | 953 | static struct orangefs_attribute ccache_hard_limit_attribute = |
1123 | __ATTR(hard_limit, | 954 | __ATTR(hard_limit, |
1124 | 0664, | 955 | 0664, |
1125 | service_ccache_show, | 956 | sysfs_service_op_show, |
1126 | service_ccache_store); | 957 | sysfs_service_op_store); |
1127 | 958 | ||
1128 | static struct orangefs_attribute ccache_reclaim_percent_attribute = | 959 | static struct orangefs_attribute ccache_reclaim_percent_attribute = |
1129 | __ATTR(reclaim_percentage, | 960 | __ATTR(reclaim_percentage, |
1130 | 0664, | 961 | 0664, |
1131 | service_ccache_show, | 962 | sysfs_service_op_show, |
1132 | service_ccache_store); | 963 | sysfs_service_op_store); |
1133 | 964 | ||
1134 | static struct orangefs_attribute ccache_soft_limit_attribute = | 965 | static struct orangefs_attribute ccache_soft_limit_attribute = |
1135 | __ATTR(soft_limit, | 966 | __ATTR(soft_limit, |
1136 | 0664, | 967 | 0664, |
1137 | service_ccache_show, | 968 | sysfs_service_op_show, |
1138 | service_ccache_store); | 969 | sysfs_service_op_store); |
1139 | 970 | ||
1140 | static struct orangefs_attribute ccache_timeout_secs_attribute = | 971 | static struct orangefs_attribute ccache_timeout_secs_attribute = |
1141 | __ATTR(timeout_secs, | 972 | __ATTR(timeout_secs, |
1142 | 0664, | 973 | 0664, |
1143 | service_ccache_show, | 974 | sysfs_service_op_show, |
1144 | service_ccache_store); | 975 | sysfs_service_op_store); |
1145 | 976 | ||
1146 | static struct attribute *ccache_orangefs_default_attrs[] = { | 977 | static struct attribute *ccache_orangefs_default_attrs[] = { |
1147 | &ccache_hard_limit_attribute.attr, | 978 | &ccache_hard_limit_attribute.attr, |
@@ -1159,26 +990,26 @@ static struct kobj_type ccache_orangefs_ktype = { | |||
1159 | static struct orangefs_attribute ncache_hard_limit_attribute = | 990 | static struct orangefs_attribute ncache_hard_limit_attribute = |
1160 | __ATTR(hard_limit, | 991 | __ATTR(hard_limit, |
1161 | 0664, | 992 | 0664, |
1162 | service_ncache_show, | 993 | sysfs_service_op_show, |
1163 | service_ncache_store); | 994 | sysfs_service_op_store); |
1164 | 995 | ||
1165 | static struct orangefs_attribute ncache_reclaim_percent_attribute = | 996 | static struct orangefs_attribute ncache_reclaim_percent_attribute = |
1166 | __ATTR(reclaim_percentage, | 997 | __ATTR(reclaim_percentage, |
1167 | 0664, | 998 | 0664, |
1168 | service_ncache_show, | 999 | sysfs_service_op_show, |
1169 | service_ncache_store); | 1000 | sysfs_service_op_store); |
1170 | 1001 | ||
1171 | static struct orangefs_attribute ncache_soft_limit_attribute = | 1002 | static struct orangefs_attribute ncache_soft_limit_attribute = |
1172 | __ATTR(soft_limit, | 1003 | __ATTR(soft_limit, |
1173 | 0664, | 1004 | 0664, |
1174 | service_ncache_show, | 1005 | sysfs_service_op_show, |
1175 | service_ncache_store); | 1006 | sysfs_service_op_store); |
1176 | 1007 | ||
1177 | static struct orangefs_attribute ncache_timeout_msecs_attribute = | 1008 | static struct orangefs_attribute ncache_timeout_msecs_attribute = |
1178 | __ATTR(timeout_msecs, | 1009 | __ATTR(timeout_msecs, |
1179 | 0664, | 1010 | 0664, |
1180 | service_ncache_show, | 1011 | sysfs_service_op_show, |
1181 | service_ncache_store); | 1012 | sysfs_service_op_store); |
1182 | 1013 | ||
1183 | static struct attribute *ncache_orangefs_default_attrs[] = { | 1014 | static struct attribute *ncache_orangefs_default_attrs[] = { |
1184 | &ncache_hard_limit_attribute.attr, | 1015 | &ncache_hard_limit_attribute.attr, |
@@ -1196,19 +1027,19 @@ static struct kobj_type ncache_orangefs_ktype = { | |||
1196 | static struct orangefs_attribute pc_acache_attribute = | 1027 | static struct orangefs_attribute pc_acache_attribute = |
1197 | __ATTR(acache, | 1028 | __ATTR(acache, |
1198 | 0664, | 1029 | 0664, |
1199 | service_pc_show, | 1030 | sysfs_service_op_show, |
1200 | NULL); | 1031 | NULL); |
1201 | 1032 | ||
1202 | static struct orangefs_attribute pc_capcache_attribute = | 1033 | static struct orangefs_attribute pc_capcache_attribute = |
1203 | __ATTR(capcache, | 1034 | __ATTR(capcache, |
1204 | 0664, | 1035 | 0664, |
1205 | service_pc_show, | 1036 | sysfs_service_op_show, |
1206 | NULL); | 1037 | NULL); |
1207 | 1038 | ||
1208 | static struct orangefs_attribute pc_ncache_attribute = | 1039 | static struct orangefs_attribute pc_ncache_attribute = |
1209 | __ATTR(ncache, | 1040 | __ATTR(ncache, |
1210 | 0664, | 1041 | 0664, |
1211 | service_pc_show, | 1042 | sysfs_service_op_show, |
1212 | NULL); | 1043 | NULL); |
1213 | 1044 | ||
1214 | static struct attribute *pc_orangefs_default_attrs[] = { | 1045 | static struct attribute *pc_orangefs_default_attrs[] = { |
@@ -1226,13 +1057,13 @@ static struct kobj_type pc_orangefs_ktype = { | |||
1226 | static struct orangefs_attribute stats_reads_attribute = | 1057 | static struct orangefs_attribute stats_reads_attribute = |
1227 | __ATTR(reads, | 1058 | __ATTR(reads, |
1228 | 0664, | 1059 | 0664, |
1229 | int_stats_show, | 1060 | sysfs_int_show, |
1230 | NULL); | 1061 | NULL); |
1231 | 1062 | ||
1232 | static struct orangefs_attribute stats_writes_attribute = | 1063 | static struct orangefs_attribute stats_writes_attribute = |
1233 | __ATTR(writes, | 1064 | __ATTR(writes, |
1234 | 0664, | 1065 | 0664, |
1235 | int_stats_show, | 1066 | sysfs_int_show, |
1236 | NULL); | 1067 | NULL); |
1237 | 1068 | ||
1238 | static struct attribute *stats_orangefs_default_attrs[] = { | 1069 | static struct attribute *stats_orangefs_default_attrs[] = { |