Hotplug partition manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

100 lines
2.2 KiB

  1. /*
  2. * blk_node.h
  3. * Copyright (C) 2021 Aitor Cuadrado Zubizarreta <aitor_czr@gnuinos.org>
  4. *
  5. * This program is free software: you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License as published by the
  7. * Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. * See the GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * See the LICENSE file. *
  19. */
  20. #ifndef __BLK_NODE_H__
  21. #define __BLK_NODE_H__
  22. #include <iostream>
  23. #include <memory>
  24. #include <vector>
  25. extern "C" {
  26. #include <stat_usb.h>
  27. }
  28. namespace Hopman {
  29. using namespace std;
  30. class BlkNode
  31. {
  32. public:
  33. BlkNode( struct vdev_usb_device );
  34. virtual ~BlkNode();
  35. weak_ptr<BlkNode> parent;
  36. vector< shared_ptr<BlkNode> > children;
  37. // TODO: make private (setters used by the worker thread)
  38. void set_removed(bool);
  39. void set_removable(bool);
  40. void set_label(string);
  41. void set_fstype(string);
  42. void set_size(string);
  43. void set_uuid(string);
  44. void set_partuuid(string);
  45. // Getters
  46. bool get_removed();
  47. bool get_removable();
  48. string get_inode(),
  49. get_size(),
  50. get_devname(),
  51. get_basename(),
  52. get_dirname(),
  53. get_pathname(),
  54. get_label(),
  55. get_vendor(),
  56. get_model(),
  57. get_mtpt(),
  58. get_fstype(),
  59. get_devtype(),
  60. get_uuid(),
  61. get_partuuid();
  62. vector<string> get_children_mtpt_vector();
  63. private:
  64. bool removed, removable;
  65. string devname,
  66. basename,
  67. pathname,
  68. dirname,
  69. label,
  70. vendor,
  71. model,
  72. mtpt,
  73. fstype,
  74. devtype,
  75. inode,
  76. size,
  77. uuid,
  78. partuuid;
  79. string getBaseName(),
  80. getDirName();
  81. };
  82. } // namespace Hopman
  83. #endif //__BLK_NODE_H__