Esempio n. 1
0
status_t
Inode::Unlink(Transaction& transaction)
{
	uint32 numLinks = fNode.NumLinks();
	TRACE("Inode::Unlink(): Current links: %lu\n", numLinks);

	if (numLinks == 0)
		return B_BAD_VALUE;

	if ((IsDirectory() && numLinks == 2) || (numLinks == 1))  {
		fUnlinked = true;

		TRACE("Inode::Unlink(): Putting inode in orphan list\n");
		ino_t firstOrphanID;
		status_t status = fVolume->SaveOrphan(transaction, fID, firstOrphanID);
		if (status != B_OK)
			return status;

		if (firstOrphanID != 0) {
			Vnode firstOrphan(fVolume, firstOrphanID);
			Inode* nextOrphan;

			status = firstOrphan.Get(&nextOrphan);
			if (status != B_OK)
				return status;

			fNode.SetNextOrphan(nextOrphan->ID());
		} else {
			// Next orphan link is stored in deletion time
			fNode.deletion_time = 0;
		}

		fNode.num_links = 0;

		status = remove_vnode(fVolume->FSVolume(), fID);
		if (status != B_OK)
			return status;
	} else
		fNode.SetNumLinks(--numLinks);

	return WriteBack(transaction);
}
Esempio n. 2
0
void execute_pipeline(){

	
	cycle = 0;

	while(1){

			
		
		
		register_output();
		WriteBack();
		DataMemoryAccess();
		Execute();
		InstrDecode();
		InstrFetch();
		PrintCycle(PC, cycle++);
		if(halt_error == 1) return;
		if(ID_EX.opcode == halt && EX_DM.opcode == halt && DM_WB.opcode == halt && precedent.opcode == halt)
			return;
	}
}
Esempio n. 3
0
status_t
Inode::Resize(Transaction& transaction, off_t size)
{
	TRACE("Inode::Resize() ID:%" B_PRIdINO " size: %" B_PRIdOFF "\n", ID(),
		size);
	if (size < 0)
		return B_BAD_VALUE;

	off_t oldSize = Size();

	if (size == oldSize)
		return B_OK;

	TRACE("Inode::Resize(): old size: %" B_PRIdOFF ", new size: %" B_PRIdOFF
		"\n", oldSize, size);

	status_t status;
	if (size > oldSize) {
		status = _EnlargeDataStream(transaction, size);
		if (status != B_OK) {
			// Restore original size
			_ShrinkDataStream(transaction, oldSize);
		}
	} else
		status = _ShrinkDataStream(transaction, size);

	TRACE("Inode::Resize(): Updating file map and cache\n");

	if (status != B_OK)
		return status;

	file_cache_set_size(FileCache(), size);
	file_map_set_size(Map(), size);

	TRACE("Inode::Resize(): Writing back inode changes. Size: %" B_PRIdOFF
		"\n", Size());

	return WriteBack(transaction);
}
Esempio n. 4
0
DialogGLInject::DialogGLInject(PageInput* parent)
	: QDialog(parent) {

	m_parent = parent;

	setWindowTitle("OpenGL Settings");

	QLabel *label_info = new QLabel(this);
	label_info->setText("<p>Warning: OpenGL recording works by injecting a library into the program that will be recorded. "
						"This library will override some system functions in order to capture the frames before they are "
						"displayed on the screen. If you are trying to record a game that tries to detect hacking attempts "
						"on the client side, it's (theoretically) possible that the game will consider this a hack. This "
						"might even get you banned, so it's a good idea to make sure that the program you want to record "
						"won't ban you, *before* you try to record it. You've been warned :).</p>\n\n"
						"<p>Another warning: OpenGL recording is experimental, it may not work or even crash the program you "
						"are recording. If you are worried about losing program data, make a backup first!</p>\n\n"
						"<p>If you want to record Steam games, <a href=\"http://www.maartenbaert.be/simplescreenrecorder/recording-steam-games/\">read this first</a>.</p>");
	label_info->setWordWrap(true);
	label_info->setTextFormat(Qt::RichText);
	label_info->setTextInteractionFlags(Qt::TextBrowserInteraction);
	label_info->setOpenExternalLinks(true);
	QLabel *label_command = new QLabel("Command:", this);
	m_lineedit_command = new QLineEdit(m_parent->GetGLInjectCommand(), this);
	m_lineedit_command->setToolTip("This command will be executed to start the program that should be recorded.");
	m_lineedit_command->setMinimumWidth(300);
	m_checkbox_run_command = new QCheckBox("Start the OpenGL application automatically", this);
	m_checkbox_run_command->setToolTip("If checked, the above command will be executed automatically (combined with some environment variables). If not checked,\n"
									   "you have to start the OpenGL application yourself (the full command, including the required environment variables, is shown in the log).");
	m_checkbox_run_command->setChecked(m_parent->GetGLInjectRunCommand());
	m_checkbox_relax_permissions = new QCheckBox("Relax shared memory permissions (insecure)", this);
	m_checkbox_relax_permissions->setToolTip("If checked, other users on the same machine will be able to attach to the shared memory that's used for communication with the OpenGL program.\n"
											 "This means other users can (theoretically) see what you are recording, modify the frames, inject their own frames, or simply disrupt the communication.\n"
											 "This even applies to users that are logged in remotely (ssh). You should only enable this if you need to record a program that runs as a different user.");
	m_checkbox_relax_permissions->setChecked(m_parent->GetGLInjectRelaxPermissions());
	QLabel *label_max_pixels = new QLabel("Maximum image size (megapixels):", this);
	m_lineedit_max_megapixels = new QLineEdit(QString::number(m_parent->GetGLInjectMaxMegaPixels()), this);
	m_lineedit_max_megapixels->setToolTip("This setting changes the amount of shared memory that will be allocated to send frames back to the main program.\n"
										  "The size of the shared memory can't be changed anymore once the program has been started, so if the program you\n"
										  "are trying to record is too large, recording won't work. 2 megapixels should be enough in almost all cases. Be careful,\n"
										  "high values will use a lot of memory!");
	m_checkbox_capture_front = new QCheckBox("Capture front buffer instead of back buffer", this);
	m_checkbox_capture_front->setToolTip("If checked, the injected library will read the front buffer (the frame that's currently on the screen) rather than the back buffer\n"
										 "(the new frame). This may be useful for some special applications that draw directly to the screen.");
	m_checkbox_capture_front->setChecked(m_parent->GetGLInjectCaptureFront());
	m_checkbox_limit_fps = new QCheckBox("Limit application frame rate", this);
	m_checkbox_limit_fps->setToolTip("If checked, the injected library will slow down the application so the frame rate doesn't become higher than the recording frame rate.\n"
									 "This stops the application from wasting CPU time for frames that won't be recorded, and sometimes results in smoother video\n"
									 "(this depends on the application).");
	m_checkbox_limit_fps->setChecked(m_parent->GetGLInjectLimitFPS());

	QPushButton *pushbutton_close = new QPushButton("Close", this);

	connect(pushbutton_close, SIGNAL(clicked()), this, SLOT(accept()));
	connect(this, SIGNAL(accepted()), this, SLOT(WriteBack()));
	connect(this, SIGNAL(rejected()), this, SLOT(WriteBack()));

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->addWidget(label_info);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addWidget(label_command);
		layout2->addWidget(m_lineedit_command);
	}
	layout->addWidget(m_checkbox_run_command);
	layout->addWidget(m_checkbox_relax_permissions);
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addWidget(label_max_pixels);
		layout2->addWidget(m_lineedit_max_megapixels);
	}
	layout->addWidget(m_checkbox_capture_front);
	layout->addWidget(m_checkbox_limit_fps);
	layout->addStretch();
	{
		QHBoxLayout *layout2 = new QHBoxLayout();
		layout->addLayout(layout2);
		layout2->addStretch();
		layout2->addWidget(pushbutton_close);
		layout2->addStretch();
	}

	setMinimumSize(minimumSizeHint()); // workaround for Qt bug

}
Esempio n. 5
0
status_t
Inode::WriteAt(Transaction& transaction, off_t pos, const uint8* buffer,
	size_t* _length)
{
	TRACE("Inode::WriteAt(%lld, %p, *(%p) = %ld)\n", pos, buffer,
		_length, *_length);
	ReadLocker readLocker(fLock);

	if (IsFileCacheDisabled())
		return B_BAD_VALUE;

	if (pos < 0)
		return B_BAD_VALUE;

	readLocker.Unlock();

	TRACE("Inode::WriteAt(): Starting transaction\n");
	transaction.Start(fVolume->GetJournal());

	WriteLocker writeLocker(fLock);

	TRACE("Inode::WriteAt(): Updating modification time\n");
	struct timespec timespec;
	_BigtimeToTimespec(real_time_clock_usecs(), &timespec);
	SetModificationTime(&timespec);

	// NOTE: Debugging info to find why sometimes resize doesn't happen
	size_t length = *_length;
#ifdef TRACE_EXT2
	off_t oldEnd = pos + length;
	TRACE("Inode::WriteAt(): Old calc for end? %x:%x\n",
		(int)(oldEnd >> 32), (int)(oldEnd & 0xFFFFFFFF));
#endif

	off_t end = pos + (off_t)length;
	off_t oldSize = Size();

	TRACE("Inode::WriteAt(): Old size: %x:%x, new size: %x:%x\n",
		(int)(oldSize >> 32), (int)(oldSize & 0xFFFFFFFF),
		(int)(end >> 32), (int)(end & 0xFFFFFFFF));

	if (end > oldSize) {
		status_t status = Resize(transaction, end);
		if (status != B_OK) {
			*_length = 0;
			WriteLockInTransaction(transaction);
			return status;
		}

		status = WriteBack(transaction);
		if (status != B_OK) {
			*_length = 0;
			WriteLockInTransaction(transaction);
			return status;
		}
	}

	writeLocker.Unlock();

	if (oldSize < pos)
		FillGapWithZeros(oldSize, pos);

	if (length == 0) {
		// Probably just changed the file size with the pos parameter
		return B_OK;
	}

	TRACE("Inode::WriteAt(): Performing write: %p, %lld, %p, %ld\n",
		FileCache(), pos, buffer, *_length);
	status_t status = file_cache_write(FileCache(), NULL, pos, buffer, _length);

	WriteLockInTransaction(transaction);

	TRACE("Inode::WriteAt(): Done\n");

	return status;
}