The Pedigree Project  0.1
DevFs.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "DevFs.h"
21 
22 #include "modules/system/vfs/Pipe.h"
23 
24 #define MACHINE_FORWARD_DECL_ONLY
25 #include "pedigree/kernel/machine/Display.h"
26 #include "pedigree/kernel/machine/Framebuffer.h"
27 #include "pedigree/kernel/machine/InputManager.h"
28 #include "pedigree/kernel/machine/Machine.h"
29 #include "pedigree/kernel/machine/Vga.h"
30 
31 #include "modules/system/console/Console.h"
32 #include "pedigree/kernel/utilities/assert.h"
33 
34 #include "pedigree/kernel/ServiceManager.h"
35 #include "pedigree/kernel/graphics/Graphics.h"
36 #include "pedigree/kernel/graphics/GraphicsService.h"
37 
38 #include "pedigree/kernel/utilities/utility.h"
39 
40 #include <sys/fb.h>
41 
43 #define ALT_KEY (1ULL << 60)
44 #define SHIFT_KEY (1ULL << 61)
45 #define CTRL_KEY (1ULL << 62)
46 #define SPECIAL_KEY (1ULL << 63)
47 
48 static void terminalSwitchHandler(InputManager::InputNotification &in)
49 {
50  if (!in.meta)
51  {
52  return;
53  }
54 
55  DevFs *p = reinterpret_cast<DevFs *>(in.meta);
56  p->handleInput(in);
57 }
58 
60  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
61 {
63 
64  size_t realSize = size;
65 
66  if (size < sizeof(uint64_t))
67  {
68  uint64_t val = random_next();
69  char *pBuffer = reinterpret_cast<char *>(buffer);
70  while (size--)
71  {
72  *pBuffer++ = val & 0xFF;
73  val >>= 8;
74  }
75  }
76  else
77  {
78  // Align.
79  char *pBuffer = reinterpret_cast<char *>(buffer);
80  if (size % 8)
81  {
82  uint64_t align = random_next();
83  while (size % 8)
84  {
85  *pBuffer++ = align & 0xFF;
86  --size;
87  align >>= 8;
88  }
89  }
90 
91  uint64_t *pBuffer64 = reinterpret_cast<uint64_t *>(buffer);
92  while (size)
93  {
94  *pBuffer64++ = random_next();
95  size -= 8;
96  }
97  }
98 
99  return realSize - size;
100 }
101 
103  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
104 {
105  return 0;
106 }
107 
109  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
110 {
111  return 0;
112 }
113 
115  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
116 {
117  return size;
118 }
119 
120 PtmxFile::PtmxFile(
121  String str, size_t inode, Filesystem *pParentFS, File *pParent,
122  DevFsDirectory *ptsDirectory)
123  : File(str, 0, 0, 0, inode, pParentFS, 0, pParent), m_Terminals(),
124  m_pPtsDirectory(ptsDirectory)
125 {
127  FILE_UR | FILE_UW | FILE_GR | FILE_GW | FILE_OR | FILE_OW);
128  setUidOnly(0);
129  setGidOnly(0);
130 }
131 
132 PtmxFile::~PtmxFile()
133 {
134  delete m_pPtsDirectory;
135 }
136 
138  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
139 {
140  return 0;
141 }
142 
144  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
145 {
146  return 0;
147 }
148 
150 {
151  // find a new terminal ID that we can safely use
152  size_t terminal = m_Terminals.getFirstClear();
153  m_Terminals.set(terminal);
154 
155  // create the terminals
156  String masterName, slaveName;
157  masterName.Format("pty%d", terminal);
158  slaveName.Format("%d", terminal);
159 
160  ConsoleMasterFile *pMaster = new ConsoleMasterFile(
161  terminal, masterName, m_pPtsDirectory->getFilesystem());
162  ConsoleSlaveFile *pSlave = new ConsoleSlaveFile(
163  terminal, slaveName, m_pPtsDirectory->getFilesystem());
164 
165  pMaster->setOther(pSlave);
166  pSlave->setOther(pMaster);
167 
168  m_pPtsDirectory->addEntry(slaveName, pSlave);
169 
170  // we actually open the newly-created master, which does not exist in the
171  // filesystem at all
173  return pMaster;
174 }
175 
177  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
178 {
179  ByteSet(reinterpret_cast<void *>(buffer), 0, size);
180  return size;
181 }
182 
184  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
185 {
186  return size;
187 }
188 
190  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
191 {
192  return 0;
193 }
194 
196  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
197 {
198  return 0;
199 }
200 
201 bool RtcFile::supports(const size_t command) const
202 {
203  // read/set time
204  return true;
205  // return static_cast<size_t>(command) == 0x80247009UL ||
206  // static_cast<size_t>(command) == 0x4024700aUL;
207 }
208 
209 int RtcFile::command(const size_t command, void *buffer)
210 {
211  NOTICE("RtcFile: command " << Hex << command << " with buffer " << buffer);
212  return 0;
213 }
214 
215 FramebufferFile::FramebufferFile(
216  String str, size_t inode, Filesystem *pParentFS, File *pParentNode)
217  : File(str, 0, 0, 0, inode, pParentFS, 0, pParentNode),
218  m_pGraphicsParameters(0), m_bTextMode(false), m_nDepth(0)
219 {
220  // r/w only for root
221  setPermissionsOnly(FILE_GR | FILE_GW | FILE_UR | FILE_UW);
222  setUidOnly(0);
223  setGidOnly(0);
224 }
225 
226 FramebufferFile::~FramebufferFile()
227 {
228  delete m_pGraphicsParameters;
229 }
230 
231 bool FramebufferFile::initialise()
232 {
233  ServiceFeatures *pFeatures =
234  ServiceManager::instance().enumerateOperations(String("graphics"));
235  Service *pService =
236  ServiceManager::instance().getService(String("graphics"));
237  if (pFeatures && pFeatures->provides(ServiceFeatures::probe))
238  {
239  if (pService)
240  {
241  m_pGraphicsParameters = new GraphicsService::GraphicsParameters;
242  m_pGraphicsParameters->wantTextMode = false;
243  if (!pService->serve(
244  ServiceFeatures::probe, m_pGraphicsParameters,
245  sizeof(*m_pGraphicsParameters)))
246  {
247  delete m_pGraphicsParameters;
248  m_pGraphicsParameters = 0;
249 
250  return false;
251  }
252  else
253  {
254  // Set the file size to reflect the size of the framebuffer.
255  setSize(
256  m_pGraphicsParameters->providerResult.pFramebuffer
257  ->getHeight() *
258  m_pGraphicsParameters->providerResult.pFramebuffer
259  ->getBytesPerLine());
260  }
261  }
262  }
263 
264  return pFeatures && pService;
265 }
266 
267 uintptr_t FramebufferFile::readBlock(uint64_t location)
268 {
269  if (!m_pGraphicsParameters)
270  return 0;
271 
272  if (location > getSize())
273  {
274  ERROR("FramebufferFile::readBlock with location > size: " << location);
275  return 0;
276  }
277 
279  return reinterpret_cast<uintptr_t>(m_pGraphicsParameters->providerResult
280  .pFramebuffer->getRawBuffer()) +
281  location;
282 }
283 
284 bool FramebufferFile::supports(const size_t command) const
285 {
286  return (PEDIGREE_FB_CMD_MIN <= command) && (command <= PEDIGREE_FB_CMD_MAX);
287 }
288 
289 int FramebufferFile::command(const size_t command, void *buffer)
290 {
291  if (!m_pGraphicsParameters)
292  {
293  ERROR("FramebufferFile::command called on an invalid FramebufferFile");
294  return -1;
295  }
296 
297  Display *pDisplay = m_pGraphicsParameters->providerResult.pDisplay;
298  Framebuffer *pFramebuffer =
299  m_pGraphicsParameters->providerResult.pFramebuffer;
300 
301  switch (command)
302  {
303  case PEDIGREE_FB_SETMODE:
304  {
305  pedigree_fb_modeset *arg =
306  reinterpret_cast<pedigree_fb_modeset *>(buffer);
307  size_t desiredWidth = arg->width;
308  size_t desiredHeight = arg->height;
309  size_t desiredDepth = arg->depth;
310 
311  // Are we seeking a text mode?
312  if (!(desiredWidth && desiredHeight && desiredDepth))
313  {
314  bool bSuccess = false;
315  if (!m_pGraphicsParameters->providerResult.bTextModes)
316  {
317  bSuccess = pDisplay->setScreenMode(0);
318  }
319  else
320  {
321  // Set via VGA method.
322  if (Machine::instance().getNumVga())
323  {
325  Vga *pVga = Machine::instance().getVga(0);
326  pVga->setMode(3);
327  pVga->rememberMode();
328  pVga->setLargestTextMode();
329 
330  m_nDepth = 0;
331  m_bTextMode = true;
332 
333  bSuccess = true;
334  }
335  }
336 
337  if (bSuccess)
338  {
339  NOTICE("FramebufferFile: set text mode");
340  return 0;
341  }
342  else
343  {
344  return -1;
345  }
346  }
347 
348  bool bSet = false;
349  while (desiredDepth > 8)
350  {
351  if (pDisplay->setScreenMode(
352  desiredWidth, desiredHeight, desiredDepth))
353  {
354  NOTICE(
355  "FramebufferFile: set mode "
356  << Dec << desiredWidth << "x" << desiredHeight << "x"
357  << desiredDepth << Hex << ".");
358  bSet = true;
359  break;
360  }
361  desiredDepth -= 8;
362  }
363 
364  if (bSet)
365  {
366  m_nDepth = desiredDepth;
367 
368  setSize(
369  pFramebuffer->getHeight() *
370  pFramebuffer->getBytesPerLine());
371 
372  if (m_pGraphicsParameters->providerResult.bTextModes &&
373  m_bTextMode)
374  {
375  // Okay, we need to 'undo' the text mode.
376  if (Machine::instance().getNumVga())
377  {
379  Vga *pVga = Machine::instance().getVga(0);
380  pVga->restoreMode();
381 
382  m_bTextMode = false;
383  }
384  }
385  }
386 
387  return bSet ? 0 : -1;
388  }
389  case PEDIGREE_FB_GETMODE:
390  {
391  pedigree_fb_mode *arg =
392  reinterpret_cast<pedigree_fb_mode *>(buffer);
393  if (m_bTextMode)
394  {
395  ByteSet(arg, 0, sizeof(*arg));
396  }
397  else
398  {
399  arg->width = pFramebuffer->getWidth();
400  arg->height = pFramebuffer->getHeight();
401  arg->depth = m_nDepth;
402  arg->bytes_per_pixel = pFramebuffer->getBytesPerPixel();
403  arg->format = pFramebuffer->getFormat();
404  }
405 
406  return 0;
407  }
408  case PEDIGREE_FB_REDRAW:
409  {
410  pedigree_fb_rect *arg =
411  reinterpret_cast<pedigree_fb_rect *>(buffer);
412  if (!arg)
413  {
414  // Redraw all.
415  pFramebuffer->redraw(
416  0, 0, pFramebuffer->getWidth(), pFramebuffer->getHeight(),
417  true);
418  }
419  else
420  {
421  pFramebuffer->redraw(arg->x, arg->y, arg->w, arg->h, true);
422  }
423 
424  return 0;
425  }
426  default:
427  return -1;
428  }
429 }
430 
431 Tty0File::Tty0File(
432  String str, size_t inode, Filesystem *pParentFS, File *pParent,
433  DevFs *devfs)
434  : File(str, 0, 0, 0, inode, pParentFS, 0, pParent), m_pDevFs(devfs)
435 {
437  FILE_UR | FILE_UW | FILE_GR | FILE_GW | FILE_OR | FILE_OW);
438  setUidOnly(0);
439  setGidOnly(0);
440 }
441 
442 Tty0File::~Tty0File()
443 {
444 }
445 
447  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
448 {
449  return 0;
450 }
451 
453  uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock)
454 {
455  return 0;
456 }
457 
459 {
460  // easy - just return the currently-active VT
461  return m_pDevFs->getTerminalManager().getCurrentTerminalFile();
462 }
463 
464 physical_uintptr_t MemFile::getPhysicalPage(size_t offset)
465 {
466 #if 0
467  NOTICE("MemFile: giving matching physical page for offset " << Hex << offset);
468 #endif
469 
470  // offset is literally the physical page for /dev/mem
471  return offset & ~0xFFF;
472 }
473 
474 void MemFile::returnPhysicalPage(size_t offset)
475 {
476  // no-op
477 }
478 
479 DevFsDirectory::~DevFsDirectory() = default;
480 
481 DevFs::~DevFs()
482 {
483  InputManager::instance().removeCallback(terminalSwitchHandler, this);
484 
485  delete m_pPsAuxFile;
486  delete m_VtManager;
487  delete m_pTty;
488  delete m_pRoot;
489 }
490 
492 {
493  // Deterministic inode assignment to each devfs node
494  m_NextInode = 0;
495 
496  if (m_pRoot)
497  {
498  delete m_pRoot;
499  }
500 
501  m_pRoot =
502  new DevFsDirectory(String(""), 0, 0, 0, getNextInode(), this, 0, 0);
503  // Allow user/group to read and write, but disallow all others anything
504  // other than the ability to list and access files.
505  m_pRoot->setPermissions(
506  FILE_UR | FILE_UW | FILE_UX | FILE_GR | FILE_GW | FILE_GX | FILE_OR |
507  FILE_OX);
508 
509  // Create /dev/null and /dev/zero nodes
510  NullFile *pNull =
511  new NullFile(String("null"), getNextInode(), this, m_pRoot);
512  ZeroFile *pZero =
513  new ZeroFile(String("zero"), getNextInode(), this, m_pRoot);
514  m_pRoot->addEntry(pNull->getName(), pNull);
515  m_pRoot->addEntry(pZero->getName(), pZero);
516 
517  // Create the /dev/mem device.
518  MemFile *pMem = new MemFile(String("mem"), getNextInode(), this, m_pRoot);
519  m_pRoot->addEntry(pMem->getName(), pMem);
520 
521  // Create the /dev/pts directory for ptys to go into.
522  DevFsDirectory *pPts = new DevFsDirectory(
523  String("pts"), 0, 0, 0, getNextInode(), this, 0, m_pRoot);
524  pPts->setPermissions(
525  FILE_UR | FILE_UW | FILE_UX | FILE_GR | FILE_GX | FILE_OR | FILE_OX);
526  m_pRoot->addEntry(pPts->getName(), pPts);
527 
528  // Create the /dev/ptmx device.
529  PtmxFile *pPtmx =
530  new PtmxFile(String("ptmx"), getNextInode(), this, m_pRoot, pPts);
531  m_pRoot->addEntry(pPtmx->getName(), pPtmx);
532 
533  // Create /dev/urandom for the RNG.
534  RandomFile *pUrandom =
535  new RandomFile(String("urandom"), getNextInode(), this, m_pRoot);
536  m_pRoot->addEntry(pUrandom->getName(), pUrandom);
537 
538  // Create /dev/random - note, won't block waiting for more entropy!
539  RandomFile *pRandom =
540  new RandomFile(String("random"), getNextInode(), this, m_pRoot);
541  m_pRoot->addEntry(pRandom->getName(), pRandom);
542 
543  // Create /dev/fb for the framebuffer device.
544  FramebufferFile *pFb =
545  new FramebufferFile(String("fb"), getNextInode(), this, m_pRoot);
546  if (pFb->initialise())
547  m_pRoot->addEntry(pFb->getName(), pFb);
548  else
549  {
550  WARNING("POSIX: no /dev/fb - framebuffer failed to initialise.");
551  revertInode();
552  delete pFb;
553  }
554 
555  m_VtManager = new VirtualTerminalManager(m_pRoot);
556  if (!m_VtManager->initialise())
557  {
558  WARNING("POSIX: no /dev/tty - VT manager failed to initialise");
559  delete m_VtManager;
560  m_VtManager = nullptr;
561  }
562 
563  // tty0 == current console
564  Tty0File *pTty0 =
565  new Tty0File(String("tty0"), getNextInode(), this, m_pRoot, this);
566  m_pRoot->addEntry(pTty0->getName(), pTty0);
567 
568  // console == current console
569  Tty0File *pConsole =
570  new Tty0File(String("console"), getNextInode(), this, m_pRoot, this);
571  m_pRoot->addEntry(pConsole->getName(), pConsole);
572 
573 #if 0
574  // Create /dev/textui for the text-only UI device.
575  m_pTty = new TextIO(String("textui"), getNextInode(), this, m_pRoot);
576  m_pTty->markPrimary();
577  if (m_pTty->initialise(false))
578  {
579  m_pRoot->addEntry(m_pTty->getName(), m_pTty);
580  }
581  else
582  {
583  WARNING("POSIX: no /dev/tty - TextIO failed to initialise.");
584  revertInode();
585  delete m_pTty;
586  m_pTty = nullptr;
587  }
588 
589  // tty0 == current console
590  Tty0File *pTty0 =
591  new Tty0File(String("tty0"), getNextInode(), this, m_pRoot, this);
592  m_pRoot->addEntry(pTty0->getName(), pTty0);
593 
594  // console == current console
595  Tty0File *pConsole =
596  new Tty0File(String("console"), getNextInode(), this, m_pRoot, this);
597  m_pRoot->addEntry(pConsole->getName(), pConsole);
598 
599  // create tty1 which is essentially just textui but with a S_IFCHR wrapper
600  if (m_pTty)
601  {
602  ConsolePhysicalFile *pTty1 =
603  new ConsolePhysicalFile(m_pTty, String("tty1"), this);
604  m_pRoot->addEntry(pTty1->getName(), pTty1);
605 
606  m_pTtys[0] = m_pTty;
607  m_pTtyFiles[0] = pTty1;
608  }
609 
610  // create tty2-6 as non-overloaded TextIO instances
611  for (size_t i = 1; i < DEVFS_NUMTTYS; ++i)
612  {
613  String ttyname;
614  ttyname.Format("tty%u", i + 1);
615 
616  TextIO *tio = new TextIO(ttyname, getNextInode(), this, m_pRoot);
617  if (tio->initialise(true))
618  {
619  ConsolePhysicalFile *file =
620  new ConsolePhysicalFile(tio, ttyname, this);
621  m_pRoot->addEntry(tio->getName(), file);
622 
623  m_pTtys[i] = tio;
624  m_pTtyFiles[i] = file;
625 
626  // activate the terminal by performing an empty write, which will
627  // ensure users switching to the terminal see a blank screen if
628  // nothing has actually opened it - this is better than seeing the
629  // previous tty's output...
630  tio->write("", 0);
631  }
632  else
633  {
634  WARNING("POSIX: failed to create " << ttyname);
635  revertInode();
636  delete tio;
637 
638  m_pTtys[i] = nullptr;
639  m_pTtyFiles[i] = nullptr;
640  }
641  }
642 #endif
643 
644  Pipe *initctl =
645  new Pipe(String("initctl"), 0, 0, 0, getNextInode(), this, 0, m_pRoot);
646  m_pRoot->addEntry(initctl->getName(), initctl);
647  // initctl->increaseRefCount(false); // pretend to be a reader
648 
649  RtcFile *rtc = new RtcFile(getNextInode(), this, m_pRoot);
650  m_pRoot->addEntry(rtc->getName(), rtc);
651 
652  PsAuxFile *pPsAux =
653  new PsAuxFile(String("psaux"), getNextInode(), this, m_pRoot);
654  if (pPsAux->initialise())
655  {
656  m_pRoot->addEntry(pPsAux->getName(), pPsAux);
657  m_pPsAuxFile = pPsAux;
658  }
659  else
660  {
661  delete pPsAux;
662  }
663 
664  // add input handler for terminal switching
666  InputManager::Key, terminalSwitchHandler, this);
667 
668  m_CurrentTty = 0;
669 
670  return true;
671 }
672 
673 size_t DevFs::getNextInode()
674 {
675  return m_NextInode++;
676 }
677 
678 void DevFs::revertInode()
679 {
680  --m_NextInode;
681 }
682 
683 void DevFs::handleInput(InputManager::InputNotification &in)
684 {
685  uint64_t c = in.data.key.key;
686  if (c & SPECIAL_KEY)
687  {
688  uint32_t k = c & 0xFFFFFFFFUL;
689  char *s = reinterpret_cast<char *>(&k);
690 
691  size_t newTty = 0;
692  if (!StringCompareN(s, "f1", 3))
693  {
694  newTty = 0;
695  }
696  else if (!StringCompareN(s, "f2", 3))
697  {
698  newTty = 1;
699  }
700  else if (!StringCompareN(s, "f3", 3))
701  {
702  newTty = 2;
703  }
704  else if (!StringCompareN(s, "f4", 3))
705  {
706  newTty = 3;
707  }
708  else if (!StringCompareN(s, "f5", 3))
709  {
710  newTty = 4;
711  }
712  else if (!StringCompareN(s, "f6", 3))
713  {
714  newTty = 5;
715  }
716  else
717  {
718  return;
719  }
720 
721  m_VtManager->activate(newTty);
722  }
723 }
Definition: DevFs.h:75
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:452
virtual int command(const size_t command, void *buffer)
Definition: File.cc:544
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:176
static const int Key
Definition: InputManager.h:40
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:446
virtual void restoreMode()=0
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:114
virtual int command(const size_t command, void *buffer)
Definition: DevFs.cc:209
virtual physical_uintptr_t getPhysicalPage(size_t offset)
Definition: DevFs.cc:464
void setUidOnly(size_t uid)
Definition: File.cc:644
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:189
virtual int command(const size_t command, void *buffer)
Definition: DevFs.cc:289
Definition: DevFs.h:244
virtual void rememberMode()=0
void installCallback(CallbackType filter, callback_t callback, void *meta=0, Thread *pThread=0, uintptr_t param=0)
Installs a callback.
Definition: String.h:49
virtual bool initialise(Disk *pDisk)
Definition: DevFs.cc:491
All zeroes = &#39;revert to text mode&#39;.
Definition: fb.h:37
virtual bool provides(Type service)
virtual Vga * getVga(size_t n)=0
Definition: Disk.h:32
virtual bool setMode(int mode)=0
Definition: TextIO.h:48
Definition: DevFs.h:162
void removeCallback(callback_t callback, void *meta=0, Thread *pThread=0)
Removes a callback.
void setPermissionsOnly(uint32_t perms)
Definition: File.cc:639
#define WARNING(text)
Definition: Log.h:78
virtual uintptr_t readBlock(uint64_t location)
Definition: DevFs.cc:267
void redraw(size_t x=~0UL, size_t y=~0UL, size_t w=~0UL, size_t h=~0UL, bool bChild=false)
Definition: Framebuffer.cc:112
File()
Definition: File.cc:68
bool initialise(bool bClear=true)
Definition: TextIO.cc:104
virtual bool supports(const size_t command) const
Definition: DevFs.cc:201
#define NOTICE(text)
Definition: Log.h:74
Definition: Log.h:136
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:108
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:102
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:195
void setGidOnly(size_t gid)
Definition: File.cc:649
virtual bool supports(const size_t command) const
Definition: DevFs.cc:284
Abstracts the system&#39;s framebuffer offering.
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:183
virtual void returnPhysicalPage(size_t offset)
Definition: DevFs.cc:474
virtual size_t getNumVga()=0
Service * getService(const String &serviceName)
String getName() const
Definition: File.cc:411
virtual uint64_t writeBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:143
static InputManager & instance()
Singleton design.
Definition: InputManager.h:107
virtual bool serve(ServiceFeatures::Type type, void *pData, size_t dataLen)=0
Definition: DevFs.h:287
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:137
virtual bool setLargestTextMode()=0
#define ERROR(text)
Definition: Log.h:82
virtual uint64_t readBytewise(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true)
Definition: DevFs.cc:59
Definition: Log.h:138
virtual File * open()
Definition: DevFs.cc:458
Definition: File.h:66
ServiceFeatures * enumerateOperations(const String &serviceName)
virtual bool setScreenMode(ScreenMode sm)
Definition: Display.cc:110
virtual File * open()
Definition: DevFs.cc:149
Definition: Pipe.h:35
virtual uint64_t write(uint64_t location, uint64_t size, uintptr_t buffer, bool bCanBlock=true) final
Definition: File.cc:183