@@ -731,7 +731,7 @@ static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr,
731
731
ff_flag = (devmap -> features & DASD_FEATURE_FAILFAST ) != 0 ;
732
732
else
733
733
ff_flag = (DASD_FEATURE_DEFAULT & DASD_FEATURE_FAILFAST ) != 0 ;
734
- return snprintf (buf , PAGE_SIZE , ff_flag ? "1\n" : "0\n" );
734
+ return sysfs_emit (buf , ff_flag ? "1\n" : "0\n" );
735
735
}
736
736
737
737
static ssize_t dasd_ff_store (struct device * dev , struct device_attribute * attr ,
@@ -773,7 +773,7 @@ dasd_ro_show(struct device *dev, struct device_attribute *attr, char *buf)
773
773
spin_unlock (& dasd_devmap_lock );
774
774
775
775
out :
776
- return snprintf (buf , PAGE_SIZE , ro_flag ? "1\n" : "0\n" );
776
+ return sysfs_emit (buf , ro_flag ? "1\n" : "0\n" );
777
777
}
778
778
779
779
static ssize_t
@@ -834,7 +834,7 @@ dasd_erplog_show(struct device *dev, struct device_attribute *attr, char *buf)
834
834
erplog = (devmap -> features & DASD_FEATURE_ERPLOG ) != 0 ;
835
835
else
836
836
erplog = (DASD_FEATURE_DEFAULT & DASD_FEATURE_ERPLOG ) != 0 ;
837
- return snprintf (buf , PAGE_SIZE , erplog ? "1\n" : "0\n" );
837
+ return sysfs_emit (buf , erplog ? "1\n" : "0\n" );
838
838
}
839
839
840
840
static ssize_t
@@ -1033,13 +1033,13 @@ dasd_discipline_show(struct device *dev, struct device_attribute *attr,
1033
1033
dasd_put_device (device );
1034
1034
goto out ;
1035
1035
} else {
1036
- len = snprintf (buf , PAGE_SIZE , "%s\n" ,
1037
- device -> discipline -> name );
1036
+ len = sysfs_emit (buf , "%s\n" ,
1037
+ device -> discipline -> name );
1038
1038
dasd_put_device (device );
1039
1039
return len ;
1040
1040
}
1041
1041
out :
1042
- len = snprintf (buf , PAGE_SIZE , "none\n" );
1042
+ len = sysfs_emit (buf , "none\n" );
1043
1043
return len ;
1044
1044
}
1045
1045
@@ -1056,30 +1056,30 @@ dasd_device_status_show(struct device *dev, struct device_attribute *attr,
1056
1056
if (!IS_ERR (device )) {
1057
1057
switch (device -> state ) {
1058
1058
case DASD_STATE_NEW :
1059
- len = snprintf (buf , PAGE_SIZE , "new\n" );
1059
+ len = sysfs_emit (buf , "new\n" );
1060
1060
break ;
1061
1061
case DASD_STATE_KNOWN :
1062
- len = snprintf (buf , PAGE_SIZE , "detected\n" );
1062
+ len = sysfs_emit (buf , "detected\n" );
1063
1063
break ;
1064
1064
case DASD_STATE_BASIC :
1065
- len = snprintf (buf , PAGE_SIZE , "basic\n" );
1065
+ len = sysfs_emit (buf , "basic\n" );
1066
1066
break ;
1067
1067
case DASD_STATE_UNFMT :
1068
- len = snprintf (buf , PAGE_SIZE , "unformatted\n" );
1068
+ len = sysfs_emit (buf , "unformatted\n" );
1069
1069
break ;
1070
1070
case DASD_STATE_READY :
1071
- len = snprintf (buf , PAGE_SIZE , "ready\n" );
1071
+ len = sysfs_emit (buf , "ready\n" );
1072
1072
break ;
1073
1073
case DASD_STATE_ONLINE :
1074
- len = snprintf (buf , PAGE_SIZE , "online\n" );
1074
+ len = sysfs_emit (buf , "online\n" );
1075
1075
break ;
1076
1076
default :
1077
- len = snprintf (buf , PAGE_SIZE , "no stat\n" );
1077
+ len = sysfs_emit (buf , "no stat\n" );
1078
1078
break ;
1079
1079
}
1080
1080
dasd_put_device (device );
1081
1081
} else
1082
- len = snprintf (buf , PAGE_SIZE , "unknown\n" );
1082
+ len = sysfs_emit (buf , "unknown\n" );
1083
1083
return len ;
1084
1084
}
1085
1085
@@ -1120,15 +1120,15 @@ static ssize_t dasd_vendor_show(struct device *dev,
1120
1120
device = dasd_device_from_cdev (to_ccwdev (dev ));
1121
1121
vendor = "" ;
1122
1122
if (IS_ERR (device ))
1123
- return snprintf (buf , PAGE_SIZE , "%s\n" , vendor );
1123
+ return sysfs_emit (buf , "%s\n" , vendor );
1124
1124
1125
1125
if (device -> discipline && device -> discipline -> get_uid &&
1126
1126
!device -> discipline -> get_uid (device , & uid ))
1127
1127
vendor = uid .vendor ;
1128
1128
1129
1129
dasd_put_device (device );
1130
1130
1131
- return snprintf (buf , PAGE_SIZE , "%s\n" , vendor );
1131
+ return sysfs_emit (buf , "%s\n" , vendor );
1132
1132
}
1133
1133
1134
1134
static DEVICE_ATTR (vendor , 0444 , dasd_vendor_show , NULL) ;
@@ -1148,7 +1148,7 @@ dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
1148
1148
device = dasd_device_from_cdev (to_ccwdev (dev ));
1149
1149
uid_string [0 ] = 0 ;
1150
1150
if (IS_ERR (device ))
1151
- return snprintf (buf , PAGE_SIZE , "%s\n" , uid_string );
1151
+ return sysfs_emit (buf , "%s\n" , uid_string );
1152
1152
1153
1153
if (device -> discipline && device -> discipline -> get_uid &&
1154
1154
!device -> discipline -> get_uid (device , & uid )) {
@@ -1183,7 +1183,7 @@ dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf)
1183
1183
}
1184
1184
dasd_put_device (device );
1185
1185
1186
- return snprintf (buf , PAGE_SIZE , "%s\n" , uid_string );
1186
+ return sysfs_emit (buf , "%s\n" , uid_string );
1187
1187
}
1188
1188
static DEVICE_ATTR (uid , 0444 , dasd_uid_show , NULL) ;
1189
1189
@@ -1201,7 +1201,7 @@ dasd_eer_show(struct device *dev, struct device_attribute *attr, char *buf)
1201
1201
eer_flag = dasd_eer_enabled (devmap -> device );
1202
1202
else
1203
1203
eer_flag = 0 ;
1204
- return snprintf (buf , PAGE_SIZE , eer_flag ? "1\n" : "0\n" );
1204
+ return sysfs_emit (buf , eer_flag ? "1\n" : "0\n" );
1205
1205
}
1206
1206
1207
1207
static ssize_t
@@ -1243,7 +1243,7 @@ dasd_expires_show(struct device *dev, struct device_attribute *attr, char *buf)
1243
1243
device = dasd_device_from_cdev (to_ccwdev (dev ));
1244
1244
if (IS_ERR (device ))
1245
1245
return - ENODEV ;
1246
- len = snprintf (buf , PAGE_SIZE , "%lu\n" , device -> default_expires );
1246
+ len = sysfs_emit (buf , "%lu\n" , device -> default_expires );
1247
1247
dasd_put_device (device );
1248
1248
return len ;
1249
1249
}
@@ -1283,7 +1283,7 @@ dasd_retries_show(struct device *dev, struct device_attribute *attr, char *buf)
1283
1283
device = dasd_device_from_cdev (to_ccwdev (dev ));
1284
1284
if (IS_ERR (device ))
1285
1285
return - ENODEV ;
1286
- len = snprintf (buf , PAGE_SIZE , "%lu\n" , device -> default_retries );
1286
+ len = sysfs_emit (buf , "%lu\n" , device -> default_retries );
1287
1287
dasd_put_device (device );
1288
1288
return len ;
1289
1289
}
@@ -1324,7 +1324,7 @@ dasd_timeout_show(struct device *dev, struct device_attribute *attr,
1324
1324
device = dasd_device_from_cdev (to_ccwdev (dev ));
1325
1325
if (IS_ERR (device ))
1326
1326
return - ENODEV ;
1327
- len = snprintf (buf , PAGE_SIZE , "%lu\n" , device -> blk_timeout );
1327
+ len = sysfs_emit (buf , "%lu\n" , device -> blk_timeout );
1328
1328
dasd_put_device (device );
1329
1329
return len ;
1330
1330
}
@@ -1398,11 +1398,11 @@ static ssize_t dasd_hpf_show(struct device *dev, struct device_attribute *attr,
1398
1398
return - ENODEV ;
1399
1399
if (!device -> discipline || !device -> discipline -> hpf_enabled ) {
1400
1400
dasd_put_device (device );
1401
- return snprintf (buf , PAGE_SIZE , "%d\n" , dasd_nofcx );
1401
+ return sysfs_emit (buf , "%d\n" , dasd_nofcx );
1402
1402
}
1403
1403
hpf = device -> discipline -> hpf_enabled (device );
1404
1404
dasd_put_device (device );
1405
- return snprintf (buf , PAGE_SIZE , "%d\n" , hpf );
1405
+ return sysfs_emit (buf , "%d\n" , hpf );
1406
1406
}
1407
1407
1408
1408
static DEVICE_ATTR (hpf , 0444 , dasd_hpf_show , NULL) ;
@@ -1416,13 +1416,13 @@ static ssize_t dasd_reservation_policy_show(struct device *dev,
1416
1416
1417
1417
devmap = dasd_find_busid (dev_name (dev ));
1418
1418
if (IS_ERR (devmap )) {
1419
- rc = snprintf (buf , PAGE_SIZE , "ignore\n" );
1419
+ rc = sysfs_emit (buf , "ignore\n" );
1420
1420
} else {
1421
1421
spin_lock (& dasd_devmap_lock );
1422
1422
if (devmap -> features & DASD_FEATURE_FAILONSLCK )
1423
- rc = snprintf (buf , PAGE_SIZE , "fail\n" );
1423
+ rc = sysfs_emit (buf , "fail\n" );
1424
1424
else
1425
- rc = snprintf (buf , PAGE_SIZE , "ignore\n" );
1425
+ rc = sysfs_emit (buf , "ignore\n" );
1426
1426
spin_unlock (& dasd_devmap_lock );
1427
1427
}
1428
1428
return rc ;
@@ -1457,14 +1457,14 @@ static ssize_t dasd_reservation_state_show(struct device *dev,
1457
1457
1458
1458
device = dasd_device_from_cdev (to_ccwdev (dev ));
1459
1459
if (IS_ERR (device ))
1460
- return snprintf (buf , PAGE_SIZE , "none\n" );
1460
+ return sysfs_emit (buf , "none\n" );
1461
1461
1462
1462
if (test_bit (DASD_FLAG_IS_RESERVED , & device -> flags ))
1463
- rc = snprintf (buf , PAGE_SIZE , "reserved\n" );
1463
+ rc = sysfs_emit (buf , "reserved\n" );
1464
1464
else if (test_bit (DASD_FLAG_LOCK_STOLEN , & device -> flags ))
1465
- rc = snprintf (buf , PAGE_SIZE , "lost\n" );
1465
+ rc = sysfs_emit (buf , "lost\n" );
1466
1466
else
1467
- rc = snprintf (buf , PAGE_SIZE , "none\n" );
1467
+ rc = sysfs_emit (buf , "none\n" );
1468
1468
dasd_put_device (device );
1469
1469
return rc ;
1470
1470
}
@@ -1531,7 +1531,7 @@ dasd_path_threshold_show(struct device *dev,
1531
1531
device = dasd_device_from_cdev (to_ccwdev (dev ));
1532
1532
if (IS_ERR (device ))
1533
1533
return - ENODEV ;
1534
- len = snprintf (buf , PAGE_SIZE , "%lu\n" , device -> path_thrhld );
1534
+ len = sysfs_emit (buf , "%lu\n" , device -> path_thrhld );
1535
1535
dasd_put_device (device );
1536
1536
return len ;
1537
1537
}
@@ -1578,7 +1578,7 @@ dasd_path_autodisable_show(struct device *dev,
1578
1578
else
1579
1579
flag = (DASD_FEATURE_DEFAULT &
1580
1580
DASD_FEATURE_PATH_AUTODISABLE ) != 0 ;
1581
- return snprintf (buf , PAGE_SIZE , flag ? "1\n" : "0\n" );
1581
+ return sysfs_emit (buf , flag ? "1\n" : "0\n" );
1582
1582
}
1583
1583
1584
1584
static ssize_t
@@ -1616,7 +1616,7 @@ dasd_path_interval_show(struct device *dev,
1616
1616
device = dasd_device_from_cdev (to_ccwdev (dev ));
1617
1617
if (IS_ERR (device ))
1618
1618
return - ENODEV ;
1619
- len = snprintf (buf , PAGE_SIZE , "%lu\n" , device -> path_interval );
1619
+ len = sysfs_emit (buf , "%lu\n" , device -> path_interval );
1620
1620
dasd_put_device (device );
1621
1621
return len ;
1622
1622
}
@@ -1662,9 +1662,9 @@ dasd_device_fcs_show(struct device *dev, struct device_attribute *attr,
1662
1662
return - ENODEV ;
1663
1663
fc_sec = dasd_path_get_fcs_device (device );
1664
1664
if (fc_sec == - EINVAL )
1665
- rc = snprintf (buf , PAGE_SIZE , "Inconsistent\n" );
1665
+ rc = sysfs_emit (buf , "Inconsistent\n" );
1666
1666
else
1667
- rc = snprintf (buf , PAGE_SIZE , "%s\n" , dasd_path_get_fcs_str (fc_sec ));
1667
+ rc = sysfs_emit (buf , "%s\n" , dasd_path_get_fcs_str (fc_sec ));
1668
1668
dasd_put_device (device );
1669
1669
1670
1670
return rc ;
@@ -1677,7 +1677,7 @@ dasd_path_fcs_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
1677
1677
struct dasd_path * path = to_dasd_path (kobj );
1678
1678
unsigned int fc_sec = path -> fc_security ;
1679
1679
1680
- return snprintf (buf , PAGE_SIZE , "%s\n" , dasd_path_get_fcs_str (fc_sec ));
1680
+ return sysfs_emit (buf , "%s\n" , dasd_path_get_fcs_str (fc_sec ));
1681
1681
}
1682
1682
1683
1683
static struct kobj_attribute path_fcs_attribute =
@@ -1698,7 +1698,7 @@ static ssize_t dasd_##_name##_show(struct device *dev, \
1698
1698
val = _func(device); \
1699
1699
dasd_put_device(device); \
1700
1700
\
1701
- return snprintf (buf, PAGE_SIZE , "%d\n", val); \
1701
+ return sysfs_emit (buf, "%d\n", val); \
1702
1702
} \
1703
1703
static DEVICE_ATTR(_name, 0444, dasd_##_name##_show, NULL); \
1704
1704
0 commit comments