@@ -266,21 +266,20 @@ static void selfballoon_process(struct work_struct *work)
266
266
267
267
#ifdef CONFIG_SYSFS
268
268
269
- #include <linux/sysdev.h>
270
269
#include <linux/capability.h>
271
270
272
271
#define SELFBALLOON_SHOW (name , format , args ...) \
273
- static ssize_t show_##name(struct sys_device *dev, \
274
- struct sysdev_attribute *attr, \
275
- char *buf) \
272
+ static ssize_t show_##name(struct device *dev, \
273
+ struct device_attribute *attr, \
274
+ char *buf) \
276
275
{ \
277
276
return sprintf(buf, format, ##args); \
278
277
}
279
278
280
279
SELFBALLOON_SHOW (selfballooning , "%d\n" , xen_selfballooning_enabled );
281
280
282
- static ssize_t store_selfballooning (struct sys_device * dev ,
283
- struct sysdev_attribute * attr ,
281
+ static ssize_t store_selfballooning (struct device * dev ,
282
+ struct device_attribute * attr ,
284
283
const char * buf ,
285
284
size_t count )
286
285
{
@@ -303,13 +302,13 @@ static ssize_t store_selfballooning(struct sys_device *dev,
303
302
return count ;
304
303
}
305
304
306
- static SYSDEV_ATTR (selfballooning , S_IRUGO | S_IWUSR ,
305
+ static DEVICE_ATTR (selfballooning , S_IRUGO | S_IWUSR ,
307
306
show_selfballooning , store_selfballooning ) ;
308
307
309
308
SELFBALLOON_SHOW (selfballoon_interval , "%d\n" , selfballoon_interval );
310
309
311
- static ssize_t store_selfballoon_interval (struct sys_device * dev ,
312
- struct sysdev_attribute * attr ,
310
+ static ssize_t store_selfballoon_interval (struct device * dev ,
311
+ struct device_attribute * attr ,
313
312
const char * buf ,
314
313
size_t count )
315
314
{
@@ -325,13 +324,13 @@ static ssize_t store_selfballoon_interval(struct sys_device *dev,
325
324
return count ;
326
325
}
327
326
328
- static SYSDEV_ATTR (selfballoon_interval , S_IRUGO | S_IWUSR ,
327
+ static DEVICE_ATTR (selfballoon_interval , S_IRUGO | S_IWUSR ,
329
328
show_selfballoon_interval , store_selfballoon_interval ) ;
330
329
331
330
SELFBALLOON_SHOW (selfballoon_downhys , "%d\n" , selfballoon_downhysteresis );
332
331
333
- static ssize_t store_selfballoon_downhys (struct sys_device * dev ,
334
- struct sysdev_attribute * attr ,
332
+ static ssize_t store_selfballoon_downhys (struct device * dev ,
333
+ struct device_attribute * attr ,
335
334
const char * buf ,
336
335
size_t count )
337
336
{
@@ -347,14 +346,14 @@ static ssize_t store_selfballoon_downhys(struct sys_device *dev,
347
346
return count ;
348
347
}
349
348
350
- static SYSDEV_ATTR (selfballoon_downhysteresis , S_IRUGO | S_IWUSR ,
349
+ static DEVICE_ATTR (selfballoon_downhysteresis , S_IRUGO | S_IWUSR ,
351
350
show_selfballoon_downhys , store_selfballoon_downhys ) ;
352
351
353
352
354
353
SELFBALLOON_SHOW (selfballoon_uphys , "%d\n" , selfballoon_uphysteresis );
355
354
356
- static ssize_t store_selfballoon_uphys (struct sys_device * dev ,
357
- struct sysdev_attribute * attr ,
355
+ static ssize_t store_selfballoon_uphys (struct device * dev ,
356
+ struct device_attribute * attr ,
358
357
const char * buf ,
359
358
size_t count )
360
359
{
@@ -370,14 +369,14 @@ static ssize_t store_selfballoon_uphys(struct sys_device *dev,
370
369
return count ;
371
370
}
372
371
373
- static SYSDEV_ATTR (selfballoon_uphysteresis , S_IRUGO | S_IWUSR ,
372
+ static DEVICE_ATTR (selfballoon_uphysteresis , S_IRUGO | S_IWUSR ,
374
373
show_selfballoon_uphys , store_selfballoon_uphys ) ;
375
374
376
375
SELFBALLOON_SHOW (selfballoon_min_usable_mb , "%d\n" ,
377
376
selfballoon_min_usable_mb );
378
377
379
- static ssize_t store_selfballoon_min_usable_mb (struct sys_device * dev ,
380
- struct sysdev_attribute * attr ,
378
+ static ssize_t store_selfballoon_min_usable_mb (struct device * dev ,
379
+ struct device_attribute * attr ,
381
380
const char * buf ,
382
381
size_t count )
383
382
{
@@ -393,16 +392,16 @@ static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev,
393
392
return count ;
394
393
}
395
394
396
- static SYSDEV_ATTR (selfballoon_min_usable_mb , S_IRUGO | S_IWUSR ,
395
+ static DEVICE_ATTR (selfballoon_min_usable_mb , S_IRUGO | S_IWUSR ,
397
396
show_selfballoon_min_usable_mb ,
398
397
store_selfballoon_min_usable_mb ) ;
399
398
400
399
401
400
#ifdef CONFIG_FRONTSWAP
402
401
SELFBALLOON_SHOW (frontswap_selfshrinking , "%d\n" , frontswap_selfshrinking );
403
402
404
- static ssize_t store_frontswap_selfshrinking (struct sys_device * dev ,
405
- struct sysdev_attribute * attr ,
403
+ static ssize_t store_frontswap_selfshrinking (struct device * dev ,
404
+ struct device_attribute * attr ,
406
405
const char * buf ,
407
406
size_t count )
408
407
{
@@ -424,13 +423,13 @@ static ssize_t store_frontswap_selfshrinking(struct sys_device *dev,
424
423
return count ;
425
424
}
426
425
427
- static SYSDEV_ATTR (frontswap_selfshrinking , S_IRUGO | S_IWUSR ,
426
+ static DEVICE_ATTR (frontswap_selfshrinking , S_IRUGO | S_IWUSR ,
428
427
show_frontswap_selfshrinking , store_frontswap_selfshrinking ) ;
429
428
430
429
SELFBALLOON_SHOW (frontswap_inertia , "%d\n" , frontswap_inertia );
431
430
432
- static ssize_t store_frontswap_inertia (struct sys_device * dev ,
433
- struct sysdev_attribute * attr ,
431
+ static ssize_t store_frontswap_inertia (struct device * dev ,
432
+ struct device_attribute * attr ,
434
433
const char * buf ,
435
434
size_t count )
436
435
{
@@ -447,13 +446,13 @@ static ssize_t store_frontswap_inertia(struct sys_device *dev,
447
446
return count ;
448
447
}
449
448
450
- static SYSDEV_ATTR (frontswap_inertia , S_IRUGO | S_IWUSR ,
449
+ static DEVICE_ATTR (frontswap_inertia , S_IRUGO | S_IWUSR ,
451
450
show_frontswap_inertia , store_frontswap_inertia ) ;
452
451
453
452
SELFBALLOON_SHOW (frontswap_hysteresis , "%d\n" , frontswap_hysteresis );
454
453
455
- static ssize_t store_frontswap_hysteresis (struct sys_device * dev ,
456
- struct sysdev_attribute * attr ,
454
+ static ssize_t store_frontswap_hysteresis (struct device * dev ,
455
+ struct device_attribute * attr ,
457
456
const char * buf ,
458
457
size_t count )
459
458
{
@@ -469,21 +468,21 @@ static ssize_t store_frontswap_hysteresis(struct sys_device *dev,
469
468
return count ;
470
469
}
471
470
472
- static SYSDEV_ATTR (frontswap_hysteresis , S_IRUGO | S_IWUSR ,
471
+ static DEVICE_ATTR (frontswap_hysteresis , S_IRUGO | S_IWUSR ,
473
472
show_frontswap_hysteresis , store_frontswap_hysteresis ) ;
474
473
475
474
#endif /* CONFIG_FRONTSWAP */
476
475
477
476
static struct attribute * selfballoon_attrs [] = {
478
- & attr_selfballooning .attr ,
479
- & attr_selfballoon_interval .attr ,
480
- & attr_selfballoon_downhysteresis .attr ,
481
- & attr_selfballoon_uphysteresis .attr ,
482
- & attr_selfballoon_min_usable_mb .attr ,
477
+ & dev_attr_selfballooning .attr ,
478
+ & dev_attr_selfballoon_interval .attr ,
479
+ & dev_attr_selfballoon_downhysteresis .attr ,
480
+ & dev_attr_selfballoon_uphysteresis .attr ,
481
+ & dev_attr_selfballoon_min_usable_mb .attr ,
483
482
#ifdef CONFIG_FRONTSWAP
484
- & attr_frontswap_selfshrinking .attr ,
485
- & attr_frontswap_hysteresis .attr ,
486
- & attr_frontswap_inertia .attr ,
483
+ & dev_attr_frontswap_selfshrinking .attr ,
484
+ & dev_attr_frontswap_hysteresis .attr ,
485
+ & dev_attr_frontswap_inertia .attr ,
487
486
#endif
488
487
NULL
489
488
};
@@ -494,12 +493,12 @@ static struct attribute_group selfballoon_group = {
494
493
};
495
494
#endif
496
495
497
- int register_xen_selfballooning (struct sys_device * sysdev )
496
+ int register_xen_selfballooning (struct device * dev )
498
497
{
499
498
int error = -1 ;
500
499
501
500
#ifdef CONFIG_SYSFS
502
- error = sysfs_create_group (& sysdev -> kobj , & selfballoon_group );
501
+ error = sysfs_create_group (& dev -> kobj , & selfballoon_group );
503
502
#endif
504
503
return error ;
505
504
}
0 commit comments