sysfs.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. * fs/sysfs/sysfs.h - sysfs internal header file
  3. *
  4. * Copyright (c) 2001-3 Patrick Mochel
  5. * Copyright (c) 2007 SUSE Linux Products GmbH
  6. * Copyright (c) 2007 Tejun Heo <teheo@suse.de>
  7. *
  8. * This file is released under the GPLv2.
  9. */
  10. #ifndef __SYSFS_INTERNAL_H
  11. #define __SYSFS_INTERNAL_H
  12. #include "../kernfs/kernfs-internal.h"
  13. #include <linux/sysfs.h>
  14. /*
  15. * mount.c
  16. */
  17. /*
  18. * Each sb is associated with one namespace tag, currently the network
  19. * namespace of the task which mounted this sysfs instance. If multiple
  20. * tags become necessary, make the following an array and compare
  21. * sysfs_dirent tag against every entry.
  22. */
  23. struct sysfs_super_info {
  24. void *ns;
  25. };
  26. #define sysfs_info(SB) ((struct sysfs_super_info *)(SB->s_fs_info))
  27. extern struct sysfs_dirent sysfs_root;
  28. extern struct kmem_cache *sysfs_dir_cachep;
  29. /*
  30. * dir.c
  31. */
  32. extern struct mutex sysfs_mutex;
  33. extern spinlock_t sysfs_symlink_target_lock;
  34. extern const struct dentry_operations sysfs_dentry_ops;
  35. extern const struct file_operations sysfs_dir_operations;
  36. extern const struct inode_operations sysfs_dir_inode_operations;
  37. struct sysfs_dirent *sysfs_get_active(struct sysfs_dirent *sd);
  38. void sysfs_put_active(struct sysfs_dirent *sd);
  39. void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt);
  40. void sysfs_warn_dup(struct sysfs_dirent *parent, const char *name);
  41. int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd,
  42. struct sysfs_dirent *parent_sd);
  43. void sysfs_addrm_finish(struct sysfs_addrm_cxt *acxt);
  44. struct sysfs_dirent *sysfs_new_dirent(const char *name, umode_t mode, int type);
  45. /*
  46. * file.c
  47. */
  48. extern const struct file_operations kernfs_file_operations;
  49. int sysfs_add_file(struct sysfs_dirent *dir_sd,
  50. const struct attribute *attr, bool is_bin);
  51. int sysfs_add_file_mode_ns(struct sysfs_dirent *dir_sd,
  52. const struct attribute *attr, bool is_bin,
  53. umode_t amode, const void *ns);
  54. void sysfs_unmap_bin_file(struct sysfs_dirent *sd);
  55. /*
  56. * symlink.c
  57. */
  58. extern const struct inode_operations sysfs_symlink_inode_operations;
  59. int sysfs_create_link_sd(struct sysfs_dirent *sd, struct kobject *target,
  60. const char *name);
  61. #endif /* __SYSFS_INTERNAL_H */