@@ -272,6 +272,38 @@ shutdown_store(struct kobject *kobj, struct kobj_attribute *attr,
272
272
273
273
static struct kobj_attribute nfs_sysfs_attr_shutdown = __ATTR_RW (shutdown );
274
274
275
+ #if IS_ENABLED (CONFIG_NFS_V4_1 )
276
+ static ssize_t
277
+ implid_domain_show (struct kobject * kobj , struct kobj_attribute * attr ,
278
+ char * buf )
279
+ {
280
+ struct nfs_server * server = container_of (kobj , struct nfs_server , kobj );
281
+ struct nfs41_impl_id * impl_id = server -> nfs_client -> cl_implid ;
282
+
283
+ if (!impl_id || strlen (impl_id -> domain ) == 0 )
284
+ return 0 ; //sysfs_emit(buf, "");
285
+ return sysfs_emit (buf , "%s\n" , impl_id -> domain );
286
+ }
287
+
288
+ static struct kobj_attribute nfs_sysfs_attr_implid_domain = __ATTR_RO (implid_domain );
289
+
290
+
291
+ static ssize_t
292
+ implid_name_show (struct kobject * kobj , struct kobj_attribute * attr ,
293
+ char * buf )
294
+ {
295
+ struct nfs_server * server = container_of (kobj , struct nfs_server , kobj );
296
+ struct nfs41_impl_id * impl_id = server -> nfs_client -> cl_implid ;
297
+
298
+ if (!impl_id || strlen (impl_id -> name ) == 0 )
299
+ return 0 ; //sysfs_emit(buf, "");
300
+ return sysfs_emit (buf , "%s\n" , impl_id -> name );
301
+ }
302
+
303
+ static struct kobj_attribute nfs_sysfs_attr_implid_name = __ATTR_RO (implid_name );
304
+
305
+ #endif /* IS_ENABLED(CONFIG_NFS_V4_1) */
306
+
275
307
#define RPC_CLIENT_NAME_SIZE 64
276
308
277
309
void nfs_sysfs_link_rpc_client (struct nfs_server * server ,
@@ -309,6 +341,32 @@ static struct kobj_type nfs_sb_ktype = {
309
341
.child_ns_type = nfs_netns_object_child_ns_type ,
310
342
};
311
343
344
+ #if IS_ENABLED (CONFIG_NFS_V4_1 )
345
+ static void nfs_sysfs_add_nfsv41_server (struct nfs_server * server )
346
+ {
347
+ int ret ;
348
+
349
+ if (!server -> nfs_client -> cl_implid )
350
+ return ;
351
+
352
+ ret = sysfs_create_file_ns (& server -> kobj , & nfs_sysfs_attr_implid_domain .attr ,
353
+ nfs_netns_server_namespace (& server -> kobj ));
354
+ if (ret < 0 )
355
+ pr_warn ("NFS: sysfs_create_file_ns for server-%d failed (%d)\n" ,
356
+ server -> s_sysfs_id , ret );
357
+
358
+ ret = sysfs_create_file_ns (& server -> kobj , & nfs_sysfs_attr_implid_name .attr ,
359
+ nfs_netns_server_namespace (& server -> kobj ));
360
+ if (ret < 0 )
361
+ pr_warn ("NFS: sysfs_create_file_ns for server-%d failed (%d)\n" ,
362
+ server -> s_sysfs_id , ret );
363
+ }
364
+ #else /* CONFIG_NFS_V4_1 */
365
+ static inline void nfs_sysfs_add_nfsv41_server (struct nfs_server * server )
366
+ {
367
+ }
368
+ #endif /* CONFIG_NFS_V4_1 */
369
+
312
370
void nfs_sysfs_add_server (struct nfs_server * server )
313
371
{
314
372
int ret ;
@@ -325,6 +383,8 @@ void nfs_sysfs_add_server(struct nfs_server *server)
325
383
if (ret < 0 )
326
384
pr_warn ("NFS: sysfs_create_file_ns for server-%d failed (%d)\n" ,
327
385
server -> s_sysfs_id , ret );
386
+
387
+ nfs_sysfs_add_nfsv41_server (server );
328
388
}
329
389
EXPORT_SYMBOL_GPL (nfs_sysfs_add_server );
330
390
0 commit comments