fdisk / src / queue.h

/*
    GNU fdisk - a clone of Linux fdisk.

    Copyright (C) 2006
    Free Software Foundation, Inc.

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/


#ifndef QUEUE_H_INCLUDED
#define QUEUE_H_INCLUDED

/* NOTE: queue.{c,h} are still not in use, and lack *any* testing, it is not 
 * known if they even compile! There are known issues with them */

#include <parted/parted.h>

typedef struct _Queue Queue;
typedef struct _QueueElem QueueElem;


typedef enum {
	OPER_MKFS = 1,
	OPER_RESIZE = 2,
	OPER_COPY = 3,
	/* We need this, because other operations in the queue may decide to modify it */
	OPER_FORCE_FSTYPE = 4
} OperationType;

#define OPER_FORCE_SAVE OPER_FORCE_FSTYPE


/* Each operation carries the disk just before the operation, 
   the operation type and the needed parameters */
struct _QueueElem {
	PedDisk *prev_disk;
	OperationType type;
	void *parameters;
	QueueElem *next;
};

struct _Queue {
	QueueElem *first;
	QueueElem *last;
	PedDisk *last_disk;
	PedTimer *timer;
};

extern Queue* queue_new (PedDisk *disk, PedTimer *timer);
/* 
 * A copy of the disk before performing any changes related to this operation
 * should be given as a parameter!
 */
extern int queue_push(Queue*, PedDisk* prev, OperationType, ...);
/*
 * queue_push(Queue*, PedDisk*, OPER_MKFS, PedGeometry*, PedFileSystemType*)
 * queue_push(Queue*, PedDisk*, OPER_RESIZE, PedGeometry* old, PedGeometry* new)
 * queue_push(Queue*, PedDisk*, OPER_COPY, PedGeometry* src, PedGeometry* dst)
 * queue_push(Queue*, PedDisk*, OPER_FORCE_FSTYPE, PedPartition*)
 * queue_push(Queue*, PedDisk*, OPER_FORCE_SAVE, NULL)
 */

extern int queue_commit(Queue*);
extern void queue_destroy(Queue*);


#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.